/** * This action is used for adding/updating data. * @parameters * @param $id = id of candidate (optional) * * @return Zend_Form. */ public function editAction() { $req_model = new Default_Model_Requisition(); $jobtitleModel = new Default_Model_Jobtitles(); $cand_model = new Default_Model_Candidatedetails(); $candwork_model = new Default_Model_Candidateworkdetails(); $country_model = new Default_Model_Countries(); $role_model = new Default_Model_Roles(); $auth = Zend_Auth::getInstance(); $data = array(); $statusData = array(); $jobtitle = ''; $req_data['jobtitlename'] = ''; $popConfigPermission = array(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = trim($this->getRequest()->getParam('id')); if (is_numeric($id) && $id > 0) { try { try { $statusData = $req_model->getYesNoStatus(); $this->view->statusData = $statusData; } catch (Exception $err1) { } $candidateData = $cand_model->getcandidateData($id); $form = new Default_Form_Candidatedetails($candidateData['requisition_id']); $form->setAction(DOMAIN . 'candidatedetails/edit/id/' . $id); $statsflag = 'false'; if (count($candidateData) > 0) { try { $candidateworkData = $candwork_model->getcandidateworkData($id); $req_data = $req_model->getRequisitionDataById($candidateData['requisition_id']); // To show it on edit view $data['cand_resume'] = isset($candidateData['cand_resume']) ? $candidateData['cand_resume'] : NULL; $data['rec_id'] = isset($id) ? $id : NULL; $data['selected_option'] = $this->_getParam('selected_option'); if (($req_data['req_status'] == 'Closed' || $req_data['req_status'] == 'On hold' || $req_data['req_status'] == 'Complete') && ($candidateData['cand_status'] == 'Requisition Closed/Completed' || $candidateData['cand_status'] == 'On hold' || $candidateData['cand_status'] == 'Not Scheduled')) { //|| $candidateData['cand_status'] == 'Rejected' || $candidateData['cand_status'] == 'Disqualified' $statsflag = 'true'; $reqforcv_data = $req_model->getRequisitionsForCV("'Approved','In process'"); $req_options = array(); foreach ($reqforcv_data as $req) { $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename']; } $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options); $form->cand_status->addMultiOption('', 'Select Status'); $form->cand_status->addMultiOption('Not Scheduled', 'Not Scheduled'); } $data['requisition_code'] = $req_data['requisition_code']; $data['requisition_id'] = $req_data['id']; $candidateData['candidate_phonenumber'] = $candidateData['contact_number']; $candidateData['candidate_emailaddress'] = $candidateData['emailid']; $candidateData['candidate_technology'] = $candidateData['cand_technology']; if ($id) { $form->submit->setLabel('Update'); foreach ($candidateData as $key => $val) { $candidateData[$key] = htmlentities(addslashes($val), ENT_QUOTES, "UTF-8"); } $form->populate($candidateworkData); $form->populate($candidateData); } $this->view->candidate_data = $candidateData; $this->view->form = $form; $this->view->workdata = $candidateworkData; $this->view->data = $data; $this->view->popConfigPermission = $popConfigPermission; $this->view->statsflag = $statsflag; $this->view->ermsg = ''; if ($this->getRequest()->getPost()) { $result = $this->save($form); $this->view->msgarray = $result; $this->view->messages = $result; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } } else { $this->view->ermsg = 'nodata'; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } } else { $this->view->ermsg = 'nodata'; } }