public function viewAction()
 {
     $id = $this->getRequest()->getParam('id');
     $requi_model = new Default_Model_Requisition();
     $data = array();
     try {
         if ($id > 0 && is_numeric($id)) {
             $data = $requi_model->getReqDataForView($id);
             if (count($data) > 0 && $data[0]['req_status'] == 'Rejected') {
                 $data = $data[0];
                 $auth = Zend_Auth::getInstance();
                 if ($auth->hasIdentity()) {
                     $loginUserId = $auth->getStorage()->read()->id;
                     $loginuserRole = $auth->getStorage()->read()->emprole;
                     $loginuserGroup = $auth->getStorage()->read()->group_id;
                 }
                 $data['jobtitlename'] = '';
                 $data['businessunit_name'] = $data['businessunit_name'];
                 $data['dept_name'] = $data['department_name'];
                 $data['titlename'] = $data['jobtitle_name'];
                 $data['posname'] = $data['position_name'];
                 $data['empttype'] = $data['emp_type_name'];
                 $data['mngrname'] = $data['reporting_manager_name'];
                 $data['raisedby'] = $data['createdby_name'];
                 $data['app1_name'] = $data['approver1_name'];
                 if ($data['approver2'] != '') {
                     $data['app2_name'] = $data['approver2_name'];
                 } else {
                     $data['app2_name'] = 'No Approver';
                 }
                 if ($data['approver3'] != '') {
                     $data['app3_name'] = $data['approver3_name'];
                 } else {
                     $data['app3_name'] = 'No Approver';
                 }
                 foreach ($data as $key => $val) {
                     $data[$key] = htmlentities($val, ENT_QUOTES, "UTF-8");
                 }
                 $data['onboard_date'] = sapp_Global::change_date($data['onboard_date'], 'view');
                 //start of candidate details
                 $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;
                 //end of candidate details
                 $this->view->data = $data;
                 $this->view->loginuserGroup = $loginuserGroup;
             } else {
                 $this->view->nodata = 'nodata';
             }
         } else {
             $this->view->nodata = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->nodata = 'nodata';
     }
 }
Пример #2
0
 public function save($employeeform)
 {
     $emproleStr = '';
     $roleArr = array();
     $empgroupStr = '';
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $usersModel = new Default_Model_Usermanagement();
     $employeeModal = new Default_Model_Employee();
     $requimodel = new Default_Model_Requisition();
     $candidate_model = new Default_Model_Candidatedetails();
     $orgInfoModel = new Default_Model_Organisationinfo();
     $unitid = '';
     $deptid = '';
     $errorflag = 'true';
     $msgarray = array();
     $id = $this->_request->getParam('id');
     $businessunit_id = $this->_request->getParam('businessunit_id', null);
     $department_id = $this->_request->getParam('department_id', null);
     $reporting_manager = $this->_request->getParam('reporting_manager', null);
     $jobtitle_id = $this->_request->getParam('jobtitle_id', null);
     $position_id = $this->_request->getParam('position_id', null);
     $user_id = $this->_getParam('user_id', null);
     $prefix_id = $this->_getParam('prefix_id', null);
     $extension_number = $this->_getParam('extension_number', null);
     $office_number = $this->_request->getParam('office_number', null);
     $office_faxnumber = $this->_request->getParam('office_faxnumber', null);
     $date_of_joining = $this->_request->getParam('date_of_joining', null);
     $date_of_joining = sapp_Global::change_date($date_of_joining, 'database');
     $isvalidorgstartdate = $orgInfoModel->validateEmployeeJoiningDate($date_of_joining, $unitid, $deptid);
     if (!empty($isvalidorgstartdate)) {
         $msgarray['date_of_joining'] = 'Employee joining date should be greater than organization start date.';
         $errorflag = 'false';
     }
     if ($id) {
         $data = $employeeModal->getsingleEmployeeData($id);
         if (!empty($data) && $data[0]['is_orghead'] == 1) {
             $reporting_manager = $this->_request->getParam('reporting_manager', '0');
         }
     }
     if ($employeeform->isValid($this->_request->getPost()) && $errorflag == 'true') {
         $id = $this->_request->getParam('id');
         $emp_status_id = $this->_request->getParam('emp_status_id', null);
         $date_of_leaving = $this->_request->getParam('date_of_leaving', null);
         $date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database');
         $years_exp = $this->_request->getParam('years_exp');
         //FOR USER table
         $employeeId = $this->_getParam('employeeId', null);
         $modeofentry = $this->_getParam('modeofentry', null);
         $hid_modeofentry = $this->_getParam('hid_modeofentry', null);
         $other_modeofentry = $this->_getParam('other_modeofentry', null);
         $firstname = trim($this->_getParam('firstname', null));
         $lastname = trim($this->_getParam('lastname', null));
         $userfullname = $firstname . ' ' . $lastname;
         $candidatereferredby = $this->_getParam('candidatereferredby', null);
         $rccandidatename = $this->_getParam('rccandidatename', null);
         $emprole = $this->_getParam('emprole', null);
         //roleid_group_id
         if ($emprole != "") {
             $roleArr = explode('_', $emprole);
             if (!empty($roleArr)) {
                 $emproleStr = $roleArr[0];
                 $empgroupStr = $roleArr[0];
             }
         }
         $emailaddress = $this->_getParam('emailaddress', null);
         $tmp_name = $this->_request->getParam('tmp_emp_name', null);
         $act_inact = $this->_request->getParam("act_inact", null);
         //end of user table
         $date = new Zend_Date();
         $menumodel = new Default_Model_Menu();
         $empstatusarray = array(8, 9, 10);
         $actionflag = '';
         $tableid = '';
         if ($modeofentry == 'Direct' || $hid_modeofentry == 'Direct') {
             $candidate_key = 'userfullname';
             $candidate_value = $userfullname;
             $emp_name = $userfullname;
             $candidate_flag = 'no';
         } else {
             $candidate_key = 'rccandidatename';
             $candidate_value = $rccandidatename;
             $emp_name = $tmp_name;
             $candidate_flag = 'yes';
         }
         $trDb = Zend_Db_Table::getDefaultAdapter();
         // starting transaction
         $trDb->beginTransaction();
         try {
             $emppassword = sapp_Global::generatePassword();
             $user_data = array('emprole' => $emproleStr, 'firstname' => $firstname != '' ? $firstname : NULL, 'lastname' => $lastname != '' ? $lastname : NULL, $candidate_key => $candidate_value, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => $id == '' ? $modeofentry : "", 'selecteddate' => $date_of_joining, 'candidatereferredby' => $candidatereferredby, 'userstatus' => 'old', 'other_modeofentry' => $other_modeofentry);
             if ($id != '') {
                 $where = array('user_id=?' => $user_id);
                 $actionflag = 2;
                 $user_where = "id = " . $user_id;
                 unset($user_data['candidatereferredby']);
                 unset($user_data['userstatus']);
                 unset($user_data['emppassword']);
                 unset($user_data['employeeId']);
                 unset($user_data['modeofentry']);
                 unset($user_data['other_modeofentry']);
             } else {
                 $user_data['createdby'] = $loginUserId;
                 $user_data['createddate'] = gmdate("Y-m-d H:i:s");
                 $user_data['isactive'] = 1;
                 if ($modeofentry != 'Direct') {
                     $user_data['userfullname'] = $emp_name;
                 }
                 $where = '';
                 $actionflag = 1;
                 $user_where = '';
                 $identity_code_model = new Default_Model_Identitycodes();
                 $identity_codes = $identity_code_model->getIdentitycodesRecord();
                 $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : "";
                 if ($emp_identity_code != '') {
                     $emp_id = $emp_identity_code . str_pad($usersModel->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
                 } else {
                     $emp_id = '';
                 }
                 $user_data['employeeId'] = $emp_id;
             }
             $user_status = $usersModel->SaveorUpdateUserData($user_data, $user_where);
             if ($id == '') {
                 $user_id = $user_status;
             }
             $data = array('user_id' => $user_id, 'reporting_manager' => $reporting_manager, 'emp_status_id' => $emp_status_id, 'businessunit_id' => $businessunit_id, 'department_id' => $department_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'extension_number' => $extension_number != '' ? $extension_number : NULL, 'office_number' => $office_number != '' ? $office_number : NULL, 'office_faxnumber' => $office_faxnumber != '' ? $office_faxnumber : NULL, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $years_exp == '' ? null : $years_exp, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
             if ($id == '') {
                 $data['createdby'] = $loginUserId;
                 $data['createddate'] = gmdate("Y-m-d H:i:s");
                 $data['isactive'] = 1;
             }
             $Id = $employeeModal->SaveorUpdateEmployeeData($data, $where);
             $statuswhere = array('id=?' => $user_id);
             if ($id != '') {
                 if (in_array($emp_status_id, $empstatusarray)) {
                     $isactivestatus = '';
                     if ($emp_status_id == 8) {
                         $isactivestatus = 2;
                     } else {
                         if ($emp_status_id == 9) {
                             $isactivestatus = 3;
                         } else {
                             if ($emp_status_id == 10) {
                                 $isactivestatus = 4;
                             }
                         }
                     }
                     $statusdata = array('isactive' => $isactivestatus);
                     $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
                     $employeeModal->SaveorUpdateEmployeeData($statusdata, "user_id = " . $user_id);
                 } else {
                     $edata = $usersModel->getUserDataById($id);
                     $statusdata = array('isactive' => 1);
                     if ($edata['isactive'] != 0) {
                         if ($edata['emptemplock'] == 1) {
                             $statusdata = array('isactive' => 0);
                         }
                         $empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
                         $employeeModal->SaveorUpdateEmployeeData($statusdata, "user_id = " . $user_id);
                     }
                 }
             }
             if ($Id == 'update') {
                 $tableid = $id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details updated successfully."));
             } else {
                 //start of mailing
                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                 $view = $this->getHelper('ViewRenderer')->view;
                 $this->view->emp_name = $emp_name;
                 $this->view->password = $emppassword;
                 $this->view->emp_id = $employeeId;
                 $this->view->base_url = $base_url;
                 $text = $view->render('mailtemplates/newpassword.phtml');
                 $options['subject'] = APPLICATION_NAME . ': Login Credentials';
                 $options['header'] = 'Greetings from Sentrifugo';
                 $options['toEmail'] = $emailaddress;
                 $options['toName'] = $this->view->emp_name;
                 $options['message'] = $text;
                 $result = sapp_Global::_sendEmail($options);
                 //end of mailing
                 $tableid = $Id;
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Employee details added successfully."));
                 //incrementing requisition id
                 if ($candidate_flag == 'yes') {
                     $cand_data = $candidate_model->getCandidateById($rccandidatename);
                     $candidate_model->SaveorUpdateCandidateData(array('cand_status' => 'Recruited', 'modifieddate' => gmdate("Y-m-d H:i:s")), " id = " . $rccandidatename);
                     $reqData = $requimodel->incrementfilledpositions($cand_data['requisition_id']);
                     if ($reqData['req_no_positions'] == $reqData['filled_positions']) {
                         $req_status = '6';
                         $data = array('req_status' => $req_status, 'modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"));
                         $where = "id = " . $cand_data['requisition_id'];
                         $result = $requimodel->SaveorUpdateRequisitionData($data, $where);
                         $requimodel->change_to_requisition_closed($cand_data['requisition_id']);
                         $this->send_requi_mail($cand_data['requisition_id'], $requimodel, $usersModel, $loginUserId);
                     }
                 }
             }
             $menuidArr = $menumodel->getMenuObjID('/employee');
             $menuID = $menuidArr[0]['id'];
             $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $user_id);
             if ($act_inact == 1) {
                 if ($user_data['isactive'] == 1) {
                 } else {
                 }
             }
             $trDb->commit();
             // Send email to employee when his details are edited by other user.
             $options['subject'] = APPLICATION_NAME . ': Employee details updated';
             $options['header'] = 'Employee details updated';
             $options['toEmail'] = $emailaddress;
             $options['toName'] = $userfullname;
             $options['message'] = 'Dear ' . $userfullname . ', your employee details are updated.';
             $options['cron'] = 'yes';
             if (!empty($id)) {
                 sapp_Global::_sendEmail($options);
             }
             $this->_redirect('employee/edit/id/' . $user_id);
         } catch (Exception $e) {
             $trDb->rollBack();
             $msgarray['employeeId'] = "Something went wrong, please try again later.";
             return $msgarray;
         }
     } else {
         $messages = $employeeform->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         if (isset($businessunit_id) && $businessunit_id != '') {
             $departmentsmodel = new Default_Model_Departments();
             $departmentlistArr = $departmentsmodel->getDepartmentList($businessunit_id);
             $employeeform->department_id->clearMultiOptions();
             $employeeform->reporting_manager->clearMultiOptions();
             $employeeform->department_id->addMultiOption('', 'Select Department');
             foreach ($departmentlistArr as $departmentlistresult) {
                 $employeeform->department_id->addMultiOption($departmentlistresult['id'], utf8_encode($departmentlistresult['deptname']));
             }
             if (isset($department_id) && $department_id != 0 && $department_id != '') {
                 $employeeform->setDefault('department_id', $department_id);
             }
         }
         if (isset($jobtitle_id) && $jobtitle_id != 0 && $jobtitle_id != '') {
             $positionsmodel = new Default_Model_Positions();
             $positionlistArr = $positionsmodel->getPositionList($jobtitle_id);
             $employeeform->position_id->clearMultiOptions();
             $employeeform->position_id->addMultiOption('', 'Select Position');
             foreach ($positionlistArr as $positionlistRes) {
                 $employeeform->position_id->addMultiOption($positionlistRes['id'], utf8_encode($positionlistRes['positionname']));
             }
             if (isset($position_id) && $position_id != 0 && $position_id != '') {
                 $employeeform->setDefault('position_id', $position_id);
             }
         }
         return $msgarray;
     }
 }
Пример #3
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);
 }
Пример #4
0
 public function getcandidatesreportdataAction()
 {
     $this->_helper->layout->disableLayout();
     $param_arr = $this->_getAllParams();
     $cols_param_arr = $this->_getParam('cols_arr', array());
     if (isset($param_arr['cols_arr'])) {
         unset($param_arr['cols_arr']);
     }
     $page_no = isset($param_arr['page_no']) ? $param_arr['page_no'] : 1;
     $per_page = isset($param_arr['per_page']) ? $param_arr['per_page'] : PERPAGE;
     $sort_name = $param_arr['sort_name'];
     $sort_type = $param_arr['sort_type'];
     if (isset($param_arr['page_no'])) {
         unset($param_arr['page_no']);
     }
     if (isset($param_arr['sort_name'])) {
         unset($param_arr['sort_name']);
     }
     if (isset($param_arr['sort_type'])) {
         unset($param_arr['sort_type']);
     }
     if (isset($param_arr['per_page'])) {
         unset($param_arr['per_page']);
     }
     unset($param_arr['total_grid_columns']);
     unset($param_arr['module']);
     unset($param_arr['controller']);
     unset($param_arr['action']);
     unset($param_arr['format']);
     $candidatedetails_model = new Default_Model_Candidatedetails();
     $candidates_data = $candidatedetails_model->getReportData($param_arr, $per_page, $page_no, $sort_name, $sort_type);
     $page_cnt = $candidates_data['page_cnt'];
     $candidates_data = $candidates_data['rows'];
     $columns_array = array('requisition_code' => 'Requisition Code', 'jobtitle_name' => 'Job Title', 'candidate_name' => 'Candidate', 'emailid' => 'Email', 'cand_status' => 'Status', 'contact_number' => 'Mobile', 'skillset' => 'Skill Set');
     $mandatory_array = array('requisition_code' => 'Requisition Code', 'jobtitle_name' => 'Job Title', 'candidate_name' => 'Candidate', 'emailid' => 'Email', 'cand_status' => 'Status', 'contact_number' => 'Mobile', 'skillset' => 'Skill Set');
     if (count($cols_param_arr) == 0) {
         $cols_param_arr = $mandatory_array;
     }
     $mandatory_array = array_keys($mandatory_array);
     $this->view->requisition_arr = $candidates_data;
     $this->view->columns_array = $columns_array;
     $this->view->mandatory_array = $mandatory_array;
     $this->view->page_cnt = $page_cnt;
     $this->view->per_page = $per_page;
     $this->view->page_no = $page_no;
     $this->view->cols_param_arr = $cols_param_arr;
     $this->view->sort_name = $sort_name;
     $this->view->sort_type = $sort_type;
 }
Пример #5
0
    public function save($processesform, $processdata)
    {
        $baseUrl = DOMAIN;
        $baseUrl = rtrim($baseUrl, '/');
        $auth = Zend_Auth::getInstance();
        if ($auth->hasIdentity()) {
            $loginUserId = $auth->getStorage()->read()->id;
            $loginuserRole = $auth->getStorage()->read()->emprole;
        }
        $usermodel = new Default_Model_Users();
        $hrem = 'true';
        $mngmntem = 'true';
        $agencyEmail = '';
        $lmanager1Email = '';
        $lmanager1Name = 'Manager';
        $agencysalutationName = 'Agency';
        $id = $this->getRequest()->getParam('id');
        $idData = $this->getRequest()->getParam('unitId');
        $idArr = array();
        $idArr = explode('-', $idData);
        $specimen_id = $idArr[0];
        $userflag = $idArr[1];
        $msgarray = array();
        if ($idArr[1] == 2) {
            $flag = 'cand';
            $person = 'candidate';
        } else {
            $flag = 'emp';
            $person = 'employee';
        }
        $processesmodel = new Default_Model_Processes();
        $empscreeningModel = new Default_Model_Empscreening();
        $statusFlag = '';
        $close = '';
        $controllername = 'processes';
        $errorflag = 'true';
        $BGStatus = '';
        $oldbgstatus = '';
        $mailsentflag = 0;
        if (!empty($processdata)) {
            $newStatus = $this->getRequest()->getParam('process_status');
            $previousstatus = $processdata[0]['process_status'];
            $agencyid = $processdata[0]['agencyid'];
            $checktype = $processdata[0]['checktypeid'];
            $processStatus = $processesmodel->getProcessStatus($specimen_id, $userflag, $agencyid, $checktype);
            if (!empty($processStatus) && sizeof($processStatus) > 0) {
                $oldstatus = $processStatus[0]['process_status'];
                $BGStatus = $processStatus[0]['bgcheck_status'];
                /* Check - Adding a record with same userid, agencyid and check type */
                $exists = 'false';
                for ($i = 0; $i < sizeof($processStatus); $i++) {
                    if (($processStatus[$i]['process_status'] == 'On hold' || $processStatus[$i]['process_status'] == 'In process') && $processStatus[$i]['process_status'] == $newStatus) {
                        $exists = 'true';
                    }
                }
                if ($newStatus == $previousstatus) {
                    $msgarray['StatusError'] = "Please change the status.";
                    $errorflag = "false";
                } else {
                    if ($BGStatus != 'Complete' && $exists == 'true') {
                        $msgarray['StatusError'] = "The " . $person . " is already assigned to the selected agency. Please re-assign the " . $person . " to another agency.";
                        $errorflag = "false";
                    }
                }
                /* END */
            }
        } else {
            $checktype = $this->_request->getParam('checktype');
            $radio_pocId = $this->_request->getParam('contactRadio');
            $agencyid = $this->_request->getParam('agencyids');
            $newStatus = 'In process';
            $agencyData = array();
            $agencyPOCData = array();
            if (empty($checktype) && $checktype == '') {
                $msgarray['checktype'] = "Please check atleast one screening type";
                $errorflag = "false";
            } else {
                if (empty($radio_pocId) || $radio_pocId == '') {
                    $msgarray['contactRadio'] = "Please select point of contact";
                    $errorflag = "false";
                }
            }
            if ($checktype) {
                $agencyArr = array();
                $agencyArr = $checktype;
                $agencyData = $empscreeningModel->getAgencyData($agencyArr, '', '');
            }
            if (!isset($agencyid) || $agencyid == '') {
                $agencyid = $this->getRequest()->getParam('defaultagencyid');
            }
            if (!isset($agencyid) || $agencyid == '') {
                $msgarray['agencyids'] = "Please select agency.";
                $errorflag = "false";
            }
            if ($agencyid) {
                $agencyPOCData = $empscreeningModel->getAgencyPOCData($agencyid);
            }
            $this->view->agencyData = $agencyData;
            $this->view->agencyPOCData = $agencyPOCData;
            /* Checking for configurations - screening type and agencies */
            $checktypeModal = new Default_Model_Bgscreeningtype();
            $agencymodel = new Default_Model_Agencylist();
            $typesData = $checktypeModal->fetchAll('isactive=1', 'type')->toArray();
            $agencyData = $agencymodel->fetchAll('isactive=1', 'agencyname')->toArray();
            for ($i = 0; $i < sizeof($agencyPOCData); $i++) {
                if ($agencyPOCData[$i]['id'] == $radio_pocId) {
                    $agencyEmail = $agencyPOCData[$i]['email'];
                    $agencyfname = $agencyPOCData[$i]['first_name'];
                    $agencylname = $agencyPOCData[$i]['last_name'];
                    $agencysalutationName = $agencyfname . ' ' . $agencylname;
                }
            }
            if (empty($typesData)) {
                $msgarray['checktype'] = 'Screening types are not configured yet.';
                $errorflag = 'false';
            }
            if (empty($agencyData)) {
                $msgarray['agencyids'] = 'Agencies are not added yet.';
                $errorflag = 'false';
            }
            $this->view->msgarray = $msgarray;
            /* */
            /* Check - Adding a record with same userid, agencyid and check type (for each check type ) */
            if (is_array($checktype) && $errorflag != "false") {
                for ($i = 0; $i < sizeof($checktype); $i++) {
                    $processStatus = array();
                    $processStatus = $processesmodel->getProcessStatus($specimen_id, $userflag, $agencyid, $checktype[$i]);
                    if (!empty($processStatus) && sizeof($processStatus > 0)) {
                        $exists = 'false';
                        for ($i = 0; $i < sizeof($processStatus); $i++) {
                            if ($processStatus[$i]['process_status'] == 'On hold' || $processStatus[$i]['process_status'] == 'In process') {
                                $exists = 'true';
                            }
                        }
                        $oldstatus = $processStatus[0]['process_status'];
                        $BGStatus = $processStatus[0]['bgcheck_status'];
                        if ($exists == 'true' && $BGStatus != 'Complete') {
                            $msgarray['StatusError'] = "The " . $person . " is already assigned to the selected agency. Please re-assign the " . $person . " to another agency.";
                            $errorflag = "false";
                        }
                    }
                    $oldbgstatusData = $processesmodel->getProcessStatus($specimen_id, $userflag, '', '');
                    if (!empty($oldbgstatusData)) {
                        $oldbgstatus = $oldbgstatusData[0]['bgcheck_status'];
                    } else {
                        $oldbgstatus = '';
                    }
                }
            }
            /* END */
        }
        if ($processesform->isValid($this->_request->getPost()) && $errorflag != 'false') {
            $date = new Zend_Date();
            $menumodel = new Default_Model_Menu();
            $actionflag = '';
            $tableid = '';
            /* 	A New process is created for a user whose background check status is in 'Complete' status. Then updating the bg status to 'In process' */
            if (($BGStatus == 'Complete' || $oldbgstatus == 'Complete' || $BGStatus == 'On hold' || $oldbgstatus == 'On hold') && $newStatus == 'In process') {
                $totalstatusData = array('bgcheck_status' => 'In process', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                $totalstatusWhere = array('specimen_id=?' => $specimen_id, 'flag=?' => $userflag);
                $empscreeningModel->SaveorUpdateDetails($totalstatusData, $totalstatusWhere);
                /* Updating back ground check status to In process in employees/candidates status */
                if ($userflag == 1) {
                    $empData = array('backgroundchk_status' => 'In process', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                    $empWhere = array('id=?' => $specimen_id);
                    $usermodel->addOrUpdateUserModel($empData, $empWhere);
                } else {
                    $candModel = new Default_Model_Candidatedetails();
                    $candData = array('backgroundchk_status' => 'In process', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                    $candWhere = array('id=?' => $specimen_id);
                    $candModel->SaveorUpdateUserData($candData, $candWhere);
                }
                /* END */
                /* Mail to HRD, Line 1 and Line 2 managers that the background checks has been re-opened */
                if ($BGStatus != 'On hold' && $oldbgstatus != 'On hold') {
                    $empData = $empscreeningModel->getEmpPersonalData($specimen_id, $userflag);
                    if ($userflag == 1) {
                        $username = $empData[0]['name'];
                        $lmanager1Email = $empData[0]['rmanager_email'];
                        $lmanager1Name = $empData[0]['reporting_manager'];
                    } else {
                        $username = $empData[0]['candidate_name'];
                        $lmanager1Email = '';
                    }
                    $bid = '';
                    if (isset($empData[0]['businessid'])) {
                        $bid = $empData[0]['businessid'];
                    }
                    if (isset($lmanager1Email) && $lmanager1Email != '') {
                        $manager1 = array($lmanager1Email);
                    } else {
                        $manager1 = array();
                    }
                    if (isset($agencyEmail) && $agencyEmail != '') {
                        $agencyemail1 = array($agencyEmail);
                    } else {
                        $agencyemail1 = array();
                    }
                    if (defined('BG_CHECKS_MNGMNT_' . $bid) && $bid != '') {
                        $mngmntemailId = explode(",", constant('BG_CHECKS_MNGMNT_' . $bid));
                    } else {
                        $mngmntem = 'false';
                        $mngmntemailId = array();
                    }
                    if (defined('BG_CHECKS_HR_' . $bid) && $bid != '') {
                        $hremailId = explode(",", constant('BG_CHECKS_HR_' . $bid));
                    } else {
                        $hrem = 'false';
                        $hremailId = array();
                    }
                    $emailArr = array_merge($agencyemail1, $manager1, $mngmntemailId, $hremailId);
                    for ($i = 0; $i < sizeof($emailArr); $i++) {
                        $salutation = 'Dear Sir/Madam,';
                        if ($i == 0) {
                            $salutation = 'Dear ' . ucfirst($agencysalutationName) . ',';
                            $options['toName'] = ucfirst($agencysalutationName);
                        }
                        if ($i == 1) {
                            $salutation = 'Dear ' . ucfirst($lmanager1Name) . ',';
                            $options['toName'] = ucfirst($lmanager1Name);
                        }
                        if ($i == 2) {
                            $salutation = 'Dear Management,';
                            $options['toName'] = 'Management';
                        }
                        if ($i == 3) {
                            $salutation = 'Dear HR,';
                            $options['toName'] = 'HR';
                        }
                        $options['subject'] = APPLICATION_NAME . ' : Background checks re-opened';
                        $options['header'] = 'Background checks re-opened';
                        $options['toEmail'] = $emailArr[$i];
                        $createdbyName = $usermodel->getUserDetails($loginUserId);
                        if ($i == 0) {
                            $mailsentflag = 1;
                            $options['message'] = '<div>' . $salutation . '<div>The background check for ' . ucfirst($username) . '
													has been re-opened by ' . $createdbyName[0]['userfullname'] . '. </div>
													<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div>
												</div>';
                        } else {
                            $options['message'] = '<div>' . $salutation . '<div>The background check for ' . ucfirst($username) . '
													has been re-opened by ' . $createdbyName[0]['userfullname'] . '. </div>
													<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div>
												</div>';
                        }
                        $options['cron'] = 'yes';
                        sapp_Global::_sendEmail($options);
                    }
                }
                /* END */
            }
            /* END */
            $data = array('specimen_id' => $specimen_id, 'flag' => $userflag, 'bgagency_id' => $agencyid, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
            if ($id != '') {
                $data['process_status'] = $newStatus;
                $data['explanation'] = NULL;
                $where = array('id=?' => $id);
                $actionflag = 2;
            } else {
                $data['process_status'] = $newStatus;
                $data['bgagency_pocid'] = $radio_pocId;
                $data['createdby'] = $loginUserId;
                $data['createddate'] = gmdate("Y-m-d H:i:s");
                $data['isactive'] = 1;
                $where = '';
                $actionflag = 1;
                if ($newStatus == 'In process' && ($BGStatus != 'Complete' || $oldbgstatus != 'Complete' || $BGStatus != 'On hold' || $oldbgstatus != 'On hold') && $mailsentflag == 0) {
                    $empData = $empscreeningModel->getEmpPersonalData($specimen_id, $userflag);
                    $table = '';
                    if ($userflag == 1) {
                        $username = $empData[0]['name'];
                        $lmanager1Email = $empData[0]['rmanager_email'];
                        $lmanager1Name = $empData[0]['reporting_manager'];
                        $table = '<div>
											<table border="1" style="border-collapse:collapse;">
												<tr><td>Employee ID</td><td>' . $empData[0]['employee_id'] . '</td></tr>
												<tr><td>Employee Email</td><td>' . $empData[0]['email_id'] . '</td></tr>
												<tr><td>Employee Designation</td><td>' . $empData[0]['designation'] . '</td></tr>
											</table>
										</div>';
                    } else {
                        $username = $empData[0]['candidate_name'];
                        $lmanager1Email = '';
                        $table = '<div>Candidate Email : ' . $empData[0]['email'] . '</div>';
                    }
                    if ($agencysalutationName != '') {
                        $salutation = 'Dear ' . ucfirst($agencysalutationName) . ',';
                        $options['toName'] = ucfirst($agencysalutationName);
                    } else {
                        $salutation = 'Dear Sir/Madam,';
                        $options['toName'] = 'Agency';
                    }
                    $createdbyName = $usermodel->getUserDetails($loginUserId);
                    $options['subject'] = APPLICATION_NAME . ' : Background checks initiated';
                    $options['header'] = 'Background checks initiated';
                    $options['toEmail'] = $agencyEmail;
                    $options['message'] = '<div>' . $salutation . '<div>' . ucfirst($username) . ' has been sent for background checks by ' . ucfirst($createdbyName[0]['userfullname']) . '. Please find the details below.</div>' . $table . '
					                    
												<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div>
											</div>';
                    $options['cron'] = 'yes';
                    sapp_Global::_sendEmail($options);
                }
            }
            if (is_array($checktype)) {
                for ($i = 0; $i < sizeof($checktype); $i++) {
                    $data['bgcheck_type'] = $checktype[$i];
                    $detailId = $empscreeningModel->SaveorUpdateDetails($data, $where);
                }
            } else {
                $data['bgcheck_type'] = $checktype;
                $detailId = $empscreeningModel->SaveorUpdateDetails($data, $where);
            }
            /* If all the processes are in 'Complete' status, then updating the background check status to 'Complete' and sending mail to HR, reporting manager  */
            $checkAllprocesses = $processesmodel->getProcessStatus($specimen_id, $userflag);
            $completecount = 0;
            $onholdcount = 0;
            for ($i = 0; $i < sizeof($checkAllprocesses); $i++) {
                if ($checkAllprocesses[$i]['process_status'] == 'Complete') {
                    $completecount = $completecount + 1;
                }
            }
            if ($completecount == sizeof($checkAllprocesses)) {
                $totalstatusData = array('bgcheck_status' => 'Complete', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                $totalstatusWhere = array('specimen_id=?' => $specimen_id, 'flag=?' => $userflag);
                $empscreeningModel->SaveorUpdateDetails($totalstatusData, $totalstatusWhere);
                /* Updating back ground check status to Completed in employees/candidates status */
                if ($userflag == 1) {
                    $usermodel = new Default_Model_Users();
                    $empData = array('backgroundchk_status' => 'Completed', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                    $empWhere = array('id=?' => $specimen_id);
                    $usermodel->addOrUpdateUserModel($empData, $empWhere);
                } else {
                    $candModel = new Default_Model_Candidatedetails();
                    $candData = array('backgroundchk_status' => 'Completed', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                    $candWhere = array('id=?' => $specimen_id);
                    $candModel->SaveorUpdateUserData($candData, $candWhere);
                }
                /* END */
                /* Mail to HRD, Line 1 and Line 2 managers */
                if ($newStatus == 'Complete') {
                    $empData = $empscreeningModel->getEmpPersonalData($specimen_id, $userflag);
                    if ($userflag == 1) {
                        $username = $empData[0]['name'];
                        $lmanager1Email = $empData[0]['rmanager_email'];
                        $lmanager1Name = $empData[0]['reporting_manager'];
                    } else {
                        $username = $empData[0]['name'];
                        $lmanager1Email = '';
                    }
                    $bid = '';
                    if (isset($empData[0]['businessid'])) {
                        $bid = $empData[0]['businessid'];
                    }
                    if (isset($lmanager1Email) && $lmanager1Email != '') {
                        $manager1 = array($lmanager1Email);
                    } else {
                        $manager1 = array();
                    }
                    if (defined('BG_CHECKS_MNGMNT_' . $bid) && $bid != '') {
                        $mngmntemailId = explode(",", constant('BG_CHECKS_MNGMNT_' . $bid));
                    } else {
                        $mngmntemailId = array();
                    }
                    if (defined('BG_CHECKS_HR_' . $bid) && $bid != '') {
                        $hremailId = explode(",", constant('BG_CHECKS_HR_' . $bid));
                    } else {
                        $hremailId = array();
                    }
                    $emailArr = array_merge($manager1, $mngmntemailId, $hremailId);
                    for ($i = 0; $i < sizeof($emailArr); $i++) {
                        $salutation = 'Dear Sir/Madam,';
                        if ($i == 0) {
                            $salutation = 'Dear ' . ucfirst($lmanager1Name) . ',';
                            $options['toName'] = ucfirst($lmanager1Name);
                        } else {
                            if ($i == 1) {
                                $salutation = 'Dear Management,';
                                $options['toName'] = 'Management';
                            } else {
                                $salutation = 'Dear HR,';
                                $options['toName'] = 'HR';
                            }
                        }
                        $options['subject'] = APPLICATION_NAME . ' : Background checks completed';
                        $options['header'] = 'Background checks completed';
                        $options['toEmail'] = $emailArr[$i];
                        $options['message'] = '<div>' . $salutation . '<div>The background check for ' . ucfirst($username) . '
													has been completed.</div>
													<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div>
												</div>';
                        $options['cron'] = 'yes';
                        sapp_Global::_sendEmail($options);
                    }
                }
                /* END */
            }
            /* End */
            /* If all the processes are in 'On hold' status, then updating the background check status to 'On hold' */
            for ($i = 0; $i < sizeof($checkAllprocesses); $i++) {
                if ($checkAllprocesses[$i]['process_status'] == 'On hold') {
                    $onholdcount = $onholdcount + 1;
                }
            }
            if ($onholdcount == sizeof($checkAllprocesses)) {
                $totalstatusData = array('bgcheck_status' => 'On hold', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                $totalstatusWhere = array('specimen_id=?' => $specimen_id, 'flag=?' => $userflag);
                $empscreeningModel->SaveorUpdateDetails($totalstatusData, $totalstatusWhere);
                /* Updating back ground check status to Completed in employees/candidates status */
                if ($userflag == 1) {
                    $usermodel = new Default_Model_Users();
                    $empData = array('backgroundchk_status' => 'On hold', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                    $empWhere = array('id=?' => $specimen_id);
                    $usermodel->addOrUpdateUserModel($empData, $empWhere);
                } else {
                    $candModel = new Default_Model_Candidatedetails();
                    $candData = array('backgroundchk_status' => 'On hold', 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
                    $candWhere = array('id=?' => $specimen_id);
                    $candModel->SaveorUpdateUserData($candData, $candWhere);
                }
                /* END */
            }
            /* END */
            if ($detailId == 'update') {
                $tableid = $id;
                $this->view->eventact = 'updated';
            } else {
                $tableid = $detailId;
                $this->view->eventact = 'added';
            }
            $actionflag = 2;
            //Edit of the candidate or employee
            $menuidArr = $menumodel->getMenuObjID('/empscreening');
            $menuID = $menuidArr[0]['id'];
            $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $specimen_id . '-' . $userflag);
            $close = 'close';
            $this->view->popup = $close;
        } else {
            $messages = $processesform->getMessages();
            foreach ($messages as $key => $val) {
                foreach ($val as $key2 => $val2) {
                    $msgarray[$key] = $val2;
                    break;
                }
                if (empty($checktypesData)) {
                    $msgarray['checktype'] = 'Screening types are not configured yet.';
                }
                if (empty($checkagencyData)) {
                    $msgarray['agencyids'] = 'Agencies are not added yet.';
                }
            }
            return $msgarray;
        }
        $this->view->statusFlag = $statusFlag;
    }
 public function multipleresumeAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginUserId = trim($loginUserId);
     }
     $priv_check = sapp_Global::_checkprivileges(CANDIDATEDETAILS, '', $auth->getStorage()->read()->emprole, 'add');
     if ($priv_check == 'Yes') {
         $msgarray = $req_options = array();
         $form = new Default_Form_Multipleresume();
         $form->setAction(DOMAIN . 'candidatedetails/multipleresume');
         // To show list of requisitions to user
         $req_model = new Default_Model_Requisition();
         $req_data = $req_model->getRequisitionsForCV("'Approved','In process'");
         foreach ($req_data as $req) {
             $req_options[$req['id']] = $req['requisition_code'] . ' - ' . $req['jobtitlename'];
         }
         if (count($req_options) == 0) {
             $msgarray['requisition_id'] = "No active requisitions are found.";
         }
         $form->requisition_id->addMultiOptions(array('' => 'Select Requisition ID') + $req_options);
         $form_post_status = $this->_request->getPost();
         if ($form_post_status) {
             $candidate_firstname = $this->_getParam('candidate_firstname', null);
             $candidate_lastname = $this->_getParam('candidate_lastname', null);
             $cand_resumes = $this->_getParam('cand_resume', null);
             if ($form->isValid($form_post_status)) {
                 $cand_details_model = new Default_Model_Candidatedetails();
                 $requisition_id = $this->_getParam('requisition_id', null);
                 $cand_status = $this->_getParam('cand_status', null);
                 $req_records = $cand_details_model->getcountofrecords($requisition_id);
                 $curr_date = gmdate("Y-m-d H:i:s");
                 if (empty($req_records)) {
                     $rdata = array('req_status' => 'In process', 'modifiedby' => $loginUserId, 'modifiedon' => $curr_date);
                     $rwhere = ' id = ' . $requisition_id;
                     $req_model->SaveorUpdateRequisitionData($rdata, $rwhere);
                 }
                 // To insert records in a single query
                 $records = array();
                 foreach ($candidate_firstname as $key => $candidate_fname) {
                     $cfull_name = $candidate_fname . ' ' . $candidate_lastname[$key];
                     $records[] = "({$requisition_id}, '{$candidate_fname}','{$candidate_lastname[$key]}','{$cfull_name}', '{$cand_resumes[$key]}', '{$cand_status}', 1, {$loginUserId}, {$loginUserId}, '{$curr_date}', '{$curr_date}')";
                 }
                 $data_fields = array('requisition_id', 'candidate_firstname', 'candidate_lastname', 'candidate_name', 'cand_resume', 'cand_status', 'isactive', 'createdby', 'modifiedby', 'createddate', 'modifieddate');
                 $last_insert_id = $cand_details_model->insertMultipleRecords($data_fields, $records);
                 // Log status to Log manager and redirect to Resource Pooling list page.
                 if ($last_insert_id != '') {
                     $menumodel = new Default_Model_Menu();
                     $objidArr = $menumodel->getMenuObjID('/candidatedetails');
                     $objID = $objidArr[0]['id'];
                     $log_status = sapp_Global::logManager($objID, 1, $loginUserId, $last_insert_id);
                     //$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Candidate details added successfully.');
                     $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Candidate details added successfully."));
                     $this->_redirect('/candidatedetails');
                 }
             } else {
                 // To handle server validation, when Javascript is disabled
                 $messages = $form->getMessages();
                 foreach ($messages as $key => $val) {
                     foreach ($val as $key2 => $val2) {
                         $msgarray[$key] = $val2;
                         break;
                     }
                 }
                 $form->setDefault('candidate_firstname', $candidate_firstname[0]);
                 $form->setDefault('cand_resume', '');
             }
         }
         $this->view->form = $form;
         $this->view->msgarray = $msgarray;
     } else {
         $this->_redirect('error');
     }
 }
Пример #7
0
 /**
  * This function acts as a service for onchange of mode of employment to get candidates or referers.
  * @param array $params_arr  = array of parameters
  * @return array  Array of options.
  */
 public function modeempOnchange($params_arr)
 {
     $result = array();
     $status = 0;
     $message = "Invalid mode of employment.";
     if (isset($params_arr['role_id']) && $params_arr['role_id'] != '' && isset($params_arr['group_id']) && $params_arr['group_id'] != '' && isset($params_arr['modeofentry']) && $params_arr['modeofentry'] != '' && isset($params_arr['userid']) && $params_arr['userid'] != '') {
         $role_id = $params_arr['role_id'];
         $group_id = $params_arr['group_id'];
         $userid = $params_arr['userid'];
         $modeofentry = $params_arr['modeofentry'];
         if ($role_id == SUPERADMINROLE || $group_id == MANAGEMENT_GROUP || $group_id == HR_GROUP) {
             $privilege_flag = sapp_Global::_checkprivileges(EMPLOYEE, $group_id, $role_id, 'add');
             if ($privilege_flag == 'Yes') {
                 if ($modeofentry == "Interview" || $modeofentry == 'Other') {
                     $candidate_model = new Default_Model_Candidatedetails();
                     $candidate_options = $candidate_model->getCandidatesNamesForUsers();
                     $candidate_str = sapp_Global::selectOptionBuilder("", "Select Candidate");
                     //echo "<pre>";print_r($candidate_options);echo "</pre>";
                     if (!empty($candidate_options)) {
                         $status = 1;
                         $message = "success";
                         foreach ($candidate_options as $id => $name) {
                             $candidate_str .= sapp_Global::selectOptionBuilder($id, $name);
                         }
                     } else {
                         $status = 0;
                         $message = "No selected candidates.";
                     }
                     $result['candidates'] = $candidate_str;
                 } else {
                     if ($modeofentry == "Reference") {
                         $user_model = new Default_Model_Usermanagement();
                         $referedby_options = $user_model->getRefferedByForUsers();
                         $refered_str = sapp_Global::selectOptionBuilder("", "Select Referred By");
                         //echo "<pre>";print_r($candidate_options);echo "</pre>";
                         if (!empty($referedby_options)) {
                             $status = 1;
                             $message = "success";
                             foreach ($referedby_options as $id => $name) {
                                 $refered_str .= sapp_Global::selectOptionBuilder($id, $name);
                             }
                         } else {
                             $status = 0;
                             $message = "Employees are not added yet.";
                         }
                         $result['referred_by'] = $refered_str;
                     }
                 }
             }
         }
     }
     return array('status' => $status, 'message' => $message, 'result' => $result);
 }
 public function viewpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $id = $this->_getParam('id', null);
     $candidate_model = new Default_Model_Candidatedetails();
     $interview_model = new Default_Model_Interviewdetails();
     $interview_round_model = new Default_Model_Interviewrounddetails();
     $candidate_data = $candidate_model->getCandidateById($id);
     $interview_data = $interview_model->getInterviewDataByCandidateId($id);
     $interview_round_data = $interview_round_model->getRoundDetailsByCandidateId($id);
     $this->view->candidate_data = $candidate_data;
     $this->view->interview_data = $interview_data;
     $this->view->interview_round_data = $interview_round_data;
 }
 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';
     }
 }
Пример #10
0
 public function getemailofuserAction()
 {
     $cand_id = $this->_getParam('cand_id', null);
     $cand_model = new Default_Model_Candidatedetails();
     $cand_data = $cand_model->getCandidateById($cand_id);
     $this->_helper->_json(array('email' => $cand_data['emailid']));
 }
Пример #11
0
 /**
  * 
  * @param type $reqid
  * @return type
  */
 public function requisitionhistoryreportdetail_CVManagementGrid($reqid)
 {
     $sort_order = 'DESC';
     $sort_field = 'c.uploadedon';
     $perPage = 100;
     $pageNo = 1;
     $searchData = '';
     $where = '';
     $searchQuery = 'c.requisition_id = ' . $reqid;
     $searchArray = array();
     $data = array();
     $tableFields = array('candidate_name' => 'Candidate Name', 'cand_resume' => 'Resume', 'shortlisted_status' => 'CV-Shortlisted Status', 'cand_status' => 'Candidate Status', 'createdby' => 'Uploaded By', 'createdon' => 'Uploaded On', 'shortlistedby' => 'Shortlisted By', 'shortlistedon' => 'Shortlisted On');
     $cand_model = new Default_Model_Candidatedetails();
     $tablecontent = $cand_model->getCandidatesHistory($sort_order, $sort_field, $pageNo, $perPage, $searchQuery);
     $dataTmp = array('sort' => $sort_order, 'by' => $sort_field, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'tableheader' => $tableFields);
     return $dataTmp;
 }
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $requi_model = new Default_Model_Requisition();
     $round_model = new Default_Model_Interviewrounddetails();
     $intrvwModel = new Default_Model_Interviewdetails();
     $user_model = new Default_Model_Usermanagement();
     $cand_model = new Default_Model_Candidatedetails();
     $intrvwId = $this->getRequest()->getParam('unitId');
     if ($form->isValid($this->_request->getPost())) {
         $reqData = $intrvwModel->getReqByintrvwID($intrvwId);
         if (!empty($reqData)) {
             $reqId = $reqData['req_id'];
             $candid = $reqData['candidate_id'];
             $id = $this->getRequest()->getParam('id');
             $interview_id = $intrvwId;
             $interviewer_id = $this->getRequest()->getParam('interviewer_id');
             $interview_round = $this->getRequest()->getParam('interview_round');
             $interview_mode = $this->getRequest()->getParam('interview_mode');
             $int_location = $this->getRequest()->getParam('int_location');
             $interview_time = $this->getRequest()->getParam('interview_time');
             $interview_date = $this->getRequest()->getParam('interview_date');
             $interview_feedback = $this->getRequest()->getParam('interview_feedback');
             $interview_comments = $this->getRequest()->getParam('interview_comments');
             $round_status = $this->getRequest()->getParam('round_status', null);
             $hid_round_status = $this->getRequest()->getParam('hid_round_status', null);
             $data = array('candidate_id' => $candid, 'req_id' => $reqId, 'interview_id' => trim($intrvwId), 'interviewer_id' => trim($interviewer_id), 'interview_mode' => trim($interview_mode), 'int_location' => trim($int_location), 'int_country' => trim($this->_getParam('country', null)), 'int_state' => trim($this->_getParam('state', null)), 'int_city' => trim($this->_getParam('city', null)), 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_round' => trim($interview_round), 'interview_feedback' => trim($interview_feedback), 'interview_comments' => trim($interview_comments), 'round_status' => trim($round_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
             $roundnumberData = $intrvwModel->getinterviewroundnumber($interview_id);
             $roundnumber = $roundnumberData['interview_round_number'];
             $data['interview_round_number'] = $roundnumber + 1;
             $where = "";
             $actionflag = 1;
             if ($id != '') {
                 unset($data['createdby']);
                 unset($data['createdon']);
                 unset($data['isactive']);
                 unset($data['interview_round_number']);
                 $where = array("id = " . $id);
                 $tableid = $id;
                 $actionflag = 2;
                 if ($hid_round_status != '') {
                     $data = array();
                     $data['round_status'] = trim($round_status);
                 }
             }
             if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $interviewer_id == $loginUserId) {
                 unset($data['interviewer_id']);
                 unset($data['interview_mode']);
                 unset($data['int_location']);
                 unset($data['int_country']);
                 unset($data['int_state']);
                 unset($data['int_city']);
                 unset($data['interview_time']);
                 unset($data['interview_date']);
                 unset($data['interview_round']);
             }
             $result = $round_model->SaveorUpdateInterviewroundData($data, $where);
             if ($id == '') {
                 //start of mailing
                 $requisition_data = $requi_model->getRequisitionDataById($reqId);
                 $cand_data = $cand_model->getCandidateById($candid);
                 $report_person_data = $user_model->getUserDataById($interviewer_id);
                 $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
                 foreach ($mail_arr as $ename => $email) {
                     $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                     $view = $this->getHelper('ViewRenderer')->view;
                     $this->view->emp_name = $ename;
                     $this->view->base_url = $base_url;
                     $this->view->candidate_name = $cand_data['candidate_name'];
                     $this->view->interview_type = $interview_mode;
                     $this->view->interview_location = $int_location;
                     $this->view->interview_date = $interview_date;
                     $this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                     $this->view->requisition_code = $requisition_data['requisition_code'];
                     $text = $view->render('mailtemplates/interviewrounds.phtml');
                     $options['subject'] = APPLICATION_NAME . ': Interview schedule';
                     $options['header'] = 'Interview schedule';
                     $options['toEmail'] = $email;
                     $options['toName'] = $ename;
                     $options['message'] = $text;
                     $options['cron'] = 'yes';
                     sapp_Global::_sendEmail($options);
                 }
                 //end of mailing
                 $tableid = $result;
                 $this->view->eventact = 'scheduled';
             } else {
                 if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == MANAGEMENT_GROUP) {
                     $requisition_data = $requi_model->getRequisitionDataById($reqId);
                     $cand_data = $cand_model->getCandidateById($candid);
                     $round_data = $round_model->getSingleRoundData($id);
                     $report_person_data = $user_model->getUserDataById($loginUserId);
                     $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
                     foreach ($mail_arr as $ename => $email) {
                         $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                         $view = $this->getHelper('ViewRenderer')->view;
                         $this->view->emp_name = $ename;
                         $this->view->base_url = $base_url;
                         $this->view->candidate_name = $cand_data['candidate_name'];
                         $this->view->interview_type = $round_data['interview_mode'];
                         $this->view->interview_location = $round_data['int_location'];
                         $this->view->interview_date = sapp_Global::change_date($round_data['interview_date'], 'view');
                         $this->view->interview_time = sapp_Global::change_time($round_data['interview_time'], 'view');
                         $this->view->interview_feedback = $interview_feedback;
                         $this->view->interview_comments = $interview_comments;
                         $this->view->round_status = $round_status;
                         $this->view->reporting_person = $report_person_data['userfullname'];
                         $text = $view->render('mailtemplates/interviewrounds_feedback.phtml');
                         $options['subject'] = APPLICATION_NAME . ': Interview feedback';
                         $options['header'] = 'Interview feedback';
                         $options['toEmail'] = $email;
                         $options['toName'] = $ename;
                         $options['message'] = $text;
                         $options['cron'] = 'yes';
                         sapp_Global::_sendEmail($options);
                     }
                 }
                 $tableid = $id;
                 $this->view->eventact = 'updated';
             }
             $menumodel = new Default_Model_Menu();
             $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
             $objID = $objidArr[0]['id'];
             $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId);
             $close = 'close';
             $this->view->popup = $close;
             $this->view->ermsg = '';
         } else {
             $this->view->ermsg = 'nodata';
         }
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $candidatesmodel = new Default_Model_Shortlistedcandidates();
     $cand_model = new Default_Model_Candidatedetails();
     $requimodel = new Default_Model_Requisition();
     $user_model = new Default_Model_Usermanagement();
     if ($form->isValid($this->_request->getPost())) {
         $id = $this->getRequest()->getParam('id');
         $status = $this->getRequest()->getParam('selectionstatus');
         $txtReason = $this->getRequest()->getParam('txtReason');
         $txtJoiningDate = $this->getRequest()->getParam('txtJoiningDate');
         $candidateData = $candidatesmodel->getcandidateData($id);
         $req_id = $candidateData['requisition_id'];
         $selsctionopt = array('0' => 'Select status', '1' => 'Selected', '2' => 'Rejected', '3' => 'Offered', '4' => 'Offer Accepted', '5' => 'Joined', '6' => 'On Hold', '7' => 'Offer Declined', '8' => 'Yet to offer');
         //validation
         if ($status == "4" && $txtJoiningDate == "") {
             $this->_helper->getHelper("FlashMessenger")->addMessage(array("failure" => "Joining Date required."));
             $messages = $form->getMessages();
             foreach ($messages as $key => $val) {
                 foreach ($val as $key2 => $val2) {
                     $msgarray[$key] = $val2;
                     break;
                 }
             }
             return $msgarray;
         } else {
             if (($status == "7" || $status == "2" || $status == "6" || $status == "8") && $txtReason == "") {
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("failure" => "Comments required."));
                 $messages = $form->getMessages();
                 foreach ($messages as $key => $val) {
                     foreach ($val as $key2 => $val2) {
                         $msgarray[$key] = $val2;
                         break;
                     }
                 }
                 return $msgarray;
             } else {
                 if ($txtReason == '' && $txtJoiningDate == '') {
                     $data = array('cand_status' => $selsctionopt[$status], 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                 } else {
                     if ($txtReason == '' && $txtJoiningDate != '') {
                         $data = array('cand_status' => $selsctionopt[$status], 'joiningdate' => sapp_Global::change_date(trim($txtJoiningDate), 'database'), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                     } else {
                         if ($txtReason != '' && $txtJoiningDate == '') {
                             $data = array('cand_status' => $selsctionopt[$status], 'comments' => $txtReason, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                         } else {
                             $data = array('cand_status' => $selsctionopt[$status], 'comments' => $txtReason, 'joiningdate' => sapp_Global::change_date(trim($txtJoiningDate), 'database'), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
                         }
                     }
                 }
                 $where = "id = " . $id;
                 $result = $candidatesmodel->SaveorUpdateCandidateDetails($data, $where);
                 //if (($status == '1' || $status == 'Selected' ) && ($result != '')) {
                 //increment selected members count
                 $requimodel->incrementselected_members($req_id);
                 //start of mailing
                 $cand_data = $cand_model->getCandidateById($id);
                 $requisition_data = $requimodel->getRequisitionDataById($req_id);
                 $requisition_data_view = $requimodel->getReqDataForView($req_id);
                 $report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']);
                 $requester_person_data = $user_model->getUserDataById($requisition_data['createdby']);
                 /* $mail_arr = array(
                    'HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "",
                    'Management' => defined("REQ_MGMT_" . $requisition_data['businessunit_id']) ? constant("REQ_MGMT_" . $requisition_data['businessunit_id']) : "",
                    $report_person_data['userfullname'] => $report_person_data['emailaddress']
                    );
                    $cstat_arr = array(
                    '0' => 'Select status',
                    '1' => 'Selected',
                    '2' => 'Rejected'
                    ); */
                 //HR Group
                 $mail_arr[0]['name'] = 'HR';
                 $mail_arr[0]['email'] = constant('REQ_HR_0');
                 $mail_arr[0]['type'] = 'CandidateFinalChange';
                 //Requester
                 $mail_arr[1]['name'] = $requester_person_data['userfullname'];
                 $mail_arr[1]['email'] = $requester_person_data['emailaddress'];
                 $mail_arr[1]['type'] = 'CandidateFinalChange';
                 //Management Group
                 $mail_arr[2]['name'] = 'Management';
                 $mail_arr[2]['email'] = constant('REQ_MGMT_0');
                 $mail_arr[2]['type'] = 'CandidateFinalChange';
                 //Reporting Manager
                 $mail_arr[3]['name'] = $report_person_data['userfullname'];
                 $mail_arr[3]['email'] = $report_person_data['emailaddress'];
                 $mail_arr[3]['type'] = 'CandidateFinalChange';
                 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->type = $mail_arr[$ii]['type'];
                     $this->view->base_url = $base_url;
                     $this->view->requisition_data = $requisition_data_view[0];
                     $this->view->candidate_details = $cand_data;
                     $text = $view->render('mailtemplates/requisition.phtml');
                     $options['subject'] = APPLICATION_NAME . ':Candidate ' . $cand_data['cand_status'];
                     $options['header'] = 'Candidate ' . $cstat_arr[$status];
                     $options['toEmail'] = $mail_arr[$ii]['email'];
                     $options['toName'] = $mail_arr[$ii]['name'];
                     $options['message'] = $text;
                     sapp_Global::_sendEmail($options, "selectedcandidates", REQUISITIONMODULESENDEMAIL);
                 }
                 //end of mailing
                 //}
                 $actionflag = 2;
                 $tableid = $id;
                 $menumodel = new Default_Model_Menu();
                 $objidArr = $menumodel->getMenuObjID('/shortlistedcandidates');
                 $objID = $objidArr[0]['id'];
                 $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Request updated successfully."));
                 $this->_redirect('/shortlistedcandidates');
             }
         }
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $candidatesmodel = new Default_Model_Shortlistedcandidates();
     $cand_model = new Default_Model_Candidatedetails();
     $requimodel = new Default_Model_Requisition();
     $user_model = new Default_Model_Usermanagement();
     if ($form->isValid($this->_request->getPost())) {
         $id = $this->getRequest()->getParam('id');
         $status = $this->getRequest()->getParam('selectionstatus');
         $candidateData = $candidatesmodel->getcandidateData($id);
         $req_id = $candidateData['requisition_id'];
         $data = array('cand_status' => trim($status), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
         $where = "id = " . $id;
         $result = $candidatesmodel->SaveorUpdateCandidateDetails($data, $where);
         if (($status == '2' || $status == 'Selected') && $result != '') {
             //increment selected members count
             $requimodel->incrementselected_members($req_id);
             //start of mailing
             $cand_data = $cand_model->getCandidateById($id);
             $requisition_data = $requimodel->getRequisitionDataById($req_id);
             $report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']);
             $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", 'Management' => defined("REQ_MGMT_" . $requisition_data['businessunit_id']) ? constant("REQ_MGMT_" . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
             $cstat_arr = array('0' => 'Select status', '2' => 'Selected', '3' => 'Rejected');
             foreach ($mail_arr as $ename => $email) {
                 $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                 $view = $this->getHelper('ViewRenderer')->view;
                 $this->view->emp_name = $ename;
                 $this->view->base_url = $base_url;
                 $this->view->requisition_code = $requisition_data['requisition_code'];
                 $this->view->candidate_name = $cand_data['candidate_name'];
                 $this->view->status = $cstat_arr[$status];
                 $text = $view->render('mailtemplates/selectedcandidates.phtml');
                 $options['subject'] = APPLICATION_NAME . ': Candidate ' . $cstat_arr[$status];
                 $options['header'] = 'Candidate ' . $cstat_arr[$status];
                 $options['toEmail'] = $email;
                 $options['toName'] = $ename;
                 $options['message'] = $text;
                 $options['cron'] = 'yes';
                 sapp_Global::_sendEmail($options);
             }
             //end of mailing
         }
         $actionflag = 2;
         $tableid = $id;
         $menumodel = new Default_Model_Menu();
         $objidArr = $menumodel->getMenuObjID('/shortlistedcandidates');
         $objID = $objidArr[0]['id'];
         $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
         $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Request updated successfully."));
         $this->_redirect('/shortlistedcandidates');
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
Пример #15
0
 public function updatebgstatus($con, $specimenid, $flag)
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     $screeningmodel = new Default_Model_Empscreening();
     $usermodel = new Default_Model_Users();
     $candmodel = new Default_Model_Candidatedetails();
     if ($con == 'onhold') {
         $userdata = array('backgroundchk_status' => 'On hold', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId());
         $userwhere = "id=" . $specimenid;
         if ($flag == 1) {
             $usermodel->addOrUpdateUserModel($userdata, $userwhere);
         } else {
             $candmodel->SaveorUpdateCandidateData($userdata, $userwhere);
         }
         $data = array('bgcheck_status' => 'On hold', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId());
         $where = "flag = " . $flag . " AND specimen_id=" . $specimenid;
         $screeningmodel->SaveorUpdateDetails($data, $where);
     }
     if ($con == 'complete') {
         $userdata = array('backgroundchk_status' => 'Completed', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId());
         $userwhere = "id=" . $specimenid;
         if ($flag == 1) {
             $usermodel->addOrUpdateUserModel($userdata, $userwhere);
         } else {
             $candmodel->SaveorUpdateCandidateData($userdata, $userwhere);
         }
         $data = array('bgcheck_status' => 'Complete', 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $this->getLoginUserId());
         $where = "flag = " . $flag . " AND specimen_id=" . $specimenid;
         $screeningmodel->SaveorUpdateDetails($data, $where);
     }
 }
 public function checkscreeningstatusAction()
 {
     $candid = $this->getRequest()->getParam('candid');
     $empid = $this->getRequest()->getParam('empid');
     $empscreeningModel = new Default_Model_Empscreening();
     $personalData = '';
     $addressData = '';
     $companyData = '';
     if (isset($candid) && $candid != '') {
         $candidateModel = new Default_Model_Candidatedetails();
         $status = $candidateModel->getcandidateData($candid);
         if ($status['backgroundchk_status'] == 'Yet to start') {
             $this->_redirect('empscreening/add/candid/' . $candid);
         } else {
             $this->_redirect('empscreening/edit/id/' . $candid . '-2');
         }
     } elseif (isset($empid) && $empid != '') {
         $usersModel = new Default_Model_Users();
         $bgstatusArr = $usersModel->getBGstatus($empid);
         if ($bgstatusArr[0]['backgroundchk_status'] == 'Yet to start' || $bgstatusArr[0]['backgroundchk_status'] == 'Not Applicable') {
             $this->_redirect('empscreening/add/empid/' . $empid);
         } else {
             $this->_redirect('empscreening/edit/id/' . $empid . '-1');
         }
     }
 }
Пример #17
0
 /**
  * 
  * @param type $form
  * @return type
  */
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
     }
     $candDetails = "";
     $canProcess = true;
     $flag = 'true';
     $profile_model = new Default_Model_Profiles();
     $req_model = new Default_Model_Requisition();
     $cand_model = new Default_Model_Candidatedetails();
     if ($form->isValid($this->_request->getPost())) {
         $id = $this->getRequest()->getParam('id');
         $technology = $this->_getParam('technology', null);
         $firstname = $this->_getParam('firstname', null);
         $lastname = $this->_getParam('lastname', null);
         $fullname = $firstname . ' ' . $lastname;
         $email = $this->_getParam('emailaddress', null);
         $contact = $this->_getParam('contact', null);
         $totalexprience = $this->_getParam('totalexprience', null);
         $releventexprience = $this->_getParam('releventexprience', null);
         $currentCTC = $this->_getParam('currentCTC', null);
         $expectedCTC = $this->_getParam('expectedCTC', null);
         $currentcompany = $this->_getParam('currentcompany', null);
         $currentlocation = $this->_getParam('currentlocation', null);
         $noticeperiod = $this->_getParam('noticeperiod', null);
         $requisition_id = $this->_getParam('requisition_id', null);
         $cvcommentdescription = $this->_getParam('cvcommentdescription', null);
         $candresume = $this->_getParam('cand_resume', null);
         $data = array('requisition_id' => $requisition_id, 'technology' => $technology, 'firstname' => trim($firstname), 'lastname' => trim($lastname), 'fullname' => trim($fullname), 'emailaddress' => trim($email), 'contact' => trim($contact), 'totalexprience' => $totalexprience, 'releventexprience' => $releventexprience, 'currentCTC' => $currentCTC, 'expectedCTC' => $expectedCTC, 'currentcompany' => $currentcompany, 'currentlocation' => $currentlocation, 'noticeperiod' => $noticeperiod, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createdon' => gmdate("Y-m-d H:i:s"), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'profilelastmodifiedon' => gmdate("Y-m-d H:i:s"), 'cvcommentdescription' => $cvcommentdescription, 'cand_resume' => $candresume);
         $data1 = array('requisition_id' => $requisition_id, 'candidate_firstname' => trim($firstname), 'candidate_lastname' => trim($lastname), 'candidate_name' => trim($fullname), 'emailid' => trim($email), 'contact_number' => trim($contact) == '' ? NULL : trim($contact), 'cand_resume' => $candresume, 'cand_status' => "Not Scheduled", 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'cand_technology' => trim($technology), 'totalexprience' => trim($totalexprience), 'releventexprience' => trim($releventexprience), 'currentCTC' => trim($currentCTC), 'expectedCTC' => trim($expectedCTC), 'currentcompany' => trim($currentcompany), 'currentlocation' => trim($currentlocation), 'noticeperiod' => trim($noticeperiod));
         $where = "";
         $actionflag = 1;
         if ($id != '') {
             unset($data['createdby']);
             unset($data['createddate']);
             unset($data['isactive']);
             $where = "id = " . $id;
             $tableid = $id;
             $actionflag = 2;
             if ($canProcess) {
                 $result1 = $cand_model->SaveorUpdateCandidateData($data1, "");
             }
             //perform this action only if login user role is not HRRECRUITER role
             if ($loginuserRole != HRRECRUITER) {
                 $cvshortlistedstatus = "";
                 try {
                     //CV Shortlisted status and comments
                     $cvshortlistedstatus = 1;
                     $cvcommentdescription = $this->_getParam('cvcommentdescription', null);
                     $insertCVShortlistDetailsResult = $req_model->insertCVShortlistDetails($id, $requisition_id, $cvshortlistedstatus, $cvcommentdescription, trim($loginUserId), gmdate("Y-m-d H:i:s"));
                 } catch (Exception $xyz) {
                 }
             }
         }
         if ($where == '') {
             $canProcess = true;
             //$canProcess = $cand_model->IsCandidateExists($candidate_firstname, $candidate_lastname, $contact_number, $emailid, $cand_technology);
         }
         if ($canProcess) {
             $result = $profile_model->SaveorUpdateCandidateData($data, $where);
         } else {
             echo "<script> alert('Profile already exists....!'); </script>";
         }
         $candData = $cand_model->getCandidateForView($result1);
         if (isset($cvshortlistedstatus) || strlen(trim($cvshortlistedstatus)) > 0) {
             //updating existing CV
             $this->requisition_cvupload_emails($requisition_id, "Update", $candData);
         } else {
             if ($requisition_id !== NULL) {
                 //new CV
                 $this->requisition_cvupload_emails($requisition_id, "New", $candData);
             }
         }
         //send email end -------------------------------------------------
         if ($id == '') {
             $tableid = $result;
         }
         if ($result != '') {
             $menumodel = new Default_Model_Menu();
             $objidArr = $menumodel->getMenuObjID('/profiles');
             $objID = $objidArr[0]['id'];
             $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
             if ($id == '') {
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Profile details added successfully."));
             } elseif ($id !== '' && $requisition_id !== '') {
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Profile details Added successfully to Resource Pooling."));
             } else {
                 $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Profile details updated successfully."));
             }
             $this->_redirect('/profiles');
         }
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }
 /**
  * 
  */
 public function deleteAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->_request->getParam('objid');
     $messages['message'] = '';
     $messages['msgtype'] = '';
     $actionflag = 3;
     $flag = 1;
     if ($id) {
         $interview_model = new Default_Model_Interviewdetails();
         $round_model = new Default_Model_Interviewrounddetails();
         $cand_model = new Default_Model_Candidatedetails();
         $menumodel = new Default_Model_Menu();
         $candidateId = $interview_model->getCandidateIdById($id);
         if ($candidateId) {
             $datacand = array('cand_status' => 'Not Scheduled');
             $wherecand = array('id=?' => $candidateId);
             $Idcand = $cand_model->SaveorUpdateCandidateData($datacand, $wherecand);
             if ($Idcand == 'update') {
                 $data = array('isactive' => 0);
                 $where = array('id=?' => $id);
                 $Id = $interview_model->SaveorUpdateInterviewData($data, $where);
                 if ($Id == 'update') {
                     $menuidArr = $menumodel->getMenuObjID('/scheduleinterviews');
                     $menuID = $menuidArr[0]['id'];
                     $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
                     $messages['message'] = 'Schedule Interview deleted successfully';
                     $messages['msgtype'] = 'success';
                     $messages['flagtype'] = 'process';
                 } else {
                     $flag = 0;
                 }
             } else {
                 $flag = 0;
             }
         } else {
             $flag = 0;
         }
     } else {
         $flag = 0;
     }
     if ($flag == 0) {
         $messages['message'] = 'This schedule interview cannot be deleted';
         $messages['msgtype'] = 'error';
         $messages['flagtype'] = 'process';
     }
     $this->_helper->json($messages);
 }
Пример #19
0
 public function viewAction()
 {
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'employee';
     $employeeform = new Default_Form_employee();
     $employeeform->removeElement("submit");
     $elements = $employeeform->getElements();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     if ($id) {
         $employeeModal = new Default_Model_Employee();
         $usersModel = new Default_Model_Users();
         $employmentstatusModel = new Default_Model_Employmentstatus();
         $busineesUnitModel = new Default_Model_Businessunits();
         $deptModel = new Default_Model_Departments();
         $role_model = new Default_Model_Roles();
         $user_model = new Default_Model_Usermanagement();
         $candidate_model = new Default_Model_Candidatedetails();
         $jobtitlesModel = new Default_Model_Jobtitles();
         $positionsmodel = new Default_Model_Positions();
         $prefixModel = new Default_Model_Prefix();
         $data = $employeeModal->getsingleEmployeeData($id);
         if ($data == 'norows') {
             $this->view->rowexist = "norows";
         } else {
             if (!empty($data)) {
                 $this->view->rowexist = "rows";
                 $data = $data[0];
                 $employeeData = $employeeModal->getsingleEmployeeData($data['user_id']);
                 $roles_arr = $role_model->getRolesDataByID($data['emprole']);
                 if (sizeof($roles_arr) > 0) {
                     $employeeform->emprole->addMultiOption($roles_arr[0]['id'] . '_' . $roles_arr[0]['group_id'], utf8_encode($roles_arr[0]['rolename']));
                 }
                 $referedby_options = $user_model->getRefferedByForUsers();
                 $reportingManagerData = $usersModel->getReportingManagerList($data['department_id'], $data['id'], $roles_arr[0]['group_id']);
                 if (!empty($reportingManagerData)) {
                     $employeeform->reporting_manager->addMultiOption('', 'Select a Reporting Manager');
                     if ($roles_arr[0]['group_id'] == MANAGEMENT_GROUP) {
                         $employeeform->reporting_manager->addMultiOption(SUPERADMIN, 'Super Admin');
                     }
                     foreach ($reportingManagerData as $reportingManagerres) {
                         $employeeform->reporting_manager->addMultiOption($reportingManagerres['id'], $reportingManagerres['name']);
                     }
                 }
                 $employeeform->setDefault('reporting_manager', $data['reporting_manager']);
                 $employmentStatusData = $employmentstatusModel->getempstatuslist();
                 if (sizeof($employmentStatusData) > 0) {
                     $employeeform->emp_status_id->addMultiOption('', 'Select a Employment Status');
                     foreach ($employmentStatusData as $employmentStatusres) {
                         $employeeform->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']);
                     }
                 }
                 $businessunitData = $busineesUnitModel->getDeparmentList();
                 if (sizeof($businessunitData) > 0) {
                     $employeeform->businessunit_id->addMultiOption('0', 'No Business Unit');
                     foreach ($businessunitData as $businessunitres) {
                         $employeeform->businessunit_id->addMultiOption($businessunitres['id'], $businessunitres['unitname']);
                     }
                 }
                 $departmentsData = $deptModel->getDepartmentList($data['businessunit_id']);
                 if (sizeof($departmentsData) > 0) {
                     $employeeform->department_id->addMultiOption('', 'Select a Department');
                     foreach ($departmentsData as $departmentsres) {
                         $employeeform->department_id->addMultiOption($departmentsres['id'], $departmentsres['deptname']);
                     }
                 }
                 $jobtitleData = $jobtitlesModel->getJobTitleList();
                 if (sizeof($jobtitleData) > 0) {
                     $employeeform->jobtitle_id->addMultiOption('', 'Select a Job Title');
                     foreach ($jobtitleData as $jobtitleres) {
                         $employeeform->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']);
                     }
                 }
                 $positionlistArr = $positionsmodel->getPositionList($data['jobtitle_id']);
                 if (sizeof($positionlistArr) > 0) {
                     $employeeform->position_id->addMultiOption('', 'Select a Position');
                     foreach ($positionlistArr as $positionlistres) {
                         $employeeform->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']);
                     }
                 }
                 if (isset($data['prefix_id']) && $data['prefix_id'] != '') {
                     $singlePrefixArr = $prefixModel->getsinglePrefixData($data['prefix_id']);
                     if ($singlePrefixArr != 'norows') {
                         $employeeform->prefix_id->addMultiOption($singlePrefixArr[0]['id'], $singlePrefixArr[0]['prefix']);
                     }
                 }
                 $employeeform->populate($data);
                 $employeeform->setDefault('user_id', $data['user_id']);
                 $employeeform->setDefault('emp_status_id', $data['emp_status_id']);
                 $employeeform->setDefault('businessunit_id', $data['businessunit_id']);
                 $employeeform->setDefault('jobtitle_id', $data['jobtitle_id']);
                 $employeeform->setDefault('department_id', $data['department_id']);
                 $employeeform->setDefault('position_id', $data['position_id']);
                 $date_of_joining = sapp_Global::change_date($data['date_of_joining'], 'view');
                 $employeeform->date_of_joining->setValue($date_of_joining);
                 if ($data['date_of_leaving'] != '' && $data['date_of_leaving'] != '0000-00-00') {
                     $date_of_leaving = sapp_Global::change_date($data['date_of_leaving'], 'view');
                     $employeeform->date_of_leaving->setValue($date_of_leaving);
                 }
                 if ($data['modeofentry'] != 'Direct') {
                     $employeeform->rccandidatename->setValue($data['userfullname']);
                 }
                 if (sizeof($referedby_options) > 0 && $data['candidatereferredby'] != '' && $data['candidatereferredby'] != 0) {
                     $employeeform->candidatereferredby->setValue($referedby_options[$data['candidatereferredby']]);
                 }
                 if ($data['rccandidatename'] != '' && $data['rccandidatename'] != 0) {
                     $cand_data = $candidate_model->getCandidateById($data['rccandidatename']);
                     $data['requisition_code'] = $cand_data['requisition_code'];
                 }
                 $employeeform->setAttrib('action', DOMAIN . 'employee/edit/id/' . $id);
                 $this->view->id = $id;
                 $this->view->form = $employeeform;
                 $this->view->employeedata = !empty($employeeData) ? $employeeData[0] : "";
                 $this->view->messages = $this->_helper->flashMessenger->getMessages();
                 $this->view->data = $data;
                 $this->view->controllername = $objName;
                 $this->view->id = $id;
             }
         }
     }
 }
 /**
  * 
  * @param type $form
  * @return type
  */
 public function save($form)
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $requi_model = new Default_Model_Requisition();
     $round_model = new Default_Model_Interviewrounddetails();
     $round_reschedule_model = new Default_Model_Interviewroundrescheduledetails();
     $intrvwModel = new Default_Model_Interviewdetails();
     $user_model = new Default_Model_Usermanagement();
     $cand_model = new Default_Model_Candidatedetails();
     $roundId = $this->getRequest()->getParam('id');
     $intrvwId = $this->getRequest()->getParam('unitId');
     if ($form->isValid($this->_request->getPost())) {
         $reqData = $intrvwModel->getReqByintrvwID($intrvwId);
         if (!empty($reqData)) {
             $reqId = $reqData['req_id'];
             $candid = $reqData['candidate_id'];
             $id = $this->getRequest()->getParam('id');
             $interviewrnd_id = $intrvwId;
             $interviewer_id1 = $this->getRequest()->getParam('interviewer_id');
             if (is_array($interviewer_id1)) {
                 $interview_id = $interviewer_id1[0];
             } else {
                 $interview_id = $interviewer_id1;
             }
             $interview_round = $this->getRequest()->getParam('interview_round');
             $interview_mode = $this->getRequest()->getParam('interview_mode');
             $interview_Type_Details = $this->getRequest()->getParam('interview_Type_Details');
             $int_location = $this->getRequest()->getParam('int_location');
             $interview_time = $this->getRequest()->getParam('interview_time');
             $interview_date = $this->getRequest()->getParam('interview_date');
             $interview_feedback = $this->getRequest()->getParam('interview_feedback');
             $interview_comments = $this->getRequest()->getParam('interview_comments');
             $round_status = $this->getRequest()->getParam('round_status', null);
             $hid_round_status = $this->getRequest()->getParam('hid_round_status', null);
             if (is_array($interviewer_id1)) {
                 $interview_panel = implode(",", $this->getRequest()->getParam('interviewer_id', null));
             } else {
                 $interview_id = $interviewer_id1;
             }
             if ($id != null) {
                 //get Feedback Matrix values from Request
                 $requisitionSkillMatrix = $round_model->getRequisitionSkillMatrix($id);
                 $currRowCount = 0;
                 foreach ($requisitionSkillMatrix as $skill) {
                     $unqCode = $skill['uniquecode'];
                     $skillSelValue = $this->getRequest()->getParam($unqCode, null);
                     if ($skillSelValue != null) {
                         $requisitionSkillMatrix[$currRowCount]['Rating'] = $skillSelValue;
                     }
                     $currRowCount++;
                 }
             }
             //check if Skill matrix is filled as per business logic
             $skillsmatrixvalidate = true;
             if ($round_status == "Schedule for next round" || $round_status == "Qualified" || $round_status == "Selected" || $round_status == "Disqualified") {
                 if ($interview_round == "Technical") {
                     foreach ($requisitionSkillMatrix as $skill) {
                         if ($skill['Category'] == "Technical" && ($skill['Rating'] <= 0 || $skill['Rating'] == null)) {
                             $skillsmatrixvalidate = false;
                             break;
                         }
                     }
                 }
                 /* else if ($interview_round == "Managerial") {
                    foreach ($requisitionSkillMatrix as $skill) {
                    if ($skill['Category'] == "Non-Technical" && ($skill['Rating'] <= 0 || $skill['Rating'] == null)) {
                    $skillsmatrixvalidate = false;
                    break;
                    }
                    }
                    } */
             }
             if ($skillsmatrixvalidate != true) {
                 $alertMsg = ($interview_round == "Managerial" ? 'Non-Technical' : 'Technical') . " Skill Rating is Mandatory...!";
                 echo '<script language="javascript">';
                 echo 'alert("' . $alertMsg . '")';
                 echo '</script>';
             } else {
                 // for Interview Reschedule & Cancellations
                 if ($round_status == "Re-Scheduled-Interviewer Request" || $round_status == "Re-Scheduled-Candidate Request" || $round_status == "Cancelled") {
                     $round_data = $round_model->getSingleRoundData($id);
                     $cand_data = $cand_model->getCandidateById($candid);
                     $requisition_data = $requi_model->getRequisitionDataById($reqId);
                     $interviewpanelnamesemailaddress = $requi_model->GetInterviewPanelMamesEmailaddress($round_data['interview_panel']);
                     $loginuser_person_data = $user_model->getUserDataById($loginUserId);
                     $data = array('interviewround_id' => $id, 'interview_id' => trim($intrvwId), 'req_id' => $reqId, 'candidate_id' => $candid, 'interview_location_old' => $round_data['int_location'], 'interview_round_old' => $round_data['interview_round'], 'interview_date_old' => $round_data['interview_date'], 'interview_time_old' => $round_data['interview_time'], 'interview_mode_old' => $round_data['interview_mode'], 'interview_mode_details_old' => $round_data['interview_mode_details'], 'interview_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'interview_feedback' => trim($interview_feedback), 'round_status' => trim($round_status), 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"));
                     $result1 = $round_reschedule_model->SaveorUpdateInterviewroundData($data, "");
                     $intRound_where = array("id = " . $id);
                     if ($round_status == "Cancelled") {
                         $data_intRound = array('int_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 0);
                     } else {
                         $data_intRound = array('int_location' => $int_location, 'interview_round' => $interview_round, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_mode' => $interview_mode, 'interview_mode_details' => $interview_Type_Details, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel);
                     }
                     $result2 = $round_model->SaveorUpdateInterviewroundData($data_intRound, $intRound_where);
                     if ($result1 > 0 && $result2 == "update") {
                         //send Reschedule meeting invite
                         $emailtemp = array();
                         $nametemp = array();
                         foreach ($interviewpanelnamesemailaddress as $row) {
                             array_push($emailtemp, $row['emailaddress']);
                             array_push($nametemp, $row['userfullname']);
                         }
                         $email = implode(";", $emailtemp);
                         $ename = implode(";", $nametemp);
                         $cal_unique_id = $round_data['calendarinviteid'];
                         $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                         $description = "Meeting From : " . $ename . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n";
                         //$view = $this->getHelper('ViewRenderer')->view;
                         //$this->view->emp_name = "Interviewer";
                         //$this->view->base_url = $base_url;
                         //$this->view->candidate_name = $cand_data['candidate_name'];
                         //$this->view->interview_type = $interview_mode;
                         //$this->view->interview_mode_details = $interview_Type_Details;
                         //$this->view->interview_location = $int_location;
                         //$this->view->interview_date = $interview_date;
                         //$this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                         //$this->view->requisition_code = $requisition_data['requisition_code'];
                         //$text = $view->render('mailtemplates/interviewrounds.phtml');
                         //$options['subject'] = APPLICATION_NAME . ': Interview schedule';
                         //$options['header'] = 'Interview schedule';
                         //$options['toEmail'] = $email;
                         //$options['toName'] = $ename;
                         //$options['message'] = $description;
                         //$options['location'] = $int_location;
                         //$options['interviewdate'] = $interview_date;
                         //$options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0);
                         //$options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600);
                         //Interview Calendar Invite will be send from login user account
                         //$options['fromEmail'] = $loginuser_person_data['emailaddress'];
                         //$options['fromName'] = $loginuser_person_data['userfullname'];
                         //$options['fromEmail'] = SUPERADMIN_EMAIL;
                         //$options['fromName'] = "*****@*****.**";
                         //$options['calUniqueID'] = $cal_unique_id;
                         $calRequest = 'REQUEST';
                         if ($round_status == "Cancelled") {
                             $calRequest = 'CANCEL';
                         }
                         $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel);
                         foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) {
                             //sapp_Global::_sendCalendarEmail($options);
                             $from_name = trim($loginuser_person_data['userfullname']);
                             $from_address = trim($loginuser_person_data['emailaddress']);
                             $to_name = trim($interviewpanelnamesemailaddress['userfullname']);
                             $to_address = trim($interviewpanelnamesemailaddress['emailaddress']);
                             $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600);
                             $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)));
                             $subject = APPLICATION_NAME . ': Interview schedule';
                             $location = $int_location;
                             sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id);
                         }
                         $irwhere = "id = " . $result1;
                         $irdata = array('calendarinviteid' => $cal_unique_id);
                         $interview_round_model = new Default_Model_Interviewrounddetails();
                         $ir_result1 = $interview_round_model->SaveorUpdateInterviewroundData($irdata, $irwhere);
                         $this->view->eventact = 'updated';
                         $actionflag = 1;
                         $menumodel = new Default_Model_Menu();
                         $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
                         $objID = $objidArr[0]['id'];
                         $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId);
                         $close = 'close';
                         $this->view->popup = $close;
                         $this->view->ermsg = '';
                     }
                 } else {
                     $data = array('candidate_id' => $candid, 'req_id' => $reqId, 'interview_id' => trim($intrvwId), 'interviewer_id' => $interview_id, 'interview_mode' => trim($interview_mode), 'interview_mode_details' => $interview_Type_Details, 'int_location' => trim($int_location), 'int_country' => trim($this->_getParam('country', null)), 'int_state' => trim($this->_getParam('state', null)), 'int_city' => trim($this->_getParam('city', null)), 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_round' => trim($interview_round), 'interview_feedback' => trim($interview_feedback), 'interview_comments' => trim($interview_comments), 'round_status' => trim($round_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"), 'interview_panel' => $interview_panel);
                     if ($interviewrnd_id != null) {
                         $roundnumberData = $intrvwModel->getinterviewroundnumber($interviewrnd_id);
                         $roundnumber = $roundnumberData['interview_round_number'];
                     }
                     $data['interview_round_number'] = $roundnumber + 1;
                     $currentinterviewroundnumber = $roundnumber;
                     $where = "";
                     $actionflag = 1;
                     if ($id != '') {
                         //update skill matrix to DB
                         if ($round_status == "Schedule for next round" || $round_status == "Qualified" || $round_status == "Selected" || $round_status == "Disqualified") {
                             $skillupdateresult = $round_model->UpdateOrInsertCandidateSkillMatrix($requisitionSkillMatrix, $id, $intrvwId, $reqId, $candid, $loginUserId, $currentinterviewroundnumber);
                         }
                         unset($data['interview_panel']);
                         unset($data['createdby']);
                         unset($data['createdon']);
                         unset($data['isactive']);
                         unset($data['interview_round_number']);
                         $where = array("id = " . $id);
                         $tableid = $id;
                         $actionflag = 2;
                         if ($hid_round_status != '') {
                             $data = array();
                             $data['round_status'] = trim($round_status);
                         }
                     }
                     if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $interviewer_id == $loginUserId) {
                         unset($data['interviewer_id']);
                         unset($data['interview_mode']);
                         unset($data['int_location']);
                         unset($data['int_country']);
                         unset($data['int_state']);
                         unset($data['int_city']);
                         unset($data['interview_time']);
                         unset($data['interview_date']);
                         unset($data['interview_round']);
                     }
                     $result = $round_model->SaveorUpdateInterviewroundData($data, $where);
                     //upadating invite calander id if interview round id is numeric
                     if (is_numeric($result)) {
                         //updating calendarinviteid column in main_interviewrounddetails tabel - start
                         $startTime = sapp_Global::add_time($interview_time, 'view', 0);
                         //$domain = 'deltaintech.com';
                         //$cal_unique_id = date("Ymd\TGis", strtotime($startTime)) . rand() . "@" . $domain;
                         $irwhere = "id = " . $result;
                         $irdata = array('calendarinviteid' => $cal_unique_id);
                         $interview_round_model1 = new Default_Model_Interviewrounddetails();
                         $ir_result1 = $interview_round_model1->SaveorUpdateInterviewroundData($irdata, $irwhere);
                     }
                     //upadating invite calander id if interview round id is numeric - End
                     if ($id == '') {
                         //start of mailing
                         $requisition_data = $requi_model->getRequisitionDataById($reqId);
                         $cand_data = $cand_model->getCandidateById($candid);
                         /* $report_person_data = $user_model->getUserDataById($interviewer_id);
                            $mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "",
                            $report_person_data['userfullname'] => $report_person_data['emailaddress']
                            ); */
                         $report_person_data = $user_model->getUserDataById($interviewer_id);
                         $currentrequisition_data = $requi_model->getrequisitiondetails($reqId);
                         $requesteremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["createdby"]);
                         $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["reporting_id"]);
                         $hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]);
                         $mail_arr = array('HR' => $hrgroupemail["groupEmail"], $report_person_data['userfullname'] => $report_person_data['emailaddress'], $requesteremailaddress['userfullname'] => $requesteremailaddress['emailaddress'], $reportingmanageremailaddress['userfullname'] => $reportingmanageremailaddress['emailaddress']);
                         //foreach ($mail_arr as $ename => $email) {
                         //$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
                         $description = "Meeting From : " . $ename . "\r\n" . "Candidate Name : " . $cand_data['candidate_name'] . "\r\n" . "Interview Type : " . $interview_mode . "\r\n" . "Interview Location : " . $int_location . "\r\n" . "Interview Date : " . $interview_date . "\r\n" . "Interview Time : " . sapp_Global::change_time($interview_time, 'view') . "\r\n" . " " . " " . "\r\n";
                         //$view = $this->getHelper('ViewRenderer')->view;
                         //$this->view->emp_name = $ename;
                         //$this->view->base_url = $base_url;
                         //$this->view->candidate_name = $cand_data['candidate_name'];
                         //$this->view->interview_type = $interview_mode;
                         //$interview_Type_Details
                         //$this->view->interview_location = $int_location;
                         //$this->view->interview_date = $interview_date;
                         //$this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
                         //$this->view->requisition_code = $requisition_data['requisition_code'];
                         //$text = $view->render('mailtemplates/interviewrounds.phtml');
                         //$options['subject'] = APPLICATION_NAME . ': Interview schedule';
                         //$options['header'] = 'Interview schedule';
                         //$options['toEmail'] = $email;
                         //$options['toName'] = $ename;
                         //$options['message'] = $description;
                         ////$options['cron'] = 'yes';
                         //additional properties for Calendar invite -------------------START
                         //$options['interviewdate'] = $interview_date;
                         //$options['location'] = $int_location;
                         //$options['starttime'] = sapp_Global::add_time($interview_time, 'view', 0);
                         //$options['endtime'] = sapp_Global::add_time($interview_time, 'view', 3600);
                         //$options['calUniqueID'] = $cal_unique_id;
                         //additional properties for Calendar invite -------------------END
                         //sapp_Global::_sendCalendarEmail($options);
                         $loginuser_person_data = $user_model->getUserDataById($loginUserId);
                         $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($interview_panel);
                         foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress) {
                             $cal_unique_id = $this->getCalendarUniqueID();
                             $from_name = trim($loginuser_person_data['userfullname']);
                             $from_address = trim($loginuser_person_data['emailaddress']);
                             $to_name = trim($interviewpanelnamesemailaddress['userfullname']);
                             $to_address = trim($interviewpanelnamesemailaddress['emailaddress']);
                             $startTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)), 3600);
                             $endTime = sapp_Global::_getInterviewStartDateTime(sapp_Global::change_date($interview_date), sapp_Global::change_time(trim($interview_time)));
                             $subject = APPLICATION_NAME . ': Interview schedule';
                             $location = $int_location;
                             $calRequest = 'REQUEST';
                             sapp_Global::sendIcalEvent($from_name, $from_address, $to_name, $to_address, $startTime, $endTime, $subject, $description, $location, $calRequest, $cal_unique_id);
                         }
                         //}
                         //end of mailing
                         $tableid = $result;
                         $this->view->eventact = 'scheduled';
                     } else {
                         if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == MANAGEMENT_GROUP) {
                             $requisition_data = $requi_model->getRequisitionDataById($reqId);
                             $requisition_data_View = $requi_model->getReqDataForView($reqId);
                             $cand_data = $cand_model->getCandidateById($candid);
                             $round_data = $round_model->getSingleRoundData($id);
                             $report_person_data = $user_model->getUserDataById($interviewer_id);
                             $currentrequisition_data = $requi_model->getrequisitiondetails($reqId);
                             $requesteremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["createdby"]);
                             $reportingmanageremailaddress = $requi_model->getemployeeemailaddress($currentrequisition_data["reporting_id"]);
                             //$hrgroupemail = $requi_model->getgroupemailid("REQ_HR", $requisition_data["department_id"]);
                             //HR Group
                             $mail_arr[0]['name'] = 'HR';
                             $mail_arr[0]['email'] = constant('REQ_HR_0');
                             //Requester
                             $mail_arr[1]['name'] = $requesteremailaddress['userfullname'];
                             $mail_arr[1]['email'] = $requesteremailaddress['emailaddress'];
                             //Reporting Manager
                             $mail_arr[2]['name'] = $reportingmanageremailaddress['userfullname'];
                             $mail_arr[2]['email'] = $reportingmanageremailaddress['emailaddress'];
                             //Management Group
                             $mail_arr[3]['name'] = 'Management';
                             $mail_arr[3]['email'] = constant('REQ_MGMT_0');
                             //Recruiter Panel
                             $requisition_recruiters_data = $requi_model->GetRequisitionRecruiterEmailaddress($currentrequisition_data["requisition_code"]);
                             $emailCnt = 4;
                             foreach ($requisition_recruiters_data as $requisition_recruiters_data1) {
                                 $mail_arr[$emailCnt]['name'] = $requisition_recruiters_data1['userfullname'];
                                 $mail_arr[$emailCnt]['email'] = $requisition_recruiters_data1['emailaddress'];
                                 $emailCnt = $emailCnt + 1;
                             }
                             //Technical Panel
                             $interviewpanelnamesemailaddresss = $requi_model->GetInterviewPanelMamesEmailaddress($round_data['interview_panel']);
                             foreach ($interviewpanelnamesemailaddresss as $interviewpanelnamesemailaddress1) {
                                 $mail_arr[$emailCnt]['name'] = $interviewpanelnamesemailaddress1['userfullname'];
                                 $mail_arr[$emailCnt]['email'] = $interviewpanelnamesemailaddress1['emailaddress'];
                                 $emailCnt = $emailCnt + 1;
                             }
                             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->type = 'InterviewFeedback';
                                 $this->view->requisition_data = $requisition_data_View[0];
                                 $this->view->candidate_details = $cand_data;
                                 $this->view->round_data = $round_data;
                                 $this->view->base_url = $base_url;
                                 $text = $view->render('mailtemplates/requisition.phtml');
                                 $options['subject'] = APPLICATION_NAME . ': Interview feedback';
                                 //$options['header'] = 'Interview feedback';
                                 $options['toEmail'] = $mail_arr[$ii]['email'];
                                 $options['toName'] = $mail_arr[$ii]['name'];
                                 $options['message'] = $text;
                                 sapp_Global::_sendEmail($options, "interviewrounds_feedback", REQUISITIONMODULESENDEMAIL);
                             }
                         }
                         $tableid = $id;
                         $this->view->eventact = 'updated';
                     }
                     $menumodel = new Default_Model_Menu();
                     $objidArr = $menumodel->getMenuObjID('/scheduleinterviews');
                     $objID = $objidArr[0]['id'];
                     $result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $intrvwId);
                     $close = 'close';
                     $this->view->popup = $close;
                     $this->view->ermsg = '';
                 }
             }
         } else {
             $this->view->ermsg = 'nodata';
         }
     } else {
         $messages = $form->getMessages();
         foreach ($messages as $key => $val) {
             foreach ($val as $key2 => $val2) {
                 $msgarray[$key] = $val2;
                 break;
             }
         }
         return $msgarray;
     }
 }