public function getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $statusid, $a1, $a2, $a3) { $searchQuery = ''; $searchArray = array(); $data = array(); $requi_model = new Default_Model_Requisition(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } if ($searchData != '' && $searchData != 'undefined') { $searchValues = json_decode($searchData); if (count($searchValues) > 0) { foreach ($searchValues as $key => $val) { if ($key == 'onboard_date' || $key == 'r.createdon') { $searchQuery .= " date(" . $key . ") = '" . sapp_Global::change_date($val, 'database') . "' AND "; } else { $searchQuery .= " " . $key . " like '%" . $val . "%' AND "; } $searchArray[$key] = $val; } $searchQuery = rtrim($searchQuery, " AND"); } } $objName = 'rejectedrequisitions'; $tableFields = array('action' => 'Action', 'requisition_code' => 'Requisition Code', 'jobtitle_name' => 'Job Title', 'createdby_name' => 'Raised By', 'reporting_manager_name' => 'Reporting Manager', 'req_no_positions' => 'No. of Positions', 'filled_positions' => 'Filled Positions', 'r.createdon' => 'Raised On', 'onboard_date' => 'Due Date'); $tablecontent = $requi_model->getRequisitionData($sort, $by, $pageNo, $perPage, $searchQuery, $loginUserId, $loginuserGroup, 3); $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'add' => 'add', 'searchArray' => $searchArray, 'menuName' => 'Rejected Requisitions', 'call' => $call, 'dashboardcall' => $dashboardcall, 'search_filters' => array('r.createdon' => array('type' => 'datepicker'), 'onboard_date' => array('type' => 'datepicker'))); return $dataTmp; }
/** * * @param type $sort * @param type $by * @param type $perPage * @param type $pageNo * @param type $searchData * @param type $call * @param type $dashboardcall * @param type $statusid * @param type $a1 * @param type $a2 * @param type $a3 * @return type */ public function getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $statusid, $a1, $a2, $a3) { $searchQuery = ''; $searchArray = array(); $data = array(); $requi_model = new Default_Model_Requisition(); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } if ($searchData != '' && $searchData != 'undefined') { $searchValues = json_decode($searchData); if (count($searchValues) > 0) { foreach ($searchValues as $key => $val) { if ($key == 'onboard_date' || $key == 'r.createdon') { $searchQuery .= " date(" . $key . ") = '" . sapp_Global::change_date($val, 'database') . "' AND "; } else { $searchQuery .= " " . $key . " like '%" . $val . "%' AND "; } $searchArray[$key] = $val; } $searchQuery = rtrim($searchQuery, " AND"); } } $sarray = array('Approved' => 2, 'Rejected' => 3, 'Closed' => 4, 'On hold' => 5, 'In process' => 7); if ($statusid != '' && is_numeric($statusid)) { if ($statusid == 1) { $queryflag = 'Approved'; } else { if ($statusid == 2) { $queryflag = 'Approved'; } else { if ($statusid == 3) { $queryflag = 'Rejected'; } else { if ($statusid == 4) { $queryflag = 'Closed'; } else { if ($statusid == 5) { $queryflag = 'On hold'; } else { if ($statusid == 7) { $queryflag = 'In process'; } } } } } } $statusidstring = sapp_Global::_encrypt($statusid); } else { $statusid = 2; $queryflag = 'Approved'; $statusidstring = sapp_Global::_encrypt('2'); } $objName = 'approvedrequisitions'; $tableFields = array('action' => 'Action', 'requisition_code' => 'Requisition Code', 'jobtitle_name' => 'Job Title', 'createdby_name' => 'Raised By', 'reporting_manager_name' => 'Reporting Manager', 'r.createdon' => 'Raised On', 'onboard_date' => 'Due Date', 'hrexecutive_name' => 'Recruit Panel'); $search_filters = array('r.createdon' => array('type' => 'datepicker'), 'onboard_date' => array('type' => 'datepicker')); if ($dashboardcall == 'Yes') { $tableFields['req_status'] = "Status"; $search_filters['req_status'] = array('type' => 'select', 'filter_data' => array('Approved' => 'Approved', 'Closed' => 'Closed', 'On hold' => 'On hold', 'In process' => 'In process')); $statusid = 2; $queryflag = 'Approved'; $statusidstring = sapp_Global::_encrypt('2'); if (isset($searchArray['req_status'])) { $queryflag = $searchArray['req_status']; $statusidstring = sapp_Global::_encrypt($sarray[$queryflag]); $statusid = $sarray[$queryflag]; } } $tablecontent = $requi_model->getRequisitionData($sort, $by, $pageNo, $perPage, $searchQuery, $loginUserId, $loginuserGroup, 2, $queryflag); $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'add' => 'add', 'searchArray' => $searchArray, 'menuName' => 'Approved Requisitions', 'formgrid' => 'true', 'unitId' => $statusidstring, 'call' => $call, 'dashboardcall' => $dashboardcall, 'search_filters' => $search_filters); if (($statusid == 4 || $statusid == 6) && ($loginuserGroup == HR_GROUP || $loginuserGroup == '')) { $dataTmp = $dataTmp + array('defined_actions' => array('view')); } return $dataTmp; }