forked from quizcore/front-end-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin-user.php
122 lines (113 loc) · 2.78 KB
/
admin-user.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
<?php
// Initialize the session.
session_start();
// Check if the user is not logged in, redirect them to the login page.
if (!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true) {
header("Location: admin-login.php");
exit();
}
?>
<?php
$pageTitle = "Guidelines";
require_once 'header.php';
?>
<!--Main-->
<div class="container">
<h2>User Information</h2>
<!-- Listing all users. -->
<table class="table table-striped">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Date of Birth</th>
<th>Test Result</th>
</tr>
</thead>
<tbody>
<!-- Sample data, replace with dynamic data from your application -->
<tr>
<td>John</td>
<td>Doe</td>
<td>[email protected]</td>
<td>1990-01-01</td>
<td>CS110</td>
</tr>
<tr>
<td>Jane</td>
<td>Smith</td>
<td>[email protected]</td>
<td>1995-05-15</td>
<td>CS111</td>
</tr>
<tr>
<td>Tu</td>
<td>Ho</td>
<td>[email protected]</td>
<td>1995-05-15</td>
<td>Passed</td>
</tr>
<tr>
<td>John</td>
<td>Smith</td>
<td>[email protected]</td>
<td>1994-05-15</td>
<td>Passed</td>
</tr>
<!-- Add more rows for additional users -->
</tbody>
</table>
<!-- Student Self-Placement Distribution Pie Chart -->
<canvas id="classPieChart" width="200" height="200" style="max-width: 300px; max-height: 300px"></canvas>
</div>
<script>
document
.getElementById("myForm")
.addEventListener("submit", function(event) {
event.preventDefault(); // Prevents the default form submission behavior
window.location.href = "exam.php"; // Redirect to exam.html
});
</script>
<script>
// Get data from table rows.
let tableRows = document.querySelectorAll('table tbody tr');
let classData = {
CS110: 0,
CS111: 0,
Passed: 0
};
tableRows.forEach(row => {
let recommendedClass = row.cells[4].textContent;
classData[recommendedClass]++;
});
// Create Student Self-Placement Distribution Pie Chart.
let ctx = document.getElementById('classPieChart').getContext('2d');
let myPieChart = new Chart(ctx, {
type: 'pie',
data: {
labels: Object.keys(classData),
datasets: [{
data: Object.values(classData),
backgroundColor: [
'rgba(255, 99, 132, 0.6)',
'rgba(54, 162, 235, 0.6)',
'rgba(75, 192, 192, 0.6)'
]
}]
},
options: {
plugins: {
title: {
display: true,
text: 'Student Self-Placement Distribution'
}
}
},
});
</script>
<!--End of Main-->
<?php
// Include footer.
require_once 'footer.php';
?>