function photos_page_image in Album Photos 6.2
Same name and namespace in other branches
- 7.3 inc/photos.page.inc \photos_page_image()
1 string reference to 'photos_page_image'
- photos_menu in ./
photos.module
File
- inc/
photos.page.inc, line 33
Code
function photos_page_image($ac = false) {
global $user;
$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);
if ($ac->uid) {
$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 {node} n ON p.pid = n.nid INNER JOIN {users} u ON f.uid = u.uid WHERE f.uid = %d' . $term['order']), $term['limit'], 0, NULL, $ac->uid);
$album['links'] = _photos_order_link('photos/user/image/' . $ac->uid, $ac->album['image']['count'], l(t('Slideshow'), 'photos/user/' . $ac->uid . '/slide'), 1);
_photos_breadcrumb(array(
l(t('Images'), 'photos/image'),
));
}
else {
$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 {node} n ON p.pid = n.nid INNER JOIN {users} u ON f.uid = u.uid' . $term['order']), $term['limit']);
$album['links'] = _photos_order_link('photos/image', photos_get_count('site_image'), 0, 1);
}
$com = variable_get('photos_comment', 0);
if ($user->uid && $ac->uid == $user->uid) {
$edit = 1;
}
$vote = variable_get('allowed to 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['ajax']['del_id'] = 'id="photos_ajax_del_' . $image['fid'] . '"';
$image['ajax']['del_link'] = l(t('Delete'), 'photos/image/' . $image['fid'] . '/delete', array(
'query' => array(
'destination' => $_GET['q'],
'pid' => $image['pid'],
'uid' => $image['uid'],
),
'attributes' => array(
'class' => 'jQueryeditable_edit_delete',
'alt' => 'photos_ajax_del_' . $image['fid'],
),
));
$image['links']['cover'] = l(t('Set to Cover'), "node/{$image['pid']}/photos/cover/{$image['fid']}", array(
'query' => drupal_get_destination(),
));
}
if ($vote) {
$image['links']['vote'] = theme('photos_vote', $image['fid']);
}
$album['view'][] = theme('photos_imageview', $image, 'list');
}
if ($album['view'][0]) {
$album['pager'] = theme('pager', NULL, $term['limit']);
$v = theme('photos_albumview', $album, NULL);
}
else {
$v = t('@name has not yet upload an image', array(
'@name' => $ac->name,
));
}
return $v;
}