<?php $success = false; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $newCurrentDate = $_POST['currentdate']; $newCurrentDate = date('Y-m-d\\TH:i:s', strtotime($newCurrentDate)); $success = Session::setCurrentDateTime($newCurrentDate); } $currentDate = Session::getCurrentDateTime(); $currentDate = date('Y-m-d', strtotime($currentDate)); ?> <!doctype html> <html lang="en"> <head> <title>Set currentdate</title> </head> <body> <form method="POST"> <?php if ($success) { ?> <span style="color: green"> Successfully updated current time! </span> <?php } ?> <br> <br> Currentdate: <input type="date" value="<?php echo $currentDate;
<?php $bookingId = (int) $page['parameters']['bookingId']; $bookings = UTSHelpsAPI::SearchWorkshopBookings(['studentId' => User::getPaddedId(), 'pageSize' => 9999, 'active' => true]); $page['booking'] = null; if ($bookings != null && $bookings->IsSuccess == 1) { foreach ($bookings->Results as $value) { if ($value->BookingId == $bookingId) { if ($value->BookingArchived == null && $value->attended == null && strtotime(Session::getCurrentDateTime()) > strtotime($value->starting)) { $page['booking'] = $value; } else { Session::setError('Booking has not been completed, please try again.'); Session::redirect('/bookings'); } } } } if ($page['booking'] == null) { Session::setError('Booking does not exist, please try again.'); Session::redirect('/bookings'); } // Make sure attendance hasn't already been recorded for this booking, // or the booking hasn't been set as cancelled $attendance = Attendance::getAttendance($bookingId); if ($attendance != null) { Session::setError('You have already recorded attendance for this workshop.'); Session::redirect('/bookings'); } // If the request is a post if ($_SERVER['REQUEST_METHOD'] === 'POST') { $createNonAttendance = Attendance::createNonAttendance($bookingId, $page['booking']->workshopID);
<?php /** * @var $page */ $workshopSetId = $page['parameters']['workshopSetId']; // Get the results for the workshop details // make sure we get all of the entries by setting a large // page size. Also set the start and end date for the range so we // don't get old data. $workshop = UTSHelpsAPI::SearchWorkshops(['workshopSetId' => $workshopSetId, 'pageSize' => 9999, 'startingDtBegin' => Session::getCurrentDateTime(), 'startingDtEnd' => Session::getFutureDateTime()]); $page['available'] = 0; $page['unavailable'] = 0; if ($workshop != null && $workshop->IsSuccess == 1) { foreach ($workshop->Results as $value) { // initially set the status to available $status = 'available'; $remaining = $value->maximum - $value->BookingCount; if ($remaining <= 0) { $status = 'full'; } elseif ($value->cutoff != null && $value->cutoff <= $value->BookingCount) { $status = 'cutoff'; } if ($status == 'available') { $page['available']++; } else { $page['unavailable']++; } $startDate = strtotime($value->StartDate); $endDate = strtotime($value->EndDate); $startTime = date("g:ia", $startDate);
<?php /** * @var $page */ $page['campuses'] = UTSHelpsAPI::ListCampuses(true); if (isset($page['parameters']) && isset($page['parameters']['id'])) { if (isset($page['parameters']['workshopSet'])) { $workshop = UTSHelpsAPI::SearchWorkshops(['pageSize' => 9999, 'startingDtBegin' => Session::getCurrentDateTime(), 'startingDtEnd' => Session::getFutureDateTime(), 'campusId' => $page['parameters']['id'], 'workshopSetId' => $page['parameters']['workshopSet']]); } else { $workshop = UTSHelpsAPI::SearchWorkshops(['pageSize' => 9999, 'startingDtBegin' => Session::getCurrentDateTime(), 'startingDtEnd' => Session::getFutureDateTime(), 'campusId' => $page['parameters']['id']]); } if ($workshop != null && $workshop->IsSuccess == 1) { foreach ($workshop->Results as $value) { // initially set the status to available $status = 'available'; $remaining = $value->maximum - $value->BookingCount; if ($remaining <= 0) { $status = 'full'; } elseif ($value->cutoff != null && $value->cutoff <= $value->BookingCount) { $status = 'cutoff'; } if ($status == 'available') { $page['available']++; } else { $page['unavailable']++; } $startDate = strtotime($value->StartDate); $endDate = strtotime($value->EndDate); $startTime = date("g:ia", $startDate); $endTime = date("g:ia", $endDate);
<?php $page['loggedin'] = false; if (User::isLoggedIn()) { // If it's the user's first use, make sure they register if (User::firstUse()) { Session::setError('You have to register first before using this service.'); Session::redirect('/register'); } $page['loggedin'] = true; // search for the users bookings $bookings = UTSHelpsAPI::SearchWorkshopBookings(['studentId' => User::getPaddedId(), 'pageSize' => 9999, 'active' => true]); $currentTime = strtotime(Session::getCurrentDateTime()); $count = 0; // Get all the upcoming bookings if ($bookings != null && $bookings->IsSuccess == 1) { foreach ($bookings->Results as $booking) { // if booking archived field does not have a date, it hasn't been canceled or attended if ($booking->BookingArchived == null && strtotime($booking->starting) > $currentTime && $booking->canceled === null && $booking->attended === null) { $count++; } } } $page['bookingCount'] = $count; // Get all of the workshops for the workshop listings $workshops = UTSHelpsAPI::ListWorkshopSets(true); if ($workshops != null && $workshops->IsSuccess == 1) { $page['workshops'] = count($workshops->Results); } else { $page['workshops'] = 0; }