-
Notifications
You must be signed in to change notification settings - Fork 0
/
mySessions.php
executable file
·139 lines (123 loc) · 4.31 KB
/
mySessions.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
133
134
135
136
137
138
139
<?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 Sessions';
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 dang database');
if ($thisUser->isLibrarian) {
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="mySessions" ><thead id="mySessionsHead"><tr>
<th>Course</th>
<th>Title</th>
<th>Faculty</th>
<th>Fellow Present</th>
<th>Session</th>
<th>Semester</th>
<th>Date</th>
<th>Date2</th>
<th>Outcomes</th>
<th>Assessed</th>
<th>Tools</th>
</tr></thead><tbody>';
$query = 'select
s.sesdID as sessionID,
cp.crspName as CoursePrefix,
s.sesdCourseNumber as CourseNumber,
s.sesdCourseSection as CourseSection,
s.sesdCourseTitle as CourseTitle,
s.sesdSessionSection as SessionNum,
s.sesdFellowPresent as FellowPresent,
s.sesdDate as Date,
s.sesdFaculty as Faculty,
s.sesdOutcomeDone as OutcomeDone,
s.sesdAssessed as AssessedDone
from sessiondesc s, courseprefix cp
where s.sesdlibmID=? and s.sesdcrspID=cp.crspID
order by CoursePrefix, CourseNumber, CourseSection';
$stmt = mysqli_prepare($dbc, $query);
$idToUse=$thisUser->getLibrarianID();
mysqli_stmt_bind_param($stmt, 'i', $idToUse);
mysqli_stmt_execute($stmt) or die('Failed to retrieve session info: ' . mysqli_error($dbc));
mysqli_stmt_store_result($stmt);
mysqli_stmt_bind_result($stmt, $sessionID, $coursePrefix, $courseNumber, $courseSection,
$courseTitle, $sessionNumber, $fellowPresent, $date, $faculty, $outcomeDone, $AssessedDone);
while (mysqli_stmt_fetch($stmt)) {
echo "<tr class='mySessions' id='$sessionID'>
<td class='coursePrefix'>$coursePrefix $courseNumber-$courseSection</td>
<td class='courseTitle' >$courseTitle</td>
<td>$faculty</td>
<td>$fellowPresent</td>
<td>$sessionNumber</td>
<td>" . toSemester($date) . "</td>
<td class='dateCell'>" . toUSDate($date) . "</td>
<td class='sqlDateCel'>$date</td>
<td><a href='enterCurrentOutcomes.php?session=$sessionID'>$outcomeDone</a></td>";
if ($outcomeDone == 'yes') {
echo "<td><a href='assessOutcome.php?session=$sessionID'>$AssessedDone</a></td>";
} else {
echo "<td>$AssessedDone</td>";
}
echo "<td><div id='d$sessionID' class='menu-div'><p>+</p></div></td>";
}
mysqli_stmt_free_result($stmt);
echo '</tbody></table>';
}
echo '
<div id="chartContainer" style="clear: both; margin-top: 40px;">
<a href="#" id="test" style="display:none;">Test: Chart filtered sessions by prefix</a>
<div id="testChart"></div>
</div>';
$jsOutput .= 'var oTable = $("#mySessions").dataTable({
"sDom": "T<\'clear\'>lrtip",
"iDisplayLength": -1,
"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
"aoColumns": [
null,
null,
null,
null,
null,
{"iDataSort": 6},
null,
{"bVisible": false},
null,
null,
null
],
"oTableTools": {
"sSwfPath": "swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "csv",
"sButtonText": "Excel/CSV",
"mColumns": [ 0, 1, 2, 3, 4, 5, 7, 8 ]
},{
"sExtends": "pdf",
"sButtonText": "PDF",
"mColumns": [ 0, 1, 2, 3, 4, 5, 7, 8 ]
},{
"sExtends": "print",
"sButtonText": "Print",
"mColumns": [ 0, 1, 2, 3, 4, 5, 7, 8 ]
},{
"sExtends": "copy",
"sButtonText": "Copy",
"mColumns": [ 0, 1, 2, 3, 4, 5, 7, 8 ]
}
]
}
});
';
echo '<div id="dialog" style="display:none;"><div class="vcenter">Loading...</div></div>';
include('includes/footer.php');
?>