| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 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 : /AppServ/www/app/Controller/ |
Upload File : |
<?php
App::uses('AppController', 'Controller');
/**
* Froles Controller
*
* @property Frole $Frole
* @property PaginatorComponent $Paginator
*/
class FrolesController extends AppController {
/**
* List all `frole` in database.
*
* @author 3Musketeers <3musketeersteam@gmail.com>
* @since 28 September 2013
*/
public function admin_index() {
$conditions = array();
$keyword = '';
$this->_getCommonConditions($conditions, $keyword);
$this->Paginator->settings['conditions'] = $conditions;
$this->Frole->recursive = 0;
$this->set('froles', $this->Paginator->paginate());
$this->set('topicTitle', __('Function roles'));
$this->set('keyword', $keyword);
}
/**
* Add new `frole` information
*
* @author 3Musketeers <3musketeersteam@gmail.com>
* @since 28 September 2013
*/
public function admin_add() {
if ( $this->request->is('post') ) {
$this->Frole->create();
if ( !$this->Frole->save($this->request->data) ) {
$this->Session->setFlash(__('ไม่สามารบันทึกข้อมูล Frole ได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail');
$this->redirect(array('action' => 'index', 'admin' => true));
}
$this->Session->setFlash(__('บันทึกข้อมูล Frole สำเร็จ'), 'flash-success');
$this->redirect(array('action' => 'index', 'admin' => true));
}
$this->set('topicTitle', __('เพิ่ม Frole'));
}
/**
* Edit `frole` information
*
* @throws NotFoundExceptionif not found any recdord.
* @param string $id id of `frole`
* @author 3Musketeers <3musketeersteam@gmail.com>
* @since 29 September 2013
*/
public function admin_edit( $id = null ) {
if (!$this->Frole->exists($id)) {
throw new NotFoundException(__('ไม่พบข้อมูล frole'));
}
if ( $this->request->is('post') || $this->request->is('put') ) {
$this->Frole->id = $id;
if ( !$this->Frole->save($this->request->data) ) {
$this->Session->setFlash(__('ไม่สามารบันทึกข้อมูล Frole ได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail');
$this->redirect(array('action' => 'index', 'admin' => true));
}
$this->Session->setFlash(__('บันทึกข้อมูล Frole สำเร็จ'), 'flash-success');
return $this->redirect(array('action' => 'index', 'admin' => true));
}
//Find `frole` detail with id.
$this->Frole->recursive = -1;
$frole = $this->Frole->findById($id);
$this->set('frole', $frole);
$this->set('topicTitle', __('แก้ไขข้อมูล: ') . $frole['Frole']['name']);
}
/**
* Remove 'frole' information accually just set `is_activated` to false in `AppModel::delete()`
*
* @throws NotFoundException if not found any record.
* @param string $id id for frole.
* @author 3Musketeers <3musketeersteam@gmail.com>
* @since 28 September 2013
*/
public function admin_delete( $id = null ) {
$this->Frole->id = $id;
if (!$this->Frole->exists()) {
throw new NotFoundException(__('ไม่พบข้อมูล Frole'));
}
//Allowed only `post` method
$this->request->onlyAllow('post', 'delete');
if ( !$this->Frole->delete() ) {
$this->Session->setFlash(__('ไม่สามารถลบข้อมูล Frole ได้ กรุณาลองใหม่อีกครั้ง'), 'flash-fail');
$this->redirect(array('action' => 'index', 'admin' => ture));
}
$this->Session->setFlash(__('ลบข้อมูล Frole สำเร็จ'), 'flash-success');
$this->redirect(array('action' => 'index', 'admin' => ture));
}
public function admin_export() {
$this->set('topicTitle', __('Function Role'));
parent::admin_export();
}
}