function flickr_sets_photoset in Flickr 6
Same name and namespace in other branches
- 5 sets/flickr_sets.module \flickr_sets_photoset()
- 7 sets/flickr_sets.module \flickr_sets_photoset()
1 string reference to 'flickr_sets_photoset'
- flickr_sets_menu in sets/
flickr_sets.module - Implements hook_menu().
File
- sets/
flickr_sets.module, line 76
Code
function flickr_sets_photoset($account, $set) {
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 = $user->uid;
$nsid = $account->flickr['nsid'];
$set_id = $set['photoset']['id'];
$set_info = flickr_photoset_get_info($set_id);
// Make sure that $nsid is the real owner of $set_id.
if ($nsid != $set_info['owner']) {
drupal_goto('flickr/' . $uid . '/sets');
}
// Display photos.
// 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);
// Request set photos.
$set_response = flickr_set_load($set_id, $pager_page_array[$element] + 1);
if (!$set_response) {
drupal_set_message(t('Error retrieving :setid\'s photosets from Flickr'), array(
':setid',
$set_id,
));
return '';
}
elseif (!isset($set_response['photoset']['photo']) || empty($set_response['photoset']['photo'])) {
drupal_set_message('This photoset is empty');
return '';
}
// Set pager information we just acquired.
$pager_total_items[$element] = $set_response['photoset']['total'];
$pager_total[$element] = $set_response['photoset']['pages'];
return theme('flickr_sets_photoset', $uid, $per_page, $set_response, $set_info);
}