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'; } }
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'; } }
public function indexAction() { $call = $this->_getParam('call'); if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { } $id = $this->_request->getParam('unitId', null); $refresh = $this->_getParam('refresh'); $data = array(); $searchQuery = ''; $searchArray = array(); $tablecontent = ''; if ($refresh == 'refresh') { $sort = 'DESC'; $by = 'c.createddate'; $perPage = 10; $pageNo = 1; $searchData = ''; $searchQuery = ''; $searchQuery = ''; $searchArray = ''; $searchArray = array(); } else { $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); /** 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', 'unitId' => $id, 'search_filters' => array('cand_status' => array('type' => 'select', 'filter_data' => $cand_status_opt))); array_push($data, $dataTmp); $this->view->dataArray = $dataTmp; $this->view->call = $call; $this->view->messages = $this->_helper->flashMessenger->getMessages(); }