Rev 15051 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** Calls Controller** @property Call $Call* @property PaginatorComponent $Paginator*/class CallsController extends AppController {/*** Components** @var array*/public $components = array('Paginator');public function beforeFilter() {parent::beforeFilter();$this->Auth->allow(array('addCallDisposition'));}/*** index method** @return void*/public function index() {$this->Call->recursive = 0;$this->set('calls', $this->Paginator->paginate());}/*** view method** @throws NotFoundException* @param string $id* @return void*/public function view($id = null) {if (!$this->Call->exists($id)) {throw new NotFoundException(__('Invalid call'));}$options = array('conditions' => array('Call.' . $this->Call->primaryKey => $id));$this->set('call', $this->Call->find('first', $options));}/*** add method** @return void*/public function add() {if ($this->request->is('post')) {$this->Call->create();if ($this->Call->save($this->request->data)) {$this->Session->setFlash(__('The call has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The call could not be saved. Please, try again.'));}}$retailers = $this->Call->Retailer->find('list');$agents = $this->Call->Agent->find('list');$this->set(compact('retailers', 'agents'));}/*** edit method** @throws NotFoundException* @param string $id* @return void*/public function edit($id = null) {if (!$this->Call->exists($id)) {throw new NotFoundException(__('Invalid call'));}if ($this->request->is(array('post', 'put'))) {if ($this->Call->save($this->request->data)) {$this->Session->setFlash(__('The call has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The call could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Call.' . $this->Call->primaryKey => $id));$this->request->data = $this->Call->find('first', $options);}$retailers = $this->Call->Retailer->find('list');$agents = $this->Call->Agent->find('list');$this->set(compact('retailers', 'agents'));}/*** delete method** @throws NotFoundException* @param string $id* @return void*/public function delete($id = null) {$this->Call->id = $id;if (!$this->Call->exists()) {throw new NotFoundException(__('Invalid call'));}$this->request->onlyAllow('post', 'delete');if ($this->Call->delete()) {$this->Session->setFlash(__('The call has been deleted.'));} else {$this->Session->setFlash(__('The call could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}/*** admin_index method** @return void*/public function admin_index() {$this->Call->recursive = 0;$this->set('calls', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->Call->exists($id)) {throw new NotFoundException(__('Invalid call'));}$options = array('conditions' => array('Call.' . $this->Call->primaryKey => $id));$this->set('call', $this->Call->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->Call->create();if ($this->Call->save($this->request->data)) {$this->Session->setFlash(__('The call has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The call could not be saved. Please, try again.'));}}$retailers = $this->Call->Retailer->find('list');$agents = $this->Call->Agent->find('list');$this->set(compact('retailers', 'agents'));}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->Call->exists($id)) {throw new NotFoundException(__('Invalid call'));}if ($this->request->is(array('post', 'put'))) {if ($this->Call->save($this->request->data)) {$this->Session->setFlash(__('The call has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The call could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Call.' . $this->Call->primaryKey => $id));$this->request->data = $this->Call->find('first', $options);}$retailers = $this->Call->Retailer->find('list');$agents = $this->Call->Agent->find('list');$this->set(compact('retailers', 'agents'));}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->Call->id = $id;if (!$this->Call->exists()) {throw new NotFoundException(__('Invalid call'));}$this->request->onlyAllow('post', 'delete');if ($this->Call->delete()) {$this->Session->setFlash(__('The call has been deleted.'));} else {$this->Session->setFlash(__('The call could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}public function addCallDisposition(){$this->log(print_r($this->request->data,1),'calldisposition');}}