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());
 }
 function email_user_approved($reservation_idx)
 {
     //emails the user when thier loan has been approved
     $reserve = ReserveDatabaseAPI::by_id($reservation_idx);
     $reservation = $reserve[$reservation_idx];
     $index = $reserve[$reservation_idx]['building_idx'];
     $categories = ReserveDatabaseAPI::categories();
     $locations = ReserveDatabaseAPI::locations();
     $email = new \PSUSmarty();
     $email->assign('categories', $categories);
     $email->assign('locations', $locations);
     $email->assign('reserve', $reservation);
     $contents = $email->fetch($GLOBALS['TEMPLATES'] . '/email.user.approve.tpl');
     return PSU::mail($reserve[$reservation_idx]['email'], 'Media Request Approved!', $contents, self::headers());
 }
Пример #3
0
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservations', $reservations);
    $app->tpl->display('history-pending.tpl');
});
//end pending
respond('/search/id/[i:id]', function ($request, $response, $app) {
    $reservation_idx = (int) $request->id;
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservation_idx', $reservation_idx);
    $app->tpl->assign('reservation', ReserveDatabaseAPI::by_id($reservation_idx));
    $app->tpl->display('history-reservation.tpl');
});
//end reservation/search/
respond('/copy/[i:id]', function ($request, $response, $app) {
    $reservation_idx = (int) $request->id;
    $app->tpl->assign('locations', ReserveDatabaseAPI::locations());
    $app->tpl->assign('reservation_idx', $reservation_idx);
    $reserve = ReserveDatabaseAPI::by_id($reservation_idx);
    unset($_SESSION['cts']);
    $_SESSION['cts']['first_name'] = $reserve[$reservation_idx]['fname'];
    $_SESSION['cts']['last_name'] = $reserve[$reservation_idx]['lname'];
    $_SESSION['cts']['phone'] = $reserve[$reservation_idx]['phone'];
    $_SESSION['cts']['email'] = $reserve[$reservation_idx]['email'];
    $_SESSION['cts']['title'] = $reserve[$reservation_idx]['title'];
    $_SESSION['cts']['start_date'] = date('m/d/Y', strtotime($reserve[$reservation_idx]['start_date']));
    $_SESSION['cts']['end_date'] = date('m/d/Y', strtotime($reserve[$reservation_idx]['end_date']));
    $_SESSION['cts']['location'] = $reserve[$reservation_idx]['building_idx'];
    $_SESSION['cts']['comments'] = $reserve[$reservation_idx]['memo'];
    $_SESSION['cts']['room'] = $reserve[$reservation_idx]['room'];
    $_SESSION['cts']['starthour'] = date("g", strtotime($reserve[$reservation_idx]['start_time']));
    $_SESSION['cts']['startminute'] = date("i", strtotime($reserve[$reservation_idx]['start_time']));