You are here

function flickr_sets_photosets in Flickr 5

Same name and namespace in other branches
  1. 6 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
Implementation of hook_menu().

File

sets/flickr_sets.module, line 62

Code

function flickr_sets_photosets($uid, $nsid) {
  global $pager_page_array, $pager_total, $pager_total_items, $user;
  drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css');
  $account = user_load(array(
    'uid' => $uid,
  ));

  //set this to something else if you want multiple pagers
  $element = 0;
  $pager_page_array[$element] = empty($_GET['page']) ? 0 : (int) $_GET['page'];
  $set_response = flickr_photoset_get_list($nsid);
  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] = ceil(count($set_response) / variable_get('flickr_photosets_per_page', 20));
  $pager_total_items[$element] = count($set_response);
  return theme('flickr_sets_photosets', $uid, $nsid, $set_response);
}