feat: Erweitere Rangliste um visuelle Punkte- und Joker-Details

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
torsten 2026-10-04 05:58:19 +02:00
parent 9d040d10e2
commit e92c2c92c8
3 changed files with 111 additions and 66 deletions

View file

@ -3,36 +3,74 @@ $pageTitle = 'Rangliste';
require __DIR__ . '/partials/header.php';
// Stellt sicher, dass die benötigten Variablen vorhanden sind
if (!isset($currentSeason) || !isset($ranking)) {
if (!isset($currentSeason) || !isset($ranking) || !isset($games)) {
echo "Fehler: Daten für die Rangliste nicht gefunden.";
exit;
}
?>
<style>
/* Styling für die Punkt-Zellen in der Rangliste */
.tipp-cell { text-align: center; }
.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 */
</style>
<h1>Rangliste</h1>
<h2>Saison: <?php echo htmlspecialchars($currentSeason['name']); ?></h2>
<?php if (!empty($ranking)): ?>
<table>
<thead>
<tr>
<th>Platz</th>
<th>Name</th>
<th>Punkte</th>
</tr>
</thead>
<tbody>
<?php foreach ($ranking as $entry): ?>
<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><?php echo $entry['score']; ?></td>
<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>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>Für diese Saison gibt es noch keine Rangliste.</p>
<?php endif; ?>
</thead>
<tbody>
<?php foreach ($ranking as $entry): ?>
<tr>
<td><?php echo $entry['rank']; ?>.</td>
<td><?php echo htmlspecialchars($entry['name']); ?></td>
<td><strong><?php echo $entry['score']; ?></strong></td>
<?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>
<?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 require __DIR__ . '/partials/footer.php'; ?>