initial commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
$eventname = "Sport am Tankumsee 2026";
|
||||||
|
|
||||||
|
$rennplanJson = file_get_contents('https://api.sat.regattatech.de/api/v1/rennplan/3/');
|
||||||
|
|
||||||
|
$bootJson = file_get_contents('https://api.sat.regattatech.de/api/v1/boot/');
|
||||||
|
|
||||||
|
$ergebnisseJson = file_get_contents('https://api.sat.regattatech.de/api/v1/results/current/');
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
// Rennplan abrufen
|
||||||
|
include 'config.php';
|
||||||
|
$rennplanRaw = json_decode($rennplanJson, true)['rennplan'];
|
||||||
|
|
||||||
|
// Alle Läufe in ein flaches Array überführen
|
||||||
|
$rennplan = [];
|
||||||
|
foreach ($rennplanRaw as $lauf) {
|
||||||
|
foreach ($lauf as $rennen) {
|
||||||
|
$rennplan[] = $rennen;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bootdaten abrufen
|
||||||
|
$boote = json_decode($bootJson, true);
|
||||||
|
$bootMap = [];
|
||||||
|
foreach ($boote as $boot) {
|
||||||
|
$bootMap[$boot['name']] = $boot;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ergebnisse abrufen
|
||||||
|
$ergebnisse = isset(json_decode($ergebnisseJson, true)['ergebnisse'])
|
||||||
|
? json_decode($ergebnisseJson, true)['ergebnisse']
|
||||||
|
: [];
|
||||||
|
|
||||||
|
// Aktuelles Rennen per Index (über URL)
|
||||||
|
$rennenIndex = isset($_GET['rennen']) ? intval($_GET['rennen']) : 0;
|
||||||
|
$totalRennen = count($rennplan);
|
||||||
|
|
||||||
|
// Index validieren
|
||||||
|
$rennenIndex = max(0, min($rennenIndex, $totalRennen - 1));
|
||||||
|
|
||||||
|
// Aktuelles, vorheriges, nächstes Rennen
|
||||||
|
$current = $rennplan[$rennenIndex];
|
||||||
|
$prev = $rennplan[$rennenIndex - 1] ?? null;
|
||||||
|
$next = $rennplan[$rennenIndex + 1] ?? null;
|
||||||
|
|
||||||
|
// Ergebnis für vorheriges Rennen
|
||||||
|
$lastResult = $rennenIndex > 0 ? ($ergebnisse[$rennenIndex - 1] ?? null) : null;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Moderation <?php $eventname; ?></title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body class="bg-light">
|
||||||
|
|
||||||
|
<div class="container py-4">
|
||||||
|
<h1 class="mb-4">Moderation <?php $eventname; ?></h1>
|
||||||
|
|
||||||
|
<!-- Aktuelles Rennen -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header bg-primary text-white">Aktuelles Rennen: <?= htmlspecialchars($current['name']) ?> (<?= $current['zeit'] ?>)</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php for ($i = 1; $i <= 3; $i++): ?>
|
||||||
|
<?php if (!empty($current["bahn$i"])):
|
||||||
|
$bootName = $current["bahn$i"];
|
||||||
|
$boot = $bootMap[$bootName] ?? null;
|
||||||
|
?>
|
||||||
|
<div class="mb-2">
|
||||||
|
<strong>Bahn <?= $i ?>:</strong> <?= htmlspecialchars($bootName) ?>
|
||||||
|
<?php if ($boot): ?>
|
||||||
|
<button class="btn btn-sm btn-outline-secondary ms-2" data-bs-toggle="collapse" data-bs-target="#bootDetails<?= $i ?>">Details</button>
|
||||||
|
<div class="collapse mt-2" id="bootDetails<?= $i ?>">
|
||||||
|
<div class="card card-body">
|
||||||
|
<p><strong>Wer sind wir:</strong> <?= nl2br(htmlspecialchars($boot['wernsindwir'] ?? '')) ?></p>
|
||||||
|
<p><strong>Woher kommen wir:</strong> <?= htmlspecialchars($boot['woherkommenwir'] ?? '') ?></p>
|
||||||
|
<p><strong>Trommlerin:</strong> <?= htmlspecialchars($boot['trommlerin'] ?? '-') ?></p>
|
||||||
|
<p><strong>Aufschlag:</strong> <?= htmlspecialchars($boot['aufschlag'] ?? '-') ?></p>
|
||||||
|
<p><strong>Ziele:</strong> <?= htmlspecialchars($boot['ziele'] ?? '') ?></p>
|
||||||
|
<p><strong>Was uns auszeichnet:</strong> <?= htmlspecialchars($boot['was_uns_auszeichnet'] ?? '') ?></p>
|
||||||
|
<p><strong>Schlachtruf:</strong> <?= htmlspecialchars($boot['schlachtruf'] ?? '') ?></p>
|
||||||
|
<p><strong>Teilnahmen:</strong> <?= intval($boot['anzahl_teilnahmen']) ?></p>
|
||||||
|
<p><strong>Platzierungen:</strong> <?= implode(', ', $boot['platzierungen'] ?? []) ?></p>
|
||||||
|
<p><strong>Notizen:</strong> <?= htmlspecialchars($boot['notizen'] ?? '') ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Ergebnisse -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header bg-success text-white">Ergebnisse aus dem letzten Rennen</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if ($lastResult): ?>
|
||||||
|
<ul class="list-group">
|
||||||
|
<?php foreach (['bahn1', 'bahn2', 'bahn3'] as $bahn): ?>
|
||||||
|
<?php if (isset($lastResult[$bahn])): ?>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong><?= htmlspecialchars($lastResult[$bahn]['boot']) ?>:</strong> <?= htmlspecialchars($lastResult[$bahn]['zeit']) ?>
|
||||||
|
<?php if (($lastResult['winner'] ?? '') === $bahn): ?>
|
||||||
|
<span class="badge bg-warning text-dark">Sieger</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php else: ?>
|
||||||
|
<p>Noch kein Ergebnis.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Nächstes Rennen -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header bg-info text-white">Nächstes Rennen</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<?php if ($next): ?>
|
||||||
|
<p><strong><?= htmlspecialchars($next['name']) ?></strong> um <?= htmlspecialchars($next['zeit']) ?></p>
|
||||||
|
<ul>
|
||||||
|
<?php for ($i = 1; $i <= 3; $i++): ?>
|
||||||
|
<?php if (!empty($next["bahn$i"])): ?>
|
||||||
|
<li>Bahn <?= $i ?>: <?= htmlspecialchars($next["bahn$i"]) ?></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</ul>
|
||||||
|
<?php else: ?>
|
||||||
|
<p><strong>Letztes Rennen im Lauf</strong></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Navigation -->
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<a href="?rennen=<?= max(0, $rennenIndex - 1) ?>" class="btn btn-outline-secondary">Vorheriges Rennen</a>
|
||||||
|
<a href="?rennen=<?= min($totalRennen - 1, $rennenIndex + 1) ?>" class="btn btn-primary">Nächstes Rennen</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user