Server IP : 180.180.241.3 / Your IP : 216.73.216.194 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/app/Controller/ |
Upload File : |
<?php App::uses('AppController', 'Controller'); /** * Groups Controller * * @property Group $Group * @property PaginatorComponent $Paginator */ class GroupsController extends AppController { public function beforeFilter() { parent::beforeFilter(); // For CakePHP 2.1 and up $this->Auth->allow(); } /** * index method * * @return void */ public function admin_index() { $this->Group->recursive = 0; // $this->paginate = array('limit' => 1); $this->set('groups', $this->Paginator->paginate()); $this->set('topicTitle', 'กลุ่มผู้ใช้งาน'); $this->layout = 'admin'; } /** * view method * * @throws NotFoundException * @param string $id * @return void */ public function admin_view($id = null) { if (!$this->Group->exists($id)) { throw new NotFoundException(__('Invalid group')); } $options = array('conditions' => array('Group.' . $this->Group->primaryKey => $id)); $this->set('group', $this->Group->find('first', $options)); } /** * add method * * @return void */ public function admin_add() { if ($this->request->is('post')) { $this->Group->create(); if ($this->Group->save($this->request->data)) { $this->Session->setFlash(__('สร้างกลุ่มผู้ใช้งานสำเร็จ!.')); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('ไม่สามารถสร้างกลุ่มผู้ใช้งานได้ กรุณาลองใหม่อีกครัง.')); } $this->set('topicTitle', __('เพิ่มกลุ่มผู้ใช้งาน')); $this->layout = "admin"; } /** * edit method * * @throws NotFoundException * @param string $id * @return void */ public function admin_edit( $id = null ) { if ( !$this->Group->exists($id) ) { throw new NotFoundException(__('Invalid group')); } if ( $this->request->is('post') || $this->request->is('put') ) { if ($this->Group->save($this->request->data)) { $this->Session->setFlash(__('บันทึกข้อมูลเรียบร้อยแล้ว.')); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('ไม่สามารถแก้ไขกลุามผู้ใช้งานได้ กรุณาลองใหม่อีกครั้ง')); } else { $options = array('conditions' => array('Group.' . $this->Group->primaryKey => $id)); $this->request->data = $this->Group->find('first', $options); } $this->set('topicTitle', $this->request->data['Group']['name']); $this->layout = 'admin'; } /** * delete method * * @throws NotFoundException * @param string $id * @return void */ public function admin_delete($id = null) { $this->Group->id = $id; if (!$this->Group->exists()) { throw new NotFoundException(__('Invalid group')); } $this->request->onlyAllow('post', 'delete'); if ($this->Group->delete()) { $this->Session->setFlash(__('กลุ่มผู้ใช้งานถูกลบแล้ว.')); } else { $this->Session->setFlash(__('ไม่สามารถลบกลุุ่มผู้ใช้งานได้กรุณาลองอีกครั้ง.')); } return $this->redirect(array('action' => 'index', 'admin' => true)); }}