function node_gallery_get_gallery_gids in Node Gallery 6.3
Builds an array of gids.
Parameters
$gallery_type: (optional) The content type of the galleries to be queried. Defaults to all gallery types.
$uid: (optional) UID to filter by. Defaults to NULL, or no filter.
Return value
An array of nids.
2 calls to node_gallery_get_gallery_gids()
- node_gallery_form_views_ui_edit_view_form_alter in ./
node_gallery.module - Implementation of hook_form_FORM_ID_alter().
- node_gallery_nodeapi in ./
node_gallery.module - Implements hook_nodeapi().
File
- ./
node_gallery.inc, line 248 - Shared functions for node_gallery
Code
function node_gallery_get_gallery_gids($gallery_type = NULL, $uid = NULL) {
$items = array();
$gallery_types = empty($gallery_type) ? node_gallery_get_types('gallery') : array(
$gallery_type,
);
$args = $gallery_types;
$sql = "SELECT n.nid FROM {node} n " . "WHERE n.type IN (" . db_placeholders($gallery_types, 'varchar') . ") AND n.status = 1";
if ($uid) {
$sql .= " AND n.uid = %d";
$args[] = $uid;
}
$result = db_query(db_rewrite_sql($sql, 'n', 'nid', $args), $args);
while ($object = db_fetch_object($result)) {
$items[] = $object->nid;
}
return $items;
}