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