function node_gallery_get_gallery_list in Node Gallery 6.3
Same name and namespace in other branches
- 6.2 node_gallery.inc \node_gallery_get_gallery_list()
Returns an array of galleries, suitable for use in a form select.
Parameters
$type: The content type of the galleries to be queried.
$uid: (optional) if specified, the list returned will only contain galleries the user can modify.
Return value
Associative array where the keys are the nid, and the value is the node title.
2 calls to node_gallery_get_gallery_list()
- node_gallery_change_gallery_action_form in ./
node_gallery.actions.inc - Builds the form to allow a user to change the gallery of an image.
- node_gallery_manage_images_form in ./
node_gallery.pages.inc - Displays the content for our "Manage Images" tab, which is a VBO view.
File
- ./
node_gallery.inc, line 222 - Shared functions for node_gallery
Code
function node_gallery_get_gallery_list($type, $uid = NULL) {
$sql = "SELECT n.nid, n.title FROM {node} n WHERE n.type = '%s'";
$args[] = $type;
$items = array();
if ($uid && !node_gallery_user_access('edit', $type)) {
$sql .= " AND n.uid = %d ";
$args[] = $uid;
}
$result = db_query($sql, $args);
while ($r = db_fetch_array($result)) {
$items[$r['nid']] = $r['title'];
}
return $items;
}