-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstudylog.php
More file actions
120 lines (106 loc) · 3.55 KB
/
studylog.php
File metadata and controls
120 lines (106 loc) · 3.55 KB
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
<?php include "capricornLib.php"; ?>
<!doctype html>
<HTML>
<link rel="stylesheet" href="<?php echo $URL_root; ?>css/jquery-ui.css" />
<script src="<?php echo $URL_root; ?>js/jquery-1.9.1.js"></script>
<script src="<?php echo $URL_root; ?>js/jquery-ui.js"></script>
<script src="<?php echo $URL_root; ?>js/highcharts.js"></script>
<script src="<?php echo $URL_root; ?>js/highcharts-more.js"></script>
<script src="<?php echo $URL_root; ?>js/collapseTable.js"></script>
<?php include "header.php";
?>
<TABLE WIDTH=800>
<TR><TD>
<?php
function printRaw($results) {
echo "<PRE>";
foreach ($results as $row) {
foreach($row as $col) {
if (is_a($col, "DateTime")){
$col = $col->format('Y-m-d H:i:s');
}
echo $col . "\t";
}
echo "\n";
}
echo "</PRE>";
}
function printResults($results, $results2, $desc, $dateStr, $dateStr2) {
$graphName = str_replace(' ', '', $desc);
$dateStr = str_replace('-', '/', $dateStr);
$dateStr2 = str_replace('-', '/', $dateStr2);
$dateArray = array(1 => 0, 2 => 0, 3 => 0, 4 => 0);
$dateArray2 = array(1 => 0, 2 => 0, 3 => 0, 4 => 0);
foreach ($results as $row) {
$dateArray[intval($row['ResidentYear'])] ++;
}
foreach ($results2 as $row) {
$dateArray2[intval($row['ResidentYear'])] ++;
}
$resultStr = join(',', $dateArray);
$resultStr2 = join(',', $dateArray2);
echo
<script>
<!--
$(function () {
$("#$graphName").highcharts({
chart: {
backgroundColor:'rgba(255, 255, 255, 0.0)'
},
title: {
text: "$desc",
x: -20
},
subtitle: {
text: "Powered by Capricorn",
x: -20
},
xAxis: {
categories: ['1st Year', '2nd Year', '3rd Year', '4th Year', '5th Year', '6th Year', '7th Year']
},
yAxis: {
min: 0,
title: {
text: 'Studies'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
shared: true,
valueSuffix: ' Studies'
},
series: [{
name: "$dateStr",
data: [$resultStr],
type: 'column', color: '#088DC7'}, {
name: "$dateStr2",
data: [$resultStr2],
type: 'column', color: '#00AA00'}]
});
});
//-->
</script>
<tr><td>
<div id="$graphName" style="max-width: 600px; height: 400px; margin:0 auto"></div></td>
END;
}
function displayGraph() {
global $resdbConn;
$sql = "SELECT em.AccessionNumber, ecd.Description, aid.LastName as 'Attending', ecd.Section, ecd.Type, CompletedDTTM FROM `ExamMeta` as em INNER JOIN `ExamCodeDefinition` as ecd ON (em.ExamCode = ecd.ExamCode AND ecd.ORG = em.Organization) INNER JOIN `AttendingIDDefinition` as aid ON (em.AttendingID = aid.AttendingID) WHERE TraineeID=" . $_SESSION['traineeid'] . " ORDER BY em.CompletedDTTM";
$results = $resdbConn->query($sql) or die (mysqli_error($resdbConn));
tableStartSection("Study Log");
printRaw($results);
tableEndSection();
}
displayGraph();
ob_flush();
?>
</TR></TABLE>
</BODY>
<HR>
<FONT SIZE=-2>Designed by Po-Hao Chen, Yin Jie Chen, Tessa Cook. 2014</FONT>
</HTML>