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;
     }
 }
 /**
  * 
  */
 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;
     }
 }
Exemplo n.º 3
0
 /**
  * This function acts as a service for adding a interview.
  * @param array $params_arr  = array of parameters
  * @return array  Array of results.
  */
 public function addinterview($params_arr)
 {
     $result = array();
     $status = 0;
     $message = "No access to add interview.";
     if (isset($params_arr['role_id']) && $params_arr['role_id'] != '' && isset($params_arr['group_id']) && $params_arr['group_id'] != '' && isset($params_arr['userid']) && $params_arr['userid'] != '') {
         $role_id = $params_arr['role_id'];
         $group_id = $params_arr['group_id'];
         $userid = $params_arr['userid'];
         if ($role_id == SUPERADMINROLE || $group_id == MANAGEMENT_GROUP || $group_id == HR_GROUP) {
             $privilege_flag = sapp_Global::_checkprivileges(SCHEDULEINTERVIEWS, $group_id, $role_id, 'add');
             if ($privilege_flag == 'Yes') {
                 $status = 1;
                 $message = "success";
                 $req_model = new Default_Model_Requisition();
                 $countryModal = new Default_Model_Countries();
                 $req_data = $req_model->getReqForInterviews();
                 $req_options = $requisition_options = array();
                 $countries_options = $cntry_options = array();
                 foreach ($req_data as $req) {
                     $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
                 }
                 $requisition_options = array('' => 'Select Requisition ID') + $req_options;
                 $countriesData = $countryModal->fetchAll('isactive=1', 'country');
                 foreach ($countriesData->toArray() as $data) {
                     $cntry_options[trim($data['country_id_org'])] = $data['country'];
                 }
                 $countries_options = array('' => 'Select country') + $cntry_options;
                 $interview_type_options = array('' => 'Select Interview Type', 'In person' => 'In person', 'Phone' => 'Phone', 'Video conference' => 'Video conference');
                 if (empty($req_options) && count($req_options) == 0) {
                     $status = 0;
                     $message = "No approved requisitions.";
                 } else {
                     if (empty($cntry_options) && count($cntry_options) == 0) {
                         $status = 0;
                         $message = "Countries are not configured yet.";
                     } else {
                         $result['req_id'] = $requisition_options;
                         $result['country'] = $countries_options;
                         $result['interview_mode'] = $interview_type_options;
                     }
                 }
             }
         }
     }
     return array('status' => $status, 'message' => $message, 'result' => $result);
 }