-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeetingStats.php
95 lines (77 loc) · 2.92 KB
/
meetingStats.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
<?php
$start_time = microtime(TRUE);
require "include/db.php";
require "include/functions.php";
new Session($conn);
if (isset($_SESSION["loggedin"]) && in_array($_SESSION["role"], ["Officer", "Admin"])) {
$role = $_SESSION["role"];
$userID = $_SESSION["id"];
} else {
header('Location: login.php');
die();
}
$title = 'Meeting Statistics';
require 'include/header.php';
$meetingID = isset($_GET['meetingID']) ? $_GET['meetingID'] : 0;
$meetingInfo = getMeetingInfo($conn, $meetingID);
if (!$meetingInfo) {
header('Location: account.php');
die();
}
$attendeeStats = getAttendanceTimeStats($conn, $meetingID);
$pieChartStats = getOfficerPieChartStats($conn, $meetingID);
?>
<main class="py-4">
<div class="container">
<div class="card">
<div class="card-body">
<button class="btn btn-secondary" onclick="window.history.back();">
<span class="fa fa-fw fa-arrow-left"></span> Back to Meeting Info
</button>
<br /><br />
<h2><?php echo $meetingInfo->name; ?> Statistics</h2>
<br/>
<div class="card">
<div class="card-body">
<h2 class="text-center">Members Signed in Over Time</h2>
<canvas id="lineChart"></canvas>
</div>
</div>
</div>
</div>
<br />
<div class="card">
<div class="card-body">
<div class="row">
<div class="offset-md-2 col-md-8">
<div class="card">
<div class="card-body">
<h2 class="text-center">Members Signed in by Officer</h2>
<canvas id="pieChart"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- libraries -->
<script src="/js/moment.min.js"></script>
<script src="/js/chart.js"></script>
<script src="/js/chartUtils.js"></script>
<!-- custom scripts -->
<script>
var times = [ <?php echo implode(', ', $attendeeStats['times']); ?> ];
var attendees = [ <?php echo implode(', ', $attendeeStats['attendees']); ?> ];
var pieChartLabels = ["<?php echo implode('", "', $pieChartStats['officerName']); ?> "];
var pieChartData = [ <?php echo implode(', ', $pieChartStats['officerCount']); ?> ];
</script>
<script src="/js/meetingStats.js"></script>
</body>
</html>
<?php
$end_time = microtime(TRUE);
$time_taken = $end_time - $start_time;
$time_taken = round($time_taken, 5);
echo '<!-- Dynamic page generated in ' . $time_taken . ' seconds. -->';