public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $holidaygroupsform = new Default_Form_holidaygroups(); $holidaygroupsmodel = new Default_Model_Holidaygroups(); $holidaydatesmodel = new Default_Model_Holidaydates(); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $holidaygroupsmodel->getParticularGroupData($id); if (!empty($data)) { $holidaygroupsform->populate($data[0]); $holidaygroupsform->submit->setLabel('Update'); $holidaygroupsform->setAttrib('action', DOMAIN . 'holidaygroups/edit/id/' . $id); $groupdataArr = $holidaydatesmodel->getTotalGroupDataWithId($data[0]['id']); if ($groupdataArr[0]['count'] > 0) { $this->view->groupdataCount = $groupdataArr[0]['count']; $this->view->dataArray = $this->holidaydateGrid($data[0]['id']); $this->view->controllergrid = 'holidaydates'; } $this->view->form = $holidaygroupsform; $this->view->rowexist = ""; } else { $this->view->rowexist = "rows"; } } else { $this->view->rowexist = "norows"; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($holidaygroupsform); $this->view->msgarray = $result; } }
public function editpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->getRequest()->getParam('id'); $bunitid = $this->getRequest()->getParam('unitId'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $holidaydatesform = new Default_Form_holidaydates(); $holidaydatesmodel = new Default_Model_Holidaydates(); $holidaygroupsmodel = new Default_Model_Holidaygroups(); $holidaydatesform->submit->setLabel('Update'); if ($id) { $data = $holidaydatesmodel->getParticularHolidayDateData($id); if (!empty($data)) { $data = $data[0]; $groupdataArr = $holidaygroupsmodel->getParticularGroupData($data['groupid']); if (sizeof($groupdataArr) > 0) { $holidaydatesform->groupid->addMultiOption($groupdataArr[0]['id'], utf8_encode($groupdataArr[0]['groupname'])); } $holidaydatesform->populate($data); $holidaydate = sapp_Global::change_date($data['holidaydate'], 'view'); $holidaydatesform->holidaydate->setValue($holidaydate); $holidaydatesform->setAttrib('action', DOMAIN . 'holidaydates/editpopup/id/' . $id . '/unitId/' . $bunitid); } else { $this->view->rowexist = "rows"; } } else { $this->view->rowexist = "norows"; } $this->view->form = $holidaydatesform; $this->view->groupid = $bunitid; $this->view->controllername = 'holidaydates'; if ($this->getRequest()->getPost()) { $result = $this->popupsave($holidaydatesform); $this->view->msgarray = $result; } }
public function getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $objName, $unitId = '', $userid = '', $conText = '') { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $searchQuery = ''; $searchArray = array(); $data = array(); $dataTmp = array(); if ($objName == 'holidaydates') { if ($searchData != '' && $searchData != 'undefined') { $searchValues = json_decode($searchData); foreach ($searchValues as $key => $val) { if ($key == "description") { $searchQuery .= " h." . $key . " like '%" . $val . "%' AND "; } else { 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"); } if ($searchQuery == null) { $searchQuery = $searchData; } $tableFields = array('action' => 'Action', 'holidayname' => 'Holiday', 'holidaydate' => 'Date', 'description' => 'Description'); $tablecontent = $this->getHolidayDatesData($sort, $by, $pageNo, $perPage, $searchQuery, $unitId); if (isset($unitId) && $unitId != '') { $formgrid = 'true'; } else { $formgrid = ''; } $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'add' => 'add', 'formgrid' => $formgrid, 'unitId' => $unitId, 'menuName' => 'Holidays', 'call' => $call, 'dashboardcall' => $dashboardcall, 'search_filters' => array('holidaydate' => array('type' => 'datepicker'))); } else { if ($objName == 'myholidaycalendar') { if ($unitId == '') { $employeesModel = new Default_Model_Employees(); $empholidaygroup = $employeesModel->getHolidayGroupForEmployee($loginUserId); if (isset($empholidaygroup[0]['holiday_group']) && $empholidaygroup[0]['holiday_group'] != '') { $unitId = $empholidaygroup[0]['holiday_group']; } } if ($searchData != '' && $searchData != 'undefined') { $searchValues = json_decode($searchData); foreach ($searchValues as $key => $val) { if ($key == "description") { $searchQuery .= " h." . $key . " like '%" . $val . "%' AND "; } else { 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"); } $tableFields = array('action' => 'Action', 'holidayname' => 'Holiday', 'holidaydate' => 'Date', 'description' => 'Description'); $tablecontent = $this->getHolidayDatesData($sort, $by, $pageNo, $perPage, $searchQuery, $unitId); $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'menuName' => 'My Holiday Calendar', 'add' => 'add', 'call' => $call, 'dashboardcall' => $dashboardcall, 'search_filters' => array('holidaydate' => array('type' => 'datepicker'))); } else { if ($objName == 'empholidays') { $groupname = ''; 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 { if ($key == "description") { $searchQuery .= " h." . $key . " like '%" . $val . "%' AND "; } else { $searchQuery .= " " . $key . " like '%" . $val . "%' AND "; } } $searchArray[$key] = $val; } $searchQuery = rtrim($searchQuery, " AND"); } $tableFields = array('action' => 'Action', 'groupname' => 'Holiday Group', 'holidayname' => 'Holiday', 'holidaydate' => 'Date', 'description' => 'Description'); $tablecontent = $this->getHolidayDatesData($sort, $by, $pageNo, $perPage, $searchQuery, $unitId); $holidaygroupModel = new Default_Model_Holidaygroups(); $groupnameArr = $holidaygroupModel->getParticularGroupData($unitId); if (!empty($groupnameArr)) { $groupname = $groupnameArr[0]['groupname'] . ' - Holidays'; } else { $groupname = 'Holidays'; } $dataTmp = array('userid' => $userid, 'sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getEmployeeAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'add' => 'add', 'menuName' => $groupname, 'formgrid' => 'true', 'unitId' => $userid, 'dashboardcall' => $dashboardcall, 'call' => $call, 'context' => $conText, 'search_filters' => array('holidaydate' => array('type' => 'datepicker'))); } } } return $dataTmp; }