/**
  * 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();
     $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;
     }
     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');
     }
     $id = trim($this->getRequest()->getParam('id'));
     if (is_numeric($id) && $id > 0) {
         try {
             $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');
                     $req_data['jobtitlename'] = '';
                     $jobttlArr = $jobtitleModel->getsingleJobTitleData($req_data['jobtitle']);
                     if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                         $jobtitle = $jobttlArr[0]['jobtitlename'];
                         $req_data['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
                     }
                     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');
                     }
                     $countryId = $candidateData['country'];
                     if (isset($_POST['country'])) {
                         $countryId = $_POST['country'];
                     }
                     $stateId = $candidateData['state'];
                     if (isset($_POST['state'])) {
                         $stateId = $_POST['state'];
                     }
                     $cityId = $candidateData['city'];
                     if (isset($_POST['city'])) {
                         $cityId = $_POST['city'];
                     }
                     if ($countryId != '') {
                         $statesmodel = new Default_Model_States();
                         $statesData = $statesmodel->getStatesList($countryId);
                         foreach ($statesData as $res) {
                             $form->state->addMultiOption($res['id'], utf8_encode($res['state_name']));
                         }
                         $form->setDefault('country', $countryId);
                     }
                     if ($stateId != '') {
                         $citiesmodel = new Default_Model_Cities();
                         $citiesData = $citiesmodel->getCitiesList($stateId);
                         foreach ($citiesData as $res) {
                             $form->city->addMultiOption($res['id'], utf8_encode($res['city_name']));
                         }
                         $form->setDefault('state', $stateId);
                     }
                     $form->setDefault('city', $cityId);
                     $form->setDefault('job_title', $jobtitle);
                     $countrieslistArr = $country_model->getTotalCountriesList();
                     if (sizeof($countrieslistArr) > 0) {
                         $form->country->addMultiOption('', 'Select Country');
                         foreach ($countrieslistArr as $countrieslistres) {
                             $form->country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                         }
                     } else {
                         $msgarray['country'] = 'Countries are not configured yet';
                     }
                     $data['requisition_code'] = $req_data['requisition_code'];
                     $data['requisition_id'] = $req_data['id'];
                     $data['jobtitlename'] = $req_data['jobtitlename'];
                     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';
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 public function addpopupAction()
 {
     $emptyFlag = NULL;
     $msgarray = array();
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $jobtitleid = $this->_request->getParam('jobtitleid');
     $visible = true;
     $controllername = 'positions';
     $positionsform = new Default_Form_positions();
     $positionsmodel = new Default_Model_Positions();
     $jobtitlesmodel = new Default_Model_Jobtitles();
     if ($jobtitleid == null) {
         $jobtitleidmodeldata = $jobtitlesmodel->getJobTitleList();
         if (!empty($jobtitleidmodeldata)) {
             foreach ($jobtitleidmodeldata as $jobtitleidres) {
                 $positionsform->jobtitleid->addMultiOption($jobtitleidres['id'], utf8_encode($jobtitleidres['jobtitlename']));
                 $this->view->notdisplayposition = 0;
             }
         } else {
             $msgarray['jobtitleid'] = 'Job titles are not configured yet.';
             $emptyFlag++;
         }
         $this->view->emptyFlag = $emptyFlag;
     } else {
         $jobtitleidres = $jobtitlesmodel->getsingleJobTitleData($jobtitleid);
         $positionsform->jobtitleid->addMultiOption($jobtitleidres[0]['id'], utf8_encode($jobtitleidres[0]['jobtitlename']));
         $positionsform->setDefault('jobtitleid', $jobtitleid);
         $this->view->notdisplayposition = $jobtitleid;
     }
     $positionsform->setAction(BASE_URL . 'positions/addpopup');
     if ($this->getRequest()->getPost()) {
         if ($positionsform->isValid($this->_request->getPost())) {
             $id = $this->_request->getParam('id');
             $positionname = $this->_request->getParam('positionname');
             $jobtitleidpop = $this->_request->getParam('jobtitleid');
             $description = $this->_request->getParam('description');
             $displayposition = $this->_request->getParam('display');
             $date = new Zend_Date();
             $menumodel = new Default_Model_Menu();
             $actionflag = '';
             $tableid = '';
             $data = array('positionname' => trim($positionname), 'jobtitleid' => $jobtitleidpop, 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id != '') {
                 $where = array('id=?' => $id);
                 $actionflag = 2;
             } else {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
                 $where = '';
                 $actionflag = 1;
             }
             $Id = $positionsmodel->SaveorUpdatePositionData($data, $where);
             $tableid = $Id;
             $menuidArr = $menumodel->getMenuObjID('/positions');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
             $opt = '';
             if ($displayposition == '0') {
                 $this->view->positionlistArr = $opt;
             } else {
                 $positionlistArr = $positionsmodel->getPositionList($displayposition);
                 foreach ($positionlistArr as $record) {
                     $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['positionname']);
                 }
                 $this->view->positionlistArr = $opt;
             }
             $this->view->eventact = 'added';
             $close = 'close';
             $this->view->popup = $close;
         } else {
             $messages = $positionsform->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
             $this->view->msgarray = $msgarray;
         }
     }
     $this->view->controllername = $controllername;
     $this->view->form = $positionsform;
     $this->view->ermsg = '';
     $this->view->disableselect = $visible;
 }
Ejemplo n.º 4
0
 public function save($requisitionform, $data)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $requi_model = new Default_Model_Requisition();
     $user_model = new Default_Model_Usermanagement();
     $jobtitleModel = new Default_Model_Jobtitles();
     $appr_mail = '';
     $appr_per = '';
     if ($requisitionform->isValid($this->_request->getPost())) {
         $trDb = Zend_Db_Table::getDefaultAdapter();
         // starting transaction
         $trDb->beginTransaction();
         try {
             $id = (int) $this->_getParam('id', null);
             $requisition_code = $this->_getParam('requisition_code', null);
             $onboard_date = $this->_getParam('onboard_date', null);
             $business_unit = $this->_getParam('business_unit', null);
             $department = $this->_getParam('department', null);
             $jobtitle = $this->_getParam('jobtitle', null);
             $position_id = $this->_getParam('position_id', null);
             $reporting_id = $this->_getParam('reporting_id', null);
             $req_no_positions = $this->_getParam('req_no_positions', null);
             $jobdescription = $this->_getParam('jobdescription', null);
             $req_skills = $this->_getParam('req_skills', null);
             $req_qualification = $this->_getParam('req_qualification', null);
             $req_exp_years = $this->_getParam('req_exp_years', null);
             $emp_type = $this->_getParam('emp_type', null);
             $req_priority = $this->_getParam('req_priority', null);
             $additional_info = $this->_getParam('additional_info', null);
             $req_status = $this->_getParam('req_status', null);
             $approver1 = $this->_getParam('approver1', null);
             $approver2 = $this->_getParam('approver2', null);
             $approver3 = $this->_getParam('approver3', null);
             $aflag = $this->_getParam('aflag', null);
             $edit_flag = $this->_getParam('edit_flag', null);
             $edit_order = $this->_getParam('edit_order', null);
             $aorder = $this->_getParam('aorder', null);
             //1= approver1,2=approver2,3=approver3
             if ($aflag != '' && $aflag == 'approver') {
                 if ($req_status == 3) {
                     $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'appstatus' . $aorder => $req_status, 'req_status' => $req_status);
                 } else {
                     if ($aorder == 1) {
                         if ($approver2 != '') {
                             $data = array('appstatus1' => $req_status, 'appstatus2' => 'Initiated');
                             $appr_mail = $approver2;
                             $appr_per = $approver1;
                         } else {
                             $data = array('appstatus1' => $req_status, 'req_status' => $req_status);
                             $appr_mail = 'approved';
                         }
                     } else {
                         if ($aorder == 2) {
                             if ($approver3 != '') {
                                 $data = array('appstatus2' => $req_status, 'appstatus3' => 'Initiated');
                                 $appr_mail = $approver3;
                                 $appr_per = $approver2;
                             } else {
                                 $data = array('appstatus2' => $req_status, 'req_status' => $req_status);
                                 $appr_mail = 'approved';
                             }
                         } else {
                             if ($aorder == 3) {
                                 $data = array('appstatus3' => $req_status, 'req_status' => $req_status);
                                 $appr_mail = 'approved';
                             }
                         }
                     }
                     $data['modifiedby'] = trim($loginUserId);
                     $data['modifiedon'] = gmdate("Y-m-d H:i:s");
                 }
             } else {
                 $data = array('requisition_code' => trim($requisition_code), 'onboard_date' => sapp_Global::change_date(trim($onboard_date), 'database'), 'position_id' => trim($position_id), 'reporting_id' => trim($reporting_id), 'businessunit_id' => trim($business_unit), 'department_id' => trim($department), 'req_no_positions' => trim($req_no_positions), 'jobdescription' => trim($jobdescription), 'jobtitle' => trim($jobtitle), 'req_skills' => trim($req_skills), 'req_qualification' => trim($req_qualification), 'req_exp_years' => trim($req_exp_years), 'emp_type' => trim($emp_type), 'req_priority' => trim($req_priority), 'additional_info' => trim($additional_info), 'approver1' => $approver1, 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'req_status' => 'Initiated', 'appstatus1' => 'Initiated', 'appstatus2' => null, 'appstatus3' => null, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createdon' => gmdate("Y-m-d H:i:s"), 'modifiedon' => gmdate("Y-m-d H:i:s"));
                 if ($loginuserGroup == MANAGER_GROUP) {
                     $data['reporting_id'] = $loginUserId;
                 }
                 if ($edit_flag != '' && $edit_flag == 'yes') {
                     if ($edit_order == 1) {
                         $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus2' => 'Initiated');
                         if ($approver2 == '') {
                             $data['appstatus2'] = null;
                         } else {
                             $appr_per = $edit_order;
                             $appr_mail = $approver2;
                         }
                     }
                     if ($edit_order == 2) {
                         $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus3' => 'Initiated');
                         if ($approver3 == '') {
                             $data['appstatus3'] = null;
                         } else {
                             $appr_per = $edit_order;
                             $appr_mail = $approver3;
                         }
                     }
                 }
             }
             $where = "";
             $actionflag = 1;
             //for mailing
             if ($id == '') {
                 //for requisition code
                 $identity_code_model = new Default_Model_Identitycodes();
                 $identity_codes = $identity_code_model->getIdentitycodesRecord();
                 $irequistion_code = isset($identity_codes[0]) ? $identity_codes[0]['requisition_code'] : "";
                 if ($irequistion_code != '') {
                     $req_id = $requi_model->getMaxReqCode($irequistion_code . "/");
                 } else {
                     $req_id = '';
                 }
                 $data['requisition_code'] = $req_id;
                 //end of requisition code
                 $report_person_data = $user_model->getUserDataById($data['reporting_id']);
                 $approver1_person_data = $user_model->getUserDataById($approver1);
                 $Raisedby_person_data = $user_model->getUserDataById($data['createdby']);
                 $jobttlArr = $jobtitleModel->getsingleJobTitleData(trim($jobtitle));
                 if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                     $jobtitlename = ' - ' . $jobttlArr[0]['jobtitlename'];
                 } else {
                     $jobtitlename = '';
                 }
                 $mail_arr[0]['name'] = 'HR';
                 $mail_arr[0]['email'] = defined('REQ_HR_' . $business_unit) ? constant('REQ_HR_' . $business_unit) : "";
                 $mail_arr[0]['type'] = 'HR';
                 $mail_arr[1]['name'] = 'Management';
                 $mail_arr[1]['email'] = defined('REQ_MGMT_' . $business_unit) ? constant('REQ_MGMT_' . $business_unit) : "";
                 $mail_arr[1]['type'] = 'Management';
                 $mail_arr[2]['name'] = $Raisedby_person_data['userfullname'];
                 $mail_arr[2]['email'] = $Raisedby_person_data['emailaddress'];
                 $mail_arr[2]['type'] = 'Raise';
                 $mail_arr[3]['name'] = $approver1_person_data['userfullname'];
                 $mail_arr[3]['email'] = $approver1_person_data['emailaddress'];
                 $mail_arr[3]['type'] = 'Approver';
                 $appr_str = "";
                 $appr_str = $approver1_person_data['userfullname'];
                 if ($data['approver2'] != '') {
                     $approver2_person_data = $user_model->getUserDataById($data['approver2']);
                     $appr_str .= ", " . $approver2_person_data['userfullname'];
                     $mail_arr[4]['name'] = $approver2_person_data['userfullname'];
                     $mail_arr[4]['email'] = $approver2_person_data['emailaddress'];
                     $mail_arr[4]['type'] = 'Approver';
                 }
                 if ($data['approver3'] != '') {
                     $approver3_person_data = $user_model->getUserDataById($data['approver3']);
                     $appr_str .= " and " . $approver3_person_data['userfullname'];
                     $mail_arr[5]['name'] = $approver3_person_data['userfullname'];
                     $mail_arr[5]['email'] = $approver3_person_data['emailaddress'];
                     $mail_arr[5]['type'] = 'Approver';
                 }
                 for ($ii = 0; $ii < count($mail_arr); $ii++) {
                     $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                     $view = $this->getHelper('ViewRenderer')->view;
                     $this->view->emp_name = $mail_arr[$ii]['name'];
                     $this->view->base_url = $base_url;
                     $this->view->type = $mail_arr[$ii]['type'];
                     $this->view->jobtitle = $jobtitlename;
                     $this->view->requisition_code = $requisition_code;
                     $this->view->approver_str = $appr_str;
                     $this->view->raised_name = $Raisedby_person_data['userfullname'];
                     $text = $view->render('mailtemplates/requisition.phtml');
                     $options['subject'] = APPLICATION_NAME . ': Requisition for approval';
                     $options['header'] = 'Requisition Status';
                     $options['toEmail'] = $mail_arr[$ii]['email'];
                     $options['toName'] = $mail_arr[$ii]['name'];
                     $options['message'] = $text;
                     $options['cron'] = 'yes';
                     if ($options['toEmail'] != '') {
                         sapp_Global::_sendEmail($options);
                     }
                 }
             }
             if ($id != '') {
                 unset($data['createdby']);
                 unset($data['createdon']);
                 unset($data['isactive']);
                 $where = "id = " . $id;
                 $tableid = $id;
                 $actionflag = 2;
             }
             $result = $requi_model->SaveorUpdateRequisitionData($data, $where);
             if ($id == '') {
                 $tableid = $result;
             }
             if ($result != '') {
                 if ($actionflag == 2) {
                     //start of mailing
                     $requisition_data = $requi_model->getRequisitionDataById($id);
                     $report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']);
                     $st_arr = array('0' => 'Select status', '2' => 'Approved', '3' => 'Rejected');
                     if ($req_status == 3 || $appr_mail == 'approved') {
                         $approver1_person_data = $user_model->getUserDataById($requisition_data['approver1']);
                         $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']);
                         $jobttlArr = $jobtitleModel->getsingleJobTitleData(trim($requisition_data['jobtitle']));
                         if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                             $jobtitlename = ' - ' . $jobttlArr[0]['jobtitlename'];
                         } else {
                             $jobtitlename = '';
                         }
                         $mail_arr[0]['name'] = 'HR';
                         $mail_arr[0]['email'] = defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "";
                         $mail_arr[0]['type'] = 'HR';
                         $mail_arr[1]['name'] = 'Management';
                         $mail_arr[1]['email'] = defined('REQ_MGMT_' . $requisition_data['businessunit_id']) ? constant('REQ_MGMT_' . $requisition_data['businessunit_id']) : "";
                         $mail_arr[1]['type'] = 'Management';
                         $mail_arr[2]['name'] = $Raisedby_person_data['userfullname'];
                         $mail_arr[2]['email'] = $Raisedby_person_data['emailaddress'];
                         $mail_arr[2]['type'] = 'Raise';
                         $mail_arr[3]['name'] = $approver1_person_data['userfullname'];
                         $mail_arr[3]['email'] = $approver1_person_data['emailaddress'];
                         $mail_arr[3]['type'] = 'Approver';
                         // Check if the reporting person and raised person are same - Requisition raised by Manager case
                         if ($requisition_data['reporting_id'] != $requisition_data['createdby']) {
                             $mail_arr[4]['name'] = $report_person_data['userfullname'];
                             $mail_arr[4]['email'] = $report_person_data['emailaddress'];
                             $mail_arr[4]['type'] = 'Report';
                         }
                         $appr_str = "";
                         $appr_str = $approver1_person_data['userfullname'];
                         if ($requisition_data['approver2'] != '') {
                             $approver2_person_data = $user_model->getUserDataById($requisition_data['approver2']);
                             $appr_str .= ", " . $approver2_person_data['userfullname'];
                             $mail_arr[5]['name'] = $approver2_person_data['userfullname'];
                             $mail_arr[5]['email'] = $approver2_person_data['emailaddress'];
                             $mail_arr[5]['type'] = 'Approver';
                         }
                         if ($requisition_data['approver3'] != '') {
                             $approver3_person_data = $user_model->getUserDataById($requisition_data['approver3']);
                             $appr_str .= " and " . $approver3_person_data['userfullname'];
                             $mail_arr[6]['name'] = $approver3_person_data['userfullname'];
                             $mail_arr[6]['email'] = $approver3_person_data['emailaddress'];
                             $mail_arr[6]['type'] = 'Approver';
                         }
                         $mail = array();
                         for ($ii = 0; $ii < count($mail_arr); $ii++) {
                             $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                             $view = $this->getHelper('ViewRenderer')->view;
                             $this->view->emp_name = !empty($mail_arr[$ii]['name']) ? $mail_arr[$ii]['name'] : '';
                             $this->view->base_url = $base_url;
                             $this->view->type = !empty($mail_arr[$ii]['type']) ? $mail_arr[$ii]['type'] : '';
                             $this->view->jobtitle = $jobtitlename;
                             $this->view->requisition_code = $requisition_data['requisition_code'];
                             $this->view->approver_str = $appr_str;
                             $this->view->raised_name = $Raisedby_person_data['userfullname'];
                             $this->view->req_status = $st_arr[$req_status];
                             $this->view->reporting_manager = $report_person_data['userfullname'];
                             $text = $view->render('mailtemplates/changedrequisition.phtml');
                             $options['subject'] = $st_arr[$req_status] == 'approved' ? APPLICATION_NAME . ': Requisition is approved' : APPLICATION_NAME . ': Requisition is rejected';
                             $options['header'] = 'Requisition Status';
                             $options['toEmail'] = !empty($mail_arr[$ii]['email']) ? $mail_arr[$ii]['email'] : '';
                             $options['toName'] = !empty($mail_arr[$ii]['name']) ? $mail_arr[$ii]['name'] : '';
                             $options['message'] = $text;
                             $mail[$ii] = $options;
                             $options['cron'] = 'yes';
                             if ($options['toEmail'] != '') {
                                 sapp_Global::_sendEmail($options);
                             }
                         }
                     } else {
                         if ($req_status == 2) {
                             $approver_person_data = $user_model->getUserDataById($appr_mail);
                             $mail_arr[0]['name'] = $approver_person_data['userfullname'];
                             $mail_arr[0]['email'] = $approver_person_data['emailaddress'];
                             $mail_arr[0]['type'] = 'Approver';
                             if ($edit_flag == 'yes') {
                                 $approved_by_data = $user_model->getUserDataById($requisition_data['approver' . $appr_per]);
                                 $req_status = 2;
                             } else {
                                 $approved_by_data = $user_model->getUserDataById($appr_per);
                             }
                             $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']);
                             $appr_str = $approved_by_data['userfullname'];
                             for ($ii = 0; $ii < count($mail_arr); $ii++) {
                                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                                 $view = $this->getHelper('ViewRenderer')->view;
                                 $this->view->emp_name = $mail_arr[$ii]['name'];
                                 $this->view->base_url = $base_url;
                                 $this->view->type = $mail_arr[$ii]['type'];
                                 $this->view->requisition_code = $requisition_data['requisition_code'];
                                 $this->view->req_status = $st_arr[$req_status];
                                 $this->view->raised_name = $Raisedby_person_data['userfullname'];
                                 $this->view->approver_str = $appr_str;
                                 $text = $view->render('mailtemplates/changedrequisition.phtml');
                                 $options['subject'] = $st_arr[$req_status] == 'approved' ? APPLICATION_NAME . ': Requisition is approved' : APPLICATION_NAME . ': Requisition is rejected';
                                 $options['header'] = 'Requisition Status';
                                 $options['toEmail'] = $mail_arr[$ii]['email'];
                                 $options['toName'] = $mail_arr[$ii]['name'];
                                 $options['message'] = $text;
                                 $options['cron'] = 'yes';
                                 if ($options['toEmail'] != '') {
                                     sapp_Global::_sendEmail($options);
                                 }
                             }
                         }
                     }
                     //end of mailing
                 }
                 $menumodel = new Default_Model_Menu();
                 $objidArr = $menumodel->getMenuObjID('/requisition');
                 $objID = $objidArr[0]['id'];
                 $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
                 if ($id != '') {
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Resource requisition updated successfully."));
                 } else {
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Resource requisition added successfully."));
                 }
                 $trDb->commit();
                 $this->_redirect('/requisition');
             }
         } catch (Exception $e) {
             $trDb->rollBack();
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later."));
             $this->_redirect('/requisition');
         }
     } else {
         $messages = $requisitionform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
Ejemplo n.º 5
0
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $messages['flagtype'] = '';
     $actionflag = 3;
     if ($id) {
         $jobtitlesmodel = new Default_Model_Jobtitles();
         $positionsModel = new Default_Model_Positions();
         $menumodel = new Default_Model_Menu();
         $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $where = array('id=?' => $id);
         $job_data = $jobtitlesmodel->getsingleJobTitleData($id);
         $Id = $jobtitlesmodel->SaveorUpdateJobTitleData($data, $where);
         if ($Id == 'update') {
             $positionData = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $positionsWhere = array('jobtitleid=?' => $id);
             $positionsModel->SaveorUpdatePositionData($positionData, $positionsWhere);
             sapp_Global::send_configuration_mail("Job Titles", $job_data[0]['jobtitlename']);
             $menuidArr = $menumodel->getMenuObjID('/jobtitles');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
             $messages['message'] = 'Job title deleted successfully.';
             $messages['msgtype'] = 'success';
         } else {
             $messages['message'] = 'Job title cannot be deleted.';
             $messages['msgtype'] = 'error';
         }
     } else {
         $messages['message'] = 'Job title cannot be deleted.';
         $messages['msgtype'] = 'error';
     }
     $this->_helper->json($messages);
 }
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id');
     $data = array();
     $jobtitle = '';
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $form = new Default_Form_Requisition();
     $requi_model = new Default_Model_Requisition();
     $user_model = new Default_Model_Usermanagement();
     $jobtitleModel = new Default_Model_Jobtitles();
     $form->setAttrib('action', BASE_URL . 'approvedrequisitions/edit/id/' . $id);
     $form->submit->setLabel('Update');
     $elements = $form->getElements();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments" && $key != "submit" && $key != 'req_status' && $key != 'onboard_date') {
                 $form->removeElement($key);
             }
         }
     }
     try {
         if ($id > 0 && is_numeric($id)) {
             $data = $requi_model->getRequisitionDataById($id);
             if (count($data) > 0 && $data['req_status'] != 'Initiated' && $data['req_status'] != 'Rejected') {
                 $data['jobtitlename'] = '';
                 $business_units_list = $requi_model->getBusinessUnitsList($data['businessunit_id']);
                 $data['businessunit_name'] = $business_units_list['unitname'];
                 $departments_list = $requi_model->getDepartmentList($data['businessunit_id'], $data['department_id']);
                 $data['dept_name'] = $departments_list['deptname'];
                 $job_data = $requi_model->getJobTitleList($data['jobtitle']);
                 $data['titlename'] = $job_data['jobtitlename'];
                 $pos_data = $requi_model->getPositionOptions($data['jobtitle'], $data['position_id']);
                 $data['posname'] = $pos_data['positionname'];
                 $emptype_options = $requi_model->getEmpStatusOptions($data['emp_type']);
                 $data['empttype'] = $emptype_options['employemnt_status'];
                 $report_manager_options = $user_model->getUserDataById($data['reporting_id']);
                 $data['mngrname'] = $report_manager_options['userfullname'];
                 $raisedby = $requi_model->getrequisitioncreatername($data['createdby']);
                 $data['raisedby'] = $raisedby['userfullname'];
                 $app1_data = $user_model->getUserDataById($data['approver1']);
                 $data['app1_name'] = $app1_data['userfullname'];
                 if ($data['approver2'] != '') {
                     $app2_data = $user_model->getUserDataById($data['approver2']);
                     $data['app2_name'] = $app2_data['userfullname'];
                 } else {
                     $data['app2_name'] = 'No Approver';
                 }
                 if ($data['approver3'] != '') {
                     $app3_data = $user_model->getUserDataById($data['approver3']);
                     $data['app3_name'] = $app3_data['userfullname'];
                 } else {
                     $data['app3_name'] = 'No Approver';
                 }
                 $jobttlArr = $jobtitleModel->getsingleJobTitleData($data['jobtitle']);
                 if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                     $jobtitle = $jobttlArr[0]['jobtitlename'];
                     $data['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
                 }
                 foreach ($data as $key => $val) {
                     $data[$key] = htmlentities($val, ENT_QUOTES, "UTF-8");
                 }
                 $onboard_date_org = $data['onboard_date'];
                 $data['onboard_date'] = sapp_Global::change_date($data['onboard_date'], 'view');
                 if ($data['req_status'] == 'Approved') {
                     $form->req_status->addMultiOptions(array('Approved' => 'Approved', 'Closed' => 'Closed', 'On hold' => 'On hold', 'Complete' => 'Complete'));
                 } else {
                     if ($data['req_status'] == 'Complete') {
                         $form->req_status->addMultiOptions(array('Complete' => 'Complete'));
                         $form->req_status->setAttrib('disabled', 'disabled');
                         $form->removeElement('submit');
                     } else {
                         $form->req_status->addMultiOptions(array('' => 'Select status', 'Closed' => 'Closed', 'On hold' => 'On hold', 'Complete' => 'Complete', 'In process' => 'In process'));
                     }
                 }
                 $form->req_status->setRequired(true);
                 $form->req_status->addValidator('NotEmpty', false, array('messages' => 'Please select option.'));
                 $form->populate($data);
                 $form->setDefault('req_status', $data['req_status']);
                 $this->view->data = $data;
                 $this->view->loginuserGroup = $loginuserGroup;
                 $this->view->form = $form;
                 $this->view->id = $id;
                 $this->view->edit_duedate = 'no';
                 if ($onboard_date_org < date('Y-m-d') && ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '')) {
                     $this->view->edit_duedate = 'yes';
                 } else {
                     $form->removeElement('onboard_date');
                 }
                 $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                 $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'c.createddate';
                 $perPage = $this->_getParam('per_page', 10);
                 $pageNo = $this->_getParam('page', 1);
                 $searchQuery = '';
                 $searchArray = array();
                 $tablecontent = '';
                 /** search from grid - START **/
                 $searchData = $this->_getParam('searchData');
                 if ($searchData != '' && $searchData != 'undefined') {
                     $searchValues = json_decode($searchData);
                     if (count($searchValues) > 0) {
                         foreach ($searchValues as $key => $val) {
                             $searchQuery .= " " . $key . " like '%" . $val . "%' AND ";
                             $searchArray[$key] = $val;
                         }
                         $searchQuery = rtrim($searchQuery, " AND");
                     }
                 }
                 /** search from grid - END **/
                 $objName = 'apprreqcandidates';
                 $tableFields = array('action' => 'Action', 'candidate_name' => 'Candidate Name', 'cand_status' => 'Candidate Status');
                 $candidate_model = new Default_Model_Candidatedetails();
                 $tablecontent = $candidate_model->getCandidatesData_requisition($sort, $by, $pageNo, $perPage, $searchQuery, $id);
                 $cand_status_opt = array('' => 'All', 'Shortlisted' => 'Shortlisted', 'Selected' => 'Selected', 'Rejected' => 'Rejected', 'On hold' => 'On hold', 'Disqualified' => 'Disqualified', 'Scheduled' => 'Scheduled', 'Not Scheduled' => 'Not Scheduled', 'Recruited' => 'Recruited', 'Requisition Closed/Completed' => 'Requisition Closed/Completed');
                 $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'formgrid' => 'true', 'searchArray' => $searchArray, 'menuName' => 'Candidate details', 'call' => '', 'search_filters' => array('cand_status' => array('type' => 'select', 'filter_data' => $cand_status_opt)));
                 array_push($data, $dataTmp);
                 $this->view->dataArray = $dataTmp;
                 if ($this->getRequest()->getPost()) {
                     $result = $this->save($form, $data);
                     $this->view->msgarray = $result;
                     $this->view->messages = $result;
                 }
                 $this->view->nodata = '';
             } else {
                 $this->view->nodata = 'nodata';
             }
         } else {
             $this->view->nodata = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->nodata = 'nodata';
     }
 }
 /**
  * This action is used for adding/updating data.
  * @parameters
  * @param $id  =  id of candidate (optional)
  * 
  * @return Zend_Form.
  */
 public function editAction()
 {
     $cand_model = new Default_Model_Candidatedetails();
     $requi_model = new Default_Model_Requisition();
     $interview_model = new Default_Model_Interviewdetails();
     $interview_round_model = new Default_Model_Interviewrounddetails();
     $jobtitleModel = new Default_Model_Jobtitles();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $id = $this->getRequest()->getParam('id');
     $intId = $id;
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $previousroundstatus = '';
     $cancel_name = "Cancel";
     $form = new Default_Form_Interviewrounds();
     $form->setAction(DOMAIN . 'scheduleinterviews/edit/id/' . $id);
     $form->id->setValue($id);
     $submitButon = $form->getElement("submit");
     $submitButon->setAttrib('style', 'display:none;');
     $form->removeElement('req_id');
     $form->removeElement('candidate_name');
     $form->removeElement('interviewer_id');
     $form->removeElement('interview_mode');
     $form->removeElement('int_location');
     $form->removeElement('country');
     $form->removeElement('state');
     $form->removeElement('city');
     $form->removeElement('interview_time');
     $form->removeElement('interview_date');
     $form->removeElement('interview_round');
     $data = array();
     $jobtitle = '';
     $interviewData = array();
     try {
         if ($id > 0 && is_numeric($id)) {
             $interviewData = $interview_model->getSingleInterviewData($intId);
             $reqstatusArray = array('On hold', 'Closed', 'Complete');
             $previousroundstatus = $interview_model->getinterviewroundnumber($intId);
             $previousroundstatus = $previousroundstatus['round_status'];
             $data = $interview_model->getCandidateDetailsById($intId);
             if (!empty($data) && $data['interview_status'] != 'Requisition Closed/Completed' && $data['interview_status'] != 'Completed' && !in_array($data['req_status'], $reqstatusArray)) {
                 if ($data['interview_status'] == 'On hold' && ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP)) {
                     $this->view->ermsg = 'nodata';
                 } else {
                     $data['jobtitlename'] = '';
                     $round_count = $interview_round_model->getRoundCnt($data['id'], $id);
                     $jobttlArr = $jobtitleModel->getsingleJobTitleData($data['jobtitle']);
                     if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                         $jobtitle = $jobttlArr[0]['jobtitlename'];
                         $data['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
                     }
                     $irData = $this->interviewRoundsGrid($id, $interviewData['interview_status']);
                     $this->view->dataArray = $irData[0];
                     $form->setDefault('interview_status', $interviewData['interview_status']);
                     $cand_arr = array();
                     if ($interviewData['interview_status'] == 'In process') {
                         $cand_arr['Scheduled'] = 'Scheduled';
                     } elseif ($interviewData['interview_status'] == 'Completed') {
                         $cand_arr['Disqualified'] = 'Disqualified';
                         $cand_arr['Shortlisted'] = 'Shortlisted';
                     } elseif ($interviewData['interview_status'] == 'On hold') {
                         $cand_arr['On hold'] = 'On hold';
                     }
                     $form->cand_status->clearMultiOptions();
                     $form->cand_status->addMultiOptions(array('' => 'Select status') + $cand_arr);
                     $form->setDefault('cand_status', $data['cand_status']);
                     $this->view->form = $form;
                     $this->view->data = $data;
                     $this->view->id = $id;
                     $this->view->round_count = $round_count;
                     if ($this->getRequest()->getPost()) {
                         $result = $this->save($form, $data);
                         $this->view->msgarray = $result;
                         $this->view->messages = $result;
                     }
                     $this->view->ermsg = '';
                     if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $interviewData['interview_status'] == 'Completed') {
                         $form->removeElement('submit');
                         $cancel_name = "Back";
                         $elements = $form->getElements();
                         if (count($elements) > 0) {
                             foreach ($elements as $key => $element) {
                                 if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                                     $element->setAttrib("disabled", "disabled");
                                 }
                             }
                         }
                         if ($interviewData['interview_status'] == 'Completed') {
                             $this->view->ermsg = 'interviewcompleted';
                         }
                     }
                 }
             } else {
                 $this->view->ermsg = 'nodata';
             }
         } else {
             $this->view->ermsg = 'nodata';
         }
         $this->view->interview_status = $interviewData['interview_status'];
         $this->view->previousroundstatus = $previousroundstatus;
         $this->view->loginuserGroup = $loginuserGroup;
         $this->view->cancel_name = $cancel_name;
     } catch (EXception $e) {
         $this->view->ermsg = 'nodata';
     }
 }
