67 lines
2.8 KiB
PHP
67 lines
2.8 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Tagesprogramm einer Veranstaltung. Props:
|
||
|
|
* $programm array [{tag: 'YYYY-MM-DD', punkte: [{zeit: 'HH:MM', titel, text?}]}, …]
|
||
|
|
* $title string (optional, Default 'Programm')
|
||
|
|
* $compact bool (optional) — kleinere Variante für den Rückblick, wo das
|
||
|
|
* Programm nicht mehr informiert, sondern nur noch dokumentiert.
|
||
|
|
*
|
||
|
|
* Ein Tag = eine Gruppe mit Wochentag-Überschrift, damit ein dreitägiges Fest
|
||
|
|
* lesbar bleibt. Ohne Programm rendert die Komponente nichts (die Seite startet
|
||
|
|
* ja mit nichts als dem Plakat).
|
||
|
|
*/
|
||
|
|
$programm = $programm ?? [];
|
||
|
|
$title = $title ?? 'Programm';
|
||
|
|
$compact = $compact ?? false;
|
||
|
|
|
||
|
|
if ($programm === []) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
?>
|
||
|
|
<section class="section veranstaltung-programm<?= $compact ? ' veranstaltung-programm--compact' : '' ?>" id="programm">
|
||
|
|
<div class="container">
|
||
|
|
<h2><?= e($title) ?></h2>
|
||
|
|
<div class="veranstaltung-programm__tage">
|
||
|
|
<?php foreach ($programm as $tag): ?>
|
||
|
|
<?php
|
||
|
|
$tagIso = (string) ($tag['tag'] ?? '');
|
||
|
|
$weekday = german_weekday($tagIso);
|
||
|
|
$tagText = trim(($weekday !== '' ? $weekday . ', ' : '') . german_date($tagIso));
|
||
|
|
?>
|
||
|
|
<div class="veranstaltung-programm__tag">
|
||
|
|
<?php if ($tagIso !== ''): ?>
|
||
|
|
<h3 class="veranstaltung-programm__tag-titel">
|
||
|
|
<time datetime="<?= e($tagIso) ?>"><?= e($tagText) ?></time>
|
||
|
|
</h3>
|
||
|
|
<?php endif; ?>
|
||
|
|
<ul class="veranstaltung-programm__liste">
|
||
|
|
<?php foreach ($tag['punkte'] ?? [] as $punkt): ?>
|
||
|
|
<?php $zeit = (string) ($punkt['zeit'] ?? ''); ?>
|
||
|
|
<li class="veranstaltung-programm__punkt">
|
||
|
|
<?php if ($zeit !== ''): ?>
|
||
|
|
<span class="veranstaltung-programm__zeit">
|
||
|
|
<time datetime="<?= e($tagIso !== '' ? $tagIso . 'T' . $zeit : $zeit) ?>"><?= e($zeit) ?></time>
|
||
|
|
</span>
|
||
|
|
<?php else: ?>
|
||
|
|
<?php /* Platzhalter hält die Spalte, aber ohne die Zeit-Klasse — sonst stünde
|
||
|
|
dort der rote Balken ohne Inhalt daneben. */ ?>
|
||
|
|
<span aria-hidden="true"></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<span class="veranstaltung-programm__body">
|
||
|
|
<span class="veranstaltung-programm__titel"><?= e($punkt['titel'] ?? '') ?></span>
|
||
|
|
<?php if (!empty($punkt['text'])): ?>
|
||
|
|
<span class="veranstaltung-programm__text"><?= e($punkt['text']) ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</span>
|
||
|
|
</li>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</section>
|