コード例 #1
0
ファイル: confirmed-requests.php プロジェクト: hughnguy/php
         $studentAccs = array_values($studentAccs);
     }
     $l10n->addResource(__DIR__ . '/l10n/confirmed-requests.json');
     $l10n->localizeArray($examAccs, 'name');
     $l10n->localizeArray($studentAccs, 'name');
     //set up response array
     $details = array("request" => $request, "exam_accommodations" => $examAccs, "student_accommodations" => $studentAccs);
     //if the request also has a seat associated with it recover the appropriate room and seat information
     if (!is_null($request[0]['seat_id'])) {
         //gather room and seat data
         $rooms = $seatManagement->getRooms($request[0]['building_id']);
         $seats = $seatManagement->getSeatsForRoom($request[0]['room_id']);
         $details['rooms'] = $rooms;
         $details['seats'] = $seats;
         //save a list of exams booked on the same seat at the same time as the one retrieved
         $bookings = $seatManagement->getSeatBookings($request[0]['seat_id'], $request[0]['exam_date']);
         $conflicts = "";
         foreach ($bookings as $b) {
             if ($request[0]['request_id'] !== $b['request_id'] && !(strtotime($request[0]['official_evaluation_starttime']) >= strtotime($b['official_evaluation_endtime']) || strtotime($request[0]['official_evaluation_endtime']) <= strtotime($b['official_evaluation_starttime']))) {
                 $conflicts .= $b['request_id'] . ",";
             }
         }
         if ($conflicts !== "") {
             $details['request'][0]['seat_conflicts'] = substr($conflicts, 0, -1);
         }
     }
     header('Content-Type: application/json; charset=utf-8');
     echo json_encode($details);
     exit;
 } else {
     if ($_GET['page'] === "pick-building") {