public function addpopupAction() { 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'); $msgarray = array(); $controllername = 'holidaygroups'; $holidaygroupsform = new Default_Form_holidaygroups(); $holidaygroupsform->setAction(DOMAIN . 'holidaygroups/addpopup'); if ($this->getRequest()->getPost()) { if ($holidaygroupsform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $groupname = $this->_request->getParam('groupname'); $description = $this->_request->getParam('description'); $date = new Zend_Date(); $holidaygroupsmodel = new Default_Model_Holidaygroups(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('groupname' => $groupname, 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $holidaygroupsmodel->SaveorUpdateGroupData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/holidaygroups'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $holidaygroupData = $holidaygroupsmodel->fetchAll('isactive = 1', 'groupname')->toArray(); $opt = ''; foreach ($holidaygroupData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['groupname']); } $this->view->holidaygroupData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $holidaygroupsform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $holidaygroupsform; $this->view->ermsg = ''; }