Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpApp::uses('AppController', 'Controller');/*** PaytmCallings Controller** @property PaytmCalling $PaytmCalling* @property PaginatorComponent $Paginator*/class PaytmCallingsController extends AppController {/*** Components** @var array*/public $components = array('Paginator');/*** admin_index method** @return void*/public function admin_index() {$this->PaytmCalling->recursive = -1;$userIds = $this->PaytmCalling->find('list');$sql = "SELECT u.id,u.first_name,u.email,u.mobile_number FROM users u JOIN user_urls ur ON u.id = ur.user_id WHERE ur.user_id NOT IN (".implode(',',$userIds).") AND ur.url LIKE 'https://paytm.com/shop/p%' GROUP BY ur.user_id";$users = $this->PaytmCalling->query($sql);$this->set('users', $users);}/*** admin_view method** @throws NotFoundException* @param string $id* @return void*/public function admin_view($id = null) {if (!$this->PaytmCalling->exists($id)) {throw new NotFoundException(__('Invalid paytm calling'));}$options = array('conditions' => array('PaytmCalling.' . $this->PaytmCalling->primaryKey => $id));$this->set('paytmCalling', $this->PaytmCalling->find('first', $options));}/*** admin_add method** @return void*/public function admin_add() {if ($this->request->is('post')) {$this->PaytmCalling->create();if ($this->PaytmCalling->save($this->request->data)) {$this->Session->setFlash(__('The paytm calling has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The paytm calling could not be saved. Please, try again.'));}}}/*** admin_edit method** @throws NotFoundException* @param string $id* @return void*/public function admin_edit($id = null) {if (!$this->PaytmCalling->exists($id)) {throw new NotFoundException(__('Invalid paytm calling'));}if ($this->request->is(array('post', 'put'))) {if ($this->PaytmCalling->save($this->request->data)) {$this->Session->setFlash(__('The paytm calling has been saved.'));return $this->redirect(array('action' => 'index'));} else {$this->Session->setFlash(__('The paytm calling could not be saved. Please, try again.'));}} else {$options = array('conditions' => array('PaytmCalling.' . $this->PaytmCalling->primaryKey => $id));$this->request->data = $this->PaytmCalling->find('first', $options);}}/*** admin_delete method** @throws NotFoundException* @param string $id* @return void*/public function admin_delete($id = null) {$this->PaytmCalling->id = $id;if (!$this->PaytmCalling->exists()) {throw new NotFoundException(__('Invalid paytm calling'));}$this->request->onlyAllow('post', 'delete');if ($this->PaytmCalling->delete()) {$this->Session->setFlash(__('The paytm calling has been deleted.'));} else {$this->Session->setFlash(__('The paytm calling could not be deleted. Please, try again.'));}return $this->redirect(array('action' => 'index'));}}