Esempio n. 1
0
 public static function getAll()
 {
     global $db;
     if (Session::hasPriv('SUPERUSER')) {
         $sql = 'SELECT g.id, g.title, g.coverImage, g.folderName, e.date, g.status FROM galleries g LEFT JOIN events e ON e.gallery = g.id ORDER BY e.date DESC, g.title ASC, g.ordinal ASC';
     } else {
         $sql = 'SELECT g.id, g.title, g.coverImage, g.folderName, e.date, g.status FROM galleries g LEFT JOIN events e ON e.gallery = g.id WHERE g.status = "Open" ORDER BY e.date DESC, g.title ASC, g.ordinal ASC';
     }
     $result = $db->query($sql);
     $galleries = array();
     foreach ($result->fetchAll() as $itemGallery) {
         $galleries[] = ItemGallery::fromArray($itemGallery);
     }
     return $galleries;
 }
Esempio n. 2
0
 public static function fromArray($stuff)
 {
     $g = new ItemGallery();
     $g->loadFromArray($stuff);
     return $g;
 }