/** Edit a vacancy
  * @access public
  * @return void
  */
 public function editAction()
 {
     if ($this->getParam('id', false)) {
         $form = new VacancyForm();
         $form->submit->setLabel('Update details');
         $this->view->form = $form;
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($this->_request->getPost())) {
                 $where = array();
                 $where[] = $this->_vacancies->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
                 $this->_vacancies->update($form->getValues(), $where);
                 $this->getFlash()->addMessage('Vacancy details updated!');
                 $this->redirect(self::REDIRECT);
             } else {
                 $form->populate($form->getValues());
             }
         } else {
             // find id is expected in $params['id']
             $id = (int) $this->getParam('id', 0);
             if ($id > 0) {
                 $vac = $this->_vacancies->fetchRow('id = ' . $id);
                 if (count($vac)) {
                     $form->populate($vac->toArray());
                 } else {
                     throw new Pas_Exception_Param($this->_nothingFound, 404);
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParamter, 500);
     }
 }
 /** Edit a vacancy
  * @access public
  * @return void
  * @throws Pas_Exception_Param
  */
 public function editAction()
 {
     if ($this->getParam('id', false)) {
         $form = new VacancyForm();
         $form->submit->setLabel('Submit changes');
         $this->view->form = $form;
         if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
             if ($form->isValid($formData)) {
                 $where = array();
                 $where[] = $this->_vacancies->getAdapter()->quoteInto('id = ?', $this->getParam('id'));
                 $insertdata = array('title' => $form->getValue('title'), 'salary' => $form->getValue('salary'), 'specification' => $form->getValue('specification'), 'regionID' => $form->getValue('regionID'), 'status' => $form->getValue('status'), 'live' => $form->getValue('live'), 'expire' => $form->getValue('expire'), 'updated' => $this->getTimeForForms(), 'updatedBy' => $this->getIdentityForForms());
                 $this->_vacancies->update($insertdata, $where);
                 $this->getFlash()->addMessage('Vacancy details updated!');
                 ${$this}->redirect('/users/vacancies');
             } else {
                 $form->populate($this->_request->getPost());
             }
         } else {
             // find id is expected in $params['id']
             $id = (int) $this->getParam('id', 0);
             if ($id > 0) {
                 $vac = $this->_vacancies->fetchRow('id = ' . $id);
                 if (count($vac)) {
                     $form->populate($vac->toArray());
                 } else {
                     throw new Pas_Exception_Param($this->_nothingFound);
                 }
             }
         }
     } else {
         throw new Pas_Exception_Param($this->_missingParamter);
     }
 }