Erster Durchstich mit updates
This commit is contained in:
parent
d3fd60b548
commit
3331f08091
60 changed files with 693 additions and 195 deletions
66
tippspiel/src/Views/admin/accounts.php
Normal file
66
tippspiel/src/Views/admin/accounts.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
$pageTitle = 'Kontoliste';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
|
||||
$euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
||||
?>
|
||||
|
||||
<h1>Konto- & Ausschüttungsübersicht</h1>
|
||||
|
||||
<?php if (!$currentSeason): ?>
|
||||
<p>Es gibt noch keine Saison.</p>
|
||||
<?php elseif (!$result): ?>
|
||||
<p>Es gibt noch keine abgeschlossene Runde, daher noch keine Ausschüttungen.
|
||||
<?php if ($seasonStart): ?>Die Saison beginnt am <?php echo $seasonStart->format('d.m.Y H:i'); ?>.<?php endif; ?></p>
|
||||
<?php else: ?>
|
||||
<p><?php echo htmlspecialchars($currentSeason['name']); ?>, Stand: <?php echo htmlspecialchars($result['rounds'][$result['max_round_id']]['round']['name']); ?>
|
||||
<?php if (!$result['is_final']): ?>(ohne Platzierungsgeld, das erst nach der letzten Runde feststeht)<?php endif; ?></p>
|
||||
|
||||
<div class="table-container">
|
||||
<table class="accounts-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Ausschüttung</th>
|
||||
<th>Bankname</th>
|
||||
<th>IBAN</th>
|
||||
<th>BLZ</th>
|
||||
<th>Kontonummer</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($moneyRanking as $entry):
|
||||
$missingAccount = $entry['amount'] > 0 && empty($entry['iban']) && empty($entry['kontonr']);
|
||||
?>
|
||||
<tr <?php if ($entry['amount'] <= 0) echo 'class="no-payout"'; ?>>
|
||||
<td><a href="/index.php?page=money_ranking&user_id=<?php echo (int)$entry['user_id']; ?>"><?php echo htmlspecialchars($entry['name']); ?></a></td>
|
||||
<td class="amount"><?php echo $euro($entry['amount']); ?></td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['bankname']); ?></td>
|
||||
<td class="iban <?php if ($missingAccount) echo 'missing'; ?>">
|
||||
<?php echo $missingAccount ? 'fehlt' : htmlspecialchars((string)$entry['iban']); ?>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['blz']); ?></td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['kontonr']); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Summe</th>
|
||||
<th class="amount"><?php echo $euro(array_sum(array_column($moneyRanking, 'amount'))); ?></th>
|
||||
<th colspan="4"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.accounts-table td.amount, .accounts-table th.amount { text-align: right; white-space: nowrap; }
|
||||
.accounts-table td.iban { font-family: monospace; white-space: nowrap; }
|
||||
.accounts-table td.missing { color: #c00; font-family: inherit; font-weight: bold; }
|
||||
.accounts-table tr.no-payout td { color: #999; }
|
||||
.accounts-table tr.no-payout td a { color: #999; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
182
tippspiel/src/Views/admin/roundmails.php
Normal file
182
tippspiel/src/Views/admin/roundmails.php
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
<?php
|
||||
use App\Models\Round;
|
||||
|
||||
$pageTitle = 'Runden-E-Mails versenden';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Runden-E-Mails</h1>
|
||||
|
||||
<?php if (!empty($message)): ?>
|
||||
<p style="color: green;"><?php echo htmlspecialchars($message); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($error)): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($compose): ?>
|
||||
|
||||
<h2>Neue Mail</h2>
|
||||
<?php if (!$mailConfigured): ?>
|
||||
<p style="color: red;">Es ist kein Mailserver konfiguriert (Umgebungsvariable SMTP_HOST). Versand ist nicht möglich.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="/index.php?page=admin_roundmails" class="mail-form">
|
||||
<div class="form-group">
|
||||
<label>Versender:</label>
|
||||
<?php echo htmlspecialchars(App\Core\Auth::user()['name']); ?>
|
||||
<small>(Antworten gehen an <?php echo htmlspecialchars(App\Core\Auth::user()['email']); ?>)</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="topic">Thema:</label>
|
||||
<input type="text" id="topic" name="topic" maxlength="200" required
|
||||
value="<?php echo htmlspecialchars($failedForm['topic'] ?? ''); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="recipients">Empfänger:</label>
|
||||
<textarea id="recipients" name="recipients" rows="5" required><?php echo htmlspecialchars($failedForm['recipients'] ?? ''); ?></textarea>
|
||||
</div>
|
||||
<div class="form-group buttons">
|
||||
<?php foreach ($recipientGroups as $key => $group): ?>
|
||||
<button type="button" data-recipients="<?php echo htmlspecialchars(implode(', ', $group['emails'])); ?>">
|
||||
<?php echo htmlspecialchars($group['label']); ?> (<?php echo count($group['emails']); ?>)
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($tippableRound): ?>
|
||||
<p class="hint">Fehlende Tipps/Joker beziehen sich auf „<?php echo htmlspecialchars($tippableRound['name']); ?>“
|
||||
<?php $lock = Round::getLockTime($tippableRound['games']); if ($lock): ?>
|
||||
(sperrt <?php echo $lock->format('d.m.Y H:i'); ?>)
|
||||
<?php endif; ?>.</p>
|
||||
<?php else: ?>
|
||||
<p class="hint">Aktuell gibt es keine tippbare Runde.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="message">Nachricht:</label>
|
||||
<textarea id="message" name="message" rows="12" required><?php echo htmlspecialchars($failedForm['message'] ?? ''); ?></textarea>
|
||||
</div>
|
||||
<div class="form-group buttons">
|
||||
<button type="button" id="add-tipplink" data-link="<?php echo htmlspecialchars($tippLink); ?>">Tipplink hinzufügen</button>
|
||||
</div>
|
||||
|
||||
<div class="form-group buttons">
|
||||
<button type="submit" onclick="return confirm('Mail jetzt versenden?');" <?php if (!$mailConfigured) echo 'disabled'; ?>>Senden</button>
|
||||
<a href="/index.php?page=admin_roundmails">Abbrechen</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
document.querySelectorAll('[data-recipients]').forEach(function (button) {
|
||||
button.addEventListener('click', function () {
|
||||
document.getElementById('recipients').value = button.dataset.recipients;
|
||||
});
|
||||
});
|
||||
document.getElementById('add-tipplink').addEventListener('click', function () {
|
||||
const message = document.getElementById('message');
|
||||
message.value += (message.value && !message.value.endsWith('\n') ? '\n' : '') + 'Link zur Tippseite: ' + this.dataset.link;
|
||||
message.focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php elseif ($viewMail): ?>
|
||||
|
||||
<h2><?php echo htmlspecialchars($viewMail['topic']); ?></h2>
|
||||
<table class="mail-details">
|
||||
<tr><th>Datum</th><td><?php echo date('d.m.Y', strtotime($viewMail['send_date'])); ?></td></tr>
|
||||
<tr><th>Versender</th><td><?php echo htmlspecialchars($viewMail['sender_name']); ?></td></tr>
|
||||
<tr><th>Empfänger</th><td class="recipients"><?php echo htmlspecialchars(str_replace(',', ', ', $viewMail['recipients'])); ?></td></tr>
|
||||
<tr><th>Nachricht</th><td><?php echo nl2br(htmlspecialchars(html_entity_decode(strip_tags(Round::reportToText($viewMail['message'])), ENT_QUOTES, 'UTF-8'))); ?></td></tr>
|
||||
</table>
|
||||
<?php $backPage = max(1, (int)($_GET['p'] ?? 1)); ?>
|
||||
<p><a href="/index.php?page=admin_roundmails<?php if ($backPage > 1) echo '&p=' . $backPage; ?>">Zurück zur Übersicht</a></p>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<p><a href="/index.php?page=admin_roundmails&new=1">Neue Mail schreiben</a></p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Thema</th>
|
||||
<th>Versender</th>
|
||||
<th>Empfänger</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($mails as $mail): ?>
|
||||
<tr>
|
||||
<td><?php echo date('d.m.Y', strtotime($mail['send_date'])); ?></td>
|
||||
<td><a href="/index.php?page=admin_roundmails&id=<?php echo (int)$mail['id']; ?><?php if ($currentPage > 1) echo '&p=' . $currentPage; ?>"><?php echo htmlspecialchars($mail['topic']); ?></a></td>
|
||||
<td><?php echo htmlspecialchars($mail['sender_name']); ?></td>
|
||||
<td><?php echo $mail['recipients'] === '' ? 0 : count(explode(',', $mail['recipients'])); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($mails)): ?>
|
||||
<tr><td colspan="4">Noch keine Mails versendet.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php if ($totalPages > 1):
|
||||
$pageUrl = fn($n) => '/index.php?page=admin_roundmails' . ($n > 1 ? '&p=' . $n : '');
|
||||
// Angezeigt werden erste und letzte Seite sowie zwei Seiten um die aktuelle herum
|
||||
$shown = array_unique(array_filter(
|
||||
[1, $currentPage - 2, $currentPage - 1, $currentPage, $currentPage + 1, $currentPage + 2, $totalPages],
|
||||
fn($n) => $n >= 1 && $n <= $totalPages
|
||||
));
|
||||
sort($shown);
|
||||
?>
|
||||
<nav class="pagination" aria-label="Seiten">
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<a href="<?php echo $pageUrl($currentPage - 1); ?>">« Zurück</a>
|
||||
<?php else: ?>
|
||||
<span class="disabled">« Zurück</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $previous = 0; foreach ($shown as $n): ?>
|
||||
<?php if ($n > $previous + 1): ?><span class="gap">…</span><?php endif; ?>
|
||||
<?php if ($n === $currentPage): ?>
|
||||
<span class="current" aria-current="page"><?php echo $n; ?></span>
|
||||
<?php else: ?>
|
||||
<a href="<?php echo $pageUrl($n); ?>"><?php echo $n; ?></a>
|
||||
<?php endif; ?>
|
||||
<?php $previous = $n; endforeach; ?>
|
||||
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<a href="<?php echo $pageUrl($currentPage + 1); ?>">Weiter »</a>
|
||||
<?php else: ?>
|
||||
<span class="disabled">Weiter »</span>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
<p class="pagination-info">
|
||||
Einträge <?php echo ($currentPage - 1) * $perPage + 1; ?>–<?php echo min($currentPage * $perPage, $totalMails); ?>
|
||||
von <?php echo $totalMails; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.mail-form { max-width: 900px; }
|
||||
.mail-form .form-group { margin-bottom: 1rem; }
|
||||
.mail-form label { display: block; font-weight: bold; margin-bottom: 0.3rem; }
|
||||
.mail-form input[type="text"], .mail-form textarea { width: 100%; box-sizing: border-box; }
|
||||
.mail-form .buttons button { margin: 0 0.4em 0.4em 0; }
|
||||
.mail-form .hint { color: #666; font-size: 0.8em; }
|
||||
.pagination { margin-top: 1em; display: flex; flex-wrap: wrap; gap: 0.3em; align-items: center; }
|
||||
.pagination a, .pagination span { padding: 0.2em 0.6em; border: 1px solid #ccc; border-radius: 3px; text-decoration: none; }
|
||||
.pagination a { color: var(--link); }
|
||||
.pagination a:hover { background: #f4f4f4; }
|
||||
.pagination .current { background: var(--link); border-color: var(--link); color: white; font-weight: bold; }
|
||||
.pagination .disabled { color: #aaa; }
|
||||
.pagination .gap { border: none; }
|
||||
.pagination-info { color: #666; font-size: 0.8em; }
|
||||
.mail-details th { width: 150px; vertical-align: top; }
|
||||
.mail-details td.recipients { word-break: break-word; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
136
tippspiel/src/Views/admin/rounds.php
Normal file
136
tippspiel/src/Views/admin/rounds.php
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
use App\Models\Round;
|
||||
|
||||
$pageTitle = 'Spiele & Ergebnisse eintragen';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
|
||||
$failedRoundId = $failedForm ? (int)($failedForm['round_id'] ?? 0) : null;
|
||||
?>
|
||||
|
||||
<h1>Spiele & Ergebnisse eintragen</h1>
|
||||
|
||||
<?php if (!empty($message)): ?>
|
||||
<p style="color: green;"><?php echo htmlspecialchars($message); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($error)): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="get" action="/index.php" class="round-filter">
|
||||
<input type="hidden" name="page" value="admin_rounds">
|
||||
<label for="season_id">Saison:</label>
|
||||
<select id="season_id" name="season_id" onchange="this.form.submit()">
|
||||
<?php foreach ($seasons as $s): ?>
|
||||
<option value="<?php echo (int)$s['id']; ?>" <?php if ((int)$s['id'] === $seasonId) echo 'selected'; ?>>
|
||||
<?php echo htmlspecialchars($s['name']); ?><?php if ($currentSeason && (int)$currentSeason['id'] === (int)$s['id']) echo ' (aktiv)'; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<noscript><button type="submit">Anzeigen</button></noscript>
|
||||
</form>
|
||||
|
||||
<?php if (!$season): ?>
|
||||
<p>Keine Saison vorhanden. Bitte zuerst unter <a href="/index.php?page=admin_seasons">Saisons verwalten</a> eine Saison anlegen.</p>
|
||||
<?php elseif (empty($rounds)): ?>
|
||||
<p>Diese Saison hat keine Runden.</p>
|
||||
<?php else: ?>
|
||||
|
||||
<p class="round-index">
|
||||
<?php foreach ($rounds as $round): ?>
|
||||
<a href="#round-<?php echo (int)$round['id']; ?>" class="<?php echo $round['completed'] ? 'done' : 'open'; ?>"
|
||||
title="<?php echo $round['completed'] ? 'Abgeschlossen' : 'Offen'; ?>"><?php echo htmlspecialchars($round['name']); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</p>
|
||||
|
||||
<?php foreach ($rounds as $round):
|
||||
$roundId = (int)$round['id'];
|
||||
$form = ($failedRoundId === $roundId) ? $failedForm : null;
|
||||
$isOpen = $failedRoundId === $roundId || ($failedRoundId === null && $roundId === $firstIncompleteRoundId);
|
||||
?>
|
||||
<details id="round-<?php echo $roundId; ?>" class="round-admin" <?php if ($isOpen) echo 'open'; ?>>
|
||||
<summary>
|
||||
<strong><?php echo htmlspecialchars($round['name']); ?></strong>
|
||||
<span class="round-status <?php echo $round['completed'] ? 'done' : 'open'; ?>">
|
||||
<?php echo $round['completed'] ? 'abgeschlossen' : 'offen'; ?>
|
||||
</span>
|
||||
<?php if ($round['lock_time']): ?>
|
||||
<small>sperrt: <?php echo $round['lock_time']->format('d.m.Y H:i'); ?></small>
|
||||
<?php endif; ?>
|
||||
</summary>
|
||||
|
||||
<form method="post" action="/index.php?page=admin_rounds&season_id=<?php echo $seasonId; ?>">
|
||||
<input type="hidden" name="round_id" value="<?php echo $roundId; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name-<?php echo $roundId; ?>">Rundenname:</label>
|
||||
<input type="text" id="name-<?php echo $roundId; ?>" name="name" maxlength="64" required
|
||||
value="<?php echo htmlspecialchars($form['name'] ?? $round['name']); ?>">
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Heim</th>
|
||||
<th>Gast</th>
|
||||
<th>Anstoß</th>
|
||||
<th>Ergebnis</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($round['games'] as $game):
|
||||
$gameId = (int)$game['id'];
|
||||
$in = $form['games'][$gameId] ?? null;
|
||||
$field = "games[$gameId]";
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="text" name="<?php echo $field; ?>[team1]" maxlength="100" required
|
||||
value="<?php echo htmlspecialchars($in['team1'] ?? $game['team1']); ?>"></td>
|
||||
<td><input type="text" name="<?php echo $field; ?>[team2]" maxlength="100" required
|
||||
value="<?php echo htmlspecialchars($in['team2'] ?? $game['team2']); ?>"></td>
|
||||
<td><input type="datetime-local" name="<?php echo $field; ?>[kickoff]" required
|
||||
value="<?php echo htmlspecialchars($in['kickoff'] ?? date('Y-m-d\TH:i', strtotime($game['kickoff']))); ?>"></td>
|
||||
<td class="score">
|
||||
<input type="number" min="0" name="<?php echo $field; ?>[score1]"
|
||||
value="<?php echo htmlspecialchars($in['score1'] ?? ((int)$game['score1'] < 0 ? '' : $game['score1'])); ?>">
|
||||
:
|
||||
<input type="number" min="0" name="<?php echo $field; ?>[score2]"
|
||||
value="<?php echo htmlspecialchars($in['score2'] ?? ((int)$game['score2'] < 0 ? '' : $game['score2'])); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="hint">Ergebnis leer lassen, solange das Spiel noch nicht beendet ist.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="report-<?php echo $roundId; ?>">Berichterstattung:</label><br>
|
||||
<textarea id="report-<?php echo $roundId; ?>" name="report" rows="4"><?php
|
||||
echo htmlspecialchars($form['report'] ?? Round::reportToText($round['report']));
|
||||
?></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit">Speichern</button>
|
||||
</form>
|
||||
</details>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.round-index a { margin-right: 0.6em; white-space: nowrap; text-decoration: none; }
|
||||
.round-index a.done { color: #888; }
|
||||
.round-index a.open { color: var(--link); font-weight: bold; }
|
||||
.round-admin { border: 1px solid #ccc; padding: 0.5em 1em; margin-bottom: 1em; max-width: 1000px; }
|
||||
.round-admin summary { cursor: pointer; }
|
||||
.round-admin summary small { color: #666; margin-left: 1em; }
|
||||
.round-status { margin-left: 0.5em; font-size: 0.8em; padding: 0 0.4em; border-radius: 3px; }
|
||||
.round-status.done { background: #d4edda; color: #155724; }
|
||||
.round-status.open { background: #fff3cd; color: #856404; }
|
||||
.round-admin td input[type="text"] { width: 10em; }
|
||||
.round-admin td.score { white-space: nowrap; }
|
||||
.round-admin td.score input { width: 3.5em; }
|
||||
.round-admin textarea { width: 100%; max-width: 800px; }
|
||||
.round-admin .form-group { margin: 0.8em 0; }
|
||||
.round-admin .hint { color: #666; font-size: 0.8em; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
160
tippspiel/src/Views/admin/seasons.php
Normal file
160
tippspiel/src/Views/admin/seasons.php
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
$pageTitle = 'Saisons verwalten';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Saisons verwalten</h1>
|
||||
|
||||
<?php if (!empty($message)): ?>
|
||||
<p style="color: green;"><?php echo htmlspecialchars($message); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($error)): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Form for creating/editing a season -->
|
||||
<h2><?php echo $editSeason ? 'Saison bearbeiten' : 'Neue Saison anlegen'; ?></h2>
|
||||
<form action="/index.php?page=admin_seasons" method="post">
|
||||
<?php if ($editSeason): ?>
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="id" value="<?php echo htmlspecialchars($editSeason['id']); ?>">
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="action" value="create">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">Name:</label>
|
||||
<input type="text" id="name" name="name" value="<?php echo htmlspecialchars($formValues['name']); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="rounds">Runden:</label>
|
||||
<input type="number" min="1" id="rounds" name="rounds" value="<?php echo htmlspecialchars($formValues['rounds']); ?>" required>
|
||||
<?php if ($editSeason): ?>
|
||||
<small>(Runden werden nur beim Anlegen erzeugt; eine Änderung legt keine Runden an oder löscht welche.)</small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="max_identical_jokertipps">Max. gleiche Joker:</label>
|
||||
<input type="number" min="0" id="max_identical_jokertipps" name="max_identical_jokertipps" value="<?php echo htmlspecialchars($formValues['max_identical_jokertipps']); ?>" required>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$q = $formValues['quotas'];
|
||||
$quotaInput = function ($name, $label, $unit, $amount = null) use ($q) {
|
||||
echo '<div class="form-group">';
|
||||
echo '<label for="quota_' . $name . '">' . htmlspecialchars($label) . ':</label>';
|
||||
echo '<input type="number" step="0.01" min="0" id="quota_' . $name . '" name="quotas[' . $name . ']" value="'
|
||||
. htmlspecialchars((string)($q[$name] ?? '')) . '" style="width: 100px;" required> ' . $unit;
|
||||
if ($amount !== null) {
|
||||
echo ' = ' . number_format($amount, 2, ',', '.') . ' €';
|
||||
}
|
||||
echo '</div>';
|
||||
};
|
||||
?>
|
||||
|
||||
<h2>Spiel-Einsatz</h2>
|
||||
<?php $quotaInput('einsatz', 'Einsatz pro Spieler', '€'); ?>
|
||||
<?php if ($payouts !== null): ?>
|
||||
<p class="hint"><?php echo $paidUserCount; ?> bezahlte Spieler, <?php echo $roundCount; ?> Runden.
|
||||
Beträge berechnet aus den gespeicherten Quoten.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>Spielquoten</h2>
|
||||
<?php
|
||||
$placementSum = 0;
|
||||
if ($payouts !== null) {
|
||||
for ($place = 1; $place <= \App\Models\Quota::PLACES; $place++) {
|
||||
$placementSum += $payouts['platz' . $place];
|
||||
}
|
||||
}
|
||||
$quotaInput('tagessieg', 'Tagessieg', '%', $payouts !== null ? $payouts['tagessieg'] : null);
|
||||
if ($payouts !== null) {
|
||||
echo '<p class="hint">je Runde</p>';
|
||||
}
|
||||
$quotaInput('platzierung', 'Platzierung', '%', $payouts !== null ? $placementSum : null);
|
||||
?>
|
||||
|
||||
<h2>Platzierungsquoten</h2>
|
||||
<?php for ($place = 1; $place <= \App\Models\Quota::PLACES; $place++) {
|
||||
$quotaInput('platz' . $place, 'Platz ' . $place, '%', $payouts !== null ? $payouts['platz' . $place] : null);
|
||||
} ?>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit"><?php echo $editSeason ? 'Speichern' : 'Anlegen'; ?></button>
|
||||
<?php if ($editSeason): ?>
|
||||
<a href="/index.php?page=admin_seasons">Abbrechen</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Season List -->
|
||||
<h2>Saison-Liste</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Runden</th>
|
||||
<th>Aktiv</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($seasons as $season): ?>
|
||||
<tr <?php if ((int)$currentSeason['id'] === (int)$season['id']) echo 'style="font-weight: bold;"'; ?>>
|
||||
<td><?php echo htmlspecialchars($season['name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($season['rounds']); ?></td>
|
||||
<td><?php echo (int)$currentSeason['id'] === (int)$season['id'] ? 'Ja' : 'Nein'; ?></td>
|
||||
<td>
|
||||
<a href="/index.php?page=admin_seasons&edit_id=<?php echo $season['id']; ?>">Bearbeiten</a>
|
||||
<?php if ((int)$currentSeason['id'] !== (int)$season['id']): ?>
|
||||
<form action="/index.php?page=admin_seasons" method="post" style="display: inline;">
|
||||
<input type="hidden" name="action" value="set_current">
|
||||
<input type="hidden" name="id" value="<?php echo $season['id']; ?>">
|
||||
<button type="submit" class="link-button">Als aktiv setzen</button>
|
||||
</form>
|
||||
<form action="/index.php?page=admin_seasons" method="post" style="display: inline;" onsubmit="return confirm(<?php echo htmlspecialchars(json_encode('Saison "' . $season['name'] . '" mit allen Runden, Spielen, Tipps, Zahlungen und Quoten endgültig löschen?'), ENT_QUOTES); ?>);">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?php echo $season['id']; ?>">
|
||||
<button type="submit" class="link-button">Löschen</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style>
|
||||
/* From users.php, for consistency */
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.form-group label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
text-align: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.hint {
|
||||
margin-left: calc(150px + 10px);
|
||||
color: #666;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.form-group button, .form-group a {
|
||||
margin-left: calc(150px + 10px);
|
||||
}
|
||||
.link-button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--link);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
font-size: inherit;
|
||||
text-decoration: underline;
|
||||
font-family: inherit;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
131
tippspiel/src/Views/admin/users.php
Normal file
131
tippspiel/src/Views/admin/users.php
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
$pageTitle = 'Benutzer verwalten';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Benutzer verwalten</h1>
|
||||
|
||||
<?php if (!empty($message)): ?>
|
||||
<p style="color: green;"><?php echo htmlspecialchars($message); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($error)): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Form for creating/editing a user -->
|
||||
<h2><?php echo $editUser ? 'Benutzer bearbeiten' : 'Neuen Benutzer anlegen'; ?></h2>
|
||||
<form action="/index.php?page=admin_users" method="post">
|
||||
<?php if ($editUser): ?>
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="id" value="<?php echo htmlspecialchars($editUser['id']); ?>">
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="action" value="create">
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="firstname">Vorname:</label>
|
||||
<input type="text" id="firstname" name="firstname" value="<?php echo htmlspecialchars($editUser['firstname'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastname">Nachname:</label>
|
||||
<input type="text" id="lastname" name="lastname" value="<?php echo htmlspecialchars($editUser['lastname'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">E-Mail:</label>
|
||||
<input type="email" id="email" name="email" value="<?php echo htmlspecialchars($editUser['email'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" id="password" name="password" placeholder="<?php echo $editUser ? 'Leer lassen, um nicht zu ändern' : ''; ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="admin">Admin:</label>
|
||||
<input type="checkbox" id="admin" name="admin" value="1" <?php echo !empty($editUser['admin']) ? 'checked' : ''; ?>>
|
||||
</div>
|
||||
|
||||
<?php if ($editUser && !empty($currentSeason)): ?>
|
||||
<div class="form-group">
|
||||
<label for="has_paid">Bezahlt (<?php echo htmlspecialchars($currentSeason['name']); ?>):</label>
|
||||
<input type="checkbox" id="has_paid" name="has_paid" value="1" <?php echo isset($payments[$editUser['id']]) ? 'checked' : ''; ?>>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit"><?php echo $editUser ? 'Speichern' : 'Anlegen'; ?></button>
|
||||
<?php if ($editUser): ?>
|
||||
<a href="/index.php?page=admin_users">Abbrechen</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- User List -->
|
||||
<h2>Benutzerliste</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>E-Mail</th>
|
||||
<th>Admin</th>
|
||||
<?php if (!empty($currentSeason)): ?>
|
||||
<th>Bezahlt (<?php echo htmlspecialchars($currentSeason['name']); ?>)</th>
|
||||
<?php endif; ?>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($user['name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($user['email']); ?></td>
|
||||
<td><?php echo $user['admin'] ? 'Ja' : 'Nein'; ?></td>
|
||||
<?php if (!empty($currentSeason)): ?>
|
||||
<td>
|
||||
<?php if (isset($payments[$user['id']])): ?>
|
||||
Ja (<?php echo date('d.m.Y', strtotime($payments[$user['id']])); ?>)
|
||||
<?php else: ?>
|
||||
Nein
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td>
|
||||
<a href="/index.php?page=admin_users&edit_id=<?php echo $user['id']; ?>">Bearbeiten</a>
|
||||
<form action="/index.php?page=admin_users" method="post" style="display: inline;" onsubmit="return confirm('Sicher, dass du diesen Benutzer löschen willst?');">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="id" value="<?php echo $user['id']; ?>">
|
||||
<button type="submit" class="link-button">Löschen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style>
|
||||
/* From login.php, for consistency */
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.form-group label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
text-align: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.form-group button, .form-group a {
|
||||
margin-left: calc(150px + 10px);
|
||||
}
|
||||
.link-button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--link);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
font-size: inherit;
|
||||
text-decoration: underline;
|
||||
font-family: inherit;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
27
tippspiel/src/Views/home.php
Normal file
27
tippspiel/src/Views/home.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
use App\Models\Round;
|
||||
|
||||
$pageTitle = 'Tippspiel 2027 - Startseite';
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Willkommen bei Tippspiel 2027</h1>
|
||||
|
||||
<h2>Rundenübersicht</h2>
|
||||
<?php if ($currentSeason): ?>
|
||||
<p>Saison: <strong><?php echo htmlspecialchars($currentSeason['name']); ?></strong></p>
|
||||
<?php if ($rounds): ?>
|
||||
<?php foreach ($rounds as $round): ?>
|
||||
<h3><a href="/index.php?page=round&id=<?php echo htmlspecialchars($round['id']); ?>"><?php echo htmlspecialchars($round['name']); ?></a></h3>
|
||||
<?php if (!empty($round['report'])): ?>
|
||||
<p><?php echo nl2br(htmlspecialchars(Round::reportToText($round['report']))); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<p>Noch keine abgeschlossenen Runden in der aktuellen Saison.</p>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<p>Keine Saison gefunden.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
171
tippspiel/src/Views/info/guide.php
Normal file
171
tippspiel/src/Views/info/guide.php
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
<?php
|
||||
use App\Models\Quota;
|
||||
use App\Models\Ranking;
|
||||
use App\Models\Tipp;
|
||||
|
||||
$pageTitle = 'Anleitung';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
|
||||
$euro = fn($amount) => number_format($amount, 0, ',', '.') . ' €';
|
||||
|
||||
// Beispielwerte direkt aus der Punkteberechnung, damit die Anleitung immer zum Code passt
|
||||
$exactExamples = ['1:0', '2:1', '2:2', '3:1', '3:2', '4:2', '5:3'];
|
||||
?>
|
||||
|
||||
<div class="guide">
|
||||
|
||||
<h1>Anleitung</h1>
|
||||
<p class="lead">Die wichtigsten Regeln auf einen Blick: wie du tippst, wie Punkte entstehen und wie Rangliste und Gewinne berechnet werden.</p>
|
||||
|
||||
<nav class="guide-toc">
|
||||
<a href="#tippen">Tippen</a>
|
||||
<a href="#joker">Joker</a>
|
||||
<a href="#punkte">Punkte</a>
|
||||
<a href="#rangliste">Rangliste</a>
|
||||
<a href="#tagessieg">Tagessieg</a>
|
||||
<a href="#gewinne">Gewinne</a>
|
||||
<a href="#app">Als App installieren</a>
|
||||
</nav>
|
||||
|
||||
<h2 id="tippen">1. Tippen</h2>
|
||||
<ul>
|
||||
<li>Mitspielen und in der Rangliste erscheinen kannst du, sobald dein <strong>Einsatz für die Saison</strong> als bezahlt eingetragen ist.</li>
|
||||
<li>Eine Saison besteht aus Runden mit mehreren Spielen. Unter <a href="/index.php?page=tipps">Tipps</a> tippst du für jedes Spiel ein Ergebnis, entweder die ganze Runde auf einmal („Runde Tippen“) oder jedes Spiel einzeln.</li>
|
||||
<li>Deine Tipps kannst du beliebig oft ändern, bis die Runde <strong>gesperrt</strong> wird: <strong>1 Minute vor dem Anpfiff des ersten Spiels der Runde</strong>. Ab dann ist die ganze Runde gesperrt, auch für die späteren Spiele. Den Sperrzeitpunkt siehst du bei jeder Runde.</li>
|
||||
<li>Ein fehlender Tipp bringt 0 Punkte.</li>
|
||||
<li>Fehlen dir rund 48 Stunden vor der Sperre noch Tipps oder der Joker, bekommst du eine Erinnerungsmail. Das kannst du unter <em>Einstellungen</em> abschalten.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="joker">2. Joker</h2>
|
||||
<ul>
|
||||
<li>Pro Runde setzt du <strong>genau einen Joker</strong> auf eines der Spiele. Er <strong>verdoppelt die Punkte</strong> dieses Spiels.</li>
|
||||
<li>Du kannst den Joker bis zur Sperre beliebig auf ein anderes Spiel der Runde verschieben.</li>
|
||||
<li>Dasselbe Ergebnis darfst du pro Saison höchstens <strong><?php echo $maxIdenticalJokertipps; ?>-mal</strong> mit Joker tippen. Wie oft du welches Ergebnis schon „gejokert“ hast, steht bei jeder Runde unter „Bereits verwendete Joker“.</li>
|
||||
<li>Ein exakt getroffener Joker entscheidet außerdem beim <a href="#tagessieg">Tagessieg</a> mit.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="punkte">3. Punkte</h2>
|
||||
<table class="guide-table">
|
||||
<thead><tr><th>Treffer</th><th>Punkte</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Falsche Tendenz</td><td>0</td></tr>
|
||||
<tr><td><strong>Richtige Tendenz</strong> (Sieg Heim / Unentschieden / Sieg Gast richtig, Ergebnis falsch)</td><td>1</td></tr>
|
||||
<tr><td><strong>Exaktes Ergebnis</strong></td><td>2 + Torbonus</td></tr>
|
||||
<tr><td>Mit <strong>Joker</strong></td><td>Punkte des Spiels × 2</td></tr>
|
||||
<tr><td><strong>Rundenbonus</strong>: Jedes Spiel der Runde bringt dir mindestens einen Punkt</td><td>+ <?php echo Tipp::ALL_HITS_BONUS; ?> (wird nicht verdoppelt)</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><strong>Torbonus:</strong> Bei einem exakten Treffer gibt es für jedes Tor über drei Tore hinaus einen Extrapunkt.
|
||||
Torreiche Ergebnisse exakt zu treffen lohnt sich also mehr:</p>
|
||||
<table class="guide-table compact">
|
||||
<thead>
|
||||
<tr><th>Exakt getroffen</th><?php foreach ($exactExamples as $ex): ?><th><?php echo $ex; ?></th><?php endforeach; ?></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Punkte</td>
|
||||
<?php foreach ($exactExamples as $ex): [$a, $b] = array_map('intval', explode(':', $ex)); ?>
|
||||
<td><?php echo Tipp::getScoreLocal($a, $b, $a, $b, false); ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<tr><td>mit Joker</td>
|
||||
<?php foreach ($exactExamples as $ex): [$a, $b] = array_map('intval', explode(':', $ex)); ?>
|
||||
<td><?php echo Tipp::getScoreLocal($a, $b, $a, $b, true); ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="example">
|
||||
<strong>Beispiel einer Runde:</strong>
|
||||
<table class="guide-table compact">
|
||||
<thead><tr><th>Ergebnis</th><th>Dein Tipp</th><th>Wertung</th><th>Punkte</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>2:1</td><td>1:0</td><td>Tendenz richtig</td><td><?php echo Tipp::getScoreLocal(2, 1, 1, 0, false); ?></td></tr>
|
||||
<tr><td>1:1</td><td>1:1</td><td>exakt</td><td><?php echo Tipp::getScoreLocal(1, 1, 1, 1, false); ?></td></tr>
|
||||
<tr><td>3:2</td><td>3:2 mit Joker</td><td>exakt: 2 + 2 Torbonus, verdoppelt</td><td><?php echo Tipp::getScoreLocal(3, 2, 3, 2, true); ?></td></tr>
|
||||
<tr><td>0:2</td><td>1:3</td><td>Tendenz richtig</td><td><?php echo Tipp::getScoreLocal(0, 2, 1, 3, false); ?></td></tr>
|
||||
<tr><td colspan="3">Alle Spiele haben gepunktet: Rundenbonus</td><td>+<?php echo Tipp::ALL_HITS_BONUS; ?></td></tr>
|
||||
<tr class="total"><td colspan="3">Rundenpunkte</td>
|
||||
<td><?php echo Tipp::getScoreLocal(2, 1, 1, 0, false) + Tipp::getScoreLocal(1, 1, 1, 1, false)
|
||||
+ Tipp::getScoreLocal(3, 2, 3, 2, true) + Tipp::getScoreLocal(0, 2, 1, 3, false) + Tipp::ALL_HITS_BONUS; ?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Hätte beim letzten Spiel der Tipp 2:0 gelautet (falsche Tendenz), gäbe es dafür 0 Punkte und keinen Rundenbonus.</p>
|
||||
</div>
|
||||
|
||||
<h2 id="rangliste">4. Rangliste</h2>
|
||||
<ul>
|
||||
<li>Die <a href="/index.php?page=ranking">Rangliste</a> zeigt den Stand nach einer Runde. Oben kannst du jede Runde auswählen, die schon begonnen hat. Die Tipps der anderen siehst du also erst, wenn die Runde gesperrt ist.</li>
|
||||
<li><strong>Platz</strong>: Sortiert wird nach <strong>Punkte (Gesamt)</strong>, der Summe aller Rundenpunkte bis einschließlich der gewählten Runde.</li>
|
||||
<li><strong>Gleichstand</strong>: Spieler mit gleicher Gesamtpunktzahl teilen sich den Platz. Der nächste Platz wird übersprungen (z.B. 1., 1., 3.). Innerhalb eines geteilten Platzes wird alphabetisch sortiert.</li>
|
||||
<li><strong>Punkte (Runde)</strong>: Punkte der gewählten Runde inklusive Rundenbonus.</li>
|
||||
<li>Pro Spiel siehst du die Punkte jedes Spielers. Beim Überfahren mit der Maus erscheint der getippte Tipp. Die Farbe zeigt den Treffer:
|
||||
<span class="swatch" style="background: var(--col-tendenz);"></span> richtige Tendenz,
|
||||
<span class="swatch" style="background: var(--col-exact);"></span> exaktes Ergebnis,
|
||||
<span class="swatch" style="background: var(--col-joker-exact);"></span> exaktes Ergebnis mit Joker.
|
||||
Das Joker-Symbol markiert, wo der Joker gesetzt war.</li>
|
||||
<li>🏆 markiert die Tagessieger der Runde.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="tagessieg">5. Tagessieg</h2>
|
||||
<ul>
|
||||
<li>Ist eine Runde komplett ausgespielt, wird der Tagessieg vergeben<?php if ($payouts): ?>, derzeit <strong><?php echo $euro($payouts['tagessieg']); ?></strong> pro Runde<?php endif; ?>.</li>
|
||||
<li>Tagessieger ist, wer in der Runde die <strong>meisten exakten Ergebnisse</strong> getroffen hat. Die Rundenpunkte spielen dabei zunächst keine Rolle.</li>
|
||||
<li>Bei Gleichstand entscheidet der <strong>Joker</strong>: Wer seinen Joker exakt getroffen hat, liegt vorn. Haben das mehrere, gewinnt der Joker-Treffer mit dem höheren Torbonus (z.B. schlägt ein 3:2-Joker einen 2:1-Joker; 1:0 und 2:1 zählen gleich).</li>
|
||||
<li>Bleibt es gleich, teilen sich alle Gleichplatzierten den Betrag.</li>
|
||||
<li>Wären es mehr als <?php echo Ranking::MAX_DAY_WINNERS; ?> Tagessieger, gewinnen nur die mit den meisten Rundenpunkten.</li>
|
||||
<li>Hat niemand ein exaktes Ergebnis getroffen, gibt es keinen Tagessieger. Der Betrag <strong>wandert in die nächste Runde</strong>, in der es einen Tagessieger gibt.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="gewinne">6. Gewinne</h2>
|
||||
<ul>
|
||||
<li>Alle Einsätze bilden den Pott. Ein Teil geht an die Tagessiege, der Rest an die Plätze 1 bis <?php echo Quota::PLACES; ?> der Endabrechnung.
|
||||
Die aktuellen Beträge stehen unter <a href="/index.php?page=info_quotas">Quoten</a>.</li>
|
||||
<li>Das <strong>Platzierungsgeld</strong> wird erst nach der letzten Runde der Saison vergeben, maßgeblich ist die Rangliste nach dieser Runde.</li>
|
||||
<li>Teilen sich mehrere Spieler einen Platz, teilen sie sich das Geld aller Plätze, die sie gemeinsam belegen.
|
||||
Beispiel: Zwei Spieler auf Platz 1 teilen sich das Geld für Platz 1 und Platz 2.</li>
|
||||
<li>Was du bisher gewonnen hast, zeigt die <a href="/index.php?page=money_ranking">Geldrangliste</a>. Damit dein Gewinn überwiesen werden kann, trage deine Bankverbindung unter <em>Einstellungen</em> ein.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="app">7. Als App installieren</h2>
|
||||
<p>Das Tippspiel kannst du dir wie eine App auf den Startbildschirm deines Smartphones legen. Sie öffnet sich dann im Vollbild mit eigenem Symbol – ohne Adressleiste des Browsers. Der eigentliche Inhalt ist identisch mit der Webseite, und es funktioniert weiterhin nur mit Internetverbindung.</p>
|
||||
|
||||
<h3>Android (Chrome)</h3>
|
||||
<ol>
|
||||
<li>Öffne das Tippspiel in <strong>Chrome</strong>.</li>
|
||||
<li>Tippe auf das Menü <strong>⋮</strong> (drei Punkte) oben rechts.</li>
|
||||
<li>Wähle <strong>„App installieren“</strong> (oder „Zum Startbildschirm hinzufügen“).</li>
|
||||
<li>Bestätige mit <strong>„Installieren“</strong>.</li>
|
||||
<li>Die App erscheint auf dem Startbildschirm und in der App-Übersicht.</li>
|
||||
</ol>
|
||||
|
||||
<h3>iPhone (Safari)</h3>
|
||||
<ol>
|
||||
<li>Öffne das Tippspiel in <strong>Safari</strong>.</li>
|
||||
<li>Tippe unten in der Mitte auf das <strong>Teilen-Symbol</strong> <span style="font-size:1.2em;">⏏</span> (Quadrat mit Pfeil nach oben).</li>
|
||||
<li>Scrolle und wähle <strong>„Zum Home-Bildschirm“</strong>.</li>
|
||||
<li>Bestätige mit <strong>„Hinzufügen“</strong> (oben rechts).</li>
|
||||
<li>Die App erscheint auf dem Home-Bildschirm.</li>
|
||||
</ol>
|
||||
|
||||
<p class="hint">Tipp: Beim ersten Öffnen musst du dich einmal anmelden. Danach bleibst du – wie im Browser – angemeldet.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.guide { max-width: 900px; line-height: 1.5; }
|
||||
.guide .lead { color: #555; }
|
||||
.guide h2 { margin-top: 1.8em; border-bottom: 1px solid #ddd; padding-bottom: 0.2em; scroll-margin-top: 1em; }
|
||||
.guide-toc { background: none; padding: 0; margin: 0 0 1em; }
|
||||
.guide-toc a { margin-right: 1em; font-weight: normal; color: var(--link); }
|
||||
.guide-table { width: auto; margin: 0.8em 0; }
|
||||
.guide-table td:last-child, .guide-table th:last-child { text-align: center; }
|
||||
.guide-table.compact td, .guide-table.compact th { padding: 4px 10px; text-align: center; }
|
||||
.guide-table.compact td:first-child, .guide-table.compact th:first-child { text-align: left; }
|
||||
.guide-table tr.total td { font-weight: bold; border-top: 2px solid #999; }
|
||||
.guide .example { background: #f9f9f9; border: 1px solid #ddd; padding: 0.8em 1em; margin: 1em 0; }
|
||||
.guide .swatch { display: inline-block; width: 0.9em; height: 0.9em; vertical-align: middle; border: 1px solid #999; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
44
tippspiel/src/Views/info/money_ranking.php
Normal file
44
tippspiel/src/Views/info/money_ranking.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
$pageTitle = 'Geldrangliste';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
|
||||
$myId = (int)$user['id'];
|
||||
?>
|
||||
|
||||
<h1>Geldrangliste</h1>
|
||||
|
||||
<table class="money-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Ausschüttung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($moneyRanking as $entry):
|
||||
$isMe = (int)$entry['user_id'] === $myId;
|
||||
?>
|
||||
<tr id="playerid_<?php echo (int)$entry['user_id']; ?>" <?php if ($isMe) echo 'class="me"'; ?>>
|
||||
<td><a href="/index.php?page=money_ranking&user_id=<?php echo (int)$entry['user_id']; ?>"><?php echo htmlspecialchars($entry['name']); ?></a></td>
|
||||
<td class="amount"><?php echo number_format($entry['amount'], 2, ',', '.'); ?> €</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
// Wie im Legacy (Link auf #playerid_<eigene ID>): ohne Anker zur eigenen Zeile springen
|
||||
if (!location.hash) {
|
||||
const me = document.getElementById('playerid_<?php echo $myId; ?>');
|
||||
if (me) me.scrollIntoView({block: 'center'});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.money-table { width: auto; min-width: 400px; }
|
||||
.money-table td.amount { text-align: right; }
|
||||
.money-table tr.me td { background: #fff3cd; font-weight: bold; }
|
||||
.money-table tr:target td { background: #fff3cd; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
41
tippspiel/src/Views/info/money_ranking_detail.php
Normal file
41
tippspiel/src/Views/info/money_ranking_detail.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
$pageTitle = 'Ausschüttungsübersicht';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Ausschüttungsübersicht <?php echo htmlspecialchars($detailUser['name']); ?></h1>
|
||||
|
||||
<table class="money-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Quoten-Titel</th>
|
||||
<th>Ausschüttung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($payoutItems as $item): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($item['label']); ?></td>
|
||||
<td class="amount"><?php echo number_format($item['amount'], 2, ',', '.'); ?> €</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($payoutItems)): ?>
|
||||
<tr><td colspan="2">Bisher keine Ausschüttungen.</td></tr>
|
||||
<?php else: ?>
|
||||
<tr class="total">
|
||||
<td>Summe</td>
|
||||
<td class="amount"><?php echo number_format(array_sum(array_column($payoutItems, 'amount')), 2, ',', '.'); ?> €</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><a href="/index.php?page=money_ranking#playerid_<?php echo (int)$detailUser['id']; ?>">Zurück</a></p>
|
||||
|
||||
<style>
|
||||
.money-table { width: auto; min-width: 400px; }
|
||||
.money-table td.amount { text-align: right; }
|
||||
.money-table tr.total td { font-weight: bold; border-top: 2px solid #999; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
14
tippspiel/src/Views/info/no_ranking.php
Normal file
14
tippspiel/src/Views/info/no_ranking.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
$pageTitle = 'Geldrangliste';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<p style="color: red;">
|
||||
Es gibt noch keine Tipprunde, die reif für die Anzeige ist.
|
||||
<?php if ($seasonStart): ?>
|
||||
Rangliste / Tippvergleich verfügbar ab <?php echo $seasonStart->format('d.m.Y H:i'); ?>.
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
<p><a href="/">Ok</a></p>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
48
tippspiel/src/Views/info/quotas.php
Normal file
48
tippspiel/src/Views/info/quotas.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
use App\Models\Quota;
|
||||
|
||||
$pageTitle = 'Quoten';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
|
||||
$euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
||||
?>
|
||||
|
||||
<?php if (!$currentSeason): ?>
|
||||
<p>Es gibt noch keine Saison.</p>
|
||||
<?php else: ?>
|
||||
<h1><?php echo htmlspecialchars($currentSeason['name']); ?></h1>
|
||||
<h2>Ausschüttungs-Quoten</h2>
|
||||
|
||||
<div class="quota-section">
|
||||
<h3>Spiel-Einsatz</h3>
|
||||
<table class="info-table">
|
||||
<tr><th>Aktive Spieler</th><td><?php echo $activeUserCount; ?></td></tr>
|
||||
<tr><th>Einsatz pro Spieler</th><td><?php echo $euro($stake); ?></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="quota-section">
|
||||
<h3>Spielquoten</h3>
|
||||
<table class="info-table">
|
||||
<tr><th>Tagessieg</th><td><?php echo $euro($payouts['tagessieg']); ?></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="quota-section">
|
||||
<h3>Platzierungsquoten</h3>
|
||||
<table class="info-table">
|
||||
<?php for ($place = 1; $place <= Quota::PLACES; $place++): ?>
|
||||
<tr><th>Platz <?php echo $place; ?></th><td><?php echo $euro($payouts['platz' . $place]); ?></td></tr>
|
||||
<?php endfor; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.quota-section { text-align: center; }
|
||||
.info-table { width: auto; min-width: 350px; margin-left: auto; margin-right: auto; }
|
||||
.info-table th { width: 200px; font-weight: normal; }
|
||||
.info-table td { text-align: right; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
55
tippspiel/src/Views/login.php
Normal file
55
tippspiel/src/Views/login.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
$pageTitle = 'Login';
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Login</h1>
|
||||
|
||||
<?php if (isset($error)): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.form-group label {
|
||||
display: inline-block;
|
||||
width: 150px;
|
||||
text-align: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.form-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
@media (min-width: 701px) {
|
||||
.form-actions {
|
||||
margin-left: calc(150px + 10px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<form action="/index.php?page=login" method="post">
|
||||
<div class="form-group">
|
||||
<label for="firstname">Vorname:</label>
|
||||
<input type="text" id="firstname" name="firstname" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastname">Nachname:</label>
|
||||
<input type="text" id="lastname" name="lastname" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" id="password" name="password" required>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit">Anmelden</button>
|
||||
<?php if (App\Models\Setting::isRegistrationOpen()): ?>
|
||||
<button type="button" onclick="location.href='/index.php?page=register'">Registrieren</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
11
tippspiel/src/Views/partials/footer.php
Normal file
11
tippspiel/src/Views/partials/footer.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
</main>
|
||||
<footer class="site-footer">⚽ Tippspiel 2027</footer>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('/sw.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
65
tippspiel/src/Views/partials/header.php
Normal file
65
tippspiel/src/Views/partials/header.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php $pageTitle = $pageTitle ?? 'Tippspiel 2027'; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php echo htmlspecialchars($pageTitle); ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="theme-color" content="#14632f">
|
||||
<meta name="description" content="Hoschis Tippspiel 2027 – Tippgemeinschaft unter Freunden.">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link rel="icon" href="/img/icon-192.png">
|
||||
<link rel="apple-touch-icon" href="/img/icon-180.png">
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" integrity="sha512-SnH5WK+bZxgPHs44uWIX+LLJAJ9/2PkPKZ5QiAj6Ta86w+fsb2TkcmfRyVX3pBnMFcV7oQPJkl9QevSCWr3W6A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="site-nav">
|
||||
<a href="/" class="brand"><span class="brand-ball">⚽</span> Tippspiel <span class="brand-year">2027</span></a>
|
||||
<a href="/">Start</a>
|
||||
<?php if (App\Core\Auth::isAdmin()): $registrationOpen = App\Models\Setting::isRegistrationOpen(); ?>
|
||||
<span class="nav-dropdown">
|
||||
<a href="#" onclick="return false;">Administration</a>
|
||||
<span class="nav-dropdown-content">
|
||||
<a href="/index.php?page=admin_users">Benutzer verwalten</a>
|
||||
<a href="/index.php?page=admin_seasons">Saisons verwalten</a>
|
||||
<a href="/index.php?page=admin_rounds">Spiele & Ergebnisse eintragen</a>
|
||||
<a href="/index.php?page=admin_roundmails">Runden-E-Mails versenden</a>
|
||||
<a href="/index.php?page=admin_accounts">Kontoliste</a>
|
||||
<form method="post" action="/index.php?page=admin" class="nav-dropdown-form">
|
||||
<input type="hidden" name="action" value="set_registration">
|
||||
<input type="hidden" name="registration_open" value="<?php echo $registrationOpen ? '0' : '1'; ?>">
|
||||
<input type="hidden" name="return" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'] ?? '/'); ?>">
|
||||
<button type="submit" title="Registrierung ist derzeit <?php echo $registrationOpen ? 'offen' : 'geschlossen'; ?>">
|
||||
Registrierung <?php echo $registrationOpen ? 'schließen' : 'öffnen'; ?>
|
||||
<small>(derzeit <?php echo $registrationOpen ? 'offen' : 'geschlossen'; ?>)</small>
|
||||
</button>
|
||||
</form>
|
||||
</span>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<a href="/index.php?page=tipps">Tipps</a>
|
||||
<a href="/index.php?page=ranking">Rangliste</a>
|
||||
<span class="nav-dropdown">
|
||||
<a href="#" onclick="return false;">Info</a>
|
||||
<span class="nav-dropdown-content">
|
||||
<a href="/index.php?page=guide">Anleitung</a>
|
||||
<a href="/index.php?page=info_quotas">Quoten</a>
|
||||
<a href="/index.php?page=money_ranking">Geldrangliste</a>
|
||||
</span>
|
||||
</span>
|
||||
<span class="nav-user">
|
||||
<?php if (App\Core\Auth::check()): ?>
|
||||
<span class="nav-dropdown">
|
||||
<a href="#" onclick="return false;">( <?php echo htmlspecialchars(App\Core\Auth::user()['name']); ?> )</a>
|
||||
<span class="nav-dropdown-content">
|
||||
<a href="/index.php?page=settings">Einstellungen</a>
|
||||
<a href="/index.php?page=logout">Abmelden</a>
|
||||
</span>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<a href="/index.php?page=login">Login</a>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</nav>
|
||||
<main class="page">
|
||||
188
tippspiel/src/Views/ranking.php
Normal file
188
tippspiel/src/Views/ranking.php
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
<?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) || !isset($allRounds) || !isset($selectedRound)) {
|
||||
echo "Fehler: Daten für die Rangliste nicht gefunden.";
|
||||
// exit; // Besser, eine freundliche Nachricht im Layout anzuzeigen
|
||||
}
|
||||
?>
|
||||
|
||||
<style>
|
||||
.game-header {
|
||||
width: 100px; /* Feste Breite für die Spiele-Spalten */
|
||||
}
|
||||
.tipp-points {
|
||||
width: 55px; /* Breite für den Tipp (z.B. 2:1) */
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
}
|
||||
.tipp-joker {
|
||||
width: 70px; /* Breite für vergrößerten Joker */
|
||||
box-sizing: border-box;
|
||||
padding-left: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
.joker-icon {
|
||||
width: 2rem; /* Größe weiter auf 75% reduziert */
|
||||
height: 2rem; /* Größe weiter auf 75% reduziert */
|
||||
vertical-align: middle;
|
||||
}
|
||||
.daily-winner-icon {
|
||||
font-size: 2rem; /* Größe verdoppeln */
|
||||
vertical-align: middle;
|
||||
}
|
||||
#round_id {
|
||||
font-size: inherit; /* Schriftgröße an die Umgebung anpassen */
|
||||
}
|
||||
table th, table td {
|
||||
padding-top: 0.1rem;
|
||||
padding-bottom: 0.1rem;
|
||||
}
|
||||
|
||||
/* Kompakter Kopfbereich: Titel, Saison und Rundenwahl auf einer Zeile */
|
||||
.ranking-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 0.3em 0.9em;
|
||||
margin-bottom: 0.8em;
|
||||
}
|
||||
.ranking-toolbar h1 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
.ranking-toolbar .season {
|
||||
font-family: var(--font-display);
|
||||
font-weight: 700;
|
||||
color: var(--pitch-dark);
|
||||
}
|
||||
.ranking-toolbar .round-filter {
|
||||
margin: 0 0 0 auto;
|
||||
}
|
||||
.ranking-toolbar .round-filter label {
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
/* Legende als kompakte Fußzeile unter der Tabelle */
|
||||
.legend.legend-footer {
|
||||
margin: 10px 0 0;
|
||||
padding: 6px 10px;
|
||||
font-size: 0.8em;
|
||||
gap: 6px 12px;
|
||||
justify-content: center;
|
||||
}
|
||||
.legend.legend-footer .legend-color { width: 12px; height: 12px; }
|
||||
.legend.legend-footer .joker-icon { width: 1.1em; height: 1.1em; }
|
||||
.legend.legend-footer .daily-winner-icon { font-size: 1em; }
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.ranking-toolbar h1 { font-size: 1.1em; }
|
||||
.ranking-toolbar .round-filter { margin-left: 0; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="ranking-toolbar">
|
||||
<h1>Rangliste</h1>
|
||||
<span class="season"><?php echo htmlspecialchars($currentSeason['name']); ?></span>
|
||||
<?php if ($selectedRound): ?>
|
||||
<form method="get" class="round-filter">
|
||||
<input type="hidden" name="page" value="ranking">
|
||||
<label for="round_id">Runde:</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>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($selectedRound): ?>
|
||||
<div class="table-container sticky-header">
|
||||
<?php if (!empty($ranking)): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Platz</th>
|
||||
<th>Name</th>
|
||||
<th class="text-center"><span class="daily-winner-icon">🏆</span></th>
|
||||
<th class="text-center">Punkte (Gesamt)</th>
|
||||
<th class="text-center">Punkte (Runde)</th>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<th class="game-header" colspan="2">
|
||||
<?php echo htmlspecialchars($game['team1']); ?><br>
|
||||
<?php echo htmlspecialchars($game['team2']); ?><br>
|
||||
<small>(<?php echo htmlspecialchars(App\Models\Game::getResultString($game['score1'], $game['score2'], $game['kickoff'])); ?>)</small>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($ranking as $entry):
|
||||
$rowClasses = [];
|
||||
if ($entry['rank'] <= 3) $rowClasses[] = 'rank-' . $entry['rank'];
|
||||
if ((int)$entry['user_id'] === (int)App\Core\Auth::id()) $rowClasses[] = 'me';
|
||||
?>
|
||||
<tr<?php if ($rowClasses) echo ' class="' . implode(' ', $rowClasses) . '"'; ?>
|
||||
<?php if ((int)$entry['user_id'] === (int)App\Core\Auth::id()) echo ' id="me-row"'; ?>>
|
||||
<td class="text-center"><span class="rank-badge"><?php echo $entry['rank']; ?>.</span></td>
|
||||
<td><?php echo htmlspecialchars($entry['name']); ?></td>
|
||||
<td class="text-center"><?php echo $entry['is_day_winner'] ? '<span class="daily-winner-icon">🏆</span>' : ''; ?></td>
|
||||
<td class="text-center"><strong><?php echo $entry['total']; ?></strong></td>
|
||||
<td class="text-center"><?php echo $entry['points']; ?></td>
|
||||
<?php foreach ($games as $game): ?>
|
||||
<?php
|
||||
$tipp = $entry['cells'][$game['id']];
|
||||
// Farbklasse kommt fertig aus Tipp::getCol (col_tendenz / col_exact / col_joker_exact)
|
||||
$td_class = $tipp['color'];
|
||||
$title = "Punkte: " . $tipp['points'];
|
||||
?>
|
||||
<td class="tipp-cell tipp-points <?php echo htmlspecialchars($td_class); ?>" title="<?php echo $title; ?>">
|
||||
<?php echo htmlspecialchars($tipp['text']); ?>
|
||||
</td>
|
||||
<td class="tipp-cell tipp-joker" title="<?php echo $title; ?>">
|
||||
<?php if ($tipp['joker']): ?>
|
||||
<img src="/img/joker.png" alt="Joker" class="joker-icon" title="Joker">
|
||||
<?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>
|
||||
|
||||
<div class="legend legend-footer">
|
||||
<div class="legend-item"><span class="daily-winner-icon">🏆</span> Tagessieger</div>
|
||||
<div class="legend-item"><img src="/img/joker.png" alt="Joker" class="joker-icon"> Joker gesetzt</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: var(--col-tendenz);"></div> Richtige Tendenz</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: var(--col-exact);"></div> Richtiges Ergebnis</div>
|
||||
<div class="legend-item"><div class="legend-color" style="background-color: var(--col-joker-exact);"></div> Richtiges Ergebnis mit Joker</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p>Keine Runde für die Anzeige ausgewählt oder gefunden.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<script>
|
||||
// Springe beim Laden zur eigenen Zeile, falls der eingeloggte Spieler in der Tabelle ist
|
||||
window.addEventListener('load', function () {
|
||||
var me = document.getElementById('me-row');
|
||||
if (me) {
|
||||
me.scrollIntoView({ block: 'center' });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
58
tippspiel/src/Views/register.php
Normal file
58
tippspiel/src/Views/register.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
$pageTitle = 'Registrieren';
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Registrieren</h1>
|
||||
|
||||
<?php if (!empty($registrationClosed)): ?>
|
||||
<p>Die Registrierung neuer Spieler ist derzeit geschlossen. Bitte wende dich an einen Administrator.</p>
|
||||
<p><a href="/index.php?page=login">Zum Login</a></p>
|
||||
<?php require __DIR__ . '/partials/footer.php'; return; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($error)): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.form-group label {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
text-align: right;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.form-group button {
|
||||
margin-left: calc(200px + 10px);
|
||||
}
|
||||
</style>
|
||||
<form action="/index.php?page=register" method="post">
|
||||
<div class="form-group">
|
||||
<label for="firstname">Vorname:</label>
|
||||
<input type="text" id="firstname" name="firstname" value="<?php echo htmlspecialchars($_POST['firstname'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastname">Nachname:</label>
|
||||
<input type="text" id="lastname" name="lastname" value="<?php echo htmlspecialchars($_POST['lastname'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">E-Mail:</label>
|
||||
<input type="email" id="email" name="email" value="<?php echo htmlspecialchars($_POST['email'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" id="password" name="password" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password_confirm">Passwort bestätigen:</label>
|
||||
<input type="password" id="password_confirm" name="password_confirm" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit">Registrieren</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
88
tippspiel/src/Views/round.php
Normal file
88
tippspiel/src/Views/round.php
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
use App\Models\Game;
|
||||
use App\Models\Tipp;
|
||||
|
||||
// Stellt sicher, dass die benötigten Variablen vorhanden sind
|
||||
if (!isset($selectedRound) || !isset($roundsToShow) || !isset($users) || !isset($tipps_map)) {
|
||||
echo "Fehler: Daten für die Rundenansicht nicht gefunden.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$pageTitle = 'Tippübersicht - ' . htmlspecialchars($selectedRound['name']);
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Tippübersicht bis: <?php echo htmlspecialchars($selectedRound['name']); ?></h1>
|
||||
|
||||
<?php if (empty($users)): ?>
|
||||
<p>Keine teilnehmenden Spieler für diese Saison gefunden.</p>
|
||||
<?php else: ?>
|
||||
<?php foreach ($roundsToShow as $round): ?>
|
||||
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||||
<?php if (!empty($round['games'])): ?>
|
||||
<div class="table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Spieler</th>
|
||||
<?php foreach ($round['games'] as $game): ?>
|
||||
<th class="game-header">
|
||||
<?php echo htmlspecialchars($game['team1']); ?><br>
|
||||
<?php echo htmlspecialchars($game['team2']); ?><br>
|
||||
<small>(<?php echo Game::getResultString($game['score1'], $game['score2'], $game['kickoff']); ?>)</small>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($user['name']); ?></td>
|
||||
<?php foreach ($round['games'] as $game): ?>
|
||||
<?php
|
||||
$tipp = $tipps_map[$user['id']][$game['id']] ?? null;
|
||||
$color = '';
|
||||
$text = '-';
|
||||
$is_joker = false;
|
||||
|
||||
if ($tipp && $game['score1'] > -1) {
|
||||
$color = Tipp::getCol($game['score1'], $game['score2'], $tipp['tipp1'], $tipp['tipp2'], $tipp['joker']);
|
||||
}
|
||||
if ($tipp) {
|
||||
// Zeige Tipps nur für gesperrte Spiele
|
||||
if (Game::isLocked($game['kickoff'])) {
|
||||
$text = $tipp['tipp1'] . ':' . $tipp['tipp2'];
|
||||
} else {
|
||||
$text = 'verdeckt';
|
||||
}
|
||||
$is_joker = (bool)$tipp['joker'];
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
$td_class = $color;
|
||||
// Spezielle Farbe für exakten Tipp mit Joker
|
||||
if ($td_class === 'col_exact' && $is_joker) {
|
||||
$td_class = 'col_joker_exact';
|
||||
}
|
||||
?>
|
||||
<td class="tipp-cell <?php echo htmlspecialchars($td_class); ?>" title="Tipp: <?php echo htmlspecialchars($text); ?>">
|
||||
<?php echo htmlspecialchars($text); ?>
|
||||
<?php if ($is_joker && Game::isLocked($game['kickoff'])): ?>
|
||||
<img src="/img/joker.png" alt="Joker" class="joker-icon" title="Joker">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p>Für diese Runde wurden keine Spiele gefunden.</p>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><a href="/">Zurück zur Startseite</a></p>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
75
tippspiel/src/Views/settings.php
Normal file
75
tippspiel/src/Views/settings.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
$pageTitle = 'Einstellungen';
|
||||
require __DIR__ . '/partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Spielerdaten</h1>
|
||||
|
||||
<?php if ($message): ?>
|
||||
<p style="color: green;"><?php echo htmlspecialchars($message); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ($error): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="/index.php?page=settings" class="settings-form">
|
||||
<div class="form-group">
|
||||
<label for="name">Login:</label>
|
||||
<input type="text" id="name" value="<?php echo htmlspecialchars($user['name']); ?>" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="firstname">Vorname:</label>
|
||||
<input type="text" id="firstname" value="<?php echo htmlspecialchars($user['firstname']); ?>" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastname">Nachname:</label>
|
||||
<input type="text" id="lastname" value="<?php echo htmlspecialchars($user['lastname']); ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iban">IBAN:</label>
|
||||
<input type="text" id="iban" name="iban" maxlength="34" value="<?php echo htmlspecialchars((string)$user['iban']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bankname">Bankname:</label>
|
||||
<input type="text" id="bankname" name="bankname" value="<?php echo htmlspecialchars((string)$user['bankname']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="blz">BLZ:</label>
|
||||
<input type="text" id="blz" name="blz" value="<?php echo htmlspecialchars((string)$user['blz']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="kontonr">Kontonummer:</label>
|
||||
<input type="text" id="kontonr" name="kontonr" value="<?php echo htmlspecialchars((string)$user['kontonr']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobile">Handynummer:</label>
|
||||
<input type="text" id="mobile" name="mobile" value="<?php echo htmlspecialchars((string)$user['mobile']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email">Email:</label>
|
||||
<input type="email" id="email" name="email" class="wide" required value="<?php echo htmlspecialchars((string)$user['email']); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="gets_reminders">Erinnerungen:</label>
|
||||
<input type="checkbox" id="gets_reminders" name="gets_reminders" value="1" <?php if (!empty($user['gets_reminders'])) echo 'checked'; ?>>
|
||||
<label for="gets_reminders" class="inline">Ich möchte E-Mail-Erinnerungen erhalten</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button type="submit">Ok</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<style>
|
||||
.settings-form .form-group { margin-bottom: 0.8rem; }
|
||||
.settings-form .form-group > label:first-child { display: inline-block; width: 160px; }
|
||||
.settings-form label.inline { width: auto; }
|
||||
.settings-form input[readonly] { background: #f4f4f4; color: #666; border: 1px solid #ccc; }
|
||||
.settings-form input.wide { width: 25em; max-width: 100%; }
|
||||
.settings-form button { margin-left: 164px; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/partials/footer.php'; ?>
|
||||
40
tippspiel/src/Views/tipps/game.php
Normal file
40
tippspiel/src/Views/tipps/game.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
$pageTitle = 'Spieltipp';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<h1>Spieltipp:</h1>
|
||||
|
||||
<p><strong><?php echo htmlspecialchars($game['team1'] . ' : ' . $game['team2']); ?></strong></p>
|
||||
|
||||
<?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>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
84
tippspiel/src/Views/tipps/index.php
Normal file
84
tippspiel/src/Views/tipps/index.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?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; }
|
||||
.tipp-round td:not(:first-child) { white-space: nowrap; }
|
||||
.tipp-round table { max-width: 1050px; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
9
tippspiel/src/Views/tipps/no_payment.php
Normal file
9
tippspiel/src/Views/tipps/no_payment.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
$pageTitle = 'Tipps';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<p style="color: red;">Dein Zahlungseingang für die Saison wurde noch nicht registriert.</p>
|
||||
<p><a href="/">Ok</a></p>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
75
tippspiel/src/Views/tipps/round.php
Normal file
75
tippspiel/src/Views/tipps/round.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
$pageTitle = 'Runde tippen';
|
||||
require __DIR__ . '/../partials/header.php';
|
||||
?>
|
||||
|
||||
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($locked): ?>
|
||||
<p style="color: red;">Die Runde ist bereits gesperrt, Tipps können nicht mehr geä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_round&id=<?php echo (int)$round['id']; ?>" class="tipp-form">
|
||||
<table>
|
||||
<?php foreach ($games as $game):
|
||||
$gameId = (int)$game['id'];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($game['team1']); ?></td>
|
||||
<td>:</td>
|
||||
<td><?php echo htmlspecialchars($game['team2']); ?></td>
|
||||
<td class="score">
|
||||
<input type="number" min="0" max="99" name="scores[<?php echo $gameId; ?>][score1]" required
|
||||
value="<?php echo htmlspecialchars((string)($formScores[$gameId]['score1'] ?? '')); ?>">
|
||||
:
|
||||
<input type="number" min="0" max="99" name="scores[<?php echo $gameId; ?>][score2]" required
|
||||
value="<?php echo htmlspecialchars((string)($formScores[$gameId]['score2'] ?? '')); ?>">
|
||||
</td>
|
||||
<td>
|
||||
<label>
|
||||
Joker
|
||||
<input type="checkbox" class="joker-checkbox" name="joker" value="<?php echo $gameId; ?>"
|
||||
<?php if ($formJoker === $gameId) echo 'checked'; ?>>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<p><button type="submit" id="btn_submit">Ok</button></p>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// Wie im Legacy: genau ein Joker pro Runde. Ein gesetzter Joker kann nur durch
|
||||
// einen anderen ersetzt werden; ohne Joker bleibt "Ok" deaktiviert.
|
||||
(function () {
|
||||
const boxes = document.querySelectorAll('.joker-checkbox');
|
||||
const submit = document.getElementById('btn_submit');
|
||||
const update = () => { submit.disabled = !Array.from(boxes).some(b => b.checked); };
|
||||
boxes.forEach(function (box) {
|
||||
box.addEventListener('change', function () {
|
||||
if (box.checked) {
|
||||
boxes.forEach(other => { if (other !== box) other.checked = false; });
|
||||
} else {
|
||||
box.checked = true;
|
||||
}
|
||||
update();
|
||||
});
|
||||
});
|
||||
update();
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.tipp-form table { width: auto; }
|
||||
.tipp-form td { border: none; padding: 6px 8px; }
|
||||
.tipp-form td.score { white-space: nowrap; }
|
||||
.tipp-form td.score input { width: 3.5em; font-size: 1em; }
|
||||
</style>
|
||||
|
||||
<?php require __DIR__ . '/../partials/footer.php'; ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue