2026-10-04 23:15:54 +02:00
|
|
|
<?php
|
2026-10-18 23:16:07 +02:00
|
|
|
use App\Models\Team;
|
|
|
|
|
|
2026-10-04 23:15:54 +02:00
|
|
|
$pageTitle = 'Spieltipp';
|
|
|
|
|
require __DIR__ . '/../partials/header.php';
|
2026-10-18 23:16:07 +02:00
|
|
|
|
|
|
|
|
$teamLogo = function ($name) {
|
|
|
|
|
static $cache = [];
|
|
|
|
|
if (array_key_exists($name, $cache)) {
|
|
|
|
|
return $cache[$name];
|
|
|
|
|
}
|
|
|
|
|
$team = Team::resolve($name);
|
|
|
|
|
$cache[$name] = ($team && Team::logoExists($team)) ? Team::logoUrl($team) : null;
|
|
|
|
|
return $cache[$name];
|
|
|
|
|
};
|
2026-10-04 23:15:54 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<h1>Spieltipp:</h1>
|
|
|
|
|
|
2026-10-20 17:56:44 +02:00
|
|
|
<div>Bereits verwendete Joker: <?php echo htmlspecialchars($jokerUsage); ?></div>
|
|
|
|
|
<div>Maximale Anzahl gleicher Joker: <?php echo $maxIdenticalJokertipps; ?></div>
|
|
|
|
|
|
2026-11-10 13:22:23 +01:00
|
|
|
<p><a href="/index.php?page=tipps">Weitere Runden vortippen</a></p>
|
|
|
|
|
|
2026-10-18 23:16:07 +02:00
|
|
|
<p><strong>
|
2026-10-31 15:12:16 +01:00
|
|
|
<span class="team-cell"><?php $l1 = $teamLogo($game['team1']); if ($l1): ?><img src="<?php echo htmlspecialchars($l1); ?>" alt="" class="team-logo" loading="lazy"><?php endif; ?><?php echo htmlspecialchars($game['team1']); ?></span>
|
2026-10-18 23:16:07 +02:00
|
|
|
:
|
2026-10-31 15:12:16 +01:00
|
|
|
<span class="team-cell"><?php $l2 = $teamLogo($game['team2']); if ($l2): ?><img src="<?php echo htmlspecialchars($l2); ?>" alt="" class="team-logo" loading="lazy"><?php endif; ?><?php echo htmlspecialchars($game['team2']); ?></span>
|
2026-10-18 23:16:07 +02:00
|
|
|
</strong></p>
|
2026-10-04 23:15:54 +02:00
|
|
|
|
|
|
|
|
<?php if ($error): ?>
|
|
|
|
|
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<?php if ($locked): ?>
|
|
|
|
|
<p style="color: red;">Die Runde hat bereits begonnen, der Tipp kann nicht mehr verändert werden.</p>
|
|
|
|
|
<p><a href="/index.php?page=tipps#round-<?php echo (int)$round['id']; ?>">Zu den Tipps</a></p>
|
|
|
|
|
<?php else: ?>
|
|
|
|
|
<form method="post" action="/index.php?page=tipp_game&id=<?php echo (int)$game['id']; ?>" class="tipp-form">
|
|
|
|
|
<p class="score">
|
|
|
|
|
<input type="number" min="0" max="99" name="score1" required
|
|
|
|
|
value="<?php echo htmlspecialchars((string)$formTipp['score1']); ?>">
|
|
|
|
|
:
|
|
|
|
|
<input type="number" min="0" max="99" name="score2" required
|
|
|
|
|
value="<?php echo htmlspecialchars((string)$formTipp['score2']); ?>">
|
|
|
|
|
<label style="margin-left: 1.5em;">
|
|
|
|
|
Joker
|
|
|
|
|
<input type="checkbox" name="joker" value="yes" <?php if ($formTipp['joker']) echo 'checked'; ?>>
|
|
|
|
|
</label>
|
|
|
|
|
</p>
|
|
|
|
|
<p class="hint">Wird der Joker hier gesetzt, wird er bei den anderen Spielen dieser Runde entfernt.</p>
|
|
|
|
|
<p><button type="submit">Ok</button></p>
|
|
|
|
|
</form>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.tipp-form .score input[type="number"] { width: 3.5em; font-size: 1em; }
|
|
|
|
|
.tipp-form .hint { color: #666; font-size: 0.8em; }
|
|
|
|
|
</style>
|
|
|
|
|
|
2026-10-31 11:40:56 +01:00
|
|
|
<script>
|
|
|
|
|
// Doppel-Submit bremsen: Nach dem Absenden bleibt der Button gesperrt,
|
|
|
|
|
// bis die Antwort da ist.
|
|
|
|
|
(function () {
|
|
|
|
|
const form = document.querySelector('form.tipp-form');
|
|
|
|
|
if (!form) return;
|
|
|
|
|
const submit = form.querySelector('button[type="submit"]');
|
|
|
|
|
form.addEventListener('submit', function (event) {
|
|
|
|
|
if (form.dataset.submitting === '1') {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
form.dataset.submitting = '1';
|
|
|
|
|
if (submit) {
|
|
|
|
|
submit.disabled = true;
|
|
|
|
|
submit.textContent = 'Speichern…';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})();
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-10-04 23:15:54 +02:00
|
|
|
<?php require __DIR__ . '/../partials/footer.php'; ?>
|