-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotifications.php
51 lines (50 loc) · 2.44 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
<?php
function displayNotifications($notifications) {
?>
<div>
<?php foreach ($notifications as $notification): ?>
<!-- New Notification element. -->
<div class="notification">
<img alt="User Profile Pic" src="<?php echo UPLOAD_DIR . $notification["from_user_profile_pic"] ?>" />
<!-- The notification hasn't been seen -->
<?php if ($notification['seen'] == 0): ?>
<span class="notify-badge badge rounded-pill bg-primary">New</span>
<?php endif; ?>
<!-- The notification is of type liked -->
<?php if ($notification['notification_type'] == 'liked'): ?>
<p>
<span class="notify-user">
<a href="<?php echo "profile.php?=".$notification['from_user_username']?>">
<?php echo $notification['from_user_username']?>
</a>
</span>
<a class="notify-liked" href="#">Liked</a> your post.
<span class="notify-time"><?php echo calculate_days($notification['date_posted']); ?></span>
</p>
<!-- The notification is of type commented -->
<?php elseif ($notification['notification_type'] == 'commented'): ?>
<p>
<span class="notify-user">
<a href="<?php echo "profile.php?=".$notification['from_user_username']?>">
<?php echo $notification['from_user_username']?>
</a>
</span>
<a class="notify-commented" href="#">Commented</a> your post.
<span class="notify-time"><?php echo calculate_days($notification['date_posted']); ?></span>
</p>
<!-- The notification is of type starred -->
<?php else: ?>
<p>
<span class="notify-user">
<a href="<?php echo "profile.php?=".$notification['from_user_username']?>">
<?php echo $notification['from_user_username']?>
</a>
</span>
<a class="notify-stared" href="#">Starred</a> your post.
<span class="notify-time"><?php echo calculate_days($notification['date_posted']); ?></span>
</p>
<?php endif; ?>
</div>
<?php endforeach;
}
?>