83 lines
3.4 KiB
PHP
83 lines
3.4 KiB
PHP
|
|
<?php
|
||
|
|
use App\Models\Tipp;
|
||
|
|
|
||
|
|
$pageTitle = 'Tipps';
|
||
|
|
require __DIR__ . '/../partials/header.php';
|
||
|
|
?>
|
||
|
|
|
||
|
|
<p>Aktive Saison: <?php echo htmlspecialchars($activeSeason['name']); ?></p>
|
||
|
|
<h1>Tipps</h1>
|
||
|
|
|
||
|
|
<?php foreach ($rounds as $round): ?>
|
||
|
|
<section class="tipp-round" id="round-<?php echo (int)$round['id']; ?>">
|
||
|
|
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||
|
|
<?php if ($round['lock_time']): ?>
|
||
|
|
<div>Runde sperrt sich: <?php echo $round['lock_time']->format('d.m.Y H:i'); ?></div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<div>Bereits verwendete Joker: <?php echo htmlspecialchars($round['joker_usage']); ?></div>
|
||
|
|
<div>Maximale Anzahl gleicher Joker: <?php echo $maxIdenticalJokertipps; ?></div>
|
||
|
|
|
||
|
|
<table>
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th>Spiel</th>
|
||
|
|
<th>Anstoss</th>
|
||
|
|
<th>Ergebnis</th>
|
||
|
|
<th>Tipp</th>
|
||
|
|
<th>Joker</th>
|
||
|
|
<th>Punkte</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<?php foreach ($round['games'] as $game):
|
||
|
|
$tipp = $round['tipps'][$game['id']] ?? null;
|
||
|
|
$tipp1 = $tipp ? (int)$tipp['score1'] : -1;
|
||
|
|
$tipp2 = $tipp ? (int)$tipp['score2'] : -1;
|
||
|
|
$joker = $tipp && $tipp['joker'];
|
||
|
|
$tippText = $tipp1 > -1 ? $tipp1 . ' : ' . $tipp2 : null;
|
||
|
|
?>
|
||
|
|
<tr>
|
||
|
|
<td><?php echo htmlspecialchars($game['team1'] . ' : ' . $game['team2']); ?></td>
|
||
|
|
<td><?php echo date('d.m.Y H:i', strtotime($game['kickoff'])); ?></td>
|
||
|
|
<td><?php echo (int)$game['score1'] > -1 ? (int)$game['score1'] . ' : ' . (int)$game['score2'] : ''; ?></td>
|
||
|
|
<td>
|
||
|
|
<?php if ($round['locked']): ?>
|
||
|
|
<?php echo $tippText ?? 'Ungetippt'; ?>
|
||
|
|
<?php else: ?>
|
||
|
|
<a href="/index.php?page=tipp_game&id=<?php echo (int)$game['id']; ?>"><?php echo $tippText ?? 'Tippen'; ?></a>
|
||
|
|
<?php endif; ?>
|
||
|
|
</td>
|
||
|
|
<td class="text-center">
|
||
|
|
<?php if ($joker): ?>
|
||
|
|
<img src="/img/joker.png" alt="Joker" class="joker-icon" title="Joker">
|
||
|
|
<?php endif; ?>
|
||
|
|
</td>
|
||
|
|
<td><?php echo Tipp::getScoreLocal((int)$game['score1'], (int)$game['score2'], $tipp1, $tipp2, $joker); ?></td>
|
||
|
|
</tr>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
|
||
|
|
<?php if (!$round['locked'] && !empty($round['games'])): ?>
|
||
|
|
<p><a href="/index.php?page=tipp_round&id=<?php echo (int)$round['id']; ?>">Runde Tippen</a></p>
|
||
|
|
<?php endif; ?>
|
||
|
|
</section>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
|
||
|
|
<?php if ($firstTippableRoundId !== null): ?>
|
||
|
|
<script>
|
||
|
|
// Wie im Legacy: ohne Anker zur ersten tippbaren Runde springen
|
||
|
|
if (!location.hash) {
|
||
|
|
document.getElementById('round-<?php echo $firstTippableRoundId; ?>').scrollIntoView();
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
<style>
|
||
|
|
.tipp-round { margin-bottom: 2.5em; }
|
||
|
|
.tipp-round h2 { margin-bottom: 0.3em; scroll-margin-top: 1em; }
|
||
|
|
.tipp-round .joker-icon { width: 1.5em; height: 1.5em; }
|
||
|
|
</style>
|
||
|
|
|
||
|
|
<?php require __DIR__ . '/../partials/footer.php'; ?>
|