Rev 16910 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** Appacls Controller** @property Appacl $Appacl* @property PaginatorComponent $Paginator*/class AppaclsController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** index method** @return void*/public function admin_index() {$this->Appacl->recursive = 0;$this->set('appacls', $this->Paginator->paginate());}/*** view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->Appacl->exists($id)) {throw new NotFoundException(__('Invalid appacl'));}$options = array('conditions' => array('Appacl.' . $this->Appacl->primaryKey => $id));$this->set('appacl', $this->Appacl->find('first', $options));}/*** add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->Appacl->create();if ($this->Appacl->save($this->request->data)) {$this->Session->setFlash(__('The appacl has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The appacl could not be saved. Please, try again.'));}}$users = $this->Appacl->User->find('list');$this->set(compact('users'));}public function admin_activate($id) {$data = array('user_id'=>$id,'access'=>1);$count = $this->Appacl->find('count',array('conditions'=> $data));if($count==0){$this->Appacl->create();if ($this->Appacl->save($data)) {$this->loadModel('Appaclrevision');$historydata = $data;$historydata['modifier'] = $this->Auth->User('id');$historydata['timestamp'] = date('Y-m-d H:i:s',time());$this->Appaclrevision->create();$this->Appaclrevision->save($historydata);$this->Session->setFlash(__('The user has been activated.'));} else {$this->Session->setFlash(__('The user could not be activated. Please, try again.'));}}return $this->redirect($this->referer());}/*** edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->Appacl->exists($id)) {throw new NotFoundException(__('Invalid appacl'));}if ($this->request->is(array('post', 'put'))) {if ($this->Appacl->save($this->request->data)) {$this->Session->setFlash(__('The appacl has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The appacl could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Appacl.' . $this->Appacl->primaryKey => $id));$this->request->data = $this->Appacl->find('first', $options);}$users = $this->Appacl->User->find('list');$this->set(compact('users'));}/*** delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->Appacl->id = $id;if (!$this->Appacl->exists()) {throw new NotFoundException(__('Invalid appacl'));}$this->request->onlyAllow('post', 'delete');if ($this->Appacl->delete()) {$this->Session->setFlash(__('The appacl has been deleted.'));} else {$this->Session->setFlash(__('The appacl could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}