-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyAssessments.php
executable file
·132 lines (113 loc) · 4.68 KB
/
myAssessments.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
123
124
125
126
127
128
129
130
131
132
<?php
include('control/connectionVars.php');
include_once('control/functions.php');
include('classes/InstructionSession.php');
include('classes/User.php');
require_once('control/startSession.php');
$page_title = 'My Assessments';
include('includes/header.php');
$thisUser = $_SESSION['thisUser'];
echo '<h2>'.$page_title.'</h2>';
/*TODO: this is an annoying workaround that prevents the focus to filter input from breaking (can't click or enter */
echo'<span> </span>';
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Error connecting to the stupid database');
if ($thisUser->isLibrarian) {
$query = 'select
s.sesdID as SessionID,
cp.crspName as CoursePrefix,
s.sesdCourseNumber as CourseNumber,
s.sesdCourseSection as CourseSection,
s.sesdSessionSection as SessionSection,
s.sesdDate as Date,
ot.otctID as OutcomeTaughtID,
CONCAT(od.otcdotchID, od.otcdName) as OutcomeName,
oa.otcaID as OutcomeID,
oa.otcaMet as Met,
oa.otcaPartial as Partial,
oa.otcaNotMet as NotMet,
oa.otcaNotAssessed as NotAssessed
from
sessiondesc s,
courseprefix cp,
outcomestaught ot,
outcomedetail od,
outcomesassessed oa
where
s.sesdlibmID = ?
and s.sesdAssessed = "yes"
and s.sesdcrspID = cp.crspID
and ot.otctsesdID = s.sesdID
and ot.otctotcdID = od.otcdID
and oa.otcaotctID = ot.otctID
order by
CoursePrefix,
CourseNumber,
CourseSection,
outcomeName';
// 8 columns.
echo '<div class="dataTables_filter">
<label for="dataTables_filter">Filter</label><input type="text" id="dataTables_filter" class="ui-widget" />
<label for="dataTables_invert">Invert</label><input type="checkbox" id="dataTables_invert" />
</div>
<table id="myAssessments"><thead id="myAssessmentsHead"><tr>' .
// *** for dataTables grouping addOn ***
'<th>Course</th>' .
// *** ***
'<th>Semester</th>' .
// '<th>Course</th>'.
'<th>Outcome</th>' .
'<th>Met</th>' .
'<th>Partially Met</th>' .
'<th>Not Met</th>' .
'<th>Assessed</th>' .
'</tr></thead><tbody>';
$row = array();
$stmt = mysqli_prepare($dbc, $query);
$thisLibrarianID = $thisUser->getLibrarianID();
mysqli_stmt_bind_param($stmt, 'i', $thisLibrarianID);
mysqli_stmt_execute($stmt) or die('Failed to retrieve assessments: ' . mysqli_error($dbc));
mysqli_stmt_store_result($stmt);
mysqli_stmt_bind_result($stmt, $row['SessionID'], $row['CoursePrefix'], $row['CourseNumber'], $row['CourseSection'], $row['SessionSection'], $row['Date'], $row['OutcomeTaughtID'], $row['OutcomeName'], $row['OutcomeID'], $row['Met'], $row['Partial'], $row['NotMet'], $row['NotAssessed']);
while (mysqli_stmt_fetch($stmt)) {
$sessionID = $row['SessionID'];
$coursePrefix = $row['CoursePrefix'];
$courseNumber = $row['CourseNumber'];
$courseSection = $row['CourseSection'];
$sessionSection = $row['SessionSection'];
$date = $row['Date'];
$sessionDate = toUSDate($date);
$semester = toSemester($date);
$outcomeTaughtID = $row['OutcomeTaughtID'];
$outcomeName = $row['OutcomeName'];
$outcomeID = $row['OutcomeID'];
$met = $row['Met'];
$partial = $row['Partial'];
$notMet = $row['NotMet'];
$notAssessed = $row['NotAssessed'];
if ($notAssessed == '1') {
$notAssessed = "No";
} else {
$notAssessed = "Yes";
}
echo "<tr class='myAssessments'>" .
// *** for dataTables grouping addOn ***
"<td class='myAssessments otcdID$outcomeID coursePrefix'>$coursePrefix $courseNumber-$courseSection $sessionSection $semester</td>" .
// *** ***
"<td class='myAssessments otcdID$outcomeID semester'>$semester</td>" .
// "<td class='myAssessments otcdID$outcomeID coursePrefix'>$coursePrefix $courseNumber-$courseSection $sessionSection</td>".
"<td class='myAssessments otcdID$outcomeID outcomeName'>$outcomeName</td>" .
"<td class='myAssessments otcdID$outcomeID met'>$met</td>" .
"<td class='myAssessments otcdID$outcomeID partial'>$partial</td>" .
"<td class='myAssessments otcdID$outcomeID notMet'>$notMet</td>" .
"<td class='myAssessments otcdID$outcomeID notAssessed'>$notAssessed</td></tr>";
}
echo '</tbody></table>';
mysqli_stmt_free_result($stmt);
}
$jsOutput .= 'var oTable = $("#myAssessments").dataTable({
"sDom": "T<\'clear\'>lrtip",
"bPaginate": false,
"oTableTools": { "sSwfPath":"swf/copy_csv_xls_pdf.swf" }
});';
include('includes/footer.php');
?>