Rev 16932 | 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 paytm_coupon_non_usages p on p.user_id=u.id order by p.created";$sql = "SELECT u.id,u.first_name,u.email,u.mobile_number FROM users u JOIN (select o.user_id, o.created from orders o where o.id not in (select order_id from paytm_coupon_usages) and store_id=6 and status='ORDER_CREATED')p on p.user_id=u.id where u.referrer not like '%emp%' order by p.created";$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'));}}