You are here

class gallery_config_gateway in Node Gallery 6

Hierarchy

Expanded class hierarchy of gallery_config_gateway

File

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

View source
class gallery_config_gateway {
  static function get_by($type, $op = 'type') {
    static $types;
    if (empty($types[$type])) {
      if ($op == 'id' && is_numeric($type)) {
        $type = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $type));
      }
      $result = db_query("SELECT * FROM {ng_gallery_config} gt WHERE gt.gallery_type = '%s'", $type);
      $t = drupal_unpack(db_fetch_object($result));
      if (!empty($t)) {
        $types[$type] = new gallery_config($t);
      }
    }
    return $types[$type];
  }
  static function get_types($op = 'gallery', $type = NULL) {
    static $types;
    if (empty($types)) {
      $result = db_query("SELECT name, gallery_type, image_type FROM {ng_gallery_config}");
      while ($o = db_fetch_object($result)) {
        $types['image'][$o->image_type] = $o;
        $types['gallery'][$o->gallery_type] = $o;
      }
    }
    return empty($type) ? $types[$op] : $types[$op][$type];
  }
  static function is_type($op, $type) {
    $types = self::get_types($op);
    if (in_array($type, array_keys($types))) {
      return TRUE;
    }
    return FALSE;
  }

}

Members