Ejemplo n.º 8
0
 /**
  * 
  * @param type $requisitionform
  * @param type $data
  * @return type
  */
 public function save($requisitionform, $data)
 {
     $ipreporting_id = "";
     $technicalskill_id = "";
     $nontechnicalskill_id = "";
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $requi_model = new Default_Model_Requisition();
     $user_model = new Default_Model_Usermanagement();
     $jobtitleModel = new Default_Model_Jobtitles();
     $appr_mail = '';
     $appr_per = '';
     if ($requisitionform->isValid($this->_request->getPost())) {
         $trDb = Zend_Db_Table::getDefaultAdapter();
         // starting transaction
         $trDb->beginTransaction();
         try {
             $id = (int) $this->_getParam('id', null);
             $requisition_code = $this->_getParam('requisition_code', null);
             $onboard_date = $this->_getParam('onboard_date', null);
             $business_unit = $this->_getParam('business_unit', null);
             $department = $this->_getParam('department', null);
             $jobtitle = $this->_getParam('jobtitle', null);
             $position_id = $this->_getParam('position_id', null);
             $reporting_id = $this->_getParam('reporting_id', null);
             $req_no_positions = $this->_getParam('req_no_positions', null);
             $jobdescription = $this->_getParam('jobdescription', null);
             $req_skills = $this->_getParam('req_skills', null);
             $req_qualification = $this->_getParam('req_qualification', null);
             $req_exp_years = $this->_getParam('req_exp_years', null);
             $emp_type = $this->_getParam('emp_type', null);
             $req_priority = $this->_getParam('req_priority', null);
             $additional_info = $this->_getParam('additional_info', null);
             $req_status = $this->_getParam('req_status', null);
             $approver1 = $this->_getParam('approver1', null);
             $approver2 = $this->_getParam('approver2', null);
             $approver3 = $this->_getParam('approver3', null);
             $aflag = $this->_getParam('aflag', null);
             $edit_flag = $this->_getParam('edit_flag', null);
             $edit_order = $this->_getParam('edit_order', null);
             $requ_jd = $this->_getParam('requ_jd', null);
             $billable = $this->_getParam('billable', null);
             $billablefor = $this->_getParam('billablefor', null);
             $billable_empname = $this->_getParam('billable_empname', null);
             $interviewroundscount = $this->_getParam('interviewroundscount', null);
             $technology = $this->_getParam('technology', null);
             try {
                 $ipbusiness_unit = 1;
                 $ipdepartment = 1;
                 $ipreporting_id = $this->_getParam('ipreporting_id', null);
                 $technicalskill_id = $this->_getParam('technicalskill_id', null);
                 $nontechnicalskill_id = $this->_getParam('nontechnicalskill_id', null);
             } catch (Exception $abc) {
             }
             $aorder = $this->_getParam('aorder', null);
             //1= approver1,2=approver2,3=approver3
             if ($aflag != '' && $aflag == 'approver') {
                 if ($req_status == 3) {
                     //for rejected
                     $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'appstatus' . $aorder => $req_status, 'req_status' => $req_status);
                 } else {
                     //for approved
                     if ($aorder == 1) {
                         if ($approver2 != '') {
                             $data = array('appstatus1' => $req_status, 'req_status' => $req_status);
                             $appr_mail = $approver1;
                             $appr_per = $approver1;
                         } else {
                             $data = array('appstatus1' => $req_status, 'req_status' => $req_status);
                             $appr_mail = 'approved';
                         }
                     } else {
                         if ($aorder == 2) {
                             if ($approver3 != '') {
                                 $data = array('appstatus2' => $req_status, 'req_status' => $req_status);
                                 $appr_mail = $approver2;
                                 $appr_per = $approver2;
                             } else {
                                 $data = array('appstatus2' => $req_status, 'req_status' => $req_status);
                                 $appr_mail = 'approved';
                             }
                         }
                     }
                     $data['modifiedby'] = trim($loginUserId);
                     $data['modifiedon'] = gmdate("Y-m-d H:i:s");
                 }
             } else {
                 $data = array('requisition_code' => trim($requisition_code), 'onboard_date' => sapp_Global::change_date(trim($onboard_date), 'database'), 'position_id' => trim($position_id), 'reporting_id' => trim($reporting_id), 'businessunit_id' => trim($business_unit), 'department_id' => trim($department), 'req_no_positions' => trim($req_no_positions), 'jobdescription' => trim($jobdescription), 'jobtitle' => trim($jobtitle), 'req_skills' => trim($req_skills), 'req_qualification' => trim($req_qualification), 'req_exp_years' => trim($req_exp_years), 'emp_type' => trim($emp_type), 'req_priority' => trim($req_priority), 'additional_info' => trim($additional_info), 'billable' => trim($billable), 'interviewroundscount' => trim($interviewroundscount), 'technology' => trim($technology), 'approver1' => $approver1, 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'req_status' => 'Initiated', 'appstatus1' => 'Initiated', 'appstatus2' => null, 'appstatus3' => null, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createdon' => gmdate("Y-m-d H:i:s"), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'upload_jd' => trim($requ_jd), 'billable_for' => trim($billablefor), 'billable_empname' => trim($billable_empname));
                 if ($loginuserGroup == MANAGER_GROUP) {
                     $data['reporting_id'] = $loginUserId;
                 }
                 if ($edit_flag != '' && $edit_flag == 'yes') {
                     if ($edit_order == 1) {
                         $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus2' => 'Initiated');
                         if ($approver2 == '') {
                             $data['appstatus2'] = null;
                         } else {
                             $appr_per = $edit_order;
                             $appr_mail = $approver2;
                         }
                     }
                     if ($edit_order == 2) {
                         $data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus3' => 'Initiated');
                         if ($approver3 == '') {
                             $data['appstatus3'] = null;
                         } else {
                             $appr_per = $edit_order;
                             $appr_mail = $approver3;
                         }
                     }
                 }
             }
             $where = "";
             $actionflag = 1;
             //for mailing
             if ($id == '') {
                 //for requisition code
                 $identity_code_model = new Default_Model_Identitycodes();
                 $identity_codes = $identity_code_model->getIdentitycodesRecord();
                 $irequistion_code = isset($identity_codes[0]) ? $identity_codes[0]['requisition_code'] : "";
                 if ($irequistion_code != '') {
                     $req_id = $requi_model->getMaxReqCode($irequistion_code . "/");
                 } else {
                     $req_id = '';
                 }
                 $data['requisition_code'] = $req_id;
                 //end of requisition code
                 $report_person_data = $user_model->getUserDataById($data['reporting_id']);
                 $approver1_person_data = $user_model->getUserDataById($approver1);
                 $Raisedby_person_data = $user_model->getUserDataById($data['createdby']);
                 $jobttlArr = $jobtitleModel->getsingleJobTitleData(trim($jobtitle));
                 if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                     $jobtitlename = ' - ' . $jobttlArr[0]['jobtitlename'];
                 } else {
                     $jobtitlename = '';
                 }
                 //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $business_unit);
                 //if (isset($hrgroupemail)) {
                 //HR Group
                 $mail_arr[0]['name'] = 'HR';
                 $mail_arr[0]['email'] = constant('REQ_HR_0');
                 $mail_arr[0]['type'] = 'HR';
                 //}
                 //$mgmtgroupemail = $requi_model->getgroupemailid("REQ_MGMT", $business_unit);
                 //if (isset($mgmtgroupemail)) {
                 //HR Group
                 $mail_arr[1]['name'] = 'Management';
                 $mail_arr[1]['email'] = constant('REQ_MGMT_0');
                 $mail_arr[1]['type'] = 'Management';
                 //}
                 $mail_arr[2]['name'] = $Raisedby_person_data['userfullname'];
                 $mail_arr[2]['email'] = $Raisedby_person_data['emailaddress'];
                 $mail_arr[2]['type'] = 'RaiseNew';
                 $mail_arr[3]['name'] = $approver1_person_data['userfullname'];
                 $mail_arr[3]['email'] = $approver1_person_data['emailaddress'];
                 $mail_arr[3]['type'] = 'Approver';
                 $appr_str = "";
                 $appr_str = $approver1_person_data['userfullname'];
                 $req_selected_skills = sprintf("Technical Skills (%s), Non-Technical Skills (%s).", $requi_model->getSkillNamesByIds(implode(",", $technicalskill_id), "Technical"), $requi_model->getSkillNamesByIds(implode(",", $nontechnicalskill_id), "Non-Technical"));
                 for ($ii = 0; $ii < count($mail_arr); $ii++) {
                     $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                     $view = $this->getHelper('ViewRenderer')->view;
                     $this->view->emp_name = $mail_arr[$ii]['name'];
                     $this->view->base_url = $base_url;
                     $this->view->type = $mail_arr[$ii]['type'];
                     $this->view->jobtitle = $jobtitlename;
                     $this->view->requisition_code = $requisition_code;
                     $this->view->approver_str = $appr_str;
                     $this->view->raised_name = $Raisedby_person_data['userfullname'];
                     if ($mail_arr[$ii]['type'] == "RaiseNew" || $mail_arr[$ii]['type'] == 'Raise' || $mail_arr[$ii]['type'] == 'RaiseNew' || $mail_arr[$ii]['type'] == 'HR' || $mail_arr[$ii]['type'] == 'Management' || $mail_arr[$ii]['type'] == 'Approver' || $mail_arr[$ii]['type'] == 'ReportingManager') {
                         //values for new email template
                         $bu_dept = $requi_model->getBusinessUnitDepartmentName(trim($department));
                         $this->view->department_name = $bu_dept['DepartmentName'];
                         $this->view->businessunit_name = $bu_dept['BusinessUnitName'];
                         $this->view->noofopenings = trim($req_no_positions);
                         $this->view->position_name = trim($jobtitlename);
                         $this->view->skills = trim($req_selected_skills);
                         $this->view->application_name = APPLICATION_NAME;
                     }
                     $text = $view->render('mailtemplates/requisition.phtml');
                     $options['subject'] = APPLICATION_NAME . ': ' . $requisition_code . '-Requisition for approval';
                     $options['header'] = 'Requisition Status';
                     $options['toEmail'] = $mail_arr[$ii]['email'];
                     $options['toName'] = $mail_arr[$ii]['name'];
                     $options['message'] = $text;
                     //var_dump($text);
                     //$options['cron'] = 'yes';
                     if ($options['toEmail'] != '') {
                         if ($mail_arr[$ii]['type'] == "RaiseNew" || $mail_arr[$ii]['type'] == 'Raise' || $mail_arr[$ii]['type'] == 'RaiseNew' || $mail_arr[$ii]['type'] == 'HR' || $mail_arr[$ii]['type'] == 'Management' || $mail_arr[$ii]['type'] == 'Approver' || $mail_arr[$ii]['type'] == 'ReportingManager') {
                             sapp_Global::_sendEmail($options, "New", REQUISITIONMODULESENDEMAIL);
                         } else {
                             sapp_Global::_sendEmail($options, '', REQUISITIONMODULESENDEMAIL);
                         }
                     }
                 }
             }
             if ($id != '') {
                 unset($data['createdby']);
                 unset($data['createdon']);
                 unset($data['isactive']);
                 $where = "id = " . $id;
                 $tableid = $id;
                 $actionflag = 2;
             }
             $result = $requi_model->SaveorUpdateRequisitionData($data, $where);
             //log approvals by approver
             if ($loginUserId == $approver1) {
                 $requisition_data1 = $requi_model->getRequisitionDataById($id);
                 $result1 = $requi_model->insert_requisition_approvalLog($id, $requisition_data1['requisition_code'], $req_status, $loginUserId, gmdate("Y-m-d H:i:s"));
             }
             /*
              * To Insert Interview Panel & Skill details when a new Requisition created
              */
             $currReqIDinDB = $id;
             if ($currReqIDinDB <= 0) {
                 $currReqIDinDB = $result;
             }
             $requisition_data2 = $requi_model->getRequisitionDataById($currReqIDinDB);
             $result1 = $requi_model->insert_requisition_interview_panel($requisition_data2['requisition_code'], $ipbusiness_unit, $ipdepartment, $ipreporting_id, $requ_jd);
             $result2 = $requi_model->insert_requisition_skills($requisition_data2['requisition_code'], $technicalskill_id, "Technical");
             $result3 = $requi_model->insert_requisition_skills($requisition_data2['requisition_code'], $nontechnicalskill_id, "Non-Technical");
             if ($id == '') {
                 $tableid = $result;
             }
             if ($result != '') {
                 if ($actionflag == 2) {
                     //start of mailing
                     $requisition_data = $requi_model->getRequisitionDataById($id);
                     $report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']);
                     $st_arr = array('0' => 'Select status', '2' => 'Approved', '3' => 'Rejected');
                     if ($req_status == 3 || $appr_mail == 'approved') {
                         //for rejected
                         $approver1_person_data = $user_model->getUserDataById($requisition_data['approver1']);
                         $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']);
                         $jobttlArr = $jobtitleModel->getsingleJobTitleData(trim($requisition_data['jobtitle']));
                         if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                             $jobtitlename = ' - ' . $jobttlArr[0]['jobtitlename'];
                         } else {
                             $jobtitlename = '';
                         }
                         /* $mail_arr[0]['name'] = 'HR';
                            $mail_arr[0]['email'] = defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "";
                            $mail_arr[0]['type'] = 'HR';
                            $mail_arr[1]['name'] = 'Management';
                            $mail_arr[1]['email'] = defined('REQ_MGMT_' . $requisition_data['businessunit_id']) ? constant('REQ_MGMT_' . $requisition_data['businessunit_id']) : "";
                            $mail_arr[1]['type'] = 'Management'; */
                         //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data['businessunit_id']);
                         //if (isset($hrgroupemail)) {
                         //HR Group
                         $mail_arr[0]['name'] = 'HR';
                         $mail_arr[0]['email'] = constant('REQ_HR_0');
                         $mail_arr[0]['type'] = 'HR';
                         //}
                         //$mgmtgroupemail = $requi_model->getgroupemailid("REQ_MGMT", $requisition_data['businessunit_id']);
                         //if (isset($mgmtgroupemail)) {
                         //HR Group
                         $mail_arr[1]['name'] = 'Management';
                         $mail_arr[1]['email'] = constant('REQ_MGMT_0');
                         $mail_arr[1]['type'] = 'Management';
                         //}
                         $mail_arr[2]['name'] = $Raisedby_person_data['userfullname'];
                         $mail_arr[2]['email'] = $Raisedby_person_data['emailaddress'];
                         $mail_arr[2]['type'] = 'Raise';
                         $mail_arr[3]['name'] = $approver1_person_data['userfullname'];
                         $mail_arr[3]['email'] = $approver1_person_data['emailaddress'];
                         $mail_arr[3]['type'] = 'Approver';
                         // Check if the reporting person and raised person are same - Requisition raised by Manager case
                         if ($requisition_data['reporting_id'] != $requisition_data['createdby']) {
                             $mail_arr[4]['name'] = $report_person_data['userfullname'];
                             $mail_arr[4]['email'] = $report_person_data['emailaddress'];
                             $mail_arr[4]['type'] = 'ReportingManager';
                         }
                         $appr_str = "";
                         $appr_str = $approver1_person_data['userfullname'];
                         if ($requisition_data['approver2'] != '') {
                             $approver2_person_data = $user_model->getUserDataById($requisition_data['approver2']);
                             $appr_str .= ", " . $approver2_person_data['userfullname'];
                             $mail_arr[5]['name'] = $approver2_person_data['userfullname'];
                             $mail_arr[5]['email'] = $approver2_person_data['emailaddress'];
                             $mail_arr[5]['type'] = 'Approver';
                         }
                         if ($requisition_data['approver3'] != '') {
                             $approver3_person_data = $user_model->getUserDataById($requisition_data['approver3']);
                             $appr_str .= " and " . $approver3_person_data['userfullname'];
                             $mail_arr[6]['name'] = $approver3_person_data['userfullname'];
                             $mail_arr[6]['email'] = $approver3_person_data['emailaddress'];
                             $mail_arr[6]['type'] = 'Approver';
                         }
                         $mail = array();
                         for ($ii = 0; $ii < count($mail_arr); $ii++) {
                             $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                             $view = $this->getHelper('ViewRenderer')->view;
                             $this->view->emp_name = !empty($mail_arr[$ii]['name']) ? $mail_arr[$ii]['name'] : '';
                             $this->view->base_url = $base_url;
                             $this->view->type = !empty($mail_arr[$ii]['type']) ? $mail_arr[$ii]['type'] : '';
                             $this->view->jobtitle = $jobtitlename;
                             $this->view->requisition_code = $requisition_data['requisition_code'];
                             $this->view->approver_str = $appr_str;
                             $this->view->raised_name = $Raisedby_person_data['userfullname'];
                             $this->view->req_status = $st_arr[$req_status];
                             $this->view->reporting_manager = $report_person_data['userfullname'];
                             $text = $view->render('mailtemplates/changedrequisition.phtml');
                             $options['subject'] = strtolower($st_arr[$req_status]) == 'approved' ? APPLICATION_NAME . ': ' . $requisition_data['requisition_code'] . '-Requisition is approved' : APPLICATION_NAME . ': Requisition is rejected';
                             $options['header'] = 'Requisition Status';
                             $options['toEmail'] = !empty($mail_arr[$ii]['email']) ? $mail_arr[$ii]['email'] : '';
                             $options['toName'] = !empty($mail_arr[$ii]['name']) ? $mail_arr[$ii]['name'] : '';
                             $options['message'] = $text;
                             $mail[$ii] = $options;
                             //$options['cron'] = 'yes';
                             if ($options['toEmail'] != '') {
                                 sapp_Global::_sendEmail($options, "by_approver1", REQUISITIONMODULESENDEMAIL);
                             } else {
                                 sapp_Global::_sendEmail($options, '', REQUISITIONMODULESENDEMAIL);
                             }
                         }
                     } else {
                         if ($req_status == 2) {
                             //Approver
                             $approver_person_data = $user_model->getUserDataById($appr_mail);
                             $mail_arr[0]['name'] = $approver_person_data['userfullname'];
                             $mail_arr[0]['email'] = $approver_person_data['emailaddress'];
                             $mail_arr[0]['type'] = 'Approver';
                             //HR Group
                             $mail_arr[1]['name'] = 'HR';
                             $mail_arr[1]['email'] = constant('REQ_HR_0');
                             $mail_arr[1]['type'] = 'HR';
                             //Management Group
                             $mail_arr[2]['name'] = 'Management';
                             $mail_arr[2]['email'] = constant('REQ_MGMT_0');
                             $mail_arr[2]['type'] = 'Management';
                             //Requester
                             $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']);
                             $mail_arr[3]['name'] = $Raisedby_person_data['userfullname'];
                             $mail_arr[3]['email'] = $Raisedby_person_data['emailaddress'];
                             $mail_arr[3]['type'] = 'Raise';
                             if ($edit_flag == 'yes') {
                                 $approved_by_data = $user_model->getUserDataById($requisition_data['approver' . $appr_per]);
                                 $req_status = 2;
                             } else {
                                 $approved_by_data = $user_model->getUserDataById($appr_per);
                             }
                             $Raisedby_person_data = $user_model->getUserDataById($requisition_data['createdby']);
                             $appr_str = $approved_by_data['userfullname'];
                             for ($ii = 0; $ii < count($mail_arr); $ii++) {
                                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                                 $view = $this->getHelper('ViewRenderer')->view;
                                 $this->view->emp_name = $mail_arr[$ii]['name'];
                                 $this->view->base_url = $base_url;
                                 $this->view->type = $mail_arr[$ii]['type'];
                                 $this->view->requisition_code = $requisition_data['requisition_code'];
                                 $this->view->req_status = $st_arr[$req_status];
                                 $this->view->raised_name = $Raisedby_person_data['userfullname'];
                                 $this->view->approver_str = $appr_str;
                                 $text = $view->render('mailtemplates/changedrequisition.phtml');
                                 $options['subject'] = strtolower($st_arr[$req_status]) == 'approved' ? APPLICATION_NAME . ':' . $requisition_data['requisition_code'] . '-Requisition is approved' : APPLICATION_NAME . ': Requisition is rejected';
                                 $options['header'] = 'Requisition Status';
                                 $options['toEmail'] = $mail_arr[$ii]['email'];
                                 $options['toName'] = $mail_arr[$ii]['name'];
                                 $options['message'] = $text;
                                 //$options['cron'] = 'yes';
                                 if ($options['toEmail'] != '') {
                                     sapp_Global::_sendEmail($options, "by_approver2", REQUISITIONMODULESENDEMAIL);
                                 } else {
                                     sapp_Global::_sendEmail($options, '', REQUISITIONMODULESENDEMAIL);
                                 }
                             }
                         }
                     }
                     //end of mailing
                 }
                 $menumodel = new Default_Model_Menu();
                 $objidArr = $menumodel->getMenuObjID('/requisition');
                 $objID = $objidArr[0]['id'];
                 $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
                 if ($id != '') {
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Resource requisition updated successfully."));
                 } else {
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Resource requisition added successfully."));
                 }
                 $trDb->commit();
                 $this->_redirect('/requisition');
             }
         } catch (Exception $e) {
             $trDb->rollBack();
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later."));
             $this->_redirect('/requisition');
         }
     } else {
         $messages = $requisitionform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 public function viewpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     if ($id == '') {
         $id = $loginUserId;
     }
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'empjobhistory';
     $empjobhistoryform = new Default_Form_empjobhistory();
     $empjobhistoryModel = new Default_Model_Empjobhistory();
     $employeeModel = new Default_Model_Employee();
     $positionModel = new Default_Model_Positions();
     $departmentModel = new Default_Model_Departments();
     $jobtitleModel = new Default_Model_Jobtitles();
     $empjobhistoryform->removeElement("submit");
     $elements = $empjobhistoryform->getElements();
     $clientsModel = new Timemanagement_Model_Clients();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     if ($id) {
         $data = $empjobhistoryModel->getsingleEmpJobHistoryData($id);
         if (!empty($data)) {
             $positionheldArr = 'norows';
             if (is_numeric($data[0]['positionheld'])) {
                 $positionheldArr = $positionModel->getsinglePositionData($data[0]['positionheld']);
             }
             if ($positionheldArr != 'norows') {
                 $empjobhistoryform->positionheld->addMultiOption($positionheldArr[0]['id'], $positionheldArr[0]['positionname']);
             }
             $departmentArr = array();
             if (is_numeric($data[0]['department'])) {
                 $departmentArr = $departmentModel->getSingleDepartmentData($data[0]['department']);
             }
             if (!empty($departmentArr)) {
                 $empjobhistoryform->department->addMultiOption($departmentArr['id'], $departmentArr['deptname']);
             }
             $jobtitleArr = 'norows';
             if (is_numeric($data[0]['jobtitleid'])) {
                 $jobtitleArr = $jobtitleModel->getsingleJobTitleData($data[0]['jobtitleid']);
             }
             if ($jobtitleArr != 'norows') {
                 $empjobhistoryform->jobtitleid->addMultiOption($jobtitleArr[0]['id'], $jobtitleArr[0]['jobtitlename']);
             }
             $clientsArr = array();
             if (is_numeric($data[0]['client_id'])) {
                 $clientsArr = $clientsModel->getClientDetailsById($data[0]['client_id']);
             }
             if (!empty($clientsArr)) {
                 $empjobhistoryform->client->addMultiOption($clientsArr[0]['id'], $clientsArr[0]['client_name']);
             }
             $empjobhistoryform->populate($data[0]);
             if (isset($data[0]['start_date']) && $data[0]['start_date'] != '') {
                 $start_date = sapp_Global::change_date($data[0]['start_date'], 'view');
                 $empjobhistoryform->start_date->setValue($start_date);
             }
             if (isset($data[0]['end_date']) && $data[0]['end_date'] != '') {
                 $end_date = sapp_Global::change_date($data[0]['end_date'], 'view');
                 $empjobhistoryform->end_date->setValue($end_date);
             }
         }
         $this->view->controllername = $objName;
         $this->view->id = $id;
         $this->view->form = $empjobhistoryform;
     }
 }
