function theme_flickrgallery_albums in FlickrGallery 6.2
1 theme call to theme_flickrgallery_albums()
File
- ./
flickrgallery.module, line 189 - This module shows the sets and photo's from a Flickr account
Code
function theme_flickrgallery_albums() {
// Check if phpFlickr file is downloaded
if (_flickrgallery_check_file()) {
// Require phpFlickr.php
require_once libraries_get_path('phpFlickr') . "/phpFlickr.php";
// 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 = new phpFlickr(variable_get('flickrgallery_apikey', ''), variable_get('flickrgallery_secretkey', NULL));
// Get Flickr User info and User ID
$flickr_user = $f
->people_getInfo(variable_get('flickrgallery_userID', NULL));
$flickr_uid = $flickr_user['id'];
// Get Flickr sets
$sets = $f
->photosets_getList($flickr_uid);
// Start output
$output = "<div id='flickrgallery'>";
$output .= "<div id='flickrgallery-description'>" . variable_get('flickrgallery_description', NULL) . "</div>";
$output .= "<div id='flickrgallery-albums'>";
// Check if $sets isn't empty
if (!empty($sets)) {
foreach ($sets['photoset'] as $set) {
$thumbUrl = "http://farm" . $set['farm'] . ".static.flickr.com/" . $set['server'] . "/" . $set['primary'] . "_" . $set['secret'] . "_" . variable_get('flickrgallery_albums', 's') . ".jpg";
$img = theme_image($thumbUrl, $set['title'], $set['title'], NULL, FALSE);
$output .= "<div class='flickr-wrap'>";
$output .= l($img, "flickr/set/" . $set['id'], array(
'attributes' => array(
'class' => 'flickrgallery',
'title' => $set['title'],
),
'html' => 'true',
));
$output .= l($set['title'], "flickr/set/" . $set['id'], array(
'attributes' => array(
'class' => 'flickrgallery-title',
'title' => $set['title'],
),
'html' => 'true',
));
$output .= t('Total') . ": " . $set['photos'] . "\n";
$output .= "</div>";
}
}
else {
// If no sets, display msg
$output .= "<h2>" . t("No pictures available") . "</h2>";
}
$output .= '</div>';
$output .= '</div>';
return $output;
}
else {
return '';
}
}