function flickr_sets_photoset in Flickr 5
Same name and namespace in other branches
- 6 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 - Implementation of hook_menu().
File
- sets/
flickr_sets.module, line 90
Code
function flickr_sets_photoset($uid, $nsid, $set_id, $set_info) {
global $pager_page_array, $pager_total, $pager_total_items, $user;
drupal_add_css(drupal_get_path('module', 'flickr') . '/flickr.css');
//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_request('flickr.photosets.getPhotos', array(
'photoset_id' => $set_id,
'page' => $pager_page_array[$element] + 1,
'per_page' => variable_get('flickr_photos_per_page', 20),
));
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);
}