Blame | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** NotificationViews Controller** @property NotificationView $NotificationView* @property PaginatorComponent $Paginator*/class NotificationViewsController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** index method** @return void*/public function index() {$this->NotificationView->recursive = 0;$this->set('notificationViews', $this->Paginator->paginate());}/*** view method** @throws NotFoundException* @param string $id* @return void*/public function view($id = null) {if (!$this->NotificationView->exists($id)) {throw new NotFoundException(__('Invalid notification view'));}$options = array('conditions' => array('NotificationView.' . $this->NotificationView->primaryKey => $id));$this->set('notificationView', $this->NotificationView->find('first', $options));}/*** add method** @return void*/public function add() {if ($this->request->is('post')) {$this->NotificationView->create();if ($this->NotificationView->save($this->request->data)) {$result = array('success'=>true,'message'=>'Notification view has been saved');} else {$result = array('success'=>false,'message'=>'Notification view could not be saved');}$this->response->type('json');$this->layout = 'ajax';$this->set(array('result' => $result,'_serialize' => array('result')));$this->render('/Elements/json');}}/*** edit method** @throws NotFoundException* @param string $id* @return void*/public function edit($id = null) {if (!$this->NotificationView->exists($id)) {throw new NotFoundException(__('Invalid notification view'));}if ($this->request->is(array('post', 'put'))) {if ($this->NotificationView->save($this->request->data)) {$this->Session->setFlash(__('The notification view has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The notification view could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('NotificationView.' . $this->NotificationView->primaryKey => $id));$this->request->data = $this->NotificationView->find('first', $options);}$users = $this->NotificationView->User->find('list');$notificationRules = $this->NotificationView->NotificationRule->find('list');$this->set(compact('users', 'notificationRules'));}/*** delete method** @throws NotFoundException* @param string $id* @return void*/public function delete($id = null) {$this->NotificationView->id = $id;if (!$this->NotificationView->exists()) {throw new NotFoundException(__('Invalid notification view'));}$this->request->onlyAllow('post', 'delete');if ($this->NotificationView->delete()) {$this->Session->setFlash(__('The notification view has been deleted.'));} else {$this->Session->setFlash(__('The notification view could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}/*** admin_index method** @return void*/public function admin_index() {$this->NotificationView->recursive = 0;$this->set('notificationViews', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->NotificationView->exists($id)) {throw new NotFoundException(__('Invalid notification view'));}$options = array('conditions' => array('NotificationView.' . $this->NotificationView->primaryKey => $id));$this->set('notificationView', $this->NotificationView->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->NotificationView->create();if ($this->NotificationView->save($this->request->data)) {$this->Session->setFlash(__('The notification view has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The notification view could not be saved. Please, try again.'));}}$users = $this->NotificationView->User->find('list');$notificationRules = $this->NotificationView->NotificationRule->find('list');$this->set(compact('users', 'notificationRules'));}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->NotificationView->exists($id)) {throw new NotFoundException(__('Invalid notification view'));}if ($this->request->is(array('post', 'put'))) {if ($this->NotificationView->save($this->request->data)) {$this->Session->setFlash(__('The notification view has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The notification view could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('NotificationView.' . $this->NotificationView->primaryKey => $id));$this->request->data = $this->NotificationView->find('first', $options);}$users = $this->NotificationView->User->find('list');$notificationRules = $this->NotificationView->NotificationRule->find('list');$this->set(compact('users', 'notificationRules'));}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->NotificationView->id = $id;if (!$this->NotificationView->exists()) {throw new NotFoundException(__('Invalid notification view'));}$this->request->onlyAllow('post', 'delete');if ($this->NotificationView->delete()) {$this->Session->setFlash(__('The notification view has been deleted.'));} else {$this->Session->setFlash(__('The notification view could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}