You are here

function theme_gallery_images_list in Node Gallery 6

1 theme call to theme_gallery_images_list()
node_gallery_preprocess_node in ./node_gallery.module

File

./node_gallery.themes.inc, line 134
Node gallery themes.

Code

function theme_gallery_images_list($gallery, $config) {
  $output = '<div class="gallery-images-list">';
  if (!count($gallery->images)) {
    $output .= '<p>' . t('There are no photos in this gallery currently.');
    if (node_gallery_user_access('edit', $gallery)) {
      $output .= '  ' . l('Upload Some!', 'node/' . $gallery->nid . '/upload', array(
        'query' => 'destination=node/' . $gallery->nid,
      ));
    }
    $output .= '</p>';
  }
  elseif ($config->gallery['gallery_display'] == 'lightbox2_gallery' && module_exists('lightbox2')) {
    foreach ($gallery->images as $nid => $image) {
      $items[] = theme('gallery_image_lightbox2', $image, $config, $gallery);
    }
    $output .= theme('item_list', $items);
  }
  elseif ($config->gallery['gallery_display'] == 'cover') {
    $no_cover = TRUE;
    foreach ($gallery->images as $image) {
      if ($image->is_cover) {
        $cover = $image;
        $no_cover = FALSE;
        break;
      }
    }
    unset($image);

    // If there is no cover image, use the first one
    if ($no_cover == TRUE) {
      $keys = array_keys($gallery->images);
      $first_key = $keys[0];
      $cover = $gallery->images[$first_key];
      unset($keys, $first_key);
    }
    $navigator = new Gallery(array(
      'nid' => $gallery->nid,
    ));
    $navigation = $navigator
      ->get_image_navigator($cover->nid);
    $cover->filepath = empty($cover->filepath) ? $config->default_cover : $cover->filepath;
    $cover->title = $gallery->title;
    $output .= l(theme('image_view', $config->gallery['image'], $cover), 'node/' . $navigation['next_nid'], array(
      'html' => TRUE,
    ));
    $output .= '<p>' . l(t('Continue to the Next Photo'), 'node/' . $navigation['next_nid'], array(
      'html' => TRUE,
    )) . '</p>';
  }
  else {
    foreach ($gallery->images as $nid => $image) {
      $items[] = theme('gallery_image_thumbnail', $image, $config);
    }
    unset($image);
    $output .= theme('item_list', $items);
  }
  $output .= '</div>';
  return $output;
}