Exemple #1
0
 public function editMenuItemAction()
 {
     $id = $this->_getParam('id');
     $model1 = new Security_Model_SystemMaster();
     $model1->setMasterCode("fdMenu");
     $model = $model1->fetchRow("master_code ='" . $model1->getMasterCode() . "' AND master_id='" . $id . "'");
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/user'));
     }
     $options['title'] = $model->getMasterValue();
     $options['path'] = $model->getStrval1();
     $options['toolTip'] = $model->getStrval2();
     $options['parentMenuId'] = $model->getIntval1();
     $options['isActive'] = $model->getStatus();
     $options['isChild'] = $model->getBlnval1();
     $form = new Security_Form_Menu();
     $form->populate($options);
     $request = $this->getRequest();
     $options = $request->getPost();
     if ($request->isPost()) {
         if ($form->isValid($options)) {
             $model->setMasterValue($options['title']);
             $model->setStatus($options['isActive']);
             $model->setStrval1($options['path']);
             $model->setStrval2($options['toolTip']);
             $model->setIntval1($options['parentMenuId']);
             $model->setBlnval1($options['isChild']);
             $model->save();
             $this->_flashMessenger->addMessage(array('success' => 'Menu information has been updated successfully!'));
             $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/menu/edit-menu-item/id/' . $id));
         } 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;
 }
 public function editMenuItemAction()
 {
     $id = $this->_getParam('id');
     $guid = $this->_getParam('guid');
     $model1 = new Security_Model_SystemMaster();
     $model1->setMasterCode("fdMenu");
     $model = $model1->fetchRow("master_code ='" . $model1->getMasterCode() . "' AND master_id='" . $id . "'");
     if (false === $model || $model->getRowGuid() != $guid) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/security/menu/index'));
     }
     $this->getIconsList();
     $options['title'] = $model->getMasterValue();
     $options['path'] = $model->getStrval1();
     $options['toolTip'] = $model->getStrval2();
     $options['parentMenuId'] = $model->getIntval1();
     $options['isActive'] = $model->getStatus();
     $options['isChild'] = $model->getBlnval1();
     $options['isAction'] = $model->getBlnval2();
     $options['menuIcon'] = $model->getStrval3();
     $form = new Security_Form_Menu();
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('label');
         //$element->removeDecorator('Errors');
     }
     $form->populate($options);
     $request = $this->getRequest();
     $options = $request->getPost();
     // echo "str val3=".$options['menuIcon']; die;
     if ($request->isPost()) {
         if ($form->isValid($options)) {
             $model->setMasterValue($options['title']);
             $model->setStatus($options['isActive']);
             $model->setStrval1($options['path']);
             $model->setStrval2($options['toolTip']);
             $model->setIntval1($options['parentMenuId']);
             $model->setBlnval1($options['isChild']);
             $model->setBlnval2($options['isAction']);
             $model->setStrval3($options['menuIcon']);
             $model->save();
             $this->_flashMessenger->addMessage(array('success' => 'Menu information has been updated successfully!'));
             $this->_helper->_redirector->gotoUrl($this->view->seoUrl("/security/menu/edit-menu-item/id/{$id}/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;
 }