Files
tsv08kulmbach-website/app/components/league-table.php
fs a101b0c3ec Stadionzeitung, Veranstaltungen, News-Artikel, Lightbox und Anzeigen-Verteilung
Stadionzeitung: Live-Seiten (Tabellen, Ergebnisse, Vorschau, Termine, News,
Kontakt, Historie, Sportheim, Partner, Momente, Impressum), automatisches Cover,
Swipe-Viewer mit Vollbildmodus und die Druckfassung als Falt-Heft. Anzeigen
kommen jetzt aus dem Bestand und werden gleichmäßig verteilt, nie mehr als zwei
hintereinander (vorher vier Blöcke à fünf). Die Doppelseiten-Regel rechnet das
Skript selbst, statt sie von Hand zu prüfen.

Veranstaltungen: Bereich /veranstaltungen mit Detailseite pro Fest, Lebenszyklus
über das Datum (Ankündigung vor dem Fest, Rückblick danach), Galerie mit
Lightbox. veranstaltungen.json ist dritte Termin-Quelle, damit ein Fest nie
doppelt gepflegt wird.

News-Artikel als dritte dynamische Prefix-Route, gemeinsamer detail-head.

Behobene Fehler:
- Wappen-Kontexte setzten Zeilen-Layout auf .crest statt auf die Zeile; das
  Wappen wurde zum Grid, Vereinsname und Tore rutschten darunter zusammen
  (Ergebnis-Rückblick, Vorschau, Cover).
- --header-h (60px) unterschätzt die Kopfleiste um 32px (Logo 72px + 20px
  Versatz): neues abgeleitetes --header-space, sonst klebten Zurück-Links
  unter dem Logo.
- base_url in der Produktions-Config ohne www, während .htaccess auf www
  umleitet; preflight prüft das jetzt.
- .lightbox brauchte display:none mit (0,2,0), sonst lag das Overlay offen.

Neue Werkzeuge: bin/anzeige-add.php (Anzeigen-Bestand), bin/veranstaltung-bilder.php
(Plakate und Galerien, Alt-Texte folgen der Quelldatei), bin/qr.php (Druck-QR mit
Warnung, wenn base_url nicht auf die echte Domain zeigt).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NzeVVgMCrzCDJAKeLEdKr7
2026-07-31 14:55:27 +02:00

100 lines
4.8 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
/**
* Liga-Tabelle. Props: $table (data/matchcenter.json → teams[].table[]),
* $caption (Beschriftung für Screenreader/Region, z. B. "Tabelle Kreisklasse").
* Die eigene Vereinszeile wird hervorgehoben; Auf-/Abstiegszonen über farbige
* Randmarkierungen (Legende darunter). Horizontal scrollbar auf schmalen Screens
* (fokussierbare Region, WCAG). Spaltenköpfe in Abel (Coolvetica wäre zu klein).
*/
$table = $table ?? [];
$caption = (string) ($caption ?? 'Tabelle');
if ($table === []) {
return;
}
$zones = array_column($table, 'zone');
$hasPromo = in_array('promotion', $zones, true);
$hasPromoPlayoff = in_array('promotion-playoff', $zones, true);
$hasRelegPlayoff = in_array('relegation-playoff', $zones, true);
$hasReleg = in_array('relegation', $zones, true);
// Vor dem 1. Spieltag liefert der BFV für JEDE Mannschaft Platz 1 und dieselbe
// Auf-/Abstiegszone. Beides ist dann bedeutungslos und lässt die Tabelle kaputt
// aussehen (zehn Erste, alles grün) — deshalb Ränge und Zonen unterdrücken.
// Ein erklärender Hinweissatz stand hier mal und ist bewusst raus (Felix,
// 29.07.2026): eine Tabelle mit 0 Spielen erklärt sich selbst. Testspiele
// zählen nicht mit, ein Freundschaftsspiel-Ergebnis ändert die Tabelle also
// zu Recht nicht.
$notStarted = array_sum(array_map(
static fn (array $r): int => (int) ($r['played'] ?? 0),
$table
)) === 0;
if ($notStarted) {
$hasPromo = $hasPromoPlayoff = $hasRelegPlayoff = $hasReleg = false;
}
?>
<div class="table-scroll-frame">
<div class="table-scroll" role="region" aria-label="<?= e($caption) ?>" tabindex="0">
<table class="league-table">
<caption class="visually-hidden"><?= e($caption) ?></caption>
<thead>
<tr>
<th scope="col" class="league-table__rank">#</th>
<th scope="col" class="league-table__club">Verein</th>
<th scope="col"><abbr title="Spiele">Sp</abbr></th>
<th scope="col"><abbr title="Siege">S</abbr></th>
<th scope="col"><abbr title="Unentschieden">U</abbr></th>
<th scope="col"><abbr title="Niederlagen">N</abbr></th>
<th scope="col"><abbr title="Tordifferenz">Diff</abbr></th>
<th scope="col"><abbr title="Punkte">Pkt</abbr></th>
</tr>
</thead>
<tbody>
<?php foreach ($table as $row): ?>
<?php
$trClass = [];
if (!empty($row['is_own_club'])) {
$trClass[] = 'is-own';
}
if (!$notStarted && !empty($row['zone'])) {
$trClass[] = 'zone-' . e($row['zone']);
}
$diff = (int) ($row['goal_diff'] ?? 0);
?>
<tr<?= $trClass !== [] ? ' class="' . implode(' ', $trClass) . '"' : '' ?>>
<td class="league-table__rank"><?= $notStarted ? '' : (int) ($row['rank'] ?? 0) ?></td>
<th scope="row" class="league-table__club">
<?php component('crest', ['src' => $row['crest'] ?? null, 'name' => $row['club'] ?? '']); ?>
<span class="league-table__name" title="<?= e($row['club'] ?? '') ?>"><?= e($row['club'] ?? '') ?></span>
</th>
<td><?= (int) ($row['played'] ?? 0) ?></td>
<td><?= (int) ($row['won'] ?? 0) ?></td>
<td><?= (int) ($row['drawn'] ?? 0) ?></td>
<td><?= (int) ($row['lost'] ?? 0) ?></td>
<td><?= ($diff > 0 ? '+' : '') . $diff ?></td>
<td class="league-table__pts"><?= (int) ($row['points'] ?? 0) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php if ($hasPromo || $hasPromoPlayoff || $hasRelegPlayoff || $hasReleg): ?>
<ul class="league-table__legend">
<?php if ($hasPromo): ?>
<li class="league-table__legend-item zone-promotion">Aufstieg</li>
<?php endif; ?>
<?php if ($hasPromoPlayoff): ?>
<li class="league-table__legend-item zone-promotion-playoff">Aufstiegsrelegation</li>
<?php endif; ?>
<?php if ($hasRelegPlayoff): ?>
<li class="league-table__legend-item zone-relegation-playoff">Abstiegsrelegation</li>
<?php endif; ?>
<?php if ($hasReleg): ?>
<li class="league-table__legend-item zone-relegation">Abstieg</li>
<?php endif; ?>
</ul>
<?php endif; ?>