-
Notifications
You must be signed in to change notification settings - Fork 0
/
news.php
113 lines (84 loc) · 3.29 KB
/
news.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
include 'layout.php';
include 'model.php';
$amjad = "img/avatar/amjad.jpg";
$waleed = "img/avatar/waleed.jpg";
$mustafa = "img/avatar/mustafa.JPG";
$avatar = "";
?>
<link rel="stylesheet" type="text/css" href="css/news.css">
<div id="container">
<?php
$news = getNews();
?>
<div class="row"><?php
while ($row = $news->fetch()) {
$owner = getOwnerOfNew($row['nid']);
if ($i = $owner->fetch()) {
if ($i['username'] == "Mustafa") {
$avatar = $mustafa;
} elseif ($i['username'] == "Waleed") {
$avatar = $waleed;
} else {
$avatar = $amjad;
}
?>
<div class="column">
<div class="talk-bubble">
<div class="avatar"><img src="<?= $avatar ?>"
style="max-width: 100%;max-height: 100%;"><br>Spread By:
<strong><?= $i['username'] ?></strong>
<br>
<small>Created At: <?= $row['created_at'] ?></small>
</div>
<p><?= $row['news'] ?></p>
</div>
</div>
</div>
<?php
}
} ?>
<div class="left-sidebar" id="left-sidebar">
<a href="#" id="close-sidebar" class="fas fa-arrow-left"></a>
<a href="picnics.php" class="fas fa-thumbtack"> Latest Picnics</a>
<a href="news.php" class="fas fa-newspaper"> News</a>
<?php if (isset($_SESSION['userType']) && $_SESSION['userType'] == 2) { ?>
<a href="#" class="fas fa-shopping-cart" id="openCart"> Cart <span id="openCart-span"
class="fas fa-sort-down"
style="float: right"></span></a>
<div class="purchase" id="purchase">
<?php $customer = getCustomerIdByEmail($_SESSION['email']);
$cid = 0;
if ($i = $customer->fetch())
$cid = $i['cid'];
$order = getPurchase($cid);
?>
<ul><?php
while ($i = $order->fetch()) {
echo "<li>" . $i['pid'] . " | " . $i['title'] . "</li>";
echo "<small>" . $i['invoice'] . " <strong class='fas fa-shekel-sign'></strong></small>";
echo "<hr>";
}
?> </ul><?php
?>
</div>
<?php } ?>
</div>
</div>
<script type="text/javascript">
var role = <?=$_SESSION['userType']?>
if (role ==2) {
document.getElementById('openCart').addEventListener('click', function (event) {
event.preventDefault();
openAndCloseCart();
})
}
</script>
<script>
document.getElementById('close-sidebar').addEventListener('click', function (event) {
event.preventDefault();
closeSlidMenu();
})
</script>
<?php
require 'footer.php' ?>