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'); $controllername = 'ethniccode'; $ethniccodeform = new Default_Form_ethniccode(); $ethniccodemodel = new Default_Model_Ethniccode(); $ethniccodeform->setAction(DOMAIN . 'ethniccode/addpopup'); if ($this->getRequest()->getPost()) { if ($ethniccodeform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $ethniccode = $this->_request->getParam('ethniccode'); $ethnicname = $this->_request->getParam('ethnicname'); $description = $this->_request->getParam('description'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('ethniccode' => trim($ethniccode), 'ethnicname' => trim($ethnicname), '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 = $ethniccodemodel->SaveorUpdateEthnicCodeData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/ethniccode'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $ethniccodesData = $ethniccodemodel->fetchAll('isactive = 1', 'ethnicname')->toArray(); $opt = ''; foreach ($ethniccodesData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['ethnicname']); } $this->view->ethniccodesData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $ethniccodeform->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 = $ethniccodeform; }