function theme_flickrgallery_set in FlickrGallery 6.2
Same name and namespace in other branches
- 7 flickrgallery.module \theme_flickrgallery_set()
- 7.2 flickrgallery.module \theme_flickrgallery_set()
1 theme call to theme_flickrgallery_set()
File
- ./
flickrgallery.module, line 242 - This module shows the sets and photo's from a Flickr account
Code
function theme_flickrgallery_set($set_id = 0) {
// 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');
// Create Flickr object
$f = new phpFlickr(variable_get('flickrgallery_apikey', NULL), variable_get('flickrgallery_secretkey', NULL));
// Get Flickr set title
$set_info = $f
->photosets_getInfo($set_id);
// Set Flickr set title as page title
drupal_set_title($set_info['title']);
// Get Flickr photos for this set
$photos = $f
->photosets_getPhotos($set_id);
// If there aren't any photo's, display message
if (empty($set_id) || empty($photos)) {
drupal_set_message("This set doesn't exists or there aren't any pictures available for this set.", "error");
}
// Get the type for Lightbox
$type = variable_get('flickrgallery_lightbox_type', NULL);
// Start the output
$output = "<div id='flickrgallery'>";
$output .= '<div id="flickrgallery-set">';
foreach ($photos['photoset']['photo'] as $photo) {
$img = theme_image($f
->buildPhotoURL($photo, variable_get('flickrgallery_thumb', 'square')), $photo['title'], $photo['title'], NULL, FALSE);
$output .= "<div class='flickr-wrap'>";
$output .= l($img, $f
->buildPhotoURL($photo, variable_get('flickrgallery_large', 'large')), array(
'attributes' => array(
'class' => 'flickrgallery-image ' . $type,
'rel' => $type . "[flickrgallery]",
'title' => $photo['title'],
),
'html' => 'true',
));
if (!empty($photo['title'])) {
$output .= "<div class='flickrgallery-picture-title'>" . $photo['title'] . '</div>';
}
$output .= "</div>";
}
$output .= "<div class='flickrgallery-return'>" . l(t('Back to sets'), 'flickr') . "</div>";
$output .= "</div>";
$output .= '</div>';
return $output;
}
else {
return '';
}
}