You are here

function flickr_sets_photosets in Flickr 6

Same name and namespace in other branches
  1. 5 sets/flickr_sets.module \flickr_sets_photosets()
  2. 7 sets/flickr_sets.module \flickr_sets_photosets()
1 string reference to 'flickr_sets_photosets'
flickr_sets_menu in sets/flickr_sets.module
Implements hook_menu().

File

sets/flickr_sets.module, line 46

Code

function flickr_sets_photosets($account, $nsid = NULL) {
  global $pager_page_array, $pager_total, $pager_total_items, $user;
  if (variable_get('flickr_css', 1)) {
    drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css');
  }
  $uid = $account->uid;
  $nsid = $account->flickr['nsid'];

  // Set this to something else if you want multiple pagers.
  $element = 0;
  $pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
  $per_page = variable_get('flickr_photos_per_page', 20);
  $set_response = flickr_photoset_get_list($nsid, $pager_page_array[$element] + 1);
  if ($set_response === FALSE) {
    drupal_set_message(t('Error retrieving %user\'s photosets from Flickr'), array(
      '%user' => $account->name,
    ));
    return '';
  }
  if (!$set_response || empty($set_response)) {
    drupal_set_message(t('%user has no photosets.', array(
      '%user' => $account->name,
    )));
    return '';
  }

  // Set pager information we just acquired.
  $pager_total[$element] = $set_response['pages'];
  $pager_total_items[$element] = $set_response['total'];
  return theme('flickr_sets_photosets', $uid, $per_page, $nsid, $set_response['photoset']);
}