feat: Erweitere Rundenansicht und integriere Hauptmenü
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
parent
15cce6e697
commit
19e40998c2
5 changed files with 107 additions and 64 deletions
49
src/Views/home.php
Normal file
49
src/Views/home.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
use App\Models\Game;
|
||||
|
||||
$pageTitle = 'Tippspiel 2027 - Startseite';
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Willkommen bei Tippspiel 2027</h1>
|
||||
<p>Dies ist die Nachfolgeversion des alten Tippspiels (Pure PHP Variante).</p>
|
||||
|
||||
<p>Datenbank verbunden! Aktuell <strong><?php echo $userCount; ?></strong> User im System.</p>
|
||||
|
||||
<h2>Rundenübersicht</h2>
|
||||
<?php if ($currentSeason): ?>
|
||||
<p>Saison: <strong><?php echo htmlspecialchars($currentSeason['name']); ?></strong></p>
|
||||
<?php if ($rounds): ?>
|
||||
<ul>
|
||||
<?php foreach ($rounds as $round): ?>
|
||||
<li><a href="/index.php?page=round&id=<?php echo htmlspecialchars($round['id']); ?>"><?php echo htmlspecialchars($round['name']); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>Keine Runden für die aktuelle Saison gefunden.</p>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<p>Keine Saison gefunden.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>Portierte Backend-Logik (Test)</h2>
|
||||
|
||||
<h3>Punkteberechnung</h3>
|
||||
<p>Test: Spiel endet 2:1, getippt wurde 2:1 mit Joker. Erwartet: 4 Punkte. <strong>Berechnet: <?php echo $scoreTest; ?> Punkte</strong>.</p>
|
||||
|
||||
<h3>Spiele der letzten gespielten Runde</h3>
|
||||
<?php if ($lastRoundId && $games): ?>
|
||||
<ul>
|
||||
<?php foreach ($games as $g): ?>
|
||||
<?php
|
||||
$status = Game::getResultString($g['score1'], $g['score2'], $g['kickoff']);
|
||||
$locked = Game::isLocked($g['kickoff']) ? "Gesperrt" : "Offen";
|
||||
?>
|
||||
<li><?php echo htmlspecialchars($g['team1'] . " vs " . $g['team2']) . " | Status: $status | $locked"; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p>Keine gespielten Spiele gefunden.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
2
src/Views/partials/footer.php
Normal file
2
src/Views/partials/footer.php
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
</body>
|
||||
</html>
|
||||
24
src/Views/partials/header.php
Normal file
24
src/Views/partials/header.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php $pageTitle = $pageTitle ?? 'Tippspiel 2027'; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php echo htmlspecialchars($pageTitle); ?></title>
|
||||
<style>
|
||||
body { font-family: sans-serif; margin: 2em; }
|
||||
nav { background: #f4f4f4; padding: 1em; margin-bottom: 2em; }
|
||||
nav a { margin-right: 1em; text-decoration: none; color: #333; font-weight: bold; }
|
||||
table { border-collapse: collapse; width: 100%; max-width: 800px; margin-top: 1em;}
|
||||
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
|
||||
th { background-color: #f4f4f4; }
|
||||
tr:nth-child(even) { background-color: #f9f9f9; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<a href="/">Start</a>
|
||||
<a href="#">Administration</a>
|
||||
<a href="#">Tipps</a>
|
||||
<a href="#">Rangliste</a>
|
||||
<a href="#">Info</a>
|
||||
</nav>
|
||||
|
|
@ -1,27 +1,19 @@
|
|||
<?php
|
||||
// Stellt sicher, dass die benötigten Variablen vorhanden sind
|
||||
if (!isset($round) || !isset($games)) {
|
||||
if (!isset($selectedRound) || !isset($roundsToShow)) {
|
||||
echo "Fehler: Daten für die Rundenansicht nicht gefunden.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$pageTitle = 'Rundenübersicht - ' . htmlspecialchars($selectedRound['name']);
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tippspiel 2027 - <?php echo htmlspecialchars($round['name']); ?></title>
|
||||
<style>
|
||||
body { font-family: sans-serif; margin: 2em; }
|
||||
table { border-collapse: collapse; width: 100%; max-width: 800px; margin-top: 1em;}
|
||||
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
|
||||
th { background-color: #f4f4f4; }
|
||||
tr:nth-child(even) { background-color: #f9f9f9; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><?php echo htmlspecialchars($round['name']); ?></h1>
|
||||
|
||||
<?php if (!empty($games)): ?>
|
||||
|
||||
<h1>Tippübersicht bis: <?php echo htmlspecialchars($selectedRound['name']); ?></h1>
|
||||
|
||||
<?php foreach ($roundsToShow as $round): ?>
|
||||
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||||
<?php if (!empty($round['games'])): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -33,7 +25,7 @@ if (!isset($round) || !isset($games)) {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<?php foreach ($round['games'] as $game): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars((new DateTime($game['kickoff']))->format('d.m.Y H:i')); ?></td>
|
||||
<td><?php echo htmlspecialchars($game['team1']); ?></td>
|
||||
|
|
@ -47,7 +39,8 @@ if (!isset($round) || !isset($games)) {
|
|||
<?php else: ?>
|
||||
<p>Für diese Runde wurden keine Spiele gefunden.</p>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<p><a href="/">Zurück zur Startseite</a></p>
|
||||
</body>
|
||||
</html>
|
||||
<p><a href="/">Zurück zur Startseite</a></p>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue