You are here

static function gallery_gateway::find_by in Node Gallery 6

1 call to gallery_gateway::find_by()
node_gallery_list in ./node_gallery.pages.inc
@file Node gallery pages.

File

./node_gallery.model.inc, line 83
Node gallery module.

Class

gallery_gateway

Code

static function find_by($uid = NULL, $type = NULL) {
  $gallery_types = empty($type) ? array_keys(gallery_config_gateway::get_types()) : $type;
  $args = $gallery_types;
  $sql = "SELECT n.nid, n.title, n.type, n.created, n.uid FROM {node} n \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($sql, $args);
  while ($r = db_fetch_array($result)) {
    $items[$r['nid']] = new Gallery($r);
  }
  return $items;
}