Rev 15404 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** Callhistories Controller** @property Callhistory $Callhistory* @property PaginatorComponent $Paginator*/class CallhistoriesController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** admin_index method** @return void*/public function admin_index() {$this->Callhistory->recursive = 0;$this->Paginator->settings = array('order' => array('id'=>'desc'));$this->set('callhistories', $this->Paginator->paginate());}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->Callhistory->exists($id)) {throw new NotFoundException(__('Invalid callhistory'));}$options = array('conditions' => array('Callhistory.' . $this->Callhistory->primaryKey => $id));$this->set('callhistory', $this->Callhistory->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->Callhistory->create();if ($this->Callhistory->save($this->request->data)) {$this->Session->setFlash(__('The callhistory has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The callhistory could not be saved. Please, try again.'));}}$retailers = $this->Callhistory->Retailer->find('list');$agents = $this->Callhistory->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->Callhistory->exists($id)) {throw new NotFoundException(__('Invalid callhistory'));}if ($this->request->is(array('post', 'put'))) {if ($this->Callhistory->save($this->request->data)) {$this->Session->setFlash(__('The callhistory has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The callhistory could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('Callhistory.' . $this->Callhistory->primaryKey => $id));$this->request->data = $this->Callhistory->find('first', $options);}$retailers = $this->Callhistory->Retailer->find('list');$agents = $this->Callhistory->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->Callhistory->id = $id;if (!$this->Callhistory->exists()) {throw new NotFoundException(__('Invalid callhistory'));}$this->request->onlyAllow('post', 'delete');if ($this->Callhistory->delete()) {$this->Session->setFlash(__('The callhistory has been deleted.'));} else {$this->Session->setFlash(__('The callhistory could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}