示例#1
0
 public function getFromCategory(SxCms_Publication_Category $cat)
 {
     $lng = isset($_SESSION['System']['lng']) ? $_SESSION['System']['lng'] : 'nl';
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('Publication', array('*'))->where('language = ?', $lng)->where('publication_cat_id = ?', $cat->getId())->order('publication_date DESC');
     $stmt = $db->query($select);
     $result = $stmt->fetchAll();
     $publications = array();
     foreach ($result as $pub) {
         $publication = $this->toObject($pub);
         $publications[$publication->getId()] = $publication;
     }
     return $publications;
 }
示例#2
0
 public function getAll()
 {
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('PublicationCat', array('*'))->where('language = ?', $_SESSION['System']['lng']);
     $stmt = $db->query($select);
     $result = $stmt->fetchAll();
     $publications = array();
     foreach ($result as $pub) {
         $publication = new SxCms_Publication_Category();
         $publication->setId($pub['publication_cat_id'])->setLanguage($pub['language'])->setName($pub['name'])->setDescription($pub['description']);
         $publications[$publication->getId()] = $publication;
     }
     return $publications;
 }