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'); /** * Positions Controller * * @property Position $Position * @property PaginatorComponent $Paginator */ class PositionsController extends AppController { /** * list of all `position` records * * @author 3Musketeers <3musketeersteam@gmail.com> * @since 26 September 2013 */ public function admin_index() { $conditions = array(); $keyword = ''; $this->_getCommonConditions($conditions, $keyword); $this->Paginator->settings['conditions'] = $conditions; $this->Position->recursive = 0; $this->set('positions', $this->Paginator->paginate()); $this->set('total', $this->Position->find('count')); $this->set('topicTitle', __('สถานะที่เกี่ยวข้องกับ กสม.')); $this->set('keyword', $keyword); } /** * Add `position` data to database * * @author 3Musketeers <3musketeersteam@gmail.com> * @since 26 Sebtember 2013 */ public function admin_add() { if ( $this->request->is('post') ) { $this->Position->create(); //If cannnot save data will return to index of position page if ( !$this->Position->save($this->request->data) ) { $this->Session->setFlash(__('ไม่สามารถเพิ่มข้อมูลสถานะได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail'); $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('บันทึกข้อมูลสถานะสำเร็จ'), 'flash-success'); $this->redirect(array('action' => 'index', 'admin' => true)); } $this->set('topicTitle', 'เพิ่มสถานะที่เกี่ยวข้องกับ กสม.' ); } /** * Edit `position` data. * * @throws NotFoundException if the cannot find any position. * @param string $id postiion's id * @author 3Musketeers <3musketersteam@gmail.com> * @since 23 September 2013 */ public function admin_edit($id = null) { if (!$this->Position->exists($id)) { throw new NotFoundException(__('ไม่พบข้อมูลสถานะ')); } if ( $this->request->is('post') || $this->request->is('put') ) { $this->Position->id = $id; if ( !$this->Position->save($this->request->data) ) { $this->Session->setFlash(__('ไม่สามารถเพิ่มข้อมูลสถานะได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail'); $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('บันทึกข้อมูลสถานะสำเร็จ'), 'flash-success'); $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Position->recursive = -1; $position = $this->Position->findById($id); $this->set('position', $position); $this->set('topicTitle', 'แก้ไขข้อมูล : ' . $position['Position']['name'] ); } /** * Remove `position` detail accually we will delete just change `is_activated` to false * * @throws NotFoundException if no found any position. * @param string $id position's id. * @author 3Musketeers <3musketeersteam@gmail.com> */ public function admin_delete($id = null) { $this->Position->id = $id; if (!$this->Position->exists()) { throw new NotFoundException(__('ไม่พบข้อมูลสถานะ')); } $this->request->onlyAllow('post', 'delete'); if ( !$this->Position->delete()) { $this->Session->setFlash(__('ไม่สามารถลบข้อมูลสถานะได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail'); $this->redirect(array('action' => 'index', 'admin' => true)); } $this->Session->setFlash(__('ลบข้อมูลสถานะสำเร็จ'), 'flash-success'); $this->redirect(array('action' => 'index', 'admin' => true)); } public function admin_export() { $this->set('topicTitle', __('สถานะที่เกี่ยวข้องกับ กสม.')); parent::admin_export(); } }