feat: Rangliste: Rundenfilter, Tagessieger & Joker-Anzeige
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
parent
e92c2c92c8
commit
693ee86836
3 changed files with 170 additions and 120 deletions
|
|
@ -1,76 +1,94 @@
|
|||
<?php
|
||||
$pageTitle = 'Rangliste';
|
||||
if ($selectedRound) {
|
||||
$pageTitle .= ' - ' . htmlspecialchars($selectedRound['name']);
|
||||
}
|
||||
require __DIR__ . '/partials/header.php';
|
||||
|
||||
// Stellt sicher, dass die benötigten Variablen vorhanden sind
|
||||
if (!isset($currentSeason) || !isset($ranking) || !isset($games)) {
|
||||
if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allRounds) || !isset($selectedRound)) {
|
||||
echo "Fehler: Daten für die Rangliste nicht gefunden.";
|
||||
exit;
|
||||
// exit; // Besser, eine freundliche Nachricht im Layout anzuzeigen
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
/* Styling für die Punkt-Zellen in der Rangliste */
|
||||
.tipp-cell { text-align: center; }
|
||||
.tipp-cell { text-align: center; position: relative; }
|
||||
.col_exact { background-color: #28a745 !important; color: white; } /* Exaktes Ergebnis */
|
||||
.col_diff { background-color: #ffc107 !important; } /* Richtige Tordifferenz */
|
||||
.col_tendenz { background-color: #17a2b8 !important; color: white; } /* Richtige Tendenz */
|
||||
.joker-tipp { border: 2px solid #007bff; } /* Blauer Rahmen für Joker */
|
||||
|
||||
/* Damit die Tabelle auf kleineren Bildschirmen scrollbar wird */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
margin-top: 20px;
|
||||
}
|
||||
th.vertical-text {
|
||||
writing-mode: vertical-rl;
|
||||
transform: rotate(180deg);
|
||||
white-space: nowrap;
|
||||
text-align: left;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
table { width: auto; } /* Erlaubt der Tabelle, breiter als der Container zu sein */
|
||||
.round-filter { margin-bottom: 20px; }
|
||||
.joker-icon { font-size: 0.7em; vertical-align: top; }
|
||||
th.game-header { white-space: normal; } /* Erlaubt Umbruch im Header */
|
||||
.table-container { width: 100%; overflow-x: auto; margin-top: 20px; }
|
||||
</style>
|
||||
|
||||
<h1>Rangliste</h1>
|
||||
<h2>Saison: <?php echo htmlspecialchars($currentSeason['name']); ?></h2>
|
||||
|
||||
<div class="table-container">
|
||||
<?php if (!empty($ranking)): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Platz</th>
|
||||
<th>Name</th>
|
||||
<th>Punkte</th>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<th class="vertical-text" title="<?php echo htmlspecialchars($game['team1'] . ' vs ' . $game['team2']); ?>">
|
||||
<span><?php echo htmlspecialchars($game['team1'] . ' - ' . $game['team2']); ?></span>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($ranking as $entry): ?>
|
||||
<?php if ($selectedRound): ?>
|
||||
<div class="round-filter">
|
||||
<form method="get">
|
||||
<input type="hidden" name="page" value="ranking">
|
||||
<label for="round_id">Runde auswählen:</label>
|
||||
<select name="round_id" id="round_id" onchange="this.form.submit()">
|
||||
<?php foreach ($allRounds as $round): ?>
|
||||
<option value="<?php echo $round['id']; ?>" <?php echo ($round['id'] == $selectedRound['id']) ? 'selected' : ''; ?>>
|
||||
<?php echo htmlspecialchars($round['name']); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<?php if (!empty($ranking)): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?php echo $entry['rank']; ?>.</td>
|
||||
<td><?php echo htmlspecialchars($entry['name']); ?></td>
|
||||
<td><strong><?php echo $entry['score']; ?></strong></td>
|
||||
<th>Platz</th>
|
||||
<th>Name</th>
|
||||
<th>🏆</th>
|
||||
<th>Punkte (Gesamt)</th>
|
||||
<th>Punkte (Runde)</th>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<?php $tipp = $entry['tipps'][$game['id']]; ?>
|
||||
<td class="tipp-cell <?php echo htmlspecialchars($tipp['color']); ?> <?php echo $tipp['is_joker'] ? 'joker-tipp' : ''; ?>">
|
||||
<span title="Dein Tipp: <?php echo htmlspecialchars($tipp['text']); ?><?php echo $tipp['is_joker'] ? ' (Joker)' : ''; ?>">
|
||||
<?php echo $tipp['points']; ?>
|
||||
</span>
|
||||
</td>
|
||||
<th class="game-header">
|
||||
<?php echo htmlspecialchars($game['team1']); ?><br>
|
||||
<?php echo htmlspecialchars($game['team2']); ?><br>
|
||||
<small>(<?php echo App\Models\Game::getResultString($game['score1'], $game['score2'], $game['kickoff']); ?>)</small>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<p>Für diese Saison gibt es noch keine Rangliste (möglicherweise haben noch keine Spieler bezahlt).</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($ranking as $entry): ?>
|
||||
<tr>
|
||||
<td><?php echo $entry['rank']; ?>.</td>
|
||||
<td><?php echo htmlspecialchars($entry['name']); ?></td>
|
||||
<td><?php echo in_array($entry['id'], $dailyWinners) ? '🏆' : ''; ?></td>
|
||||
<td><strong><?php echo $entry['score']; ?></strong></td>
|
||||
<td><?php echo $entry['round_score']; ?></td>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<?php $tipp = $entry['tipps'][$game['id']]; ?>
|
||||
<td class="tipp-cell <?php echo htmlspecialchars($tipp['color']); ?>">
|
||||
<span title="Dein Tipp: <?php echo htmlspecialchars($tipp['text']); ?>">
|
||||
<?php echo $tipp['points']; ?>
|
||||
</span>
|
||||
<?php if ($tipp['is_joker']): ?>
|
||||
<span class="joker-icon" title="Joker">🃏</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<p>Für diese Saison gibt es noch keine Rangliste (möglicherweise haben noch keine Spieler bezahlt).</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p>Keine Runde für die Anzeige ausgewählt oder gefunden.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue