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'); /** * Actions Controller * * @property Action $Action * @property PaginatorComponent $Paginator */ class ActionsController extends AppController { /** * admin_index method * * @return void */ public function admin_index() { $conditions = array(); $keyword = ''; $this->_getCommonConditions($conditions, $keyword); $this->Paginator->settings['conditions'] = $conditions; $this->Action->recursive = 0; $this->set('actions', $this->Paginator->paginate()); $this->set('topicTitle', __('Actions')); $this->set('keyword', $keyword); } /** * admin_view method * * @throws NotFoundException * @param string $id * @return void */ public function admin_view($id = null) { if (!$this->Action->exists($id)) { throw new NotFoundException(__('Invalid action')); } $options = array('conditions' => array('Action.' . $this->Action->primaryKey => $id)); $this->set('action', $this->Action->find('first', $options)); } /** * admin_add method * * @return void */ public function admin_add() { //If user submit a form. if ($this->request->is('post')) { $this->Action->create(); if ( !$this->Action->save( $this->request->data ) ) { $this->Session->setFlash(__('ไม่สามารถบันทึกข้อมูล action ได้ กรุณาลองใหม่อีกครั้ง', 'flash-fail')); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('บันทึกข้อมูล action สำเร็จ'), 'flash-success'); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->set('topicTitle', __('เพิ่ม action')); } /** * admin_edit method * * @throws NotFoundException * @param string $id * @return void */ public function admin_edit( $id = null ) { if ( !$this->Action->exists($id) ) { throw new NotFoundException(__('ไม่พบข้อมูล action')); } if ( $this->request->is('post') || $this->request->is('put') ) { $this->Action->id = $id; //If cannot save `Action` return with message. if ( !$this->Action->save($this->request->data) ) { $this->Session->setFlash(__('ไม่สามารถบันทึกข้อมูล action ได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail'); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('บันทึกข้อมูล action สำเร็จ'), 'flash-success'); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Action->recursive = -1; $action = $this->Action->findById($id); $this->set('action', $action); $this->set('topicTitle', __('แก้ไขข้อมูล: ') . $action['Action']['name']); } /** * admin_delete method * * @throws NotFoundException * @param string $id * @return void */ public function admin_delete($id = null) { $this->Action->id = $id; if ( !$this->Action->exists() ) { throw new NotFoundException(__('Invalid action')); } $this->request->onlyAllow('post', 'delete'); if ( $this->Action->delete() ) { $this->Session->setFlash(__('ลบข้อมูล action สำเร็จ'), 'flash-success'); return $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('ไม่สามารถลบข้อมูล action ได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail'); return $this->redirect(array('action' => 'index', 'admin' => true)); } public function admin_export() { $this->set('topicTitle', __('Action')); parent::admin_export(); } }