Blame | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** Exceptionalnlcs Controller** @property Exceptionalnlc $Exceptionalnlc* @property PaginatorComponent $Paginator*/class ExceptionalnlcsController extends AppController {/*** Components** @var array*/public $components = array('Paginator');public function beforeFilter() {parent::beforeFilter();// Configure::load('live');$this->apihost = Configure::read('pythonapihost');}/*** admin_index method** @return void*/public function admin_index() {$page = $this->request->query('page');if(!isset($page)){$page = 1;}$limit = Configure::read('admindashboardlimit');$offset = ($page - 1)*$limit;$url = $this->apihost."exceptionalNlc/getExceptionalNlc/?limit=$limit&offset=$offset";$response = $this->make_request($url,null);$this->set('exceptionalnlcs', $response);$this->set('page',$page);}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_search() {$type = $this->request->query('type');$search = $this->request->query('search');$url = $this->apihost."Catalog/searchProducts/?class=ExceptionalNlc&$type=$search";$response = $this->make_request($url,null);$this->set('exceptionalnlcs', $response);$this->set('page',1);$this->render('admin_index');}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$url = $this->apihost."exceptionalNlc/addExceptionalNlc";$data = $this->request->data['Exceptionalnlc'];$url = $this->generateMultiUrl($url,$data);$jsonVar = json_encode($data, JSON_NUMERIC_CHECK );$response = $this->make_request($url,$jsonVar);if (key($response)) {$this->Session->setFlash(current($response));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(current($response));}}}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->Exceptionalnlc->exists($id)) {throw new NotFoundException(__('Invalid exceptionalnlc'));}if ($this->request->is(array('post', 'put'))) {if ($this->Exceptionalnlc->save($this->request->data)) {$this->Session->setFlash(__('The exceptionalnlc has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The exceptionalnlc could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Exceptionalnlc.' . $this->Exceptionalnlc->primaryKey => $id));$this->request->data = $this->Exceptionalnlc->find('first', $options);}}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {if ($this->remove($id,'ExceptionalNlc')) {$this->Session->setFlash(__('The sku scheme deal has been deleted.'));} else {$this->Session->setFlash(__('The sku scheme could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}