Ejemplo n.º 1
0
    $l10n->addResource(__DIR__ . '/l10n/seat-management.json');
    $viewFile = 'views/seat-management.php';
} elseif ($_GET['page'] === 'show-rooms') {
    $rooms = $model->getRooms($_POST['buildingId']);
    foreach ($rooms as &$r) {
        $r['seats'] = $model->getNumberOfSeats($r['room_id']);
    }
    unset($r);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($rooms);
    exit;
} elseif ($_GET['page'] === 'new-building') {
    $model->insertBuilding($_POST);
    $loggers['audit']->info("Building {$_POST['building_name']} created");
} elseif ($_GET['page'] === 'delete-building') {
    $model->deleteBuilding($_POST['id']);
    $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']);