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