function theme_flickrgallery_wrapper_albums in FlickrGallery 7
Same name and namespace in other branches
- 7.2 flickrgallery.module \theme_flickrgallery_wrapper_albums()
1 theme call to theme_flickrgallery_wrapper_albums()
File
- ./
flickrgallery.module, line 112 - This module shows the sets and photo's from a Flickr account
Code
function theme_flickrgallery_wrapper_albums() {
// Require FlickrAPI.
module_load_include('module', 'flickrapi');
// Add CSS file.
drupal_add_css(drupal_get_path('module', 'flickrgallery') . '/flickrgallery.css');
// Set custom title.
drupal_set_title(variable_get('flickrgallery_title', 'Flickr Gallery'));
// Create Flickr object.
$f = flickrapi_phpFlickr();
// Get Flickr User info and User ID.
$flickr_user = array();
$flickr_user = $f
->people_getInfo(variable_get('flickrgallery_userID', NULL));
$flickr_uid = $flickr_user['id'];
// Get Flickr sets.
$sets = $f
->photosets_getList($flickr_uid, NULL, variable_get('flickrgallery_privacy_filter', 1));
/* PHPFlickr photosets_getList() doesn't support pager option, so we have to write it ourselves
* Not is use on this moment
if (variable_get('flickrgallery_sets_pager', NULL)) {
$pager_val = variable_get('flickrgallery_pager_val', NULL);
}
*
*/
$description = variable_get('flickrgallery_description', NULL);
$albums = array();
if (!empty($sets)) {
foreach ($sets['photoset'] as $set) {
$thumb_url = "http://farm" . $set['farm'] . ".static.flickr.com/" . $set['server'] . "/" . $set['primary'] . "_" . $set['secret'] . "_" . variable_get('flickrgallery_albums', 's') . ".jpg";
$variables = array(
'path' => $thumb_url,
'alt' => $set['title'],
'title' => $set['title'],
'attributes' => array(
'class' => 'flickrgallery-set-image',
),
);
$img = theme('image', $variables);
$image = array();
$image['info'] = $set;
$image['total'] = $set['photos'];
$image['image_link'] = l($img, "flickr/set/" . $set['id'], array(
'attributes' => array(
'class' => 'flickrgallery',
'title' => $set['title'],
),
'html' => 'true',
));
$image['title_link'] = l($set['title'], "flickr/set/" . $set['id'], array(
'attributes' => array(
'class' => 'flickrgallery-title',
'title' => $set['title'],
),
'html' => 'true',
));
$albums[] = $image;
}
return theme('flickrgallery_albums', array(
'description' => $description,
'albums' => $albums,
));
}
else {
// If no sets, display msg.
return "<h2>" . t("No pictures available") . "</h2>";
}
}