-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
383 lines (357 loc) · 15.7 KB
/
header.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<?php
session_start();
if (isset($_SESSION['studID'])) {
$id = $_SESSION['id'];
$studID = $_SESSION['studID'];
$fName = $_SESSION['firstName'];
$lName = $_SESSION['lastName'];
$email = $_SESSION['email'];
$matric = $_SESSION['matric'];
$level = $_SESSION['level'];
include('config.php');
} else {
header('Location: login.php');
exit();
}
// Fetch user details
$sql = "SELECT * FROM student WHERE studID = '$studID'";
$rn = mysqli_query($conn, $sql);
if (!$rn) {
die("Query failed: " . mysqli_error($conn));
}
$user_details = mysqli_fetch_all($rn, MYSQLI_ASSOC);
if (empty($user_details)) {
header('Location: login.php');
}
$full_name = $user_details[0]['firstName'] . ' ' . $user_details[0]['lastName'];
//available COURSES
$sql = "SELECT * FROM courses WHERE level = '$level'";
$rn = mysqli_query($conn,$sql);
$numCourses = mysqli_num_rows($rn);
$courses = mysqli_fetch_all($rn,MYSQLI_ASSOC);
//active COURSES
$sql = "SELECT * FROM activecourses WHERE student = '$id'";
$rn = mysqli_query($conn,$sql);
$numActiveCourses = mysqli_num_rows($rn);
$Activecourses = mysqli_fetch_all($rn,MYSQLI_ASSOC);
//archived COURSES
$sql = "SELECT * FROM archivecourses WHERE student = '$id'";
$rn = mysqli_query($conn,$sql);
$numArchiveCourses = mysqli_num_rows($rn);
$Archivecourses = mysqli_fetch_all($rn,MYSQLI_ASSOC);
//completed COURSES
$sql = "SELECT * FROM activecourses WHERE progress = 100";
$rn = mysqli_query($conn,$sql);
$numCompleteCourses = mysqli_num_rows($rn);
$CompleteCourses = mysqli_fetch_all($rn,MYSQLI_ASSOC);
//Date Function
function simpleDate($rawDate) {
$date = new DateTime($rawDate);
return $date->format('F j, Y, g:i a');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>EDT-LMS Dashboard</title>
<link rel="stylesheet" href="assets/vendors/mdi/css/materialdesignicons.min.css">
<link rel="stylesheet" href="assets/vendors/flag-icon-css/css/flag-icon.min.css">
<link rel="stylesheet" href="assets/vendors/css/vendor.bundle.base.css">
<link rel="stylesheet" href="assets/vendors/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="assets/vendors/bootstrap-datepicker/bootstrap-datepicker.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="shortcut icon" href="assets/images/favicon.png" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
<style>
input::placeholder{
color:grey !important;
}
.navbar.fixed-top + .page-body-wrapper {
padding-top: 50px !important;
}
.icon-bg{
background-color: white !important;
}
.menu-title{
color:#f0f1f6 !important;
}
</style>
</head>
<body>
<div class="container-scroller">
<nav class="navbar default-layout-navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
<div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
<a class="navbar-brand brand-logo px-4" style="text-align:left" href="index.php">
<img src="assets/images/logo-dark.png" style="width: 150px !important;height:40px" alt="logo" />
</a>
<a class="navbar-brand brand-logo-mini" href="index.php">
<img src="assets/images/favicon.png" alt="logo" />
</a>
</div>
<div class="navbar-menu-wrapper d-flex align-items-stretch">
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
<span class="mdi mdi-menu"></span>
</button>
<ul class="navbar-nav navbar-nav-right">
<button class="btn bg-white p-3 d-flex align-items-center" type="button" id="dropdownMenuButton1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="mdi mdi-calendar mr-1"></i><span id="currentTime"><?php echo date('F j, Y, g:i:s a') ?></span>
</button>
<script>
function updateTime() {
const now = new Date();
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
hour12: true
};
const formattedDate = now.toLocaleString('en-US', options);
document.getElementById('currentTime').textContent = formattedDate;
}
// Update time immediately and then every 1 seconds
updateTime();
setInterval(updateTime, 1000);
</script>
<li class="nav-item dropdown">
<a class="nav-link count-indicator dropdown-toggle" id="notificationDropdown" href="#" data-toggle="dropdown">
<i class="mdi mdi-bell-outline"></i>
<span class="count-symbol bg-danger"></span>
</a>
<div class="dropdown-menu dropdown-menu-right navbar-dropdown preview-list" aria-labelledby="notificationDropdown">
<h6 class="p-3 mb-0 bg-primary text-white py-4">Notifications</h6>
<div class="dropdown-divider"></div>
<a class="dropdown-item preview-item">
<div class="preview-thumbnail">
<div class="preview-icon bg-success">
<i class="mdi mdi-calendar"></i>
</div>
</div>
<div class="preview-item-content d-flex align-items-start flex-column justify-content-center">
<h6 class="preview-subject font-weight-normal mb-1">Upcoming Assignment</h6>
<p class="text-gray ellipsis mb-0"> ED 215 have been added to your courses by your </p>
</div>
</a>
<div class="dropdown-divider"></div>
<h6 class="p-3 mb-0 text-center">See all notifications</h6>
</div>
</li>
</ul>
<button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
<span class="mdi mdi-menu"></span>
</button>
</div>
</nav>
<!-- partial -->
<div class="container-fluid page-body-wrapper">
<!-- partial:partials/_sidebar.php -->
<nav class="sidebar sidebar-offcanvas" id="sidebar">
<ul class="nav">
<li class="nav-item " style="border-bottom: 2px solid grey;">
<div class="mt-5" style="text-align: left;" >
<img src="assets/images/faces/1.jpg" style="border:#AE07BD solid 2px;border-radius: 50%;" width="100px" alt="Face 1">
<br><br>
<span class="text-light"> Welcome, <?php echo $fName ?> </span>
<br>
<span class="">
<?php ?>
</span>
<br>
</div>
</li>
<br><br>
<!-- <li class="nav-item" style="border-top: 2px solid white;padding-top:10px">
<a class="nav-link">
<span class="icon-bg" style="color:#AE07BD"><i class="mdi mdi-account"></i></span>
<span class="menu-title" style="color:white">Welcome, <?php echo $fName ?></span>
</a>
</li> -->
<li class="nav-item" >
<a class="nav-link" href="index.php">
<span class="icon-bg"><i class="mdi mdi-home menu-icon" style="color:#AE07BD"></i></span>
<span class="menu-title">Dashboard</span>
</a>
</li>
<?php //if ($role === 'Instructor' || $role === 'Admin') { ?>
<!-- <li class="nav-item">
<a class="nav-link" href="add_course.php">
<span class="icon-bg"><i class="mdi mdi-plus menu-icon" style="color:#AE07BD"></i></span>
<span class="menu-title">Add Course</span>
</a>
</li> -->
<?php //} ?>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#course-view" aria-expanded="false" aria-controls="course-view">
<span class="icon-bg"><i class="mdi mdi-format-list-bulleted-type menu-icon" style="color:#AE07BD"></i></span>
<span class="menu-title">Courses</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="course-view">
<ul class="nav flex-column sub-menu">
<li class="nav-item"> <a class="nav-link" href="coursesActive.php">Active Courses</a></li>
<li class="nav-item"> <a class="nav-link" href="coursesAvailable.php">Available Courses</a></li>
<li class="nav-item"> <a class="nav-link" href="coursesArchived.php">Archived Courses</a></li>
<li class="nav-item"> <a class="nav-link" href="coursesCompleted.php">Completed Courses</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="profile.php">
<span class="icon-bg"><i class="mdi mdi-account-circle menu-icon" style="color:#AE07BD"></i></span>
<span class="menu-title">Profile</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" onclick="logout()">
<span class="icon-bg">
<i class="mdi mdi-lock menu-icon" style="color:#AE07BD"></i>
</span>
<span class="menu-title">Logout</span>
</a>
</li>
</ul>
</nav>
<!-- partial -->
<script>
function logout(){
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Toastify({
text: "Logging Out...",
duration: 1000,
newWindow: true,
close: true,
gravity: "bottom",
position: "center",
stopOnFocus: true,
style: {
background: "#AE07BD",
},
onClick: function(){}
}).showToast();
setTimeout(function(){window.location = 'login.php'},1500)
}
};
xmlhttp.open("GET","logout.php",true);
xmlhttp.send();
}
function start(course){
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Toastify({
text: "Starting...",
duration: 1000,
newWindow: true,
close: true,
gravity: "bottom",
position: "center",
stopOnFocus: true,
style: {
background: "#AE07BD",
},
onClick: function(){}
}).showToast();
setTimeout(function(){window.location = 'single.php?id='+course},1500)
}
};
xmlhttp.open("GET","startFun.php?course="+course,true);
xmlhttp.send();
}
function archive(course){
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Toastify({
text: "Archiving...",
duration: 1000,
newWindow: true,
close: true,
gravity: "bottom",
position: "center",
stopOnFocus: true,
style: {
background: "#AE07BD",
},
onClick: function(){}
}).showToast();
setTimeout(function(){window.location = 'coursesArchived.php'},1500)
}
};
xmlhttp.open("GET","archFun.php?course="+course,true);
xmlhttp.send();
}
function unarch(course){
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Toastify({
text: "Archiving...",
duration: 1000,
newWindow: true,
close: true,
gravity: "bottom",
position: "center",
stopOnFocus: true,
style: {
background: "#AE07BD",
},
onClick: function(){}
}).showToast();
setTimeout(function(){window.location = 'coursesActive.php?id='+course},1500)
}
};
xmlhttp.open("GET","unArchFun.php?course="+course,true);
xmlhttp.send();
}
function updateP(course){
var prog = document.getElementById('slider').value;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Toastify({
text: "Updated...",
duration: 1000,
newWindow: true,
close: true,
gravity: "bottom",
position: "center",
stopOnFocus: true,
style: {
background: "#AE07BD",
},
onClick: function(){}
}).showToast();
// setTimeout(function(){window.location = 'coursesActive.php?id='+course},1500)
}
};
xmlhttp.open("GET","updateP.php?course="+course+"&&progress="+prog,true);
xmlhttp.send();
}
</script>