/**
  * 
  */
 public function addAction()
 {
     $req_model = new Default_Model_Requisition();
     $candsmodel = new Default_Model_Candidatedetails();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginUserGroup = $auth->getStorage()->read()->group_id;
     }
     $managerStr = '';
     $messages = array();
     $inter_options = array();
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $form = new Default_Form_Interviewrounds();
     $form->setAction(DOMAIN . 'scheduleinterviews/add');
     $form->id->setValue($id);
     $form->removeElement('cand_status');
     $form->removeElement('interview_status');
     $form->submit->setLabel('Save');
     $data = array();
     $req_data = $req_model->getReqForInterviews();
     $req_options = array();
     foreach ($req_data as $req) {
         $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
     }
     $form->req_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
     if (count($req_options) == 0) {
         $messages['req_id'] = "No approved requisitions.";
         $messages['candidate_name'] = "Candidates are not added yet.";
         $messages['interviewer_id'] = "Interviewers are not added yet.";
     }
     if (isset($_POST['req_id']) && $_POST['req_id'] != '') {
         $candsData = $candsmodel->getnotscheduledcandidateData($_POST['req_id']);
         $cand_data_opt = array();
         if (count($candsData) > 0) {
             foreach ($candsData as $cand) {
                 $cand_data_opt[$cand['id']] = $cand['candidate_name'];
             }
         }
         $form->candidate_name->addMultiOptions(array('' => 'Select Candidate') + $cand_data_opt);
         if (isset($req['department_id'])) {
             #$repmanData = $req_model->getReportingmanagers($loginUserGroup, $loginUserId, '', $req['department_id'], 'interviewer');
             #$requi_number = $_POST['req_id'];
             $repmanData = $req_model->getRequisitionInterviewPanel($_POST['req_id']);
             $managers_data_opt = array();
             if (!empty($repmanData)) {
                 foreach ($repmanData as $rep) {
                     $inter_options[] = array('id' => $rep['id'], 'name' => $rep['name'], 'profileimg' => $rep['profileimg']);
                 }
             }
         } else {
             $managerStr = "nomanagers";
         }
     }
     $this->view->form = $form;
     $this->view->round_count = 0;
     $this->view->messages = $messages;
     $this->view->inter_options = $inter_options;
     if ($this->getRequest()->getPost()) {
         $result = $this->save($form, $data);
         $this->view->msgarray = $result;
         $this->view->messages = $result;
     }
 }
