Subversion Repositories SmartDukaan

Rev

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

Rev 14662 Rev 15530
Line 16... Line 16...
16
	public $components = array('Paginator');
16
	public $components = array('Paginator');
17
 
17
 
18
	public function index() {	
18
	public function index() {	
19
		$this->layout = 'ajax';
19
		$this->layout = 'ajax';
20
		$t = $this->request->query('t');
20
		$t = $this->request->query('t');
-
 
21
		$imeinumber = $this->request->query('imeinumber');
21
		if(!empty($t) && $t >0){
22
		if(!empty($t) && $t >0){
22
			$options = array('conditions'=>array("unix_timestamp(modified) > "=>$t));
23
			$options = array('conditions'=>array("unix_timestamp(modified) > "=>$t));
23
		}else{
24
		}else{
24
			$options = null;
25
			$options = null;
25
		}
26
		}
26
		$settings = $this->Mobileappsetting->find('all',$options);
27
		$settings = $this->Mobileappsetting->find('all',$options);
27
		$options = array('fields'=>array("unix_timestamp(modified) t"),'order'=>array('modified'=>'desc'));
28
		$options = array('fields'=>array("unix_timestamp(modified) t"),'order'=>array('modified'=>'desc'));
28
		$lasttimestamp = $this->Mobileappsetting->find('first',$options);		
29
		$lasttimestamp = $this->Mobileappsetting->find('first',$options);	
-
 
30
		$failureCount = 0;
-
 
31
		if(isset($imeinumber) && !empty($imeinumber)) {
-
 
32
			$this->loadModel('GcmUser');
-
 
33
			$options = array('conditions'=>array('imeinumber'=>$imeinumber),'fields'=>array('failurecount'),'order'=>array('id'=>'desc'));
-
 
34
			$data = $this->GcmUser->find('first',$options);
-
 
35
			if(!empty($data)){
-
 
36
				$failureCount = $data['GcmUser']['failurecount'];
-
 
37
			}
-
 
38
		}
29
		$result = array('settings' => $settings,'t'=>$lasttimestamp[0]['t']);
39
		$result = array('settings' => $settings,'t'=>$lasttimestamp[0]['t'],'failureCount'=>$failureCount);
30
		$this->set(array(
40
		$this->set(array(
31
		    'result' => $result,
41
		    'result' => $result,
32
		    '_serialize' => array('result')
42
		    '_serialize' => array('result')
33
		));
43
		));
34
		$this->render('/Elements/json');
44
		$this->render('/Elements/json');