function photos_sub_album_page in Album Photos 6.2
Same name and namespace in other branches
- 7.3 inc/photos.album.inc \photos_sub_album_page()
1 string reference to 'photos_sub_album_page'
- photos_menu in ./
photos.module
File
- inc/
photos.album.inc, line 59
Code
function photos_sub_album_page($node) {
$order = explode('|', variable_get('photos_display_imageorder', 'timestamp|desc'));
$order = _photos_order_value_change($order[0], $order[1]);
$term = _photos_order_value($_GET['field'], $_GET['sort'], variable_get('photos_display_viewpager', 10), $order);
$result = pager_query(db_rewrite_sql('SELECT f.filepath, f.filemime, f.timestamp, f.filename, f.filesize, u.uid, u.name, n.title, p.* FROM {files} f INNER JOIN {x_image} p ON f.fid = p.fid INNER JOIN {x_node} a ON f.fid = a.fid INNER JOIN {node} n ON p.pid = n.nid INNER JOIN {users} u ON f.uid = u.uid WHERE a.nid = %d' . $term['order']), $term['limit'], 0, NULL, $node->nid);
$com = variable_get('photos_comment', 0);
$edit = node_access('update', $node);
$del = node_access('delete', $node);
$vote = variable_get('photos_vote', 0);
$label = variable_get('photos_display_list_imagesize', false);
while ($data = db_fetch_array($result)) {
$image = photos_get_info(0, $data);
$image['view'] = theme('photos_imagehtml', $image['thumb'][$label], array(
'filename' => $image['filename'],
));
$image['url'] = url('photos/image/' . $image['fid']);
if ($com) {
$image['links']['comment'] = theme('photos_comment_count', $image['comcount'], $image['url']);
}
if ($image['count']) {
$image['links']['count'] = t('!cou visits', array(
'!cou' => $image['count'],
));
}
$image['links']['info'] = t('!name in !time upload to !title', array(
'!name' => theme('username', (object) $image),
'!time' => format_date($image['timestamp'], 'small'),
'!title' => l($image['title'], 'photos/album/' . $image['pid']),
));
if ($edit) {
$image['ajax']['edit_url'] = $image['url'] . '/update';
$image['links']['cover'] = l(t('Set to Cover'), "node/{$image['pid']}/photos/cover/{$image['fid']}", array(
'query' => drupal_get_destination(),
));
}
if ($del) {
$image['ajax']['del_id'] = 'id="photos_ajax_del_' . $image['fid'] . '"';
$image['ajax']['del_link'] = l(t('Move out'), 'photos/image/' . $image['fid'] . '/delete', array(
'query' => array(
'destination' => $_GET['q'],
'type' => 'sub_album',
'nid' => $node->nid,
),
'attributes' => array(
'class' => 'jQueryeditable_edit_delete',
'alt' => 'photos_ajax_del_' . $image['fid'],
),
));
}
if ($vote) {
$image['links']['vote'] = theme('photos_vote', $image['fid']);
}
$album['view'][] = theme('photos_imageview', $image, 'list');
}
if ($album['view'][0]) {
$album['node_url'] = url("node/{$node->nid}");
$album['album_url'] = url("photos/sub_album/{$node->nid}");
$album['links'] = _photos_order_link("photos/album/{$node->nid}", $node->subalbum['count'], 0, 1);
$album['pager'] = theme('pager', NULL, $term['limit']);
$v = theme('photos_albumview', $album, $node);
}
else {
$v = t('Sub-Album is empty');
}
_photos_breadcrumb(array(
l(t('@name\'s albums', array(
'@name' => $node->name,
)), "photos/user/{$node->uid}/album"),
l($node->title, "node/{$node->nid}"),
));
drupal_set_title(t('Sub-Album: @title', array(
'@title' => check_plain($node->title),
)));
return $v;
}