-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreport.php
executable file
·83 lines (70 loc) · 2.69 KB
/
report.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
<?php
/*
UserCake Version: 2.0.2
http://usercake.com
*/
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
//Forms posted
if(!empty($_POST))
{
$deletions = $_POST['delete'];
if ($deletion_count = deleteUsers($deletions)){
$successes[] = lang("ACCOUNT_DELETIONS_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
require_once("models/header.php");
function reportCount()
{
echo "<h2>Statistics:</h2>";
GLOBAL $mysqli;
$sql = "SELECT count(id) as result_count FROM uc_users";
$result = mysqli_query($mysqli,$sql);
$out = mysqli_fetch_assoc($result);
echo "<h3>Users registered: ".$out["result_count"]."</h3>";
$sql = "SELECT count(cmr_id) as result_count FROM cmr";
$result = mysqli_query($mysqli,$sql);
$out = mysqli_fetch_assoc($result);
echo "<h3>CMRs created: ".$out["result_count"]."</h3>";
$sql = "SELECT count(faculty_id) as result_count FROM faculty";
$result = mysqli_query($mysqli,$sql);
$out = mysqli_fetch_assoc($result);
echo "<h3>Number of faculties: ".$out["result_count"]."</h3>";
}
$getfaculties = $mysqli->prepare("SELECT
faculty_id,
faculty_name, pvc_name, dlt_name FROM faculty");
$getfaculties->execute();
$getfaculties->bind_result($faculty_id, $faculty_name, $pvc_name, $dlt_name);
while ($getfaculties->fetch()){
$faculties[] = array('faculty_id' => $faculty_id, 'faculty_name' => $faculty_name, 'pvc_name' => $pvc_name, 'dlt_name' => $dlt_name);
}
$getfaculties->close();
echo "
</div>
<div id='main' class='col-md-10'>";
reportCount();
echo resultBlock($errors,$successes);
echo "<table class='table'><thead><tr><th>ID</th><th>Faculty Name</th><th>PVC</th><th>DLT</th><th>CMRs</th><th>Responded</th></tr></thead><tbody>";
if (isset($faculties)) {
foreach ($faculties as $faculty) {
$sql = "SELECT count(cmr_id) as result_count FROM cmr where course_code in (SELECT course_code from course where faculty_id = '".$faculty['faculty_id']."')";
$result = mysqli_query($mysqli,$sql);
$out = mysqli_fetch_assoc($result);
$sql = "SELECT count(cmr_id) as result_count FROM cmr where comment != '' and course_code in (SELECT course_code from course where faculty_id = '".$faculty['faculty_id']."')";
$result = mysqli_query($mysqli,$sql);
$out1 = mysqli_fetch_assoc($result);
echo "<tr><td>".$faculty['faculty_id']."</td><td>".$faculty['faculty_name']."</td><td>".$faculty['pvc_name']."</td><td>".$faculty['dlt_name']."</td><td>".$out["result_count"]."</td><td>".$out1["result_count"]."</td></tr>";
}
}
echo "</tbody></table>
<button type='submit' name='Print' class='btn btn-default' onclick='window.print();'>Print</button>
</div><br /> <br />
<div id='bottom'></div>
</div>
</body>
</html>";
?>