Subversion Repositories SmartDukaan

Rev

Rev 13593 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
App::uses('AppController', 'Controller');
/**
 * Mobileappsettings Controller
 *
 * @property Mobileappsetting $Mobileappsetting
 * @property PaginatorComponent $Paginator
 */
class MobileappsettingsController extends AppController {

/**
 * Components
 *
 * @var array
 */
        public $components = array('Paginator');

/**
 * admin_index method
 *
 * @return void
 */
        public function admin_index() {
                $this->Mobileappsetting->recursive = 0;
                $this->set('mobileappsettings', $this->Paginator->paginate());
        }

/**
 * admin_view method
 *
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
        public function admin_view($id = null) {
                if (!$this->Mobileappsetting->exists($id)) {
                        throw new NotFoundException(__('Invalid mobileappsetting'));
                }
                $options = array('conditions' => array('Mobileappsetting.' . $this->Mobileappsetting->primaryKey => $id));
                $this->set('mobileappsetting', $this->Mobileappsetting->find('first', $options));
        }

/**
 * admin_add method
 *
 * @return void
 */
        public function admin_add() {
                if ($this->request->is('post')) {
                        $this->Mobileappsetting->create();
                        if ($this->Mobileappsetting->save($this->request->data)) {
                                $this->Session->setFlash(__('The mobileappsetting has been saved.'));
                                return $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('The mobileappsetting could not be saved. Please, try again.'));
                        }
                }
        }

/**
 * admin_edit method
 *
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
        public function admin_edit($id = null) {
                if (!$this->Mobileappsetting->exists($id)) {
                        throw new NotFoundException(__('Invalid mobileappsetting'));
                }
                if ($this->request->is(array('post', 'put'))) {
                        if ($this->Mobileappsetting->save($this->request->data)) {
                                $this->Session->setFlash(__('The mobileappsetting has been saved.'));
                                return $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('The mobileappsetting could not be saved. Please, try again.'));
                        }
                } else {
                        $options = array('conditions' => array('Mobileappsetting.' . $this->Mobileappsetting->primaryKey => $id));
                        $this->request->data = $this->Mobileappsetting->find('first', $options);
                }
        }

/**
 * admin_delete method
 *
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
        public function admin_delete($id = null) {
                $this->Mobileappsetting->id = $id;
                if (!$this->Mobileappsetting->exists()) {
                        throw new NotFoundException(__('Invalid mobileappsetting'));
                }
                $this->request->onlyAllow('post', 'delete');
                if ($this->Mobileappsetting->delete()) {
                        $this->Session->setFlash(__('The mobileappsetting has been deleted.'));
                } else {
                        $this->Session->setFlash(__('The mobileappsetting could not be deleted. Please, try again.'));
                }
                return $this->redirect(array('action' => 'index'));
        }}