Subversion Repositories SmartDukaan

Rev

Rev 15227 | Rev 16628 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15227 Rev 15824
Line 20... Line 20...
20
		$this->Auth->allow('add','mine','pendingcashbacks','all');
20
		$this->Auth->allow('add','mine','pendingcashbacks','all');
21
		$this->apihost = Configure::read('pythonapihost');
21
		$this->apihost = Configure::read('pythonapihost');
22
	}
22
	}
23
	
23
	
24
	public function mine() {
24
	public function mine() {
-
 
25
		$type = $this->request->query('type');
25
		$page = $this->request->query('page');
26
		$page = $this->request->query('page');
26
		$page = isset($page)?$page:1;
27
		$page = isset($page)?$page:1;
27
		$userId = $this->request->query('user_id');
28
		$userId = $this->request->query('user_id');
28
		if(isset($userId) && !empty($userId)){
29
		if(isset($userId) && !empty($userId)){
29
			$this->loadModel('User');
30
			$this->loadModel('User');
30
			$dbuser = $this->User->findById($userId);
31
			$dbuser = $this->User->findById($userId);
31
			$this->Auth->login($dbuser['User']);	
32
			$this->Auth->login($dbuser['User']);	
32
		}
33
		}
33
		$this->layout = "innerpages";
34
		$this->layout = "innerpages";
34
		$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=$page&window=10";
35
		$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=$page&window=10";
-
 
36
		if(isset($type) && !empty($type)) {
-
 
37
			$url .= '&type='.$type;
-
 
38
		}
35
		$response = $this->make_request($url,null);
39
		$response = $this->make_request($url,null);
36
		$totalPages = $response['totalPages'];
40
		$totalPages = $response['totalPages'];
37
		if(!empty($response['data'])){
41
		if(!empty($response['data'])){
38
			$this->set('orders',$response['data']);
42
			$this->set('orders',$response['data']);
39
		}
43
		}