Blame | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** ProductCashbacks Controller** @property ProductCashback $ProductCashback* @property PaginatorComponent $Paginator*/class ProductCashbacksController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** index method** @return void*/public function index() {$this->ProductCashback->recursive = 0;$this->set('productCashbacks', $this->Paginator->paginate());}/*** view method** @throws NotFoundException* @param string $id* @return void*/public function view($id = null) {if (!$this->ProductCashback->exists($id)) {throw new NotFoundException(__('Invalid product cashback'));}$options = array('conditions' => array('ProductCashback.' . $this->ProductCashback->primaryKey => $id));$this->set('productCashback', $this->ProductCashback->find('first', $options));}/*** add method** @return void*/public function add() {if ($this->request->is('post')) {$this->ProductCashback->create();if ($this->ProductCashback->save($this->request->data)) {$this->Session->setFlash(__('The product cashback has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The product cashback could not be saved. Please, try again.'));}}$stores = $this->ProductCashback->Store->find('list');$this->set(compact('stores'));}/*** edit method** @throws NotFoundException* @param string $id* @return void*/public function edit($id = null) {if (!$this->ProductCashback->exists($id)) {throw new NotFoundException(__('Invalid product cashback'));}if ($this->request->is(array('post', 'put'))) {if ($this->ProductCashback->save($this->request->data)) {$this->Session->setFlash(__('The product cashback has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The product cashback could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('ProductCashback.' . $this->ProductCashback->primaryKey => $id));$this->request->data = $this->ProductCashback->find('first', $options);}$stores = $this->ProductCashback->Store->find('list');$this->set(compact('stores'));}/*** delete method** @throws NotFoundException* @param string $id* @return void*/public function delete($id = null) {$this->ProductCashback->id = $id;if (!$this->ProductCashback->exists()) {throw new NotFoundException(__('Invalid product cashback'));}$this->request->onlyAllow('post', 'delete');if ($this->ProductCashback->delete()) {$this->Session->setFlash(__('The product cashback has been deleted.'));} else {$this->Session->setFlash(__('The product cashback could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}/*** admin_index method** @return void*/public function admin_index() {$this->ProductCashback->recursive = 0;$this->set('productCashbacks', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->ProductCashback->exists($id)) {throw new NotFoundException(__('Invalid product cashback'));}$options = array('conditions' => array('ProductCashback.' . $this->ProductCashback->primaryKey => $id));$this->set('productCashback', $this->ProductCashback->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->ProductCashback->create();if ($this->ProductCashback->save($this->request->data)) {$this->Session->setFlash(__('The product cashback has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The product cashback could not be saved. Please, try again.'));}}$stores = $this->ProductCashback->Store->find('list');$this->set(compact('stores'));}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->ProductCashback->exists($id)) {throw new NotFoundException(__('Invalid product cashback'));}if ($this->request->is(array('post', 'put'))) {if ($this->ProductCashback->save($this->request->data)) {$this->Session->setFlash(__('The product cashback has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The product cashback could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('ProductCashback.' . $this->ProductCashback->primaryKey => $id));$this->request->data = $this->ProductCashback->find('first', $options);}$stores = $this->ProductCashback->Store->find('list');$this->set(compact('stores'));}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->ProductCashback->id = $id;if (!$this->ProductCashback->exists()) {throw new NotFoundException(__('Invalid product cashback'));}$this->request->onlyAllow('post', 'delete');if ($this->ProductCashback->delete()) {$this->Session->setFlash(__('The product cashback has been deleted.'));} else {$this->Session->setFlash(__('The product cashback could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}