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