-
Notifications
You must be signed in to change notification settings - Fork 0
/
notifications.php
61 lines (50 loc) · 2.15 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
<div class="col-lg-12 sidebar-offcanvas sidebar-right">
<?php
$sql = "SELECT n.id, n.student_id, n.pub_date, n.category_name, n.subject, n.description, n.read_flag, c.color, c.URL, c.icon FROM notifications n, categories c WHERE (student_id = '" . $_SESSION['student_id'] ."') AND n.category_name = c.name ORDER BY n.PUB_DATE";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
echo '
<h5 class="section-title hidden-lg-down">Notifiche</h5>
<div class="card card-block">
<ul class="list-group history">';
while($row = $result->fetch_assoc()) {
$id = $row['id'];
$subject = $row['subject'];
$description = $row['description'];
$read_flag = $row['read_flag'];
$category_name = $row['category_name'];
$pub_date = $row['pub_date'];
$color = $row['color'];
$icon = $row['icon'];
$url = $row['URL'];
if(!$read_flag) {
echo '<li class="list-group-item list-group-notification notification-unread" data-notification-id="' . $id . '">';
} else {
echo '<li class="list-group-item list-group-notification" data-notification-id="' . $id . '">';
}
echo '
<div class="tag-align">
<a href="' . $url . '">
<span class="tag tag-custom" style="background-color: ' . $color . '">
<span class="icon-' . $icon . '" aria-hidden="true"></span>
</span>
</a>
</div>
<span>
<strong>' . $subject . '</strong> - ' . $description . '</br>
<span class="text-muted">' . $pub_date . ' · ' . $category_name . '</span>
</span>
</li>
';
}
echo '</ul>
</div>';
} else {
echo '<div class="row">
<span class="icon-pin big-grey-icon" aria-hidden="true"></span>
<h3 class="login-card-title">Nessuna notifica</h3>
<p class="login-card-subtitle">Attualmente non é registrata nessuna notifica.</p>
</div>'; //TODO do it better
}
?>
</div><!--/span-->