Subversion Repositories SmartDukaan

Rev

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

Rev 17184 Rev 17202
Line 236... Line 236...
236
				$sentUsers = array();
236
				$sentUsers = array();
237
				$payload = array();
237
				$payload = array();
238
				foreach ($users as $key => $value) {	
238
				foreach ($users as $key => $value) {	
239
					if(!in_array($value['User']['id'], $sentUsers)) {
239
					if(!in_array($value['User']['id'], $sentUsers)) {
240
						$sentUsers[] = $value['User']['id'];								
240
						$sentUsers[] = $value['User']['id'];								
241
						$data = array('notification_campaign_id'=>$message['cid'],'user_id'=>$value['User']['id'],'type'=>'pending','status'=>1);
241
						$data = array('notification_campaign_id'=>$message['cid'],'user_id'=>$value['User']['id'],'type'=>'pending','status'=>0);
242
						// $this->Pushnotification->create();
242
						// $this->Pushnotification->create();
243
						// $this->Pushnotification->save($data);
243
						// $this->Pushnotification->save($data);
244
						$payload[] = $data;
244
						$payload[] = $data;
245
					}
245
					}
246
				}
246
				}
247
				$url = "http://192.168.203.21:3001/addPushNotification";//remove hardcoded value
247
				$url = "http://45.33.50.227:3001/addPushNotification";//remove hardcoded value
248
				$this->make_request($url,json_encode($payload,JSON_NUMERIC_CHECK));
248
				$this->make_request($url,json_encode($payload,JSON_NUMERIC_CHECK));
249
				$this->Session->setFlash(__('Push notification scheduled for '.sizeof($users).' users'));
249
				$this->Session->setFlash(__('Push notification scheduled for '.sizeof($users).' users'));
250
				return $this->redirect(array('controller' => 'administration', 'action' => 'dashboard', 'admin' => false));
250
				return $this->redirect(array('controller' => 'administration', 'action' => 'dashboard', 'admin' => false));
251
			}
251
			}
252
		}
252
		}
253
	}
253
	}
254
}
254
}
255
255