forked from mig0s/BullyTrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcllist.php
43 lines (39 loc) · 1.72 KB
/
cllist.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
<?php
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
require_once("models/header.php");
$getcmrs = $mysqli->prepare("SELECT cmr_id, course_code, cmr_timestamp from cmr where cl_name='$loggedInUser->displayname' and status='pending';");
$getcmrs->execute();
$getcmrs->bind_result($cmr_id, $coursecode, $timestamp);
while ($getcmrs->fetch()) {
$cmrs[] = array('id' => $cmr_id, 'code' => $coursecode, 'name' => 'undefined', 'time' => $timestamp);
}
$getcmrs->close();
echo "
</div>
<div id='main' class='col-md-10'>";
echo resultBlock($errors,$successes);
echo "
<div id='regbox'><h1>My reports:</h1>
<table class='table'><thead><th>CMR ID</th><th>Course Code</th><th>Course Title</th><th>Date</th></thead><tbody>";
foreach ($cmrs as $cmr) {
$ccode = $cmr['code'];
$getcourses = $mysqli->prepare("SELECT course_name from course where course_code='$ccode'");
$getcourses->execute();
$getcourses->bind_result($course_name);
while ($getcourses->fetch()) {
$cmr['name'] = $course_name;
}
$getcourses->close();
$ts = $cmr['time'];
$time = new DateTime($ts);
$cmr['time'] = $time->format('Y-m-d');
echo "<tr><td><a href='viewcmr.php?id=".$cmr['id']."'>".$cmr['id']."</a></td><td><a href='viewcmr.php?id=".$cmr['id']."'>".$cmr['code']."</a></td><td><a href='viewcmr.php?id=".$cmr['id']."'>".$cmr['name']."</a></td><td><a href='viewcmr.php?id=".$cmr['id']."'>".$cmr['time']."</a></td></tr>";
}
echo" </tbody></table></div>
</div>
</div>
<div id='bottom'></div>
</div>
</body>
</html>";