public function init_vars() { $hours = array(); //generate numbers 1 through 12 for the hours for ($i = 1; $i <= 12; $i++) { $hours[$i] = $i; } $minutes = array(); //generate numbers 0 through 55 every 5 numbers (0,5,10,15 etc.) for ($x = 0; $x <= 55; $x += 5) { $minutes[$x] = $x; } $this->assign('hours', $hours); $this->assign('minutes', $minutes); $this->assign('ampm', array("AM" => "AM", "PM" => "PM")); //assign vars that are used throughout the whole system $this->assign('date_format', '%m-%d-%Y'); $this->assign('time_format', '%l:%M %p'); $this->assign('locations', ReserveDatabaseAPI::locations(false)); $this->assign('user_level', ReserveDatabaseAPI::user_level()); //this assigns the user to a manager (0) cts staff (1) or helpdesk (2) $status = array("approved" => "approved", "pending" => "pending", "pending-pick-up" => "pending pick-up", "ready-for-pick-up" => "ready for pick-up", "pending-delivery" => "pending delivery", "delivered" => "delivered", "closed" => "closed", "missing-equipment" => "missing equipment", "loaned out" => "loaned out", "returned" => "returned", "cancelled" => "cancelled"); $this->assign('status', $status); $this->assign('priority', array("normal", "high")); $this->assign('subitemlist', ReserveDatabaseAPI::get_subitems()); }
$startampm = date("A", strtotime($reservation[$reservation_idx]['start_time'])); $endhour = date("g", strtotime($reservation[$reservation_idx]['end_time'])); $endminute = date("i", strtotime($reservation[$reservation_idx]['end_time'])); $endampm = date("A", strtotime($reservation[$reservation_idx]['end_time'])); $app->tpl->assign('starthour', $starthour); $app->tpl->assign('startminute', $startminute); $app->tpl->assign('startampm', $startampm); $app->tpl->assign('endhour', $endhour); $app->tpl->assign('endminute', $endminute); $app->tpl->assign('endampm', $endampm); $app->tpl->assign('reservation', $reservation); $app->tpl->display('single-reservation.tpl'); } //edit if ($request->action == "delete") { if (ReserveDatabaseAPI::user_level() > 2) { die('You do not have permission to delete a reservation.'); } $reservation_idx = $request->id; ReserveDatabaseAPI::delete_reservation($reservation_idx); ReserveDatabaseAPI::delete_messages($reservation_idx); $response->redirect($GLOBALS['BASE_URL'] . '/admin/reservation'); } //delete }); //end reservation/searach/id respond('/reservation/addmessage/[i:id]', function ($request, $response, $app) { //adding a message to a loan $username = $_SESSION['username']; $message = $request->message; $message = filter_var($message, FILTER_SANITIZE_STRING);