forked from vignesh-82coder/Foodereum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
notification.php
32 lines (28 loc) · 981 Bytes
/
notification.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php SESSION_START();
include_once 'config/Database.php';
include_once 'class/Notification.php';
$database = new Database();
$db = $database->getConnection();
$notification = new Notification($db);
$array=array();
$rows=array();
$notification->username = $_SESSION['username'];
$result = $notification->getNotificationByUser();
$totalNotification = 0;
while ($userNotification = $result->fetch_assoc()) {
$data['title'] = $userNotification['title'];
$data['message'] = $userNotification['message'];
$data['icon'] = 'avatar.png';
$data['url'] = 'manage.php';
$rows[] = $data;
$nextime = date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s'))+($userNotification['repeat']*60));
$notification->nexttime = $nextime;
$notification->id = $userNotification['id'];
$notification->updateNotification();
$totalNotification++;
}
$array['notif'] = $rows;
$array['count'] = $totalNotification;
$array['result'] = true;
echo json_encode($array);
?>