/**
  * This action is used for adding/updating data.
  * @parameters
  * @param $id  =  id of requisition.
  *
  * @return Zend_Form.
  */
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id', null);
     $auth = Zend_Auth::getInstance();
     $data = array();
     $data_m = array();
     $ipreporting_idData = array();
     $ipreporting_ids = array();
     $technicalskills_all = array();
     $technicalskills_selected = array();
     $nontechnicalskills_all = array();
     $nontechnicalskills_selected = array();
     $job_title_permission = NULL;
     if ($auth->hasIdentity()) {
         $sess_vals = $auth->getStorage()->read();
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $job_title_permission = sapp_Global::_checkprivileges(JOBTITLES, $loginuserGroup, $loginuserRole, 'add');
     //$positions_permission = sapp_Global::_checkprivileges(POSITIONS, $loginuserGroup, $loginuserRole, 'add');
     $emp_status_permission = sapp_Global::_checkprivileges(EMPLOYMENTSTATUS, $loginuserGroup, $loginuserRole, 'add');
     $form = new Default_Form_Requisition();
     $requi_model = new Default_Model_Requisition();
     $usersModel = new Default_Model_Users();
     $user_model = new Default_Model_Usermanagement();
     $ipreporting_idData = $requi_model->getAllEmployees();
     $ipreporting_ids = $requi_model->getRequisitionInterviewPanelIDs($id);
     $technicalskills_all = $requi_model->getAllActiveTechnicalSkills();
     $technicalskills_selected = $requi_model->getRequisitionSkillIDs($id, "Technical");
     $nontechnicalskills_all = $requi_model->getAllActiveNonTechnicalSkills();
     $nontechnicalskills_selected = $requi_model->getRequisitionSkillIDs($id, "Non-Technical");
     $form->setAttrib('action', DOMAIN . 'requisition/edit/id/' . $id);
     $form->submit->setLabel('Update');
     $edit_flag = '';
     $edit_order = '';
     $approver1_opt = array();
     $approver2_opt = array();
     $reportingManagerData = array();
     $hrexecutivesData = array();
     try {
         if ($id > 0 && is_numeric($id)) {
             $id = abs($id);
             //$data['id'] = $id;
             $data = $requi_model->getRequisitionForEdit($id, $loginUserId);
             //$data['requ_jd'] = "<span title='" . htmlentities(trim($data['requ_jd']), ENT_QUOTES, "UTF-8") . "'><a href='" . DOMAIN . 'requisition/download/id/' . $id . "'>" . $data['requ_jd'] . "</a></span>";
             $getempId = $requi_model->getrequisitionDataonid($id);
             if (!empty($getempId['billable_empname'])) {
                 $getdatampname = $requi_model->getEmployeeNameonId($getempId['billable_empname']);
             }
             $aflag = $data['aflag'];
             if ($aflag == "approver") {
                 $aorder = 1;
             }
             //$aorder = $data['aorder'];
             if (!empty($data) && $data['req_status'] == 'Initiated') {
                 if ($loginuserGroup != MANAGEMENT_GROUP || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == '') {
                     if ($aflag == 'approver' && $data['appstatus' . $aorder] == 'Initiated') {
                         $data['onboard_date'] = sapp_Global::change_date($data['onboard_date'], 'view');
                         $business_units_list = $requi_model->getBusinessUnitsList();
                         $data['bunit_name'] = $business_units_list[$data['businessunit_id']];
                         $departments_list = $requi_model->getDepartmentList($data['businessunit_id']);
                         $data['dept_name'] = $departments_list[$data['department_id']];
                         $job_data = $requi_model->getJobTitleList();
                         if (isset($job_data[$data['jobtitle']])) {
                             $data['jtitle_name'] = $job_data[$data['jobtitle']];
                         } else {
                             $data['jtitle_name'] = 'Select Job Title';
                         }
                         //                            $pos_data = $requi_model->getPositionOptions($data['jobtitle']);
                         //                            $data['position_name'] = $pos_data[$data['position_id']];
                         $emptype_options = $requi_model->getStatusOptionsForRequi();
                         if (isset($emptype_options[$data['emp_type']])) {
                             $data['emptype_name'] = $emptype_options[$data['emp_type']];
                         } else {
                             $data['emptype_name'] = 'Select Employment Status';
                         }
                         $report_manager_data = $user_model->getUserDataById($data['reporting_id']);
                         $data['mngrname'] = $report_manager_data['userfullname'];
                         $form->req_status->addMultiOptions(array('0' => 'Select status', '2' => 'Approved', '3' => 'Rejected'));
                         $form->req_status->setRequired(true)->addErrorMessage('Please select the status.');
                         $form->req_status->addFilter('Int')->addValidator('NotEmpty', true, array('integer', 'zero'));
                         $elements = $form->getElements();
                         if (count($elements) > 0) {
                             foreach ($elements as $key => $element) {
                                 if ($key != 'req_status') {
                                     $element->setRequired(false);
                                 }
                             }
                         }
                         if ($data['approver1'] != '') {
                             $app1_opt = $user_model->getUserDataById($data['approver1']);
                             $data_m['approver1'] = $app1_opt['userfullname'];
                         }
                         if ($data['approver2'] != '') {
                             $app2_opt = $user_model->getUserDataById($data['approver2']);
                             $data_m['approver2'] = $app2_opt['userfullname'];
                         }
                     } else {
                         $edit_flag = 'no';
                         if (in_array('Approved', array($data['appstatus1'], $data['appstatus2'], $data['appstatus3']))) {
                             $edit_flag = 'yes';
                         }
                         if ($edit_flag == 'yes') {
                             $data['onboard_date'] = sapp_Global::change_date($data['onboard_date'], 'view');
                             $business_units_list = $requi_model->getBusinessUnitsList();
                             $data['bunit_name'] = $business_units_list[$data['businessunit_id']];
                             $departments_list = $requi_model->getDepartmentList($data['businessunit_id']);
                             $data['dept_name'] = $departments_list[$data['department_id']];
                             $job_data = $requi_model->getJobTitleList();
                             if (isset($job_data[$data['jobtitle']])) {
                                 $data['jtitle_name'] = $job_data[$data['jobtitle']];
                             } else {
                                 $data['jtitle_name'] = 'Select Job Title';
                             }
                             //                                $pos_data = $requi_model->getPositionOptions($data['jobtitle']);
                             //                                $data['position_name'] = $pos_data[$data['position_id']];
                             $emptype_options = $requi_model->getStatusOptionsForRequi();
                             if (isset($emptype_options[$data['emp_type']])) {
                                 $data['emptype_name'] = $emptype_options[$data['emp_type']];
                             } else {
                                 $data['emptype_name'] = 'Select Employment Status';
                             }
                             $report_manager_data = $user_model->getUserDataById($data['reporting_id']);
                             $data['mngrname'] = $report_manager_data['userfullname'];
                             $elements = $form->getElements();
                             if (count($elements) > 0) {
                                 foreach ($elements as $key => $element) {
                                     $element->setRequired(false);
                                 }
                             }
                             if ($data['appstatus1'] == 'Approved') {
                                 $edit_order = 1;
                                 $app1_opt = $user_model->getUserDataById($data['approver1']);
                                 $data_m['approver1'] = $app1_opt['userfullname'];
                                 $report_manager_options = $requi_model->getapprovers($data['reporting_id'], $data['department_id']);
                                 $form->setDefault('approver1', $data['approver1']);
                             }
                         } else {
                             #$form->setDefault('requ_jd', $data['requ_jd']);
                             $business_units_list = $requi_model->getBusinessUnitsList();
                             $form->business_unit->addMultiOptions(array('' => 'Select Business Unit') + $business_units_list);
                             $form->setDefault('business_unit', $data['businessunit_id']);
                             $departments_list = $requi_model->getDepartmentList($data['businessunit_id']);
                             $form->department->addMultiOptions(array('' => 'Select Department') + $departments_list);
                             $form->setDefault('department', $data['department_id']);
                             $job_data = $requi_model->getJobTitleList();
                             $form->jobtitle->addMultiOptions(array('' => 'Select Job Title') + $job_data);
                             $form->setDefault('jobtitle', $data['jobtitle']);
                             //                                $pos_data = $requi_model->getPositionOptions($data['jobtitle']);
                             //                                $form->position_id->addMultiOptions(array('' => 'Select Position') + $pos_data);
                             //                                $form->setDefault('position_id', $data['position_id']);
                             $emptype_options = $requi_model->getStatusOptionsForRequi();
                             $form->emp_type->addMultiOptions(array('' => 'Select Employment Status') + $emptype_options);
                             $form->technology->addMultiOptions(array('' => 'Select Technology') + $requi_model->getTechnologySkillIDName());
                             $form->setDefault('technology', $data['technology']);
                             $form->setDefault('reporting_id', $data['reporting_id']);
                             $form->billablefor->addMultiOptions(array('' => 'Select Billable Type', 'New' => 'New', 'Replacement' => 'Replacement', 'Backup' => 'Backup'));
                             $form->setDefault('billablefor', $getempId['billable_for']);
                             $form->setDefault('requ_jd', $getempId['upload_jd']);
                             $form->requ_jd->setRequired(false);
                             //$form->requisition_code->setValue($ipreporting_ids);
                             //$form->ipreporting_id->addMultiOptions(array('' => 'Select Technical Panel') + $ipreporting_idData);
                             //$form->ipreporting_id->setValue($data['requisition_code']);
                             //$form->ipreporting_id->setMultiOptions($ipreporting_ids);
                             $form->req_status->addMultiOptions(array('1' => 'Initiated'));
                             if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) {
                                 if ($loginuserGroup == '') {
                                     $reportingManagerData = $requi_model->getReportingmanagers('', $loginUserId, '', $data['department_id'], 'requisition');
                                 } else {
                                     $reportingManagerData = $requi_model->getReportingmanagers('', '', '', $data['department_id'], 'requisition');
                                 }
                                 if ($loginuserGroup == HR_GROUP || $loginuserGroup == '' || $loginuserGroup == MANAGEMENT_GROUP) {
                                     if ($loginuserGroup == '') {
                                         $getEmployeelistonBunit = $requi_model->getEmployeelistonBunit('', $data['business_unit'], 'requisition');
                                     } else {
                                         $getEmployeelistonBunit = $requi_model->getEmployeelistonBunit('', $data['business_unit'], 'requisition');
                                     }
                                     //for hr,management
                                     $re_arr = array();
                                 }
                                 if (isset($_POST['business_unit']) && $_POST['business_unit'] != '') {
                                     $departments_list = $requi_model->getDepartmentList($_POST['business_unit']);
                                     $form->department->addMultiOptions(array('' => 'Select Department') + $departments_list);
                                 }
                                 if (isset($_POST['department']) && $_POST['department'] != '') {
                                     $reportingManagerData = $requi_model->getReportingmanagers('', $loginUserId, '', $_POST['department'], 'requisition');
                                 }
                                 $form->reporting_id->addMultiOptions(array('' => 'Select Reporting Manager') + $reportingManagerData);
                                 $form->setDefault('reporting_id', $data['reporting_id']);
                                 $form->setDefault('req_status', $data['req_status']);
                                 $form->req_status->setAttrib("disabled", "disabled");
                                 if ($loginuserGroup == HR_GROUP) {
                                     $departments_list = $requi_model->getDepartmentList($sess_vals->businessunit_id);
                                     $data_m['bunit_data']['id'] = $sess_vals->businessunit_id;
                                     $data_m['bunit_data']['name'] = $business_units_list[$sess_vals->businessunit_id];
                                     $form->department->addMultiOptions(array('' => 'Select Department') + $departments_list);
                                 }
                             } else {
                                 //for managers login
                                 $report_manager_options = $user_model->getUserDataById($data['reporting_id']);
                                 $departments_list = $requi_model->getDepartmentList($data['businessunit_id']);
                                 $data_m['manager_data']['id'] = $data['reporting_id'];
                                 $data_m['manager_data']['name'] = $report_manager_options['userfullname'];
                                 $data_m['bunit_data']['id'] = $data['businessunit_id'];
                                 $data_m['bunit_data']['name'] = $business_units_list[$data['businessunit_id']];
                                 $data_m['dept_data']['id'] = $data['department_id'];
                                 $data_m['dept_data']['name'] = $departments_list[$data['department_id']];
                                 $form->setDefault('reporting_id', $data['reporting_id']);
                                 $form->setDefault('req_status', $data['req_status']);
                                 $form->req_status->setAttrib("disabled", "disabled");
                             }
                             $hrexecutivesData = $requi_model->getHRExecutives();
                             //start of approvers options
                             $approver_opt = $requi_model->getapprovers($data['reporting_id'], $data['department_id']);
                             $app1_opt = array();
                             if (count($approver_opt) > 0 && count($_POST) == 0) {
                                 foreach ($approver_opt as $app1) {
                                     $approver1_opt[] = array('id' => $app1['id'], 'name' => ucwords($app1['name']), 'profileimg' => $app1['profileimg']);
                                 }
                             }
                             //end of approvers options
                             foreach ($data as $key => $val) {
                                 $data[$key] = htmlentities(addslashes($val), ENT_QUOTES, "UTF-8");
                             }
                             $data['onboard_date'] = sapp_Global::change_date($data['onboard_date'], 'view');
                             $form->populate($data);
                             if (isset($_POST['business_unit']) && $_POST['business_unit'] != '') {
                                 $departments_list = $requi_model->getDepartmentList($_POST['business_unit']);
                                 $form->department->clearMultiOptions();
                                 $form->department->addMultiOptions(array('' => 'Select Department') + $departments_list);
                             }
                             //                                if (isset($_POST['jobtitle']) && $_POST['jobtitle'] != '') {
                             //                                    $pos_data = $requi_model->getPositionOptions($_POST['jobtitle']);
                             //                                    $form->position_id->clearMultiOptions();
                             //                                    $form->position_id->addMultiOptions(array('' => 'Select Position') + $pos_data);
                             //                                }
                             if (isset($_POST['reporting_id']) && $_POST['reporting_id'] != '') {
                                 $app1_data = $requi_model->getapprovers($_POST['reporting_id'], $_POST['department']);
                                 $app1_opt = array();
                                 if (count($app1_data) > 0) {
                                     foreach ($app1_data as $app1) {
                                         $app1_opt[$app1['id']] = ucwords($app1['name']);
                                         $approver1_opt[] = array('id' => $app1['id'], 'name' => ucwords($app1['name']), 'profileimg' => $app1['profileimg']);
                                     }
                                     $form->reporting_id->setValue($_POST['reporting_id']);
                                 }
                             }
                         }
                     }
                     //end of else of aflag.
                     $this->view->loginuserGroup = $loginuserGroup;
                     $this->view->form = $form;
                     $this->view->data = $data;
                     $this->view->data_m = $data_m;
                     $this->view->aflag = $aflag;
                     $this->view->aorder = $aorder;
                     $this->view->edit_flag = $edit_flag;
                     $this->view->edit_order = $edit_order;
                     $this->view->reportingManagerData = $reportingManagerData;
                     $this->view->hrexecutivesData = $hrexecutivesData;
                     $this->view->approver1_opt = $approver1_opt;
                     $this->view->approver2_opt = $approver2_opt;
                     $this->view->ipreporting_idData = $ipreporting_idData;
                     $this->view->ipreporting_ids = $ipreporting_ids;
                     $this->view->technicalskills_all = $technicalskills_all;
                     $this->view->technicalskills_selected = $technicalskills_selected;
                     $this->view->nontechnicalskills_all = $nontechnicalskills_all;
                     $this->view->nontechnicalskills_selected = $nontechnicalskills_selected;
                     $this->view->getEmployeelistonBunit = $getEmployeelistonBunit;
                     $this->view->getempId = $getempId;
                     $this->view->getdatampname = $getdatampname;
                     if ($this->getRequest()->getPost()) {
                         $result = $this->save($form, $data);
                         $this->view->msgarray = $result;
                         $this->view->messages = $result;
                     }
                     $this->view->ermsg = '';
                 } else {
                     $this->view->nodata = 'nodata';
                 }
             } else {
                 $this->view->nodata = 'nodata';
             }
         } else {
             $this->view->nodata = 'nodata';
         }
         // To check whether to display Employment Status configuration link or not
         $employmentstatusmodel = new Default_Model_Employmentstatus();
         $activeEmploymentStatusArr = $employmentstatusmodel->getEmploymentStatuslist();
         $this->view->job_title_permission = $job_title_permission;
         $this->view->positions_permission = $positions_permission;
         $this->view->emp_status_permission = $emp_status_permission;
     } catch (Exception $e) {
         $this->view->nodata = 'nodata';
     }
 }
 /**
  * 
  */
 public function editAction()
 {
     $id = $this->getRequest()->getParam('id');
     $data = array();
     $additionaldata = array();
     $hrexecutivesData = array();
     $hrselectedexecutivesData_ids = 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', DOMAIN . '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);
             $additionaldata = $requi_model->getReqDataForView($id);
             $hrselectedexecutivesData_ids = $requi_model->getRequisitionHRPanelIDs($id);
             if (count($data) > 0 && $data['req_status'] != 'Initiated') {
                 $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");
                     if ($key == 'jdfilename') {
                         if (isset($val)) {
                             $data[$key] = "<a href='" . DOMAIN . 'requisition/download/id/' . $id . "'>View Job Description file.</a>";
                         } else {
                             $data[$key] = "--No Job Description file exists...";
                         }
                     } else {
                         $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' && $loginUserId == trim($data['createdby'])) {
                     $form->req_status->addMultiOptions(array('Approved' => 'Approved', 'Closed' => 'Closed', 'On hold' => 'On hold'));
                 } else {
                     if ($data['req_status'] == 'Approved' || $data['req_status'] == 'In process' && $loginUserId == trim($data['createdby'])) {
                         $form->req_status->addMultiOptions(array('In process' => 'In process', 'Closed' => 'Closed', 'On hold' => 'On hold'));
                     } else {
                         if ($data['req_status'] == 'Approved' || $data['req_status'] == 'In process' && $loginuserGroup == HR_GROUP) {
                             $form->req_status->addMultiOptions(array('Approved' => 'Approved', 'In process' => 'In process'));
                             $form->req_status->setAttrib('disabled', 'disabled');
                         } else {
                             if ($data['req_status'] == 'Closed') {
                                 $form->req_status->addMultiOptions(array('Closed' => 'Closed'));
                                 $form->req_status->setAttrib('disabled', 'disabled');
                                 $form->removeElement('submit');
                             } else {
                                 if ($data['req_status'] == 'Rejected') {
                                     $form->req_status->addMultiOptions(array('Rejected' => 'Rejected'));
                                     $form->req_status->setAttrib('disabled', 'disabled');
                                     $form->removeElement('submit');
                                 } else {
                                     $form->req_status->addMultiOptions(array('Closed' => 'Closed', 'On hold' => 'On hold', 'In process' => 'In process'));
                                     $form->req_status->setAttrib('disabled', 'disabled');
                                 }
                             }
                         }
                     }
                 }
                 $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']);
                 try {
                     $hrexecutivesData = $requi_model->getHRExecutives();
                     $this->view->hrexecutivesData = $hrexecutivesData;
                 } catch (Exception $err1) {
                 }
                 $this->view->data = $data;
                 $this->view->additionaldata = $additionaldata;
                 $this->view->loginuserGroup = $loginuserGroup;
                 $this->view->form = $form;
                 $this->view->id = $id;
                 $this->view->edit_duedate = 'no';
                 $this->view->hrselectedexecutivesData_ids = $hrselectedexecutivesData_ids;
                 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';
     }
 }