| Line 293... |
Line 293... |
| 293 |
$url = Configure::read('nodeurl')."/getNotificationCampaignById?id=".$id;
|
293 |
$url = Configure::read('nodeurl')."/getNotificationCampaignById?id=".$id;
|
| 294 |
$result = $this->make_request($url,null);
|
294 |
$result = $this->make_request($url,null);
|
| 295 |
$getdata = array();
|
295 |
$getdata = array();
|
| 296 |
$getdata["NotificationCampaign"] = $result;
|
296 |
$getdata["NotificationCampaign"] = $result;
|
| 297 |
$getdata["NotificationCampaign"]["expiresat"] = date('Y-m-d H:i:s', $result["expiresat"]/1000);
|
297 |
$getdata["NotificationCampaign"]["expiresat"] = date('Y-m-d H:i:s', $result["expiresat"]/1000);
|
| 298 |
$getdata["NotificationCampaign"]["id"] = $result["_id"];
|
298 |
$getdata["NotificationCampaign"]["created"] = date('Y-m-d H:i:s', $result["created"]/1000);
|
| 299 |
unset($getdata["NotificationCampaign"]["_id"]);
|
299 |
unset($getdata["NotificationCampaign"]["_id"]);
|
| 300 |
// debug($getdata);
|
300 |
// debug($getdata);
|
| 301 |
|
301 |
|
| 302 |
// if (!$this->NotificationCampaign->exists($id)) {
|
302 |
// if (!$this->NotificationCampaign->exists($id)) {
|
| 303 |
// throw new NotFoundException(__('Invalid notification campaign'));
|
303 |
// throw new NotFoundException(__('Invalid notification campaign'));
|
| Line 321... |
Line 321... |
| 321 |
$userActions = array();
|
321 |
$userActions = array();
|
| 322 |
$url = Configure::read('nodeurl')."/getPushNotificationByCampaignId/?notification_campaign_id=".$id;
|
322 |
$url = Configure::read('nodeurl')."/getPushNotificationByCampaignId/?notification_campaign_id=".$id;
|
| 323 |
// echo $url;
|
323 |
// echo $url;
|
| 324 |
$result = $this->make_request($url,null);
|
324 |
$result = $this->make_request($url,null);
|
| 325 |
foreach ($result as $key => $value) {
|
325 |
foreach ($result as $key => $value) {
|
| 326 |
if($value['type']=='sent'){
|
326 |
/*if($value['type']=='sent'){
|
| 327 |
// date_default_timezone_set('GMT');
|
- |
|
| 328 |
$epoch = $value['created']/1000;
|
327 |
$epoch = $value['created']/1000;
|
| 329 |
$dt = date('Y-m-d H:i:s', $epoch);
|
328 |
$dt = date('Y-m-d H:i:s', $epoch);
|
| 330 |
// echo $dt->format('Y-m-d H:i:s');
|
329 |
// echo $dt->format('Y-m-d H:i:s');
|
| 331 |
$userActions[$value['user_id']][$value['type']] = $dt;//$value['created'];
|
330 |
$userActions[$value['user_id']][$value['type']] = $dt;//$value['created'];
|
| 332 |
$userActions[$value['user_id']]['status'] =$value['status'];
|
331 |
$userActions[$value['user_id']]['status'] =$value['status'];
|
| 333 |
}else if(isset($value['response_time'])){
|
332 |
}else if(isset($value['response_time'])){
|
| 334 |
$epoch = $value['response_time']/1000;
|
333 |
$epoch = $value['response_time']/1000;
|
| 335 |
// date_default_timezone_set('GMT');
|
- |
|
| 336 |
$dt = date('Y-m-d H:i:s', $epoch);
|
334 |
$dt = date('Y-m-d H:i:s', $epoch);
|
| 337 |
if(isset($value['user_id'])){
|
335 |
if(isset($value['user_id'])){
|
| 338 |
$userActions[$value['user_id']][$value['type']] = $dt;//$value['response_time'];
|
336 |
$userActions[$value['user_id']][$value['type']] = $dt;//$value['response_time'];
|
| 339 |
}
|
337 |
}
|
| 340 |
}else{
|
338 |
}else{
|
| 341 |
$epoch = $value['created']/1000;
|
339 |
$epoch = $value['created']/1000;
|
| 342 |
$dt = date('Y-m-d H:i:s', $epoch);
|
340 |
$dt = date('Y-m-d H:i:s', $epoch);
|
| 343 |
if(isset($value['user_id'])){
|
341 |
if(isset($value['user_id'])){
|
| 344 |
$userActions[$value['user_id']][$value['type']] = $dt;//$value['response_time'];
|
342 |
$userActions[$value['user_id']][$value['type']] = $dt;//$value['response_time'];
|
| 345 |
}
|
343 |
}
|
| - |
|
344 |
}*/
|
| - |
|
345 |
if($value['sent_timestamp']!=null){
|
| - |
|
346 |
$epoch = $value['sent_timestamp']/1000;
|
| - |
|
347 |
$dt = date('Y-m-d H:i:s', $epoch);
|
| - |
|
348 |
$userActions[$value['user_id'].'_'.$value['_id']]['sent'] = $dt;
|
| - |
|
349 |
}
|
| - |
|
350 |
if($value['receive_timestamp']!=null){
|
| - |
|
351 |
$epoch = $value['receive_timestamp']/1000;
|
| - |
|
352 |
$dt = date('Y-m-d H:i:s', $epoch);
|
| - |
|
353 |
$userActions[$value['user_id'].'_'.$value['_id']]['recieved'] = $dt;
|
| 346 |
}
|
354 |
}
|
| - |
|
355 |
if($value['open_timestamp']!=null){
|
| - |
|
356 |
$epoch = $value['open_timestamp']/1000;
|
| 347 |
//debug($value);
|
357 |
$dt = date('Y-m-d H:i:s', $epoch);
|
| - |
|
358 |
$userActions[$value['user_id'].'_'.$value['_id']]['opened'] = $dt;
|
| - |
|
359 |
}
|
| 348 |
}
|
360 |
}
|
| 349 |
|
361 |
|
| 350 |
// $cid=$userData['NotificationCampaign']['id'];
|
362 |
// $cid=$userData['NotificationCampaign']['id'];
|
| 351 |
// $sqlQuery = "SELECT status as status,notification_campaign_id,type,count(*) as count FROM pushnotifications where notification_campaign_id=4120 group by type,status";
|
363 |
// $sqlQuery = "SELECT status as status,notification_campaign_id,type,count(*) as count FROM pushnotifications where notification_campaign_id=4120 group by type,status";
|
| 352 |
// $resul=$this->NotificationCampaign->query($sqlQuery);
|
364 |
// $resul=$this->NotificationCampaign->query($sqlQuery);
|
| Line 579... |
Line 591... |
| 579 |
return $this->redirect(array('controller' => 'administration', 'action' => 'dashboard', 'admin' => false));
|
591 |
return $this->redirect(array('controller' => 'administration', 'action' => 'dashboard', 'admin' => false));
|
| 580 |
}
|
592 |
}
|
| 581 |
}
|
593 |
}
|
| 582 |
}
|
594 |
}
|
| 583 |
}
|
595 |
}
|
| - |
|
596 |
|
| - |
|
597 |
public function admin_user_polling(){
|
| - |
|
598 |
$page = $this->request->query('page');
|
| - |
|
599 |
if(!isset($page)){
|
| - |
|
600 |
$page = 1;
|
| - |
|
601 |
}
|
| - |
|
602 |
$limit = 50;
|
| - |
|
603 |
$offset = ($page - 1)*$limit;
|
| - |
|
604 |
$url = Configure::read('nodeurl').'/fetchPollUsers?limit='.$limit.'&offset='.$offset;
|
| - |
|
605 |
$response = $this->make_request( $url, null );
|
| - |
|
606 |
foreach ($response as $key => $value) {
|
| - |
|
607 |
$response[$key]['updatedOn'] = date('Y-m-d H:i:s', $value["updatedOn"]/1000);
|
| - |
|
608 |
$response[$key]['createdOn'] = date('Y-m-d H:i:s', $value["createdOn"]/1000);
|
| - |
|
609 |
}
|
| - |
|
610 |
$this->set(compact('response','page'));
|
| - |
|
611 |
}
|
| 584 |
}
|
612 |
}
|
| 585 |
|
613 |
|