Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23010 amit.gupta 1
<?php
2
App::uses('AppController', 'Controller');
3
/**
4
 * Exceptionalnlcs Controller
5
 *
6
 * @property Exceptionalnlc $Exceptionalnlc
7
 * @property PaginatorComponent $Paginator
8
 */
9
class BannersController extends AppController {
10
/**
11
 * Components
12
 *
13
 * @var array
14
 */
15
	public $components = array('Paginator');
16
 
17
	public function beforeFilter() {
18
		parent::beforeFilter();
19
//		Configure::load('live');
20
		$this->apihost = Configure::read('pythonapihost');
21
	}
22
 
23
	public function admin_index() {
24
		$url = $this->apihost."profitmandiBanners";
25
		$result = $this->make_request($url,null);
26
		$this->set(compact('result'));
27
	}
28
 
29
	public function admin_remove($bannerId) {
30
		$url = $this->apihost."profitmandiBanners/remove/".$bannerId;
31
		$result = $this->make_request($url,null);
32
		$this->autoRender = false;
33
		$this->redirect('/admin/banners');
34
	}
35
 
36
	public function admin_add() {
37
		if ($this->request->is('post')) {
38
			$url = $this->apihost."profitmandiBanners";
39
			$result = $this->post_json($url,$this->request->data['Banners']);
40
			$this->redirect('/admin/banners');
41
		}
42
	}
43
}