public function loadGallery(&$items, $item, $page = 1, $size = null) { $dbh = Project_DB::get(); $filter = array(); $values = array(); if ($this->ggid !== null) { $filter[] = ' GG.ID = :ggid'; $values['ggid'] = (int) $this->ggid; } if ($this->ggroup !== null) { $filter[] = ' GG.Title = :ggroup'; $values['ggroup'] = $this->ggroup; } $filter[] = ' G.ID = :item'; $values['item'] = (int) $item; $where = implode(' AND', $filter); if ($this->ggid !== null || $this->ggroup !== null) { $query = "SELECT GB.GAID AS GID, GB.GRID AS GGID, GB.Title AS GBTitle, G.Title AS Title, GB.ShortDesc AS GBShortDesc, G.ShortDesc AS ShortDesc, GB.LongDesc AS GBLongDesc, G.LongDesc AS LongDesc, GB.Author AS GBAuthor, G.Author AS Author, G.`When` AS `When`, G.Directory AS Directory FROM gallgbinds AS GB JOIN gallerygroups AS GG ON GB.GRID=GG.ID JOIN galleries AS G ON GB.GAID=G.ID WHERE GB.Active=1 AND G.Active=1 AND {$where}"; } else { $query = "SELECT G.ID AS GID, 0 AS GGID, '' AS GBTitle, G.Title AS Title, '' AS GBShortDesc, G.ShortDesc AS ShortDesc, '' AS GBLongDesc, G.LongDesc AS LongDesc, '' AS GBAuthor, G.Author AS Author, G.`When` AS `When`, G.Directory AS Directory FROM galleries AS G WHERE G.Active=1 AND {$where}"; } $stmt = $dbh->prepare($query); foreach ($values as $key => $value) { $stmt->bindValue(":{$key}", $value, is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR); } $items = array(); if ($stmt->execute()) { if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $item = new Var_Pool($row); $item->register('Pictures'); $item->register('PicturesTotal'); $this->loadGalleryPictures($item, $page, $size); $items = array($row['GID'] => $item); } else { $items = array(); } } }
public function unregister($name, $check = true) { parent::unregister($name, $check); $this->modified(); }