You are here

function node_gallery_list in Node Gallery 6

Same name and namespace in other branches
  1. 6.2 node_gallery.pages.inc \node_gallery_list()

@file Node gallery pages.

1 string reference to 'node_gallery_list'
node_gallery_menu in ./node_gallery.module
Implementation of hook_menu()

File

./node_gallery.pages.inc, line 9
Node gallery pages.

Code

function node_gallery_list($account = NULL) {
  $galleries = gallery_gateway::find_by($account->uid);
  if (!empty($galleries)) {
    $gids = array_keys($galleries);
    $image_counts = gallery_gateway::count_images($gids);
    $gallery_covers = gallery_gateway::find_covers($gids);
    if (!empty($gallery_covers)) {
      $images = ImageGateway::get_file(array_values($gallery_covers));
    }
    foreach ($galleries as $k => $gallery) {
      $galleries[$k]->cover = $images[$gallery_covers[$k]];
      $galleries[$k]->image_count = empty($image_counts[$k]) ? 0 : $image_counts[$k];
    }
    foreach ($galleries as $gallery) {
      $config = gallery_config_gateway::get_by($gallery->type);
      $items[] = theme('gallery_cover_view', $gallery, $config);
    }
  }
  return theme('gallery_list', $items, $account);
}