示例#1
0
 /** Render a vacancy's details
  * @access public
  * @throws Pas_Exception_Param if missing parameter on URL.
  */
 public function vacancyAction()
 {
     if ($this->getParam('id', false)) {
         $this->view->vacs = $this->_vacancies->getJobDetails($this->getParam('id'));
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }
 /** Delete a vacancy
  * @access public
  * @return void
  */
 public function deleteAction()
 {
     if ($this->_request->isPost()) {
         $id = (int) $this->getParam('id');
         $del = $this->_request->getPost('del');
         if ($del == 'Yes' && $id > 0) {
             $where = 'id = ' . (int) $id;
             $this->_vacancies->delete($where);
             $this->getFlash()->addMessage('Record deleted');
         }
         $this->redirect(self::REDIRECT);
     } else {
         $id = (int) $this->_request->getParam('id');
         if ($id > 0) {
             $this->view->vac = $this->_vacancies->fetchRow('id = ' . $id);
         }
     }
 }
 /** Delete a vacancy
  * @access public
  * @return void
  */
 public function deleteAction()
 {
     if ($this->_request->isPost()) {
         $id = (int) $this->getParam('id');
         $del = $this->_request->getPost('del');
         if ($del == 'Yes' && $id > 0) {
             $where = 'id = ' . (int) $id;
             $this->_vacancies->delete($where);
             $this->getFlash()->addMessage('Vacancy\'s information deleted! This cannot be undone.');
         }
         $this->redirect('/users/vacancies/');
     } else {
         $id = (int) $this->_request->getParam('id');
         if ($id > 0) {
             $this->view->vac = $this->_vacancies->fetchRow('id = ' . $id);
         }
     }
 }
示例#4
0
 /**
  * Удаление вакансии
  * @return void
  */
 public function removeAction()
 {
     if ($this->_authorize('vacancies', 'remove')) {
         $objVacancies = new Vacancies();
         $vacancy = $objVacancies->getObjectById($this->_request->getParam('vacancyId'));
         try {
             if (!$vacancy instanceof Vacancy) {
                 throw new Zend_Exception('Error while deleting vacancy.');
             }
             $vacancy->delete();
         } catch (Exception $ex) {
             $this->view->error = $ex->getMessage();
             $this->_forward('index', 'vacancy');
         }
         $this->_redirect('vacancy');
     }
 }
示例#5
0
 /**
  * Добавление/обновление соискателя
  * @return void
  */
 private function edit($action)
 {
     if ($action == 'edit' && $this->isAllowed('applicants', 'edit') || $action == 'add' && $this->isAllowed('applicants', 'add')) {
         $objForm = new Form_Applicant_Edit();
         $objForm->setAction($this->view->url(array('controller' => 'applicant', 'action' => $action)));
         $objVacancies = new Vacancies();
         $objForm->setSelectOptions($objVacancies->fetchAll()->toArray());
         if ($this->getRequest()->isPost()) {
             if ($objForm->isValid($_POST)) {
                 $objApplicants = new Applicants();
                 $applicantId = $objForm->applicantId->getValue();
                 $objApplicant = $objApplicants->getObjectById($applicantId);
                 if (!$objApplicant instanceof Applicant) {
                     $applicantId = null;
                     $objApplicant = $objApplicants->createRow();
                     $objApplicant->status = "new";
                 }
                 $LastName = $objForm->LastName->getValue();
                 $Name = $objForm->Name->getValue();
                 $Patronymic = $objForm->Patronymic->getValue();
                 $Birth = $objForm->Birth->getValue();
                 $VacancyId = $objForm->VacancyId->getValue();
                 $Email = $objForm->Email->getValue();
                 $Phone = $objForm->Phone->getValue();
                 $Resume = $objForm->Resume->getValue();
                 $objApplicant->last_name = $LastName;
                 $objApplicant->name = $Name;
                 $objApplicant->patronymic = $Patronymic;
                 $objApplicant->birth = $Birth;
                 $objApplicant->vacancy_id = $VacancyId;
                 $objApplicant->email = $Email;
                 $objApplicant->phone = $Phone;
                 $objApplicant->resume = $Resume;
                 if ($objApplicant->status == "staff") {
                     $objApplicant->number = $this->getRequest()->getParam('Number');
                 }
                 $objApplicant->save();
                 if ($applicantId == null) {
                     $applicantId = $objApplicants->getAdapter()->lastInsertId();
                     $comments = new Comments();
                     $comment = $comments->createRow();
                     $comment->user_id = Auth::getInstance()->getIdentity();
                     $comment->applicant_id = $applicantId;
                     $comment->comment = "Applicant added to base";
                     $comment->save();
                 }
                 if ($objForm->Photo->getValue() != "") {
                     if ($objForm->Photo->receive()) {
                         $filename = $_SERVER['DOCUMENT_ROOT'] . '/public/images/photos/' . $applicantId . '.jpg';
                         @unlink($filename);
                         rename($objForm->Photo->getFileName(), $filename);
                     }
                 }
                 $this->_helper->redirector('index', 'applicant');
             } else {
                 $objForm->populate($this->getRequest()->getParams());
             }
         } else {
             $applicantId = $this->getRequest()->getParam('applicantId');
             if ($applicantId != '') {
                 // выбираем из базы данные о редактируемом соискателе
                 $objApplicants = new Applicants();
                 $objApplicant = $objApplicants->getObjectById($applicantId);
                 if ($objApplicant) {
                     $this->view->applicantId = $applicantId;
                     if ($objApplicant->status == "staff") {
                         $objForm->showNumber();
                     }
                     $objForm->populate(array('LastName' => $objApplicant->last_name, 'Name' => $objApplicant->name, 'Patronymic' => $objApplicant->patronymic, 'Birth' => substr($objApplicant->birth, 0, 10), 'VacancyId' => $objApplicant->vacancy_id, 'Email' => $objApplicant->email, 'Phone' => $objApplicant->phone, 'Resume' => $objApplicant->resume, 'Number' => $objApplicant->number, 'applicantId' => $applicantId));
                 }
             }
         }
         $this->view->objForm = $objForm;
     }
 }