Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<?php
App::uses('AppController', 'Controller');
/**
 * PlayStoreLinks Controller
 *
 * @property PlayStoreLink $PlayStoreLink
 * @property PaginatorComponent $Paginator
 */
class PlayStoreLinksController extends AppController {

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

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

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

/**
 * add method
 *
 * @return void
 */
        public function add() {
                if ($this->request->is('post')) {
                        $this->PlayStoreLink->create();
                        if ($this->PlayStoreLink->save($this->request->data)) {
                                $this->Session->setFlash(__('The play store link has been saved.'));
                                return $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('The play store link could not be saved. Please, try again.'));
                        }
                }
                $agents = $this->PlayStoreLink->Agent->find('list');
                $calls = $this->PlayStoreLink->Call->find('list');
                $this->set(compact('agents', 'calls'));
        }

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

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

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

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

/**
 * admin_add method
 *
 * @return void
 */
        public function admin_add() {
                if ($this->request->is('post')) {
                        $this->PlayStoreLink->create();
                        if ($this->PlayStoreLink->save($this->request->data)) {
                                $this->Session->setFlash(__('The play store link has been saved.'));
                                return $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('The play store link could not be saved. Please, try again.'));
                        }
                }
                $agents = $this->PlayStoreLink->Agent->find('list');
                $calls = $this->PlayStoreLink->Call->find('list');
                $this->set(compact('agents', 'calls'));
        }

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

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