Subversion Repositories SmartDukaan

Rev

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

Rev 19098 Rev 19206
Line 15... Line 15...
15
 
15
 
16
    public function beforeFilter() {
16
    public function beforeFilter() {
17
    	parent::beforeFilter();
17
    	parent::beforeFilter();
18
    	// $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
18
    	// $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
19
    	$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display','home');
19
    	$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display','home');
20
        $this->Auth->allow(array('mine','login', 'forgotten_password', 'register', 'activate', 'checkemail','checkfbuser','registertwitteruser','skipmobileverification','reauthenticate','edit','mywallet','admin_push','socialauth','oneringcb','admin_usersanctions','admin_loanhistory','admin_credithistory')); 
20
        $this->Auth->allow(array('mine','login', 'forgotten_password', 'register', 'activate', 'checkemail','checkfbuser','registertwitteruser','skipmobileverification','reauthenticate','edit','mywallet','admin_push','socialauth','oneringcb','admin_usersanctions','admin_loanhistory','admin_credithistory','sendseen')); 
21
		$this->Cookie->name = 'profittill';
21
		$this->Cookie->name = 'profittill';
22
		$this->Cookie->time = 86400*30; 
22
		$this->Cookie->time = 86400*30; 
23
		$this->Cookie->path = '/';
23
		$this->Cookie->path = '/';
24
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
24
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
25
		$this->Cookie->httpOnly = true;
25
		$this->Cookie->httpOnly = true;
Line 1226... Line 1226...
1226
					
1226
					
1227
		$this->set(compact('loanHistory','usersMap','hasMore','totalCount','page'));
1227
		$this->set(compact('loanHistory','usersMap','hasMore','totalCount','page'));
1228
	}
1228
	}
1229
	
1229
	
1230
	public function usernotification($user = null){
1230
	public function usernotification($user = null){
-
 
1231
		$android_id = $this->request->query('android_id');
-
 
1232
		$user_id = $this->request->query('user_id');
1231
		$page = $this->request->query('page');
1233
		$page = $this->request->query('page');
1232
		if(!isset($page)){
1234
		if(!isset($page)){
1233
			$page = 1;
1235
			$page = 1;
1234
		}
1236
		}
1235
		$limit = 20;
1237
		$limit = 20;
1236
		$offset = ($page - 1)*$limit;
1238
		$offset = ($page - 1)*$limit;
1237
		
1239
		
1238
		$this->layout = 'innerpages';
1240
		$this->layout = 'innerpages';
-
 
1241
// 		$url = "http://45.79.106.95:3001/getAllNotifications?user_id=2&android_id=dfa8d17cd87d6748&offset=0&limit=20";
-
 
1242
		$url = Configure::read('nodeurl')."/getAllNotifications?user_id=".$user_id."&android_id=".$android_id."&offset=".$offset."&limit=".$limit;
-
 
1243
		$noti= $this->make_request($url,null);
-
 
1244
		if(isset($noti) && !empty($noti))
-
 
1245
		{
-
 
1246
			foreach ($noti as $nkey => $nval){
-
 
1247
				if($nval["status"] == "sent" || $nval["status"] == "recieved" || $nval["status"] == "failed"){
-
 
1248
					$noti[$nkey]['seen'] = false;
-
 
1249
				}
-
 
1250
				if($nval["status"] == "opened" || $nval["status"] == "referrer" || $nval["status"] == "login"){
-
 
1251
					$noti[$nkey]['seen'] = true;
-
 
1252
				}
-
 
1253
			}
-
 
1254
		}
-
 
1255
		debug($noti);
1239
		$noti = json_decode('[{"id" : 5 , "text" : "Intex Aqua Young @4301 " , "longText" : "Intex Aqua Young @4301 ","url" : "category/6","type" : "native", "seen":false , "expired": false},{"id" : 5 , "text" : "Apple iPhone 6 16GB @34556" , "longText" : "Apple iPhone 6 16GB @34556","url" : "abc.com","type" : "native","seen": true,"expired": false},{"id" : 5 , "text" : "Notification3" , "longText" : "Notification Long text 3","url" : "abc.com","type" : "native","seen": false,"expired": true}]',true);
1256
// 		$noti = json_decode('[{"id" : 5 , "text" : "Intex Aqua Young @4301 " , "message" : "Intex Aqua Young @4301 ", "longText" : "Intex Aqua Young @4301 ","url" : "category/6","type" : "native", "seen":false , "expired": false},{"id" : 5 , "text" : "Apple iPhone 6 16GB @34556" , "message" : "Apple iPhone 6 16GB @34556","longText" : "Apple iPhone 6 16GB @34556","url" : "abc.com","type" : "native","seen": true,"expired": false},{"id" : 5 , "text" : "Notification3" ,"longText" : "Notification Long text 3", "longText" : "Notification Long text 3","url" : "abc.com","type" : "native","seen": false,"expired": true}]',true);
1240
// 		debug($noti);
1257
// 		debug($noti);
1241
		$nexturl = "/users/getmorenotification?page=".($page+1);
1258
		$nexturl = "/users/getmorenotification?page=".($page+1);
1242
		$this->set(compact('noti','nexturl'));
1259
		$this->set(compact('noti','nexturl'));
1243
	}
1260
	}
