public function editSystemMasterAction() { $this->view->pageHeading = "Edit System Master"; // $id = $this->_getParam('guid'); $guid = $this->_getParam('guid'); //echo $guid; // $this->view->user_id = $id; $model1 = new Security_Model_SystemMaster(); $model = $model1->fetchRow("row_guid='" . $guid . "'"); $num = $model1->isExist("row_guid='" . $guid . "'"); if (empty($num)) { $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/privilege/list-system-master')); } $options['masterCode'] = $model->getMasterCode(); // $options['masterValue'] = $model->getMasterValue(); // $options['intval1'] = $model->getIntval1(); $options['status'] = $model->getStatus(); $this->view->assign('guid', $model->getRowGuid()); $request = $this->getRequest(); $form = new Security_Form_SystemMaster(); $elements = $form->getElements(); $form->clearDecorators(); foreach ($elements as $element) { $element->removeDecorator('label'); } //$element->removeDecorator('masterValue'); $usersNs = new Zend_Session_Namespace("members"); if ($usersNs->userId == guid) { //$form->removeElement('status'); } $form->removeElement('masterValue'); $modelP = new Base_Security_Privilege(); // $form->populate($options); $form->populate($options); $options = $request->getPost(); if ($request->isPost()) { $modelP = new Base_Security_Privilege(); if ($form->isValid($options)) { $model->setOptions($options); $model->save(); $this->_flashMessenger->addMessage(array('success' => 'System Master information has been updated successfully!')); $this->_helper->_redirector->gotoUrl($this->view->seoUrl("/security/privilege/edit-system-master/guid/" . $guid)); } else { $this->_flashMessenger->addMessage(array('error' => 'Unable to save the data. Please provide valid inputs and try again.')); $form->reset(); $form->populate($options); } } $this->view->form = $form; }