Ejemplo n.º 1
0
    $loggers['audit']->info("Building {$_POST['id']} deleted");
} elseif ($_GET['page'] === 'delete-seat') {
    $model->deleteSeat($_POST['id']);
    $loggers['audit']->info("Seat {$_POST['id']} deleted");
} elseif ($_GET['page'] === 'delete-room') {
    $model->deleteRoom($_POST['id']);
    $loggers['audit']->info("Room {$_POST['id']} deleted");
} elseif ($_GET['page'] === 'add-room-to-building') {
    $newRoomId = $model->insertRoom($_POST);
    $loggers['audit']->info("Room {$newRoomId} created");
    echo $newRoomId;
} elseif ($_GET['page'] === 'view-room') {
    $render = true;
    $seats = $model->getSeatsForRoom($_GET['room-id']);
    $seat_location = $model->getRoomDetails($_GET['room-id']);
    $allAccommodations = $model->getExamAccomodations();
    $allBuildings = $model->getAllBuildings();
    $l10n->addResource(__DIR__ . '/l10n/seat-management-view-seats.json');
    $l10n->localizeArray($allAccommodations, 'name');
    $viewFile = 'views/seat-management-view-seats.php';
} elseif ($_GET['page'] === 'show-seats') {
    $seats = $model->getSeatsForRoom($_GET['room-id']);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($seats);
    exit;
} elseif ($_GET['page'] === 'edit-seat-accommodations') {
    $model->editSeatAccommodations($_POST);
    $loggers['audit']->info("Accommodations modified for seat {$_POST['seat_id']}");
} elseif ($_GET['page'] === 'add-seat') {
    $result = $model->addSeat($_POST);
    $loggers['audit']->info("Seat created for room {$_POST['room_id']}");