Exemplo n.º 1
0
 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();
     }
     $holidaydatesform = new Default_Form_holidaydates();
     $holidaydatesmodel = new Default_Model_Holidaydates();
     $holidaygroupsmodel = new Default_Model_Holidaygroups();
     $holidaydatesform->removeElement('groupid');
     $holidaydatesform->submit->setLabel('Update');
     try {
         if ($id) {
             if (is_numeric($id) && $id > 0) {
                 $data = $holidaydatesmodel->getParticularHolidayDateData($id);
                 if (!empty($data)) {
                     $data = $data[0];
                     $groupdataArr = $holidaygroupsmodel->getParticularGroupData($data['groupid']);
                     $groupname = '';
                     if (sizeof($groupdataArr) > 0) {
                         $groupname = $groupdataArr[0]['groupname'];
                     }
                     $holidaydatesform->populate($data);
                     $holidaydate = sapp_Global::change_date($data['holidaydate'], 'view');
                     $holidaydatesform->holidaydate->setValue($holidaydate);
                     $this->view->form = $holidaydatesform;
                     $this->view->groupname = $groupname;
                     $this->view->groupval = $data['groupid'];
                     $this->view->rowexist = "";
                     $holidaydatesform->setAttrib('action', DOMAIN . 'holidaydates/edit/id/' . $id);
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } else {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->view->rowexist = "norows";
         }
     } catch (Exception $e) {
         $this->view->rowexist = "norows";
     }
     if ($this->getRequest()->getPost()) {
         $result = $this->save($holidaydatesform);
         $this->view->msgarray = $result;
     }
 }
 public function viewAction()
 {
     $id = intval($this->getRequest()->getParam('id'));
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'myholidaycalendar';
     $holidaydatesform = new Default_Form_holidaydates();
     $holidaydatesmodel = new Default_Model_Holidaydates();
     $holidaygroupsmodel = new Default_Model_Holidaygroups();
     $holidaydatesform->removeElement("submit");
     $data = $holidaydatesmodel->getsingleHolidayDatesData($id);
     $groupdataArr = $holidaygroupsmodel->getAllGroupData();
     if (sizeof($groupdataArr) > 0) {
         foreach ($groupdataArr as $groupdatares) {
             $holidaydatesform->groupid->addMultiOption($groupdatares['id'], utf8_encode($groupdatares['groupname']));
         }
     }
     $elements = $holidaydatesform->getElements();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     if (!empty($data)) {
         $holidaydatesform->populate($data);
         $holidaydate = sapp_Global::change_date($data['holidaydate'], 'view');
         $holidaydatesform->holidaydate->setValue($holidaydate);
         $this->view->controllername = $objName;
         $this->view->id = $id;
         $this->view->form = $holidaydatesform;
         $this->view->ermsg = '';
     } else {
         $this->view->ermsg = 'nodata';
     }
 }
Exemplo n.º 3
0
 public function viewpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'empholidays';
     $holidaydatesform = new Default_Form_holidaydates();
     $holidaydatesmodel = new Default_Model_Holidaydates();
     $holidaydatesform->removeElement("submit");
     $data = $holidaydatesmodel->getsingleHolidayDatesData($id);
     $elements = $holidaydatesform->getElements();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     $holidaydatesform->populate($data);
     $holidaydate = sapp_Global::change_date($data['holidaydate'], 'view');
     $holidaydatesform->holidaydate->setValue($holidaydate);
     $this->view->controllername = $objName;
     $this->view->id = $id;
     $this->view->form = $holidaydatesform;
 }