예제 #1
0
    $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']}");
} elseif ($_GET['page'] === 'toggle-active') {
    $model->toggleActive($_POST);
    $loggers['audit']->info("Active status toggled for {$_POST['toggle-for']} {$_POST['id']}");
} elseif ($_GET['page'] === 'update-building') {
    $model->updateBuilding($_POST);
    $loggers['audit']->info("Building {$_POST['id']} updated");
} elseif ($_GET['page'] === 'update-room') {
    $model->updateRoom($_POST);
    $loggers['audit']->info("Room {$_POST['id']} updated");
} elseif ($_GET['page'] === 'clone-accommodations') {
    $newAccommodations = $model->cloneAccommodations($_POST['clone_from'], $_POST['clone_to']);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($newAccommodations);
    exit;