-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStaff_Topics.php
250 lines (228 loc) · 13.9 KB
/
Staff_Topics.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php
include("connection.php");
session_start(); // Start the session
if (!isset($_SESSION['login'])) {
header("Location: index.php");
} else {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- fontawesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"/>
<link rel="icon" type="image/png" href="./img/favicon.ico">
<!-- bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
crossorigin="anonymous">
<!-- main css -->
<link rel="stylesheet" type="text/css" href="./css/style.css">
<title>Topics</title>
</head>
<body class="bg-gray">
<!--============ Header =========-->
<?php
include 'header.php';
?>
<!-- ================= Main ================= -->
<div class="container-fluid" style="margin-bottom: 100px;">
<div class="row justify-content-evenly">
<!-- ================= Sidebar ================= -->
<div class="col-12 col-lg-3">
<div class="d-none d-xxl-block h-100 fixed-top overflow-hidden scrollbar"
style="max-width: 360px; width: 100%; z-index: 4">
<ul class="navbar-nav mt-4 ms-3 d-flex flex-column pb-5 mb-5" style="padding-top: 56px">
<!-- top -->
<!-- avatar -->
<li class="dropdown-item p-1 rounded">
<a href="Settings.php" class="d-flex align-items-center text-decoration-none text-dark">
<div class="p-2">
<img src="https://source.unsplash.com/collection/happy-people" alt="avatar"
class="rounded-circle me-2"
style="width: 38px; height: 38px; object-fit: cover"/>
</div>
<div>
<p class="m-0"><?php echo $_SESSION['full_name']; ?></p>
</div>
</a>
</li>
<li class="dropdown-item p-1 rounded">
<a href="Staff.php" class="d-flex align-items-center text-decoration-none text-dark"
id="manage-topics">
<div class="p-2">
<i class="fa-solid fa-bars-progress topic-icon " style="font-size: 35px;"></i>
</div>
<div>
<p class="m-0" style="padding-left: 10px;">All Ideas</p>
</div>
</a>
</li>
<li class="dropdown-item p-1 rounded">
<a href="Staff_Last.php" class="d-flex align-items-center text-decoration-none text-dark"
id="manage-topics">
<div class="p-2">
<i class="fa-solid fa-bars-progress topic-icon" style="font-size: 35px;"></i>
</div>
<div>
<p class="m-0" style="padding-left: 10px;">Last Ideas</p>
</div>
</a>
</li>
<li class="dropdown-item p-1 rounded">
<a href="Staff_Hot.php" class="d-flex align-items-center text-decoration-none text-dark"
id="manage-topics">
<div class="p-2">
<i class="fa-solid fa-bars-progress topic-icon" style="font-size: 35px;"></i>
</div>
<div>
<p class="m-0" style="padding-left: 10px;">Hot Ideas</p>
</div>
</a>
</li>
<li class="dropdown-item p-1 rounded">
<a href="Staff_MyPost.php" class="d-flex align-items-center text-decoration-none text-dark"
id="manage-topics">
<div class="p-2">
<i class="fa-solid fa-bars-progress topic-icon" style="font-size: 35px;"></i>
</div>
<div>
<p class="m-0" style="padding-left: 10px;">My Ideas</p>
</div>
</a>
</li>
<li class="dropdown-item p-1 rounded">
<a href="Staff_Topics.php" class="d-flex align-items-center text-decoration-none text-dark"
id="manage-topics">
<div class="p-2">
<i class="fa-solid fa-bars-progress topic-icon active" style="font-size: 35px;"></i>
</div>
<div>
<p class="m-0" style="padding-left: 10px;" id="manage-topics-text">Topics</p>
</div>
</a>
</li>
<hr class="m-0"/>
</ul>
</div>
</div>
<!-- ================= Timeline ================= -->
<div class="col-12 col-lg-12">
<div class="d-flex flex-column justify-content-center mx-auto main-container">
<!-- Latest Topics -->
<div class="bg-white p-3 mb-3">
<h3 class="text-dark mb-3 text-center">Latest Topics</h3>
<?php
$sql = "SELECT * FROM Topic, Deadline WHERE Topic.DeadlineID = Deadline.DeadlineID AND Deadline.ClosureDate > NOW() AND Deadline.FinalClosureDate > NOW() ORDER BY Deadline.ClosureDate DESC";
$result = mysqli_query($conn, $sql);
?>
<?php if (mysqli_num_rows($result) > 0) { ?>
<div class="row">
<?php while ($row = mysqli_fetch_assoc($result)) { ?>
<div class="col-6 col-md-4 mb-3">
<a href="Staff_PostIdeas.php?topic=<?php echo $row['TopicID']; ?>"
class="text-decoration-none text-dark">
<div class="bg-light p-3 text-center">
<i class="fas fa-book fa-3x mb-3"></i>
<h5 class="mb-2"><?php echo $row['TopicName']; ?></h5><span
class="badge bg-success">Open</span>
<p class="mb-1"><i class="fas fa-calendar-alt"></i> <strong>Deadline for
submit:</strong> <span
class="font-weight-bold"><?php echo $row['ClosureDate']; ?></span>
</p>
<p><i class="fas fa-calendar-alt"></i> <strong>Final deadline:</strong>
<span
class="font-weight-bold"><?php echo $row['FinalClosureDate']; ?></span>
</p>
</div>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<!-- Topic Has Closed -->
<div class="bg-white p-3 mb-3">
<h3 class="text-dark mb-3 text-center">Topic Has Closed Submission</h3>
<?php
// Get all topics that has closed where the current date is greater than the closure date
$sql = "SELECT * FROM Topic, Deadline WHERE Topic.DeadlineID = Deadline.DeadlineID AND Deadline.ClosureDate < NOW() AND Deadline.FinalClosureDate > NOW() ORDER BY Deadline.ClosureDate DESC";
$result = mysqli_query($conn, $sql);
?>
<?php if (mysqli_num_rows($result) > 0) { ?>
<div class="row">
<?php while ($row = mysqli_fetch_assoc($result)) { ?>
<div class="col-6 col-md-4 mb-3">
<a href="Staff_PostIdeas.php?topic=<?php echo $row['TopicID']; ?>"
class="text-decoration-none text-dark">
<div class="bg-light p-3 text-center">
<i class="fas fa-book fa-3x mb-3"></i>
<h5 class="mb-2"><?php echo $row['TopicName']; ?></h5><span
class="badge bg-warning">Closed for submission</span>
<p class="mb-1"><i class="fas fa-calendar-alt"></i> <strong>Deadline for
submit:</strong> <span
class="font-weight-bold"><?php echo $row['ClosureDate']; ?></span>
</p>
<p><i class="fas fa-calendar-alt"></i> <strong>Final deadline:</strong>
<span
class="font-weight-bold"><?php echo $row['FinalClosureDate']; ?></span>
</p>
</div>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<!-- Topic Has Completely Closed -->
<div class="bg-white p-3 mb-3">
<h3 class="text-dark mb-3 text-center">Topic Has Completely Closed</h3>
<?php
$sql = "SELECT * FROM Topic, Deadline WHERE Topic.DeadlineID = Deadline.DeadlineID AND Deadline.ClosureDate < NOW() AND Deadline.FinalClosureDate < NOW()";
$result = mysqli_query($conn, $sql);
?>
<?php if (mysqli_num_rows($result) > 0) { ?>
<div class="row">
<?php while ($row = mysqli_fetch_assoc($result)) { ?>
<div class="col-6 col-md-4 mb-3">
<a href="Staff_PostIdeas.php?topic=<?php echo $row['TopicID']; ?>"
class="text-decoration-none text-dark">
<div class="bg-light p-3 text-center">
<i class="fas fa-book fa-3x mb-3"></i>
<h5 class="mb-2"><?php echo $row['TopicName']; ?></h5><span
class="badge bg-danger">Closed</span>
<p class="mb-1"><i class="fas fa-calendar-alt"></i> <strong>Deadline for
submit:</strong> <span
class="font-weight-bold"><?php echo $row['ClosureDate']; ?></span>
</p>
<p><i class="fas fa-calendar-alt"></i> <strong>Final deadline:</strong>
<span
class="font-weight-bold"><?php echo $row['FinalClosureDate']; ?></span>
</p>
</div>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div>
<!-- ================= Footer ================= -->
<!--============ Footer =========-->
<?php
include 'footer.php';
?>
<!-- bootstrap -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
<!-- main js -->
<script src="./js/main.js"></script>
</body>
</html>
<?php } ?>