Repository navigation
Expand file tree
/
Copy pathuser_details.php
More file actions
251 lines (204 loc) · 7.66 KB
/
Copy pathuser_details.php
File metadata and controls
251 lines (204 loc) · 7.66 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?php
// TODO: merge with my_reservations.php
session_start();
require_once("config/config.inc.php");
require_once("includes/Database.php");
require_once("load.php");
require_once("includes/verify_access.php");
restrict_access($db,array("staff","admin"));
$reservation_id = $_GET['reservation_id'];
$user_id = $_GET['user_id'];
$checkin_key_barcode = $_GET['checkin_key_barcode'];
$checkout_key_barcode = $_GET['checkout_key_barcode'];
if(isset($_GET['user_id']))
{
// lookup user by user id
$user = get_user_by_id($_GET['user_id']);
if($user == null)
{
require_once("includes/header.php");
print("<div id='PageTitle'>User Details</div>\n");
print("<div class='breadcrumb'><a href='http://library.pdx.edu'>Home</a> » <a href='index.php'>Reserve a Study Room</a> » User Details</div>\n");
print("<br>\n");
display_error("User not found",$_GET);
require_once("includes/footer.php");
exit();
}
}
// KEY CHECK-IN
if(isset($_GET['reservation_id']) && isset($_GET['room_id']) && isset($_GET['checkin_key_barcode']))
{
// TODO: check to make sure key hasn't already been checked in (reload issue)
$checkin_result = checkin_key($_GET['reservation_id'],$_GET['room_id'],$_GET['checkin_key_barcode']);
// reload user
$users = find_users_by_name_or_patron_id($_GET['search']);
foreach($users as $user)
break;
$message = "Successfully checked-in key for $user->first_name $user->last_name.";
}
// KEY CHECKOUT
if(isset($_GET['reservation_id']) && isset($_GET['room_id']) && isset($_GET['checkout_key_barcode']))
{
// TODO: check to make sure key hasn't already been checked out (reload issue)
$checkout_result = checkout_key($_GET['reservation_id'],$_GET['room_id'],$_GET['checkout_key_barcode']);
// reload user
$users = find_users_by_name_or_patron_id($_GET['search']);
foreach($users as $user)
break;
$message = "Successfully checked out key to $user->first_name $user->last_name.";
}
require_once("includes/header.php");
?>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
// turn off caching for ajax calls, fixes IE caching issue
jQuery.ajaxSetup({ cache: false });
jQuery(document).ready(function($)
{
var upcoming_reservations_table = $('#upcoming_reservations_table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[ 0, "asc" ]],
"aoColumns": [
{ "sWidth": "150px"},
{ "bSortable": false, "sWidth": "200px" },
{ "bSortable": false, "sWidth": "200px" },
{ "sWidth": "100px" },
{ "bSortable": false, "sWidth": "50px" }
]
});
var reservation_history_table = $('#reservation_history_table').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaSorting": [[ 0, "desc" ]],
"aoColumns": [
{ "sWidth": "150px"},
{ "bSortable": false, "sWidth": "150px" },
{ "bSortable": false, "sWidth": "150px" },
{ "bSortable": false, "sWidth": "100px" },
{ "bSortable": false, "sWidth": "100px" },
{ "sWidth": "100px" },
{ "sWidth": "100px" },
{ "bSortable": false, "sWidth": "50px" }
]
});
});
</script>
<link rel="stylesheet" href="css/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/results_table.css" type="text/css" media="all" />
<style>
.dataTable td {padding:0;}
.dataTable th {padding:0;}
</style>
<?php
print("<div id='PageTitle'>$user->first_name $user->last_name</div>\n");
print("<div class='breadcrumb'><a href='http://library.pdx.edu'>Home</a> » <a href='index.php'>Reserve a Study Room</a> » User Details - $user->first_name $user->last_name</div>\n");
print("<div style='float:right; background-color:#FFF'>\n");
require_once("includes/available_credits_widget.php");
print("</div>\n");
print("<br>\n");
//pr($user);
print("<div style='font-weight:bold; color:green;'>$message</div><br>\n");
// get current checkouts
print("<h2>Currently Checked Out</h2>\n");
if(isset($user->reservations["Checked Out"]))
{
$checkouts = $user->reservations["Checked Out"];
foreach($checkouts as $checkout)
{
print_checkin_form($checkout,$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']);
}
}
else
print("<h3 style='margin-left:30px;'>No checkouts at this time.</h3><br>\n");
display_errors($error_messages['checkin_key_barcode']);
// get next reservation info
print("<h2>Scheduled Upcoming Reservations</h2>\n");
if(isset($user->reservations["Scheduled"]))
{
$first = true;
$upcoming = $user->reservations["Scheduled"];
foreach($upcoming as $reservation)
{
//pr($reservation);
print_checkout_form($reservation,$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']);
break;
}
print("<br><table id='upcoming_reservations_table' width='850' border='0'>");
print("<thead><tr>");
print("<th>Date</th>");
print("<th>Scheduled Start Time</th>");
print("<th>Scheduled End Time</th>");
print("<th>Room</th>");
print("<th> </th>");
print("</tr></thead>");
print("<tbody>\n");
foreach($upcoming as $reservation)
{
print("<tr>\n");
$room = $reservation->room;
$date = date('m/d/Y',strtotime($reservation->date));
$start = date('g:ia',strtotime($reservation->sched_start_time));
$end = date('g:ia',strtotime($reservation->sched_end_time));
print("<td align='center'>$date</td>");
print("<td align='center'>$start</td>");
print("<td align='center'>$end</td>");
print("<td align='center'>$room->room_number</td>");
print("<td align='center'><a href='reservation_details.php?reservation_id=$reservation->id'>Details</a></td>\n");
print("</tr>\n");
}
print("</tbody></table><br><br>\n");
}
else
{
print("<h3 style='margin-left:30px'>No upcoming reservations scheduled at this time.</h3><br>\n");
}
print("<div style='margin-left:30px; background-color:#CCC; border-radius:10px; padding:5px; width:250px; text-align:center;'><h3><a href='otf.php?user_id=$user_id'>Create an On-The-Fly Checkout</a></h3></div><br>\n");
// reservation history
print("<h2>Completed Reservations</h2>\n");
if(isset($user->reservations['Completed']))
{
$completed = $user->reservations['Completed'];
print("<br><table id='reservation_history_table' width='850' border='0'>");
print("<thead><tr>");
print("<th>Date</th>");
print("<th>Scheduled Start Time</th>");
print("<th>Scheduled End Time</th>");
print("<th>Checkout Time</th>");
print("<th>Check-in Time</th>");
print("<th>Room</th>");
print("<th>Status</th>");
print("<th> </th>");
print("</tr></thead>");
print("<tbody>");
foreach($completed as $reservation)
{
print("<tr class='row_$reservation->status'>\n");
$room = $reservation->room;
$date = date('m/d/Y',strtotime($reservation->date));
$sched_start = date('g:ia',strtotime($reservation->sched_start_time));
$sched_end = date('g:ia',strtotime($reservation->sched_end_time));
if($reservation->key_checkout_time)
$key_checkout = date('g:ia',strtotime($reservation->key_checkout_time));
else
$key_checkout = "";
if($reservation->key_checkin_time)
$key_checkin = date('g:ia',strtotime($reservation->key_checkin_time));
else
$key_checkin = "";
print("<td align='center'>$date</td>");
print("<td align='center'>$sched_start</td>");
print("<td align='center'>$sched_end</td>");
print("<td align='center'>$key_checkout</td>");
print("<td align='center'>$key_checkin</td>");
print("<td align='center'>$room->room_number</td>");
print("<td align='center'>$reservation->status</td>");
print("<td align='center'><a href='reservation_details.php?reservation_id=$reservation->id'>Details</a></td>\n");
print("</tr>\n");
}
print("</tbody></table>\n");
}
else
print("<h3 style='margin-left:30px'>There is no reservation history for this user.</h3><br>\n");
require_once("includes/footer.php");
?>