Schulbuch: einheitliches App-Menü + rollenabhängiger Modus

- 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 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 02:53:23 +02:00
parent 685b4700f8
commit c5307017e4
4 changed files with 58 additions and 14 deletions
+1
View File
@@ -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; }
+37 -13
View File
@@ -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 '<nav class="b-nav"><a href="' . $bp . '/buch">📖 Schulbuch</a>';
foreach ($links as $label => $href) {
echo ' · <a href="' . $bp . '/' . $href . '">' . $label . '</a>';
function buchNav(array $links = []): void {
global $bp, $MODE, $IS_TEACHER, $IS_STUDENT;
echo '<nav class="b-nav">';
// App-Menü passend zur Rolle (bleibt oben stehen, wie auf der Schüler-/Lehrerseite)
if ($IS_TEACHER) {
echo '<a href="' . $bp . '/teacher.html">📊 Lehrer-Cockpit</a>';
echo ' · <span class="b-here">📖 Schulbuch</span>';
} elseif ($IS_STUDENT) {
echo '<a href="' . $bp . '/schueler.html">Module</a>';
echo ' · <a href="' . $bp . '/schueler.html#achievements">Erfolge</a>';
echo ' · <span class="b-here">Schulbuch</span>';
echo ' · <a href="' . $bp . '/profil.html">Profil</a>';
} else {
echo '<a href="' . $bp . '/simulationen">🎮 Simulationen</a>';
echo ' · <span class="b-here">📖 Schulbuch</span>';
}
echo '<span class="spacer"></span>';
echo '<a class="b-mode ' . ($MODE === 'schueler' ? 'active' : '') . '" href="?">👩‍🎓 Schüler:innen</a>';
// Modus-Umschalter — Lehreransicht nur für Lehrpersonen
echo '<a class="b-mode ' . ($MODE === 'schueler' ? 'active' : '') . '" href="?schueler=1">👩‍🎓 Schüler:innen</a>';
echo '<a class="b-mode ' . ($MODE === 'leicht' ? 'active' : '') . '" href="?leicht=1">🌱 Leichte Sprache</a>';
echo '<a class="b-mode ' . ($MODE === 'lehrer' ? 'active' : '') . '" href="?lehrer=1">👩‍🏫 Lehrperson</a>';
if ($IS_TEACHER) {
echo '<a class="b-mode ' . ($MODE === 'lehrer' ? 'active' : '') . '" href="?lehrer=1">👩‍🏫 Lehrperson</a>';
}
echo '</nav>';
if ($MODE === 'leicht') {
echo '<div class="b-leicht-hinweis">🌱 Dieses Heft ist in <b>Leichter Sprache</b>. Kurze Sätze. Einfache Wörter. Die Bilder und Zahlen sind die gleichen wie im großen Heft.</div>';
+19 -1
View File
@@ -7,7 +7,11 @@
* Status wird automatisch aus der Existenz von pages/buch-<id>.php abgeleitet.
*/
require_once __DIR__ . '/../php/config/app.php';
require_once __DIR__ . '/../php/lib/Session.php';
Session::start();
$bp = BASE_PATH;
$IS_TEACHER = (Session::teacherId() !== null);
$IS_STUDENT = (Session::studentId() !== null);
$KAPITEL = [
['id' => 'tourismustal', 'icon' => '🏔️', 'titel' => 'Ein Tal wird Tourismusregion',
@@ -80,11 +84,25 @@ $KAPITEL = [
.pill.fertig { background: #dcead1; color: #2f6b46; }
.pill.geplant { background: #e3ddc9; color: #6b6659; }
a.back { color: #4f7f5e; font-weight: 600; text-decoration: none; font-size: 14px; }
.appnav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; }
.appnav a { color: #4f7f5e; text-decoration: none; font-weight: 600; }
.appnav .here { color: #2f3e46; font-weight: 800; }
</style>
</head>
<body>
<div class="b-wrap">
<p><a class="back" href="<?= $bp ?>/simulationen">← Zu den Simulationen</a></p>
<nav class="appnav">
<?php if ($IS_TEACHER): ?>
<a href="<?= $bp ?>/teacher.html">📊 Lehrer-Cockpit</a> · <span class="here">📖 Schulbuch</span>
<?php elseif ($IS_STUDENT): ?>
<a href="<?= $bp ?>/schueler.html">Module</a> ·
<a href="<?= $bp ?>/schueler.html#achievements">Erfolge</a> ·
<span class="here">Schulbuch</span> ·
<a href="<?= $bp ?>/profil.html">Profil</a>
<?php else: ?>
<a href="<?= $bp ?>/simulationen">🎮 Simulationen</a> · <span class="here">📖 Schulbuch</span>
<?php endif; ?>
</nav>
<h1>📖 Das Schulbuch zu den Simulationen</h1>
<p class="sub">Jede Simulation bekommt ein Kapitel: die Sachinhalte lehrplankonform
aufbereitet, mit echten Daten, Glossar-Begriffen und Aufgaben — zum Präsentieren
+1
View File
@@ -217,6 +217,7 @@
<div class="tab" onclick="switchTab('results')">Ergebnisse</div>
<div class="tab" onclick="switchTab('licenses')">Lizenzen</div>
<div class="tab" onclick="switchTab('classes')">Klassen</div>
<a class="tab" href="buch" style="margin-left:auto;text-decoration:none">📖 Schulbuch</a>
</div>
<!-- Content -->