Rev 15222 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** Acls Controller** @property Acl $Acl* @property PaginatorComponent $Paginator*/class AclsController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** index method** @return void*/public function index() {$this->Acl->recursive = 0;$this->set('acls', $this->Paginator->paginate());}/*** view method** @throws NotFoundException* @param string $id* @return void*/public function view($id = null) {if (!$this->Acl->exists($id)) {throw new NotFoundException(__('Invalid acl'));}$options = array('conditions' => array('Acl.' . $this->Acl->primaryKey => $id));$this->set('acl', $this->Acl->find('first', $options));}/*** add method** @return void*/public function add() {if ($this->request->is('post')) {$this->Acl->create();if ($this->Acl->save($this->request->data)) {$this->Session->setFlash(__('The acl has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The acl could not be saved. Please, try again.'));}}Cache::delete('acls');$groups = $this->Acl->Group->find('list');$this->set(compact('groups'));}/*** edit method** @throws NotFoundException* @param string $id* @return void*/public function edit($id = null) {if (!$this->Acl->exists($id)) {throw new NotFoundException(__('Invalid acl'));}if ($this->request->is(array('post', 'put'))) {if ($this->Acl->save($this->request->data)) {$this->Session->setFlash(__('The acl has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The acl could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Acl.' . $this->Acl->primaryKey => $id));$this->request->data = $this->Acl->find('first', $options);}$groups = $this->Acl->Group->find('list');$this->set(compact('groups'));}/*** delete method** @throws NotFoundException* @param string $id* @return void*/public function delete($id = null) {$this->Acl->id = $id;if (!$this->Acl->exists()) {throw new NotFoundException(__('Invalid acl'));}$this->request->onlyAllow('post', 'delete');if ($this->Acl->delete()) {$this->Session->setFlash(__('The acl has been deleted.'));} else {$this->Session->setFlash(__('The acl could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}/*** admin_index method** @return void*/public function admin_index() {$this->Acl->recursive = 0;$this->set('permissions', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->Acl->exists($id)) {throw new NotFoundException(__('Invalid acl'));}$options = array('conditions' => array('Acl.' . $this->Acl->primaryKey => $id));$this->set('acl', $this->Acl->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->Acl->create();if ($this->Acl->save($this->request->data)) {$this->Session->setFlash(__('The acl has been saved.'));Cache::delete('acls','month');return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The acl could not be saved. Please, try again.'));}}$groups = $this->Acl->Group->find('list');$this->set(compact('groups'));}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->Acl->exists($id)) {throw new NotFoundException(__('Invalid acl'));}if ($this->request->is(array('post', 'put'))) {if ($this->Acl->save($this->request->data)) {$this->Session->setFlash(__('The acl has been saved.'));Cache::delete('acls','month');return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The acl could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Acl.' . $this->Acl->primaryKey => $id));$this->request->data = $this->Acl->find('first', $options);}$groups = $this->Acl->Group->find('list');$this->set(compact('groups'));}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->Acl->id = $id;if (!$this->Acl->exists()) {throw new NotFoundException(__('Invalid acl'));}$this->request->onlyAllow('post', 'delete');if ($this->Acl->delete()) {$this->Session->setFlash(__('The acl has been deleted.'));} else {$this->Session->setFlash(__('The acl could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}