/** * Change the Status of a controller (enabled/disabled) * * @view views/scripts/controller/status.phtml * @access public */ public function statusAction() { $ctrlRow = new Admin_Model_DbRow_Controller($this->dbCtrl->find($this->checkControllerIdParam())); $ctrlRow->set('enabled', $ctrlRow->get('enabled') == 1 ? 0 : 1); $this->dbCtrl->update($ctrlRow->toDbArray(array('enabled')), $ctrlRow->get('id')); // disabled all actions too, they are relevant in the ACL if ($ctrlRow->get('enabled') === 0) { $actionRow = new Admin_Model_DbRow_Action(array('enabled' => 0)); $actionDbModel = new Admin_Model_DbTable_Acl_Action(); $actionDbModel->updateWithControllerId($actionRow->toDbArray(array('enabled')), $ctrlRow->get('id')); } $this->_redirect('admin/controller/index'); }
/** * 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'); } }