public function multipleresumeAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginUserId = trim($loginUserId);
     }
     $priv_check = sapp_Global::_checkprivileges(CANDIDATEDETAILS, '', $auth->getStorage()->read()->emprole, 'add');
     if ($priv_check == 'Yes') {
         $msgarray = $req_options = array();
         $form = new Default_Form_Multipleresume();
         $form->setAction(DOMAIN . 'candidatedetails/multipleresume');
         // To show list of requisitions to user
         $req_model = new Default_Model_Requisition();
         $req_data = $req_model->getRequisitionsForCV("'Approved','In process'");
         foreach ($req_data as $req) {
             $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
         }
         if (count($req_options) == 0) {
             $msgarray['requisition_id'] = "No active requisitions are found.";
         }
         $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
         $form_post_status = $this->_request->getPost();
         if ($form_post_status) {
             $candidate_firstname = $this->_getParam('candidate_firstname', null);
             $candidate_lastname = $this->_getParam('candidate_lastname', null);
             $cand_resumes = $this->_getParam('cand_resume', null);
             if ($form->isValid($form_post_status)) {
                 $cand_details_model = new Default_Model_Candidatedetails();
                 $requisition_id = $this->_getParam('requisition_id', null);
                 $cand_status = $this->_getParam('cand_status', null);
                 $req_records = $cand_details_model->getcountofrecords($requisition_id);
                 $curr_date = gmdate("Y-m-d H:i:s");
                 if (empty($req_records)) {
                     $rdata = array('req_status' => 'In process', 'modifiedby' => $loginUserId, 'modifiedon' => $curr_date);
                     $rwhere = ' id = ' . $requisition_id;
                     $req_model->SaveorUpdateRequisitionData($rdata, $rwhere);
                 }
                 // To insert records in a single query
                 $records = array();
                 foreach ($candidate_firstname as $key => $candidate_fname) {
                     $cfull_name = $candidate_fname . ' ' . $candidate_lastname[$key];
                     $records[] = "({$requisition_id}, '{$candidate_fname}','{$candidate_lastname[$key]}','{$cfull_name}', '{$cand_resumes[$key]}', '{$cand_status}', 1, {$loginUserId}, {$loginUserId}, '{$curr_date}', '{$curr_date}')";
                 }
                 $data_fields = array('requisition_id', 'candidate_firstname', 'candidate_lastname', 'candidate_name', 'cand_resume', 'cand_status', 'isactive', 'createdby', 'modifiedby', 'createddate', 'modifieddate');
                 $last_insert_id = $cand_details_model->insertMultipleRecords($data_fields, $records);
                 // Log status to Log manager and redirect to Resource Pooling list page.
                 if ($last_insert_id != '') {
                     $menumodel = new Default_Model_Menu();
                     $objidArr = $menumodel->getMenuObjID('/candidatedetails');
                     $objID = $objidArr[0]['id'];
                     $log_status = sapp_Global::logManager($objID, 1, $loginUserId, $last_insert_id);
                     //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details added successfully.');
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details added successfully."));
                     $this->_redirect('/candidatedetails');
                 }
             } else {
                 // To handle server validation, when Javascript is disabled
                 $messages = $form->getMessages();
                 foreach ($messages as $key => $val) {
                     foreach ($val as $key2 => $val2) {
                         $msgarray[$key] = $val2;
                         break;
                     }
                 }
                 $form->setDefault('candidate_firstname', $candidate_firstname[0]);
                 $form->setDefault('cand_resume', '');
             }
         }
         $this->view->form = $form;
         $this->view->msgarray = $msgarray;
     } else {
         $this->_redirect('error');
     }
 }
Пример #2
0
 /**
  * This action is used for adding/updating data.
  * @parameters
  * @param $id  =  id of candidate (optional)
  * 
  * @return Zend_Form.
  */
 public function editAction()
 {
     $profile_model = new Default_Model_Profiles();
     $req_model = new Default_Model_Requisition();
     $cand_model = new Default_Model_Candidatedetails();
     $cand_work_model = new Default_Model_Candidateworkdetails();
     $countriesModel = new Default_Model_Countries();
     $auth = Zend_Auth::getInstance();
     $data = array();
     $popConfigPermission = array();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $req_data = $req_model->getRequisitionsForCV("'Approved','In process'");
     $req_options = array();
     foreach ($req_data as $req) {
         if (strlen(trim($req['technology'])) > 0) {
             $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'] . ' - ' . $req['technology'];
         } else {
             $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
         }
     }
     if (count($req_options) == 0) {
         $msgarray['requisition_id'] = "No approved requisitions.";
     }
     $id = trim($this->getRequest()->getParam('id'));
     $profileData = $profile_model->getProfileForView($id);
     if (is_numeric($id) && $id > 0) {
         try {
             $profileData = $profile_model->getProfileForView($id);
             $form = new Default_Form_Profiles($profileData['id']);
             $form->setAction(DOMAIN . 'profiles/edit/id/' . $id);
             $form->removeElement('cvcommentdescription');
             $statsflag = 'false';
             $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
             if (count($profileData) > 0) {
                 try {
                     if ($id) {
                         $form->submit->setLabel('Update');
                         foreach ($profileData as $key => $val) {
                             $profileData[$key] = htmlentities(addslashes($val), ENT_QUOTES, "UTF-8");
                         }
                         $form->populate($profileData);
                     }
                     $this->view->cvcommentdescription1 = "No";
                     $this->view->profile_data = $profileData;
                     $this->view->form = $form;
                     $this->view->statsflag = $statsflag;
                     $this->view->ermsg = '';
                     $this->view->msgarray = $msgarray;
                     if ($this->getRequest()->getPost()) {
                         $result = $this->save($form);
                         $this->view->msgarray = $result;
                         $this->view->messages = $result;
                     }
                 } catch (Exception $e) {
                     //$this->view->ermsg = 'nodata';
                     $this->view->exceptionmsg = $e->getMessage();
                 }
             } else {
                 $this->view->ermsg = 'nodata';
             }
         } catch (Exception $e) {
             //$this->view->ermsg = 'nodata';
             $this->view->exceptionmsg = $e->getMessage();
         }
     } else {
         $this->view->ermsg = 'nodata';
     }
 }