You are here

function _photos_node_view in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos.module \_photos_node_view()
1 call to _photos_node_view()
photos_nodeapi in ./photos.module

File

./photos.module, line 456

Code

function _photos_node_view($node, $display, $type) {
  switch ($display) {
    case 1:
      return $node->album['cover']['view'];
    case 2:
      $order = explode('|', $node->album['imageorder'] ? $node->album['imageorder'] : variable_get('photos_display_imageorder', 'timestamp|desc'));
      $order = _photos_order_value_change($order[0], $order[1]);
      $limit = $node->album[$type . '_viewnum'] ? $node->album[$type . '_viewnum'] : variable_get('photos_display_' . $type . '_viewnum', 10);
      $result = db_query_range('SELECT f.filepath, f.filemime, f.timestamp, f.filename, f.filesize, u.uid, u.name, p.* FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {users} u ON f.uid = u.uid WHERE p.pid = %d' . $order, $node->nid, 0, $limit);
      $i = 0;
      $label = $node->album[$type . '_imagesize'] ? $node->album[$type . '_imagesize'] : variable_get('photos_display_' . $type . '_imagesize', 0);
      while ($data = db_fetch_array($result)) {
        $album .= photos_get_info(0, $data, array(
          'href' => 'photos/image/' . $data['fid'],
          'label' => $label,
          'thickbox' => true,
          'pid' => $node->nid,
        ));
        ++$i;
      }
      if ($i >= $limit) {
        $album .= theme('more_link', url('photos/album/' . $node->nid), t('Album view'));
      }
      return $album;
    case 3:
      if ($node->album['count'] || $node->subalbum['count']) {
        if ($type == 'teaser' && $node->album['teaser_slide']) {
          list($width, $height) = explode('x', $node->album['teaser_slide']);
        }
        else {
          if ($type == 'page' && $node->album['page_slide']) {
            list($width, $height) = explode('x', $node->album['page_slide']);
          }
          else {
            list($width, $height) = explode('x', variable_get('photos_display_slide', '640x480'));
          }
        }
        return dfgallery_html(array(
          'url' => url("photos/data/album/{$node->nid}/json.json", array(
            'absolute' => true,
          )),
          'width' => $width,
          'height' => $height,
        ));
      }
  }
}