public function holidaysAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_holidays', $empOrganizationTabs)) {
             $tabName = "holidays";
             $objName = 'empholidays';
             $employeeData = array();
             $empdata = array();
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $loginUserId;
             $call = $this->_getParam('call');
             if ($call == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
                 $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid');
             }
             if ($id == '') {
                 $id = $userID;
             }
             $Uid = $id ? $id : $userID;
             $employeeModal = new Default_Model_Employee();
             try {
                 $empdata = $employeeModal->getsingleEmployeeData($Uid);
                 if ($empdata == 'norows') {
                     $this->view->rowexist = "norows";
                     $this->view->empdata = "";
                 } else {
                     $this->view->rowexist = "rows";
                     if (!empty($empdata)) {
                         $holidaydatesmodel = new Default_Model_Holidaydates();
                         $usersModel = new Default_Model_Users();
                         $call = $this->_getParam('call');
                         $objname = $this->_getParam('objname');
                         $refresh = $this->_getParam('refresh');
                         $data = array();
                         $searchQuery = '';
                         $searchArray = array();
                         $tablecontent = '';
                         if ($refresh == 'refresh') {
                             $sort = 'DESC';
                             $by = 'h.modifieddate';
                             $perPage = 10;
                             $pageNo = 1;
                             $searchData = '';
                         } else {
                             $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                             $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'h.modifieddate';
                             $perPage = $this->_getParam('per_page', 10);
                             $pageNo = $this->_getParam('page', 1);
                             $searchData = $this->_getParam('searchData');
                             $searchData = rtrim($searchData, ',');
                             /** search from grid - START **/
                             $searchData = $this->_getParam('searchData');
                             if ($searchData != '' && $searchData != 'undefined') {
                                 $searchValues = json_decode($searchData);
                                 foreach ($searchValues as $key => $val) {
                                     if ($key == 'holidaydate') {
                                         $searchQuery .= " " . $key . " like '%" . sapp_Global::change_date($val, 'database') . "%' AND ";
                                     } else {
                                         $searchQuery .= " " . $key . " like '%" . $val . "%' AND ";
                                     }
                                     $searchArray[$key] = $val;
                                 }
                                 $searchQuery = rtrim($searchQuery, " AND");
                             }
                             /** search from grid - END **/
                         }
                         $employeesModel = new Default_Model_Employees();
                         $empholidaydata = $employeesModel->getHolidayGroupForEmployee($id);
                         if (isset($empholidaydata[0]) && $empholidaydata[0]['holiday_group'] != '') {
                             $empGroupId = $empholidaydata[0]['holiday_group'];
                             $tableFields = array('action' => 'Action', 'holidayname' => 'Holiday', 'holidaydate' => 'Date', 'description' => 'Description');
                             $tablecontent = $holidaydatesmodel->getHolidayDatesData($sort, $by, $pageNo, $perPage, $searchQuery, $empGroupId);
                             $dataTmp = array('userid' => $Uid, 'sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getEmployeeAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'add' => 'add', 'menuName' => 'Employee Holidays', 'formgrid' => 'true', 'unitId' => $Uid, 'call' => $call, 'context' => 'mydetails', 'search_filters' => array('holidaydate' => array('type' => 'datepicker')));
                             array_push($data, $dataTmp);
                             $this->view->dataArray = $data;
                             $this->view->call = $call;
                         }
                         if ($Uid) {
                             if (!empty($empdata)) {
                                 $this->view->empdata = $empdata[0];
                             } else {
                                 $this->view->empdata = $empdata;
                             }
                         }
                         $this->view->id = $id;
                         $this->view->messages = $this->_helper->flashMessenger->getMessages();
                     }
                     $this->view->empdata = $empdata;
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function holidaydateGrid($groupid)
 {
     $holidaydatesmodel = new Default_Model_Holidaydates();
     $sort = 'DESC';
     //$by = 'h.createddate';
     $by = 'h.holidaydate';
     $perPage = 10;
     $pageNo = 1;
     $searchData = '';
     $searchQuery = '';
     $searchArray = array();
     $objName = 'holidaydates';
     $tableFields = array('action' => 'Action', 'holidayname' => 'Holiday', 'holidaydate' => 'Date', 'description' => 'Description');
     $tablecontent = $holidaydatesmodel->getHolidayDatesData($sort, $by, $pageNo, $perPage, $searchQuery, $groupid);
     $data = array();
     $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, 'formgrid' => 'true', 'menuName' => 'Holiday Dates', 'search_filters' => array('holidaydate' => array('type' => 'datepicker')));
     array_push($data, $dataTmp);
     return $data;
 }