From c5307017e49ca64632e77ea4559c47317aa9a901 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 17 Jul 2026 02:53:23 +0200 Subject: [PATCH] =?UTF-8?q?Schulbuch:=20einheitliches=20App-Men=C3=BC=20+?= =?UTF-8?q?=20rollenabh=C3=A4ngiger=20Modus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Kapitel-Kopf: alte Links (Modulseite/Simulation/Glossar/Lehrplan) raus, stattdessen einheitliches App-Menü je Rolle (Schüler: Module/Erfolge/Schulbuch/Profil; Lehrer: Cockpit/Schulbuch; öffentlich: Simulationen/Schulbuch), Schulbuch aktiv - Modus je Rolle: Schüler:in → Schüler:innen/Leichte Sprache (Default Schüler:innen, Lehreransicht gesperrt, auch bei ?lehrer=1); Lehrperson → +Lehreransicht (Default Lehrperson) - teacher.html: Menüpunkt "📖 Schulbuch" ergänzt - buch.php-Übersicht: gleiches rollen-Menü statt "← Zu den Simulationen" Co-Authored-By: Claude Fable 5 --- App/assets/css/buch.css | 1 + App/pages/_partials/buch_helpers.php | 50 ++++++++++++++++++++-------- App/pages/buch.php | 20 ++++++++++- App/teacher.html | 1 + 4 files changed, 58 insertions(+), 14 deletions(-) diff --git a/App/assets/css/buch.css b/App/assets/css/buch.css index 05a804d..42785aa 100644 --- a/App/assets/css/buch.css +++ b/App/assets/css/buch.css @@ -11,6 +11,7 @@ body { background: #edeae0; margin: 0; font-family: system-ui, -apple-system, "S .b-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; } .b-nav a { color: #4f7f5e; text-decoration: none; font-weight: 600; } .b-nav .spacer { flex: 1; } +.b-nav .b-here { color: #2f3e46; font-weight: 800; } .b-mode { background: #fff; border: 1.5px solid #c9c2ae; border-radius: 999px; padding: 5px 14px; text-decoration: none; font-weight: 700; font-size: 13px; color: #2f3e46 !important; } .b-mode.active { background: #4f7f5e; color: #fff !important; border-color: #4f7f5e; } diff --git a/App/pages/_partials/buch_helpers.php b/App/pages/_partials/buch_helpers.php index 0f5f812..a8e6e5d 100644 --- a/App/pages/_partials/buch_helpers.php +++ b/App/pages/_partials/buch_helpers.php @@ -18,9 +18,19 @@ * EXIF/GPS (magick -strip). */ -$MODE = 'schueler'; -if (isset($_GET['lehrer']) && $_GET['lehrer'] === '1') $MODE = 'lehrer'; -if (isset($_GET['leicht']) && $_GET['leicht'] === '1') $MODE = 'leicht'; +require_once __DIR__ . '/../../php/lib/Session.php'; +Session::start(); +$IS_TEACHER = (Session::teacherId() !== null); +$IS_STUDENT = (Session::studentId() !== null); + +// Modus je Rolle. Lehrer-Ansicht nur für Lehrpersonen erreichbar. +// Buttons: ?schueler=1 / ?leicht=1 / ?lehrer=1. Ohne Parameter: Default je Rolle +// (Lehrperson → Lehreransicht, sonst → Schüler:innen). +if (isset($_GET['leicht'])) $MODE = 'leicht'; +elseif (isset($_GET['lehrer'])) $MODE = 'lehrer'; +elseif (isset($_GET['schueler'])) $MODE = 'schueler'; +else $MODE = $IS_TEACHER ? 'lehrer' : 'schueler'; +if (!$IS_TEACHER && $MODE === 'lehrer') $MODE = 'schueler'; // Sperre für Nicht-Lehrpersonen $LEHRER = ($MODE === 'lehrer'); $LEICHT = ($MODE === 'leicht'); @@ -54,20 +64,34 @@ function g(string $slug, string $label): string { } /** - * Kopfzeile: Links + Modus-Umschalter. - * $links: Array [Label => href-relativ-zu-BASE_PATH], z. B. - * ['Modulseite' => 'modul-tourismustal', '🎮 Simulation starten' => 'tourismustal', ...] + * Kopfzeile: einheitliches App-Menü (rollenabhängig) + Modus-Umschalter. + * Der $links-Parameter wird nicht mehr verwendet (die alten Kapitel-Links — + * Modulseite/Simulation/Glossar/Lehrplan — gehören nicht ins Schulbuch); die + * Signatur bleibt, damit die Kapitel unverändert `buchNav([...])` aufrufen können. */ -function buchNav(array $links): void { - global $bp, $MODE; - echo '