function flickr_block_photosets in Flickr 7
Photoset block. Block delta: 1 and 4.
1 call to flickr_block_photosets()
- flickr_block_view in block/
flickr_block.module - Implements hook_block_view().
File
- block/
flickr_block.module, line 1440 - The Flickr block module
Code
function flickr_block_photosets($nsid, $show_n, $size, $media, $delta, $people = NULL, $sort = 0, $heading = 'h2', $min_title = 100, $min_metadata = 150) {
if ($cache = cache_get('flickr_block_' . $delta . '_' . $nsid)) {
$output = $cache->data;
}
else {
$photosets = flickr_photosets_getlist($nsid);
$output = '<div class="flickr-block-photosets">';
$to = min($show_n, count($photosets));
for ($i = 0; $i < $to; $i++) {
$set_title = l($photosets[$i]['title']['_content'], $people['photosurl'] . 'sets/' . $photosets[$i]['id'], array(
'attributes' => array(
'title' => t('View set on Flickr.'),
'target' => '_blank',
),
));
$map = variable_get('flickr_maps', 0) ? '(' . l(t('map'), $people['photosurl'] . 'sets/' . $photosets[$i]['id'] . '/map/', array(
'attributes' => array(
'title' => t('View set on Flickr map.'),
'target' => '_blank',
),
)) . ')' : '';
$output .= '<div class="flickr-block-photoset"><div class="flickr-block-set-title">' . $set_title . ' ' . $map . '</div>';
switch ($size) {
case "x":
$output .= theme('flickr_flickrcomslideshow', array(
'id' => $photosets[$i]['id'],
));
break;
case "y":
$output .= theme('flickr_flickrcomslideshow_simple', array(
'id' => $photosets[$i]['id'],
));
break;
default:
$output .= theme('flickr_photoset', array(
'photoset' => $photosets[$i],
'owner' => $nsid,
'size' => $size,
'media' => $media,
'min_title' => $min_title,
'min_metadata' => $min_metadata,
'per_page' => variable_get('flickr_block_photos_per_set', 6),
));
// A counter if set to show.
$flickr = l(t("set on Flickr"), $people['photosurl'] . 'sets/' . $photosets[$i]['id'] . '/', array(
'attributes' => array(
'title' => t('View set on Flickr.'),
'target' => '_blank',
),
'html' => TRUE,
));
$count = t('@total in !flickr', array(
'@total' => number_format($photosets[$i]['photos'], 0, ",", "."),
'!flickr' => $flickr,
));
$output .= variable_get('flickr_counter', 1) ? '<div class="flickr-counter">' . $count . '</div>' : '';
}
$output .= '</div>';
}
if ($i == 0) {
$flickr = l(t("on Flickr"), $people['photosurl'] . 'sets/', array(
'attributes' => array(
'title' => t('View sets on Flickr.'),
'target' => '_blank',
),
'html' => TRUE,
));
$output .= t('No sets found !flickr.', array(
'!flickr' => $flickr,
));
}
$output .= '</div>';
cache_set('flickr_block_' . $delta . '_' . $nsid, $output, 'cache', time() + variable_get('flickr_block_refresh_others', 31) * 60 * 60);
}
return $output;
}