Rev 16614 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** Appmasters Controller** @property Appmaster $Appmaster* @property PaginatorComponent $Paginator*/class AppmastersController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** admin_index method** @return void*/public function admin_index() {$type = $this->request->query('type');$search = $this->request->query('search');$conditions = array();if(!empty($type) && !empty($search)){$conditions = array($type=>$search);$options['conditions'] = array($type.' LIKE ' =>"%$search%");$this->Paginator->settings = $options;}$this->Appmaster->recursive = 0;$this->set('appmasters', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->Appmaster->exists($id)) {throw new NotFoundException(__('Invalid appmaster'));}$options = array('conditions' => array('Appmaster.' . $this->Appmaster->primaryKey => $id));$this->set('appmaster', $this->Appmaster->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->Appmaster->create();if ($this->Appmaster->save($this->request->data)) {$this->Session->setFlash(__('The appmaster has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The appmaster 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->Appmaster->exists($id)) {throw new NotFoundException(__('Invalid appmaster'));}if ($this->request->is(array('post', 'put'))) {if ($this->Appmaster->save($this->request->data)) {$this->Session->setFlash(__('The appmaster has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The appmaster could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Appmaster.' . $this->Appmaster->primaryKey => $id));$this->request->data = $this->Appmaster->find('first', $options);}}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->Appmaster->id = $id;if (!$this->Appmaster->exists()) {throw new NotFoundException(__('Invalid appmaster'));}$this->request->onlyAllow('post', 'delete');if ($this->Appmaster->delete()) {$this->Session->setFlash(__('The appmaster has been deleted.'));} else {$this->Session->setFlash(__('The appmaster could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}