/** * Edit a Controller and save it in the database * * @return array */ public function saveEditControllerAction() { $modContrModel = new Admin_Model_DbTable_Acl_ModuleController(); $modContrRow = $modContrModel->find($this->request->getParam('id', 0)); if ($modContrRow->count() === 1) { $controllerRow = new Admin_Model_DbRow_Controller($modContrRow); $controllerRow->fromArray(array('enabled' => $this->request->getParam('enabled', 'off') === 'on' ? 1 : 0, 'description' => $this->request->getParam('description', ''))); $modContrModel->update($controllerRow->toDbArray(), $controllerRow->get('id')); return $this->responseSuccess(); } else { return $this->responseFailure('failed saving informations', 'Controller Id is invalid'); } }
/** * Edit an Controller in the database * * @view views/scripts/controller/edit.phtml * @access public * @todo remove the possibility to change the virtual status, * this could causes in other problems, when working with controllers that * are marked as virtual! */ public function editAction() { $ctrlRow = new Admin_Model_DbRow_Controller($this->dbCtrl->find($this->checkControllerIdParam())); $form = new Admin_Form_Controller_Edit($ctrlRow); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getParams())) { $ctrlRow->fromArray(array('description' => $this->getRequest()->getParam('description'))); $this->dbCtrl->update($ctrlRow->toDbArray(array('description')), $ctrlRow->get('id')); $this->_redirect('admin/controller/index'); } } $this->view->form = $form; }
/** * Edit an Action * * @view views/scripts/action/delete.phtml * @access public */ public function editAction() { $actionRow = new Admin_Model_DbRow_Action(); $ctrlRow = new Admin_Model_DbRow_Controller(); $action = $this->dbAction->find($this->checkActionIdParam()); if ($action->count() !== 1) { $form = new Admin_Form_Action_Edit($ctrlRow, $actionRow); $form->setErrors(array('Invalid ActionId, cannot proceed!')); $form->setAction('/noc/admin/action/edit'); } else { $actionRow->fromArray($action); $ctrlRow->fromArray($this->dbController->find($actionRow->get('mcId'))); $form = new Admin_Form_Action_Edit($ctrlRow, $actionRow); $form->setAction('/noc/admin/action/edit'); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getParams())) { $actionRow->set('description', $this->getRequest()->getParam('description')); $this->dbAction->updateById($actionRow->toDbArray(array('description')), $actionRow->get('id')); $this->_redirect('admin/action/index/control/' . $ctrlRow->get('id')); } } } $this->view->form = $form; $this->view->controller = $ctrlRow; }