function photos_page_album in Album Photos 7.3
Same name and namespace in other branches
- 6.2 inc/photos.page.inc \photos_page_album()
Album photos page.
1 string reference to 'photos_page_album'
- photos_menu in ./
photos.module - Implements hook_menu().
File
- inc/
photos.page.inc, line 28 - Handles default page view(s) and content.
Code
function photos_page_album($account = FALSE) {
$build = array();
$output = '';
if (isset($account->uid) && $account->uid != 0) {
global $user;
if ($user->uid == $account->uid) {
// @todo add support for admin to re-arrange albums.
$output = l(t('Re-arrange albums'), 'photos/user/' . $account->uid . '/album-sort');
}
$query = db_select('node', 'n')
->extend('PagerDefault');
$query
->join('photos_album', 'p', 'p.pid = n.nid');
$query
->fields('n', array(
'nid',
));
$query
->condition('n.uid', $account->uid);
$query
->orderBy('p.wid', 'ASC');
$query
->orderBy('n.nid', 'DESC');
$query
->limit(10);
$result = $query
->execute();
_photos_breadcrumb(array(
l(t('Albums'), 'photos/album'),
));
}
else {
$query = db_select('node', 'n')
->extend('PagerDefault');
$query
->join('photos_album', 'p', 'p.pid = n.nid');
$query
->fields('n', array(
'nid',
));
$query
->orderBy('n.nid', 'DESC');
$query
->limit(10);
$query
->addTag('node_access');
$result = $query
->execute();
}
foreach ($result as $node) {
$node = node_load($node->nid);
$node_view = node_view($node, 'full');
$output .= drupal_render($node_view);
}
if ($output) {
$output .= theme('pager');
}
else {
if ($account != FALSE) {
$output .= t('@name has not created an album yet.', array(
'@name' => $account->name,
));
}
else {
$output .= t('No albums have been created yet.');
}
}
return $output;
}