示例#1
0
 /**
  * Validates job description
  *
  * @return boolean
  */
 protected function _validateDescription()
 {
     $validator = new Zend_Validate_StringLength(2);
     if ($validator->isValid($this->category->getDescription())) {
         return true;
     }
     $msg = Sanmax_MessageStack::getInstance('SxCms_Publication_Category');
     $msg->addMessage('description', $validator->getMessages());
     return false;
 }
示例#2
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;
 }
示例#3
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;
 }