/** * 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_Job_Category'); $msg->addMessage('description', $validator->getMessages()); return false; }
public function toObject(array $import) { $fields = array('vacancy_cat_id' => null, 'parent_id' => null, 'language' => null, 'name' => null, 'description' => null); foreach ($import as $key => $value) { if (array_key_exists($key, $fields)) { $fields[$key] = $value; } } $category = new SxCms_Job_Category(); $category->setId($fields['vacancy_cat_id'])->setParentId($fields['parent_id'])->setLanguage($fields['language'])->setName($fields['name'])->setDescription($fields['description']); return $category; }
public function loadState() { $db = Zend_Registry::get('db'); $select = $db->select()->from('Vacancy', array('*'))->where('vacancy_id = ?', $this->id); $stmt = $db->query($select); $result = $stmt->fetchAll(); foreach ($result as $job) { $this->setId($job['vacancy_id'])->setJobTitle($job['title'])->setPhone($job['phone'])->setMobile($job['mobile'])->setEmail($job['email'])->setTerm($job['term'])->setDescription($job['description'])->setExpireDate($job['date_expired'])->setPublicationDate($job['date_published'])->setSeekerFirstName($job['seeker_name'])->setSeekerName($job['seeker_fname']); $category = new SxCms_Job_Category(); $category->setId($job['category_id']); $this->setCategory($category); $address = new SxCms_Address(); $address->setRegion($job['region']); $this->setAddress($address)->setHours($job['hours'])->setNotes($job['notes']); } return $this; }
public function addSubCategory(SxCms_Job_Category $category) { $this->subCats[$category->getId()] = $category; return $this; }
public function addCategoryAction() { $category = new SxCms_Job_Category(); $this->view->category = $category; $mapper = new SxCms_Job_Category_DataMapper(); $this->view->categories = $mapper->getTree(); if ($this->getRequest()->isPost()) { $category->setName($this->_getParam('name'))->setParentId($this->_getParam('parent'))->setDescription($this->_getParam('description'))->setLanguage($_SESSION['System']['lng']); $validator = new SxCms_Job_Category_BaseValidator(); if ($validator->validate($category)) { $category->save(); $flashMessenger = $this->_helper->getHelper('FlashMessenger'); $flashMessenger->addMessage('Categorie werd succesvol aangemaakt!'); $this->_helper->redirector->gotoSimple('categories', 'vacancy'); } } $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Job_Category'); }
public function getByCat(SxCms_Job_Category $category) { $db = Zend_Registry::get('db'); $select = $db->select()->from('Vacancy', array('*'))->where('date_published <= CURDATE()')->where('date_expired >= CURDATE()')->order('date_published DESC'); if ($category->getId()) { $select->where('category_id = ?', $category->getId()); } $stmt = $db->query($select); $result = $stmt->fetchAll(); $jobs = array(); foreach ($result as $job) { $vacancy = $this->getModelFromArray($job); $jobs[$vacancy->getId()] = $vacancy; } return $jobs; }