<?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 /** * @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);