示例#2
0
 /**
  * This function returns candidates and interviewers based on a particular requisition code.
  * @param integer $req_id          = id of requisition
  * @param integer $loginUserGroup  = id of group
  * @param integer $loginUserId     = id of logged user
  * @return array  Array of candidate options and interviewers options.
  */
 public function getcandidates_forinterview($req_id, $loginUserGroup, $loginUserId)
 {
     $jobtitleModel = new Default_Model_Jobtitles();
     $candsmodel = new Default_Model_Candidatedetails();
     $reqData = $this->getRequisitionDataById($req_id);
     $candsData = $candsmodel->getnotscheduledcandidateData($req_id);
     $candStr = '';
     $jobttlArr = array();
     $jobtitle = '';
     $managerStr = "";
     if (!empty($candsData)) {
         foreach ($candsData as $cand) {
             $candStr .= sapp_Global::selectOptionBuilder($cand['id'], $cand['candidate_name']);
         }
     } else {
         $candStr = "nocandidates";
     }
     if (!empty($reqData)) {
         $reqData['jobtitlename'] = '';
         $jobttlArr = $jobtitleModel->getsingleJobTitleData($reqData['jobtitle']);
         if (!empty($jobttlArr) && $jobttlArr != 'norows') {
             $jobtitle = $jobttlArr[0]['jobtitlename'];
             $reqData['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
         }
         $repmanData = $this->getReportingmanagers($loginUserGroup, $loginUserId, '', $reqData['department_id'], 'interviewer');
         if (!empty($repmanData)) {
             foreach ($repmanData as $rep) {
                 $managerStr .= sapp_Global::selectOptionBuilder($rep['id'], $rep['name'], $rep['profileimg']);
             }
         } else {
             $managerStr = "nomanagers";
         }
     }
     return array('candidates' => $candStr, 'managers' => $managerStr, 'jobtitle' => $jobtitle);
 }
 public function addAction()
 {
     $req_model = new Default_Model_Requisition();
     $candsmodel = new Default_Model_Candidatedetails();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginUserGroup = $auth->getStorage()->read()->group_id;
     }
     $popConfigPermission = array();
     if (sapp_Global::_checkprivileges(COUNTRIES, $loginUserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'country');
     }
     if (sapp_Global::_checkprivileges(STATES, $loginUserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'state');
     }
     if (sapp_Global::_checkprivileges(CITIES, $loginUserGroup, $loginuserRole, 'add') == 'Yes') {
         array_push($popConfigPermission, 'city');
     }
     $managerStr = '';
     $messages = array();
     $inter_options = array();
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $form = new Default_Form_Interviewrounds();
     $form->setAction(BASE_URL . 'scheduleinterviews/add');
     $form->id->setValue($id);
     $form->removeElement('cand_status');
     $form->removeElement('interview_status');
     $form->submit->setLabel('Save');
     $data = array();
     $req_data = $req_model->getReqForInterviews();
     $req_options = array();
     foreach ($req_data as $req) {
         $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
     }
     $form->req_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
     if (count($req_options) == 0) {
         $messages['req_id'] = "No approved requisitions.";
         $messages['candidate_name'] = "Candidates are not added yet.";
         $messages['interviewer_id'] = "Interviewers are not added yet.";
     }
     if (count($form->country->getMultiOptions()) == 1) {
         $messages['country'] = "Countries are not configured yet.";
         $messages['state'] = "States are not configured yet.";
         $messages['city'] = "Cities are not configured yet.";
     }
     if (isset($_POST['req_id']) && $_POST['req_id'] != '') {
         $candsData = $candsmodel->getnotscheduledcandidateData($_POST['req_id']);
         $cand_data_opt = array();
         if (count($candsData) > 0) {
             foreach ($candsData as $cand) {
                 $cand_data_opt[$cand['id']] = $cand['candidate_name'];
             }
         }
         $form->candidate_name->addMultiOptions(array('' => 'Select Candidate') + $cand_data_opt);
         if (isset($req['department_id'])) {
             $repmanData = $req_model->getReportingmanagers($loginUserGroup, $loginUserId, '', $req['department_id'], 'interviewer');
             $managers_data_opt = array();
             if (!empty($repmanData)) {
                 foreach ($repmanData as $rep) {
                     $inter_options[] = array('id' => $rep['id'], 'name' => $rep['name'], 'profileimg' => $rep['profileimg']);
                 }
             }
         } else {
             $managerStr = "nomanagers";
         }
     }
     if (isset($_POST['country']) && $_POST['country'] != '') {
         $statesmodel = new Default_Model_States();
         $statesmodeldata = $statesmodel->getBasicStatesList(intval($_POST['country']));
         $st_opt = array();
         if (count($statesmodeldata) > 0) {
             foreach ($statesmodeldata as $dstate) {
                 $st_opt[$dstate['state_id_org']] = $dstate['state'];
             }
         }
         $form->state->addMultiOptions(array('' => 'Select State') + $st_opt);
     }
     if (isset($_POST['state']) && $_POST['state'] != '') {
         $citiesmodel = new Default_Model_Cities();
         $citiesmodeldata = $citiesmodel->getBasicCitiesList(intval($_POST['state']));
         $ct_opt = array();
         if (count($citiesmodeldata) > 0) {
             foreach ($citiesmodeldata as $dcity) {
                 $ct_opt[$dcity['city_org_id']] = $dcity['city'];
             }
         }
         $form->city->addMultiOptions(array('' => 'Select City') + $ct_opt);
     }
     $this->view->form = $form;
     $this->view->round_count = 0;
     $this->view->messages = $messages;
     $this->view->inter_options = $inter_options;
     $this->view->popConfigPermission = $popConfigPermission;
     if ($this->getRequest()->getPost()) {
         $result = $this->save($form, $data);
         $this->view->msgarray = $result;
         $this->view->messages = $result;
     }
 }