Ejemplo n.º 10
0
 public function viewpopupAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $cand_model = new Default_Model_Candidatedetails();
     $requi_model = new Default_Model_Requisition();
     $jobtitleModel = new Default_Model_Jobtitles();
     $intrvwModel = new Default_Model_Interviewdetails();
     $interview_round_model = new Default_Model_Interviewrounddetails();
     $user_model = new Default_Model_Usermanagement();
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $jobtitle = '';
     $deptid = $this->getRequest()->getParam('deptid');
     if ($deptid == '') {
         $deptid = $this->getRequest()->getParam('deptidform');
     }
     $intId = $this->getRequest()->getParam('unitId');
     $roundId = $this->getRequest()->getParam('id');
     $ir_form = new Default_Form_Interviewrounds();
     $elements = $ir_form->getElements();
     //giving only for hr,management and super admin
     if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) {
         $ir_form->round_status->addMultiOptions(array('Decision pending' => 'Decision pending', 'On hold' => 'On hold'));
     }
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     $intData = $intrvwModel->getReqByintrvwID($intId);
     $roundData = $interview_round_model->getSingleRoundData($roundId);
     $this->view->ermsg = '';
     $edit_flag = 'no';
     if ($roundData['interviewer_id'] == $loginUserId) {
         $edit_flag = 'yes';
     }
     if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '' || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP) {
         $countryId = $roundData['int_country'];
         $stateId = $roundData['int_state'];
         $cityId = $roundData['int_city'];
         $country_name = '';
         $state_name = '';
         $city_name = '';
         if ($countryId && $stateId) {
             $statesmodel = new Default_Model_States();
             $citiesmodel = new Default_Model_Cities();
             $countryModal = new Default_Model_Countries();
             $countriesData = $countryModal->fetchAll('isactive=1', 'country');
             foreach ($countriesData as $cdata) {
                 if ($roundData['int_country'] == $cdata['country_id_org']) {
                     $country_name = $cdata['country'];
                     break;
                 }
             }
             $statesData = $statesmodel->getBasicStatesList($countryId);
             $citiesData = $citiesmodel->getBasicCitiesList($stateId);
             foreach ($statesData as $res) {
                 $ir_form->state->addMultiOption($res['state_id_org'], utf8_encode($res['state']));
                 if ($roundData['int_state'] == $res['state_id_org']) {
                     $state_name = $res['state'];
                 }
             }
             foreach ($citiesData as $res) {
                 $ir_form->city->addMultiOption($res['city_org_id'], utf8_encode($res['city']));
                 if ($roundData['int_city'] == $res['city_org_id']) {
                     $city_name = $res['city'];
                 }
             }
         }
         $interviewer_data = $user_model->getUserDataById($roundData['interviewer_id']);
         $jobttlArr = $jobtitleModel->getsingleJobTitleData($interviewer_data['jobtitle_id']);
         if (!empty($jobttlArr) && $jobttlArr != 'norows') {
             $jobtitle = ', ' . $jobttlArr[0]['jobtitlename'];
             $data['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
         }
         $ir_form->interviewer_id->addMultiOptions(array('' => $interviewer_data['userfullname'] . $jobtitle));
         $roundData['interview_date'] = sapp_Global::change_date($roundData['interview_date'], 'view');
         $roundData['interview_time'] = sapp_Global::change_time($roundData['interview_time'], 'view');
         $ir_form->populate($roundData);
         $this->view->form = $ir_form;
         $this->view->intId = $intId;
         $this->view->deptid = $deptid;
         $this->view->roundId = $roundId;
         $this->view->ermsg = '';
         $this->view->country_name = $country_name;
         $this->view->state_name = $state_name;
         $this->view->city_name = $city_name;
         $this->view->edit_flag = $edit_flag;
     } else {
         $this->view->ermsg = 'nodata';
     }
 }
 public function viewAction()
 {
     $id = $this->getRequest()->getParam('id');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $candidatesmodel = new Default_Model_Shortlistedcandidates();
     $requi_model = new Default_Model_Requisition();
     $jobtitleModel = new Default_Model_Jobtitles();
     $intrvwroundsData = array();
     $intrvwData = array();
     $jobtitle = '';
     try {
         $candidateData = $candidatesmodel->getcandidateData($id);
         $cand_status = $candidateData['cand_status'];
         $req_id = $candidateData['requisition_id'];
         try {
             $requisitionData = $requi_model->getRequisitionDataById($req_id);
             $requisitionData['jobtitlename'] = '';
             $jobttlArr = $jobtitleModel->getsingleJobTitleData($requisitionData['jobtitle']);
             if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                 $jobtitle = $jobttlArr[0]['jobtitlename'];
                 $requisitionData['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
             }
             $intrvwData = $candidatesmodel->getinterviewData($requisitionData['id'], $candidateData['id']);
             if (!empty($intrvwData)) {
                 $intrvwroundsData = $candidatesmodel->getinterviewrounds($intrvwData['id'], $requisitionData['id'], $candidateData['id']);
                 $intrvwroundsSkillSetData = $candidatesmodel->getinterviewroundskillsetsummary($intrvwroundsData[0]['interview_round_number'], $requisitionData['id'], $candidateData['id']);
                 $intrvwroundsSkillSetDataSummary = $tLeaveCardData01 = sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "", $intrvwroundsSkillSetData);
                 $this->view->intrvwroundsSkillSetDataSummary = $intrvwroundsSkillSetDataSummary;
                 $this->view->candidateData = $candidateData;
                 $this->view->requisitionData = $requisitionData;
                 $this->view->intrvwrounds = $intrvwroundsData;
                 $this->view->intrvwData = $intrvwData;
                 $this->view->ermsg = '';
             } else {
                 $this->view->ermsg = 'nodata';
             }
         } catch (Exception $e) {
             $this->view->ermsg = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->ermsg = 'nodata';
     }
     $this->view->loginuserGroup = $loginuserGroup;
 }
 public function viewAction()
 {
     $id = $this->getRequest()->getParam('id');
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $candidatesmodel = new Default_Model_Shortlistedcandidates();
     $requi_model = new Default_Model_Requisition();
     $jobtitleModel = new Default_Model_Jobtitles();
     $intrvwroundsData = array();
     $intrvwData = array();
     $jobtitle = '';
     try {
         $candidateData = $candidatesmodel->getcandidateData($id);
         $cand_status = $candidateData['cand_status'];
         $req_id = $candidateData['requisition_id'];
         try {
             $requisitionData = $requi_model->getRequisitionDataById($req_id);
             $requisitionData['jobtitlename'] = '';
             $jobttlArr = $jobtitleModel->getsingleJobTitleData($requisitionData['jobtitle']);
             if (!empty($jobttlArr) && $jobttlArr != 'norows') {
                 $jobtitle = $jobttlArr[0]['jobtitlename'];
                 $requisitionData['jobtitlename'] = $jobttlArr[0]['jobtitlename'];
             }
             $intrvwData = $candidatesmodel->getinterviewData($requisitionData['id'], $candidateData['id']);
             if (!empty($intrvwData) && ($cand_status == 'Shortlisted' || $cand_status == 'Selected' || $cand_status == 'Rejected')) {
                 $intrvwroundsData = $candidatesmodel->getinterviewrounds($intrvwData['id'], $requisitionData['id'], $candidateData['id']);
                 $this->view->candidateData = $candidateData;
                 $this->view->requisitionData = $requisitionData;
                 $this->view->intrvwrounds = $intrvwroundsData;
                 $this->view->intrvwData = $intrvwData;
                 $this->view->ermsg = '';
             } else {
                 $this->view->ermsg = 'nodata';
             }
         } catch (Exception $e) {
             $this->view->ermsg = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->ermsg = 'nodata';
     }
     $this->view->loginuserGroup = $loginuserGroup;
 }