1244
	
1261
	
Line 1248... Line 1265...
1248
		if(!isset($page)){
1265
		if(!isset($page)){
1249
			$page = 1;
1266
			$page = 1;
1250
		}
1267
		}
1251
		$limit = 20;
1268
		$limit = 20;
1252
		$offset = ($page - 1)*$limit;
1269
		$offset = ($page - 1)*$limit;
-
 
1270
// 		$url = "http://45.79.106.95:3001/getAllNotifications?user_id=2&android_id=dfa8d17cd87d6748&offset=0&limit=20";
-
 
1271
		$url = Configure::read('nodeurl')."/getAllNotifications?user_id=".$user_id."&android_id=".$android_id."&offset=".$offset."&limit=".$limit;
-
 
1272
		$noti= $this->make_request($url,null);
-
 
1273
		if(isset($noti) && !empty($noti))
-
 
1274
		{
-
 
1275
			foreach ($noti as $nkey => $nval){
-
 
1276
				if($nval["status"] == "sent" || $nval["status"] == "recieved" || $nval["status"] == "failed"){
-
 
1277
					$noti[$nkey]['seen'] = false;
-
 
1278
				}
-
 
1279
				if($nval["status"] == "opened" || $nval["status"] == "referrer" || $nval["status"] == "login"){
-
 
1280
					$noti[$nkey]['seen'] = true;
-
 
1281
				}
-
 
1282
			}
-
 
1283
		}
1253
		$noti = json_decode('[{"id" : 5 , "text" : "Intex Aqua Young @4301 " , "longText" : "Intex Aqua Young @4301 ","url" : "category/6","type" : "native", "seen":false , "expired": false},{"id" : 5 , "text" : "Apple iPhone 6 16GB @34556" , "longText" : "Apple iPhone 6 16GB @34556","url" : "abc.com","type" : "native","seen": true,"expired": false},{"id" : 5 , "text" : "Notification3" , "longText" : "Notification Long text 3","url" : "abc.com","type" : "native","seen": false,"expired": true}]',true);
1284
// 		$noti = json_decode('[{"id" : 5 , "text" : "Intex Aqua Young @4301 " , "message" : "Intex Aqua Young @4301 ","url" : "category/6","type" : "native", "seen":false , "expired": false},{"id" : 5 , "text" : "Apple iPhone 6 16GB @34556" , "message" : "Apple iPhone 6 16GB @34556","longText" : "Apple iPhone 6 16GB @34556","url" : "abc.com","type" : "native","seen": true,"expired": false},{"id" : 5 , "text" : "Notification3" , "message" : "Notification message","longText" : "Notification Long text 3","url" : "abc.com","type" : "native","seen": false,"expired": true}]',true);
1254
		$nexturl = "/users/getmorenotification?page=".($page+1);
1285
		$nexturl = "/users/getmorenotification?page=".($page+1);
1255
		$this->set(compact('noti','nexturl'));
1286
		$this->set(compact('noti','nexturl'));
1256
		$this->render('/Elements/getnotification');
1287
		$this->render('/Elements/getnotification');
1257
	}
1288
	}
-
 
1289
	
-
 
1290
	public function sendseen($cid = null){
-
 
1291
		$this->layout = 'ajax';
-
 
1292
		return "Hello";
-
 
1293
	}
1258
}
1294
}