-
Notifications
You must be signed in to change notification settings - Fork 0
/
notifications.php
85 lines (68 loc) · 2.01 KB
/
notifications.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
require_once 'AndLib/AndCore.php';
session_start();
if (empty($_SESSION['user_id'])) {
$isLogin = false;
header('Location:' . AndPath::getHost() . AndPath::getPath() . '/index.php');
} else{
$isLogin = true;
}
// jika kamu pertama kali login, kamu akan di direct untuk menyelesaikan landing page
if ($_SESSION['firstTime'] == 1) {
header('Location:' . AndPath::getHost() . AndPath::getPath() . '/landing.php');
}
$owner = $_SESSION['user_id'];
// ---------------- handle database ------------------
$con = new AndDatabase();
$notif = $con->queryObj("
SELECT *
FROM `openpen`.`notifications_list`
WHERE reciever = '$owner'
ORDER BY `notifications_list`.`notif_created` DESC
");
require_once 'templates/counter.php';
$con->closeConnection();
// ---------------- handle database ------------------
// AndDevDebug::printNice($notif);
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<!-- navigation section -->
<?php require_once 'templates/nav-header.php'; ?>
<!-- navigation section -->
<h1>Notifications</h1>
<?php foreach ($notif as $value): ?>
<?php if (intval($value->sender) == intval($owner)): ?>
<?php echo null ?>
<?php else: ?>
<p><?php
if (intval($value->notif_status == 0)) {
echo "(unread) ";
}
echo $value->firstname . " " . $value->lastname;
if (intval($value->activity) == 1) {
echo " wrote messages";
}elseif (intval($value->activity) == 2) {
echo " proposed story in ";
}elseif (intval($value->activity) == 3) {
echo " is interested in your story";
}
?>
<a href="proposal.php?ref=<?php echo $value->object_id; ?>">your Story</a>
<b> <?php
$dateRaw = AndTimeUtils::setDateToTimestamp($value->notif_created);
$agoStyle = AndTimeUtils::getTimeAgoStyle($dateRaw);
echo $agoStyle;
?>
</b>
</p>
<?php endif ?>
<?php endforeach ?>
</body>
</html>