-Tag auf den Sim-Ordner; damit * loesen sich auch die zur Laufzeit gefetchten Audio-/Musik-Pfade korrekt auf. * * Stand 2026-07-11: Erst-Integration (beta) — Atlas. */ require_once __DIR__ . '/../php/config/app.php'; require_once __DIR__ . '/../php/config/db.php'; $db = getDB(); // ---- Mode-Check (Integrations-Vertrag §6.1) ---- $sessionId = $_COOKIE['ggs_session'] ?? null; $mode = 'free'; $easy = false; if ($sessionId) { $stmt = $db->prepare('SELECT class_id, display_name FROM student_sessions WHERE id = ?'); $stmt->execute([$sessionId]); $sess = $stmt->fetch(PDO::FETCH_ASSOC); if ($sess && !empty($sess['class_id'])) { $classId = (int)$sess['class_id']; $cm = $db->prepare('SELECT mode FROM class_modules WHERE class_id = ? AND module_id = ?'); $cm->execute([$classId, 'tourismustal']); $cmRow = $cm->fetch(PDO::FETCH_ASSOC); $mode = $cmRow ? $cmRow['mode'] : 'locked'; $so = $db->prepare( 'SELECT sm.mode FROM student_modules sm JOIN students s ON s.id = sm.student_id WHERE s.class_id = ? AND s.display_name = ? AND sm.module_id = ?' ); $so->execute([$classId, $sess['display_name'], 'tourismustal']); $soRow = $so->fetch(PDO::FETCH_ASSOC); if ($soRow) $mode = $soRow['mode']; $eq = $db->prepare('SELECT easy_language FROM students WHERE class_id = ? AND display_name = ?'); $eq->execute([$classId, $sess['display_name']]); $eqRow = $eq->fetch(PDO::FETCH_ASSOC); if ($eqRow) $easy = !empty($eqRow['easy_language']); } } if ($mode === 'locked') { http_response_code(403); header('Content-Type: text/html; charset=utf-8'); $cssHref = BASE_PATH . '/assets/css/design-system.css'; $cockpit = BASE_PATH . '/schueler'; echo << Gesperrt · Tourismustal

🔒 Tourismustal ist gesperrt.

Deine Lehrperson hat dieses Modul für eure Klasse noch nicht freigegeben.

Im Cockpit findest du die derzeit freigegebenen Module.

HTML; exit; } $gamePath = __DIR__ . '/../sims/tourismustal/game.html'; if (!is_file($gamePath)) { http_response_code(503); echo 'Tourismustal ist in Vorbereitung.'; exit; } $html = file_get_contents($gamePath); $modeJs = json_encode($mode); $easyJs = $easy ? 'true' : 'false'; $sessionIdJs = json_encode($sessionId); $injection = "window.TT_SESSION_MODE = {$modeJs};\n" . "window.TT_SESSION_ID = {$sessionIdJs};\n" . "window.STUDENT_EASY = {$easyJs};\n" . "window.TT_API_BASE = '" . BASE_PATH . "/php/api';"; if (strpos($html, '/*__TOURISMUSTAL_INJECTION__*/') !== false) { $html = str_replace('/*__TOURISMUSTAL_INJECTION__*/', $injection, $html); } else { $html = str_replace('', "\n", $html); } // auf den Sim-Ordner: loest css/, js/ (ES-Module), assets/… // inklusive der zur Laufzeit gesetzten Audio-Quellen korrekt auf. $base = BASE_PATH . '/sims/tourismustal/'; $html = preg_replace('//', "\n", $html, 1); // Home-Button: auf das gerade gueltige Cockpit umbiegen $cockpit = cockpit_href(); $html = str_replace("window.location.href='../../schueler.html'", "window.location.href='" . $cockpit . "'", $html); if (function_exists('ggs_inject_live')) $html = ggs_inject_live($html, 'tourismustal'); echo $html;