public function viewAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_holidays', $empOrganizationTabs)) { $conText = ""; $userID = ''; $msgarray = array(); $empGroupId = ''; $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('userid'); $call = $this->_getParam('call'); if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid'); $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context'); } if ($id == '') { $id = $userID; } $Uid = $id ? $id : $userID; if ($Uid != "") { //TO dispaly EMployee Profile information..... $usersModel = new Default_Model_Users(); $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid); } $employeesModel = new Default_Model_Employees(); $holidaydatesmodel = new Default_Model_Holidaydates(); $employeeModal = new Default_Model_Employee(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $isrowexist = $employeeModal->getsingleEmployeeData($id); if ($isrowexist == 'norows') { $this->view->rowexist = "norows"; } else { $this->view->rowexist = "rows"; } $empdata = $employeeModal->getActiveEmployeeData($id); if (!empty($empdata)) { if ($id) { $empholidaysform = new Default_Form_empholidays(); $holidaygroupModel = new Default_Model_Holidaygroups(); $holidaygroupArr = $holidaygroupModel->getAllGroupData(); if (sizeof($holidaygroupArr) > 0) { $empGroupId = $holidaygroupArr[0]['id']; foreach ($holidaygroupArr as $holidaygroupres) { $empholidaysform->holiday_group->addMultiOption($holidaygroupres['id'], $holidaygroupres['groupname']); } } else { $msgarray['empholidaysform'] = 'Holiday groups not configured yet'; } $data = $employeesModel->getHolidayGroupForEmployee($id); if ($data[0]['holiday_group'] != '') { $singleholidaygroupArr = $holidaygroupModel->getsingleGroupData($data[0]['holiday_group']); $empholidaysform->populate($data[0]); $empholidaysform->setDefault('holiday_group', $data[0]['holiday_group']); $empGroupId = $data[0]['holiday_group']; $this->view->data = $data; } $empholidaysform->setAttrib('action', BASE_URL . 'empholidays/edit/userid/' . $id); $this->view->form = $empholidaysform; } if ($this->getRequest()->getPost()) { $result = $this->save($empholidaysform, $id); $this->view->msgarray = $result; } $objname = $this->_getParam('objname'); $refresh = $this->_getParam('refresh'); $dashboardcall = $this->_getParam('dashboardcall', null); $data = array(); $searchQuery = ''; $searchArray = array(); $tablecontent = ''; if ($refresh == 'refresh') { if ($dashboardcall == 'Yes') { $perPage = DASHBOARD_PERPAGE; } else { $perPage = PERPAGE; } $sort = 'DESC'; $by = 'h.modifieddate'; $pageNo = 1; $searchData = ''; $searchQuery = ''; $searchArray = array(); } else { $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC'; $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'h.modifieddate'; if ($dashboardcall == 'Yes') { $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE); } else { $perPage = $this->_getParam('per_page', PERPAGE); } $pageNo = $this->_getParam('page', 1); $searchData = $this->_getParam('searchData'); $searchData = rtrim($searchData, ','); } $objName = 'empholidays'; $dataTmp = $holidaydatesmodel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $objName, $empGroupId, $Uid, $conText); array_push($data, $dataTmp); $this->view->dataArray = $data; $this->view->call = $call; $this->view->id = $id; $this->view->messages = $this->_helper->flashMessenger->getMessages(); if (!empty($employeeData)) { $this->view->employeedata = $employeeData[0]; } } $this->view->empdata = $empdata; } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }