function node_gallery_operations in Node Gallery 6.2
Same name and namespace in other branches
- 6 node_gallery.module \node_gallery_operations()
4 calls to node_gallery_operations()
- node_gallery_views_handler_gallery_op::render in includes/
node_gallery_views_handler_gallery_op.inc - template_preprocess_gallery_cover_view in theme/
theme.inc - theme_gallery_image_navigator in theme/
theme.inc - theme_gallery_list in theme/
theme.inc - @file theme/theme.inc Node gallery theme functions
File
- ./
node_gallery.module, line 611 - Node gallery module file
Code
function node_gallery_operations($type, $a2 = NULL) {
global $user;
$items = array();
switch ($type) {
case 'list':
$account = $a2;
//all gallery list or current user's gallery list;
if ($account->uid == $user->uid) {
$node_types = node_get_types();
$gallery_types = node_gallery_get_types();
foreach ($gallery_types as $type) {
if (user_access("create {$type} content", $user)) {
$items[] = array(
'title' => t('Create !type', array(
'!type' => $node_types[$type]->name,
)),
'href' => 'node/add/' . str_replace('_', '-', $type),
);
}
}
}
break;
case 'cover':
$gallery = $a2;
if (node_gallery_user_access('edit', $gallery)) {
$items[] = array(
'title' => t('Edit gallery'),
'href' => "node/{$gallery->nid}/edit",
'query' => array(
'destination' => "galleries/{$gallery->uid}",
),
);
}
if (node_gallery_user_access('upload', $gallery)) {
$items[] = array(
'title' => t('Upload images'),
'href' => "node/{$gallery->nid}/upload",
);
}
if (node_gallery_user_access('delete', $gallery)) {
$items[] = array(
'title' => t('Delete gallery'),
'href' => "node/{$gallery->nid}/delete",
'query' => array(
'destination' => "galleries/{$gallery->uid}",
),
);
}
break;
case 'gallery':
$gallery = $a2;
if (node_gallery_user_access('edit', $gallery)) {
$items[] = array(
'title' => t('Edit gallery'),
'href' => "node/{$gallery->nid}/edit",
'query' => array(
'destination' => "node/{$gallery->nid}",
),
);
}
if (node_gallery_user_access('upload', $gallery)) {
$items[] = array(
'title' => t('Upload images'),
'href' => "node/{$gallery->nid}/upload",
'query' => array(
'destination' => "node/{$gallery->nid}",
),
);
}
if (node_gallery_user_access('edit image', $gallery) && count($gallery->images)) {
$items[] = array(
'title' => t('Manage images'),
'href' => "node/{$gallery->nid}/images",
'query' => array(
'destination' => "node/{$gallery->nid}",
),
);
}
if (node_gallery_user_access('delete', $gallery)) {
$items[] = array(
'title' => t('Delete gallery'),
'href' => "node/{$gallery->nid}/delete",
'query' => array(
'destination' => "galleries/{$gallery->uid}",
),
);
}
break;
case 'image':
$image_node = $a2;
/*if (node_gallery_image_user_access('edit', $image_node)) {
$items[] = array('title' => t('Edit image'), 'href' => 'node/'. $image_node->nid ."/edit");
}*/
$items[] = array(
'title' => t('Back to gallery'),
'href' => 'node/' . $image_node->gid,
);
break;
}
return theme('links', $items, array(
'class' => 'gallery-operations',
));
}