61 lines
2.6 KiB
PHP
61 lines
2.6 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Matchcenter-Sektion einer Mannschaft (kicker-Stil): Kopf (Name + Liga + Link zur
|
||
|
|
* Mannschaftsseite), darunter zweispaltig — Tabelle 2/3 links, anstehende Spiele +
|
||
|
|
* letzte Ergebnisse als kompakte Liste 1/3 rechts. Auf schmalen Screens gestapelt.
|
||
|
|
* Props: $team (data/matchcenter.json → teams[]). Leere Blöcke verstecken sich selbst.
|
||
|
|
*/
|
||
|
|
$team = $team ?? [];
|
||
|
|
$next = $team['next_matches'] ?? [];
|
||
|
|
$results = $team['last_results'] ?? [];
|
||
|
|
$table = $team['table'] ?? [];
|
||
|
|
$league = $team['league'] ?? null;
|
||
|
|
$key = preg_replace('/[^a-z0-9-]+/', '', strtolower((string) ($team['key'] ?? '')));
|
||
|
|
?>
|
||
|
|
<section class="section matchcenter-team" id="team-<?= e($key) ?>">
|
||
|
|
<div class="container">
|
||
|
|
<div class="matchcenter-team__head">
|
||
|
|
<div class="matchcenter-team__heading">
|
||
|
|
<h2><?= e($team['name'] ?? '') ?></h2>
|
||
|
|
<?php if ($league): ?>
|
||
|
|
<p class="matchcenter-team__league"><?= icon('trophy', 'matchcenter-team__league-icon') ?><?= e($league) ?></p>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<?php if (!empty($team['slug'])): ?>
|
||
|
|
<a class="btn btn--outline" href="<?= e(url($team['slug'])) ?>">Zur Mannschaft</a>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<div class="matchcenter-team__grid">
|
||
|
|
<?php if ($table !== []): ?>
|
||
|
|
<div class="matchcenter-team__main">
|
||
|
|
<?php /* Sichtbare Überschrift bewusst weggelassen; <caption> labelt die Tabelle für Screenreader. */ ?>
|
||
|
|
<?php component('league-table', ['table' => $table, 'caption' => 'Tabelle ' . ($team['name'] ?? '') . ($league ? ' · ' . $league : '')]); ?>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($next !== [] || $results !== []): ?>
|
||
|
|
<aside class="matchcenter-team__aside">
|
||
|
|
<?php if ($next !== []): ?>
|
||
|
|
<h3 class="visually-hidden">Nächste Spiele</h3>
|
||
|
|
<ul class="match-list">
|
||
|
|
<?php foreach ($next as $m): ?>
|
||
|
|
<?php component('match-row', ['match' => $m]); ?>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</ul>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($results !== []): ?>
|
||
|
|
<h3 class="visually-hidden">Letzte Ergebnisse</h3>
|
||
|
|
<ul class="match-list">
|
||
|
|
<?php foreach ($results as $m): ?>
|
||
|
|
<?php component('match-row', ['match' => $m]); ?>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</ul>
|
||
|
|
<?php endif; ?>
|
||
|
|
</aside>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|