diff --git a/tippspiel/public/css/style.css b/tippspiel/public/css/style.css index 09e751c..ba7f952 100644 --- a/tippspiel/public/css/style.css +++ b/tippspiel/public/css/style.css @@ -52,6 +52,17 @@ body { box-shadow: 0 2px 12px rgba(11, 61, 35, 0.08); } +/* Rangliste: Seite so breit wie die Tabelle, damit Kopfzeile und Legende die + volle Breite nutzen und Pinch-to-Zoom über den ganzen Schirm verläuft. */ +body.ranking-page { + width: max-content; + min-width: 100%; +} +body.ranking-page .page { + max-width: none; + width: max-content; +} + h1, h2, h3 { font-family: var(--font-display); font-weight: 800; @@ -271,25 +282,6 @@ button.link-button { min-width: 100%; } -/* Vertikal scrollbare Rangliste mit angepinntem Tabellenkopf */ -.table-container.sticky-header { - max-height: 75vh; - overflow: auto; - border: 1px solid var(--line); - border-radius: 8px; -} -.table-container.sticky-header table { - border: none; - border-radius: 0; - overflow: visible; - margin-top: 0; -} -.table-container.sticky-header thead th { - position: sticky; - top: 0; - z-index: 5; -} - /* Rangliste --------------------------------------------------------------- */ td.tipp-cell { text-align: center !important; position: relative; font-weight: 700; } td.tipp-cell.col_exact { background-color: var(--col-exact) !important; color: #fff; } /* Exaktes Ergebnis */ diff --git a/tippspiel/public/index.php b/tippspiel/public/index.php index d97f51f..d4ec60d 100644 --- a/tippspiel/public/index.php +++ b/tippspiel/public/index.php @@ -248,6 +248,11 @@ if ($page === 'reminder') { $payouts = $currentSeason ? Quota::computePayouts($currentSeason['id']) : null; $maxIdenticalJokertipps = (int)($currentSeason['max_identical_jokertipps'] ?? Season::DEFAULT_MAX_IDENTICAL_JOKERTIPPS); require __DIR__ . '/../src/Views/info/guide.php'; +} elseif ($page === 'guide_admin') { + // Info -> Anleitung-Admin: Saison-/Quoten-Verwaltung (nur für Admins) + Auth::requireLogin(); + Auth::requireAdmin(); + require __DIR__ . '/../src/Views/info/guide_admin.php'; } elseif ($page === 'info_quotas') { // Info -> Quoten (Legacy UsersController::show_payouts) Auth::requireLogin(); @@ -604,6 +609,7 @@ if ($page === 'reminder') { $viewMail = isset($_GET['id']) ? Roundmail::findById((int)$_GET['id']) : null; $compose = isset($_GET['new']); + $excludeReminders = ($_GET['hide_reminders'] ?? '') === '1'; if ($compose) { $currentSeason = Season::getCurrent(); @@ -614,10 +620,10 @@ if ($page === 'reminder') { $mailConfigured = (bool)getenv('SMTP_HOST'); } elseif (!$viewMail) { $perPage = 20; - $totalMails = Roundmail::count(); + $totalMails = Roundmail::count($excludeReminders); $totalPages = max(1, (int)ceil($totalMails / $perPage)); $currentPage = min(max(1, (int)($_GET['p'] ?? 1)), $totalPages); - $mails = Roundmail::getPage($perPage, ($currentPage - 1) * $perPage); + $mails = Roundmail::getPage($perPage, ($currentPage - 1) * $perPage, $excludeReminders); } require __DIR__ . '/../src/Views/admin/roundmails.php'; @@ -635,7 +641,7 @@ if ($page === 'reminder') { $redirect = '/index.php?page=admin_users'; try { - if ($action === 'create' || $action === 'update') { + if ($action === 'update' && $userId) { $data = [ 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], @@ -644,19 +650,11 @@ if ($page === 'reminder') { 'admin' => isset($_POST['admin']) ? 1 : 0, ]; - if ($action === 'create') { - if (empty($data['password'])) { - throw new \Exception('Passwort ist erforderlich.'); - } - User::create($data); - $_SESSION['admin_message'] = "Benutzer erfolgreich erstellt."; - } elseif ($userId) { - User::update($userId, $data); - if ($currentSeason) { - Payment::setPaidStatus($userId, $currentSeason['id'], isset($_POST['has_paid'])); - } - $_SESSION['admin_message'] = "Benutzer erfolgreich aktualisiert."; + User::update($userId, $data); + if ($currentSeason) { + Payment::setPaidStatus($userId, $currentSeason['id'], isset($_POST['has_paid'])); } + $_SESSION['admin_message'] = "Benutzer erfolgreich aktualisiert."; } elseif ($action === 'delete' && $userId) { User::delete($userId); $_SESSION['admin_message'] = "Benutzer erfolgreich gelöscht."; diff --git a/tippspiel/src/Models/Roundmail.php b/tippspiel/src/Models/Roundmail.php index f50dc9c..ed0ad8a 100644 --- a/tippspiel/src/Models/Roundmail.php +++ b/tippspiel/src/Models/Roundmail.php @@ -23,10 +23,17 @@ class Roundmail { /** * Anzahl aller protokollierten Mails. * + * @param bool $excludeReminders Automatische Erinnerungen (Betreff REMINDER_TOPIC) nicht mitzählen * @return int */ - public static function count() { + public static function count($excludeReminders = false) { $db = Database::getConnection(); + if ($excludeReminders) { + $stmt = $db->prepare("SELECT COUNT(*) FROM roundmails WHERE topic <> :topic"); + $stmt->bindValue(':topic', self::REMINDER_TOPIC); + $stmt->execute(); + return (int)$stmt->fetchColumn(); + } return (int)$db->query("SELECT COUNT(*) FROM roundmails")->fetchColumn(); } @@ -35,19 +42,25 @@ class Roundmail { * * @param int $limit * @param int $offset + * @param bool $excludeReminders Automatische Erinnerungen (Betreff REMINDER_TOPIC) auslassen * @return array */ - public static function getPage($limit, $offset) { + public static function getPage($limit, $offset, $excludeReminders = false) { $db = Database::getConnection(); - $stmt = $db->prepare( - "SELECT m.id, m.send_date, m.topic, m.recipients, COALESCE(u.name, 'Automailer') AS sender_name - FROM roundmails m - LEFT JOIN users u ON u.id = m.user_id - ORDER BY m.send_date DESC, m.id DESC - LIMIT ? OFFSET ?" - ); - $stmt->bindValue(1, (int)$limit, \PDO::PARAM_INT); - $stmt->bindValue(2, (int)$offset, \PDO::PARAM_INT); + $sql = "SELECT m.id, m.send_date, m.topic, m.recipients, COALESCE(u.name, 'Automailer') AS sender_name + FROM roundmails m + LEFT JOIN users u ON u.id = m.user_id"; + if ($excludeReminders) { + $sql .= " WHERE m.topic <> :topic"; + } + $sql .= " ORDER BY m.send_date DESC, m.id DESC LIMIT :limit OFFSET :offset"; + + $stmt = $db->prepare($sql); + if ($excludeReminders) { + $stmt->bindValue(':topic', self::REMINDER_TOPIC); + } + $stmt->bindValue(':limit', (int)$limit, \PDO::PARAM_INT); + $stmt->bindValue(':offset', (int)$offset, \PDO::PARAM_INT); $stmt->execute(); return $stmt->fetchAll(); } diff --git a/tippspiel/src/Views/admin/roundmails.php b/tippspiel/src/Views/admin/roundmails.php index b17377b..b8304f8 100644 --- a/tippspiel/src/Views/admin/roundmails.php +++ b/tippspiel/src/Views/admin/roundmails.php @@ -3,6 +3,8 @@ use App\Models\Round; $pageTitle = 'Runden-E-Mails versenden'; require __DIR__ . '/../partials/header.php'; + +$reminderParam = ($excludeReminders ?? false) ? '&hide_reminders=1' : ''; ?>

Runden-E-Mails

@@ -91,12 +93,17 @@ require __DIR__ . '/../partials/header.php'; Nachricht -

Zurück zur Übersicht

+

Zurück zur Übersicht

Neue Mail schreiben

+ + @@ -110,7 +117,7 @@ require __DIR__ . '/../partials/header.php'; - + @@ -121,8 +128,27 @@ require __DIR__ . '/../partials/header.php';
+ + 1): - $pageUrl = fn($n) => '/index.php?page=admin_roundmails' . ($n > 1 ? '&p=' . $n : ''); + $pageUrl = fn($n) => '/index.php?page=admin_roundmails' + . $reminderParam + . ($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], @@ -167,6 +193,7 @@ require __DIR__ . '/../partials/header.php'; .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; } +.reminder-toggle { display: inline-flex; align-items: center; gap: 0.4em; margin-bottom: 1em; cursor: pointer; } .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); } diff --git a/tippspiel/src/Views/admin/rounds.php b/tippspiel/src/Views/admin/rounds.php index a0b26c0..8aa53a9 100644 --- a/tippspiel/src/Views/admin/rounds.php +++ b/tippspiel/src/Views/admin/rounds.php @@ -133,4 +133,48 @@ $failedRoundId = $failedForm ? (int)($failedForm['round_id'] ?? 0) : null; .round-admin .hint { color: #666; font-size: 0.8em; } + + diff --git a/tippspiel/src/Views/admin/users.php b/tippspiel/src/Views/admin/users.php index 4e518bc..d6907c7 100644 --- a/tippspiel/src/Views/admin/users.php +++ b/tippspiel/src/Views/admin/users.php @@ -12,38 +12,35 @@ require __DIR__ . '/../partials/header.php';

- -

+ + +

Benutzer bearbeiten

- - - - - - + +
- +
- +
- +
- +
>
- +
> @@ -51,14 +48,13 @@ require __DIR__ . '/../partials/header.php';
- - - Abbrechen - + + Abbrechen

+

Benutzerliste

diff --git a/tippspiel/src/Views/home.php b/tippspiel/src/Views/home.php index 5b6fb1d..80ce488 100644 --- a/tippspiel/src/Views/home.php +++ b/tippspiel/src/Views/home.php @@ -7,12 +7,12 @@ require __DIR__ . '/partials/header.php';

Willkommen bei Tippspiel 2027

-

Rundenübersicht

+

Abgeschlossene Runden:

Saison:

-

+

diff --git a/tippspiel/src/Views/info/guide.php b/tippspiel/src/Views/info/guide.php index 4c0ed95..32beb4f 100644 --- a/tippspiel/src/Views/info/guide.php +++ b/tippspiel/src/Views/info/guide.php @@ -52,7 +52,7 @@ $exactExamples = ['1:0', '2:1', '2:2', '3:1', '3:2', '4:2', '5:3']; Richtige Tendenz (Sieg Heim / Unentschieden / Sieg Gast richtig, Ergebnis falsch)1 Exaktes Ergebnis2 + Torbonus Mit JokerPunkte des Spiels × 2 - Rundenbonus: Jedes Spiel der Runde bringt dir mindestens einen Punkt+ (wird nicht verdoppelt) + Rundenbonus: Alle 4 Spiele der Runde haben mindestens die Tendenz getroffen+ (wird nicht verdoppelt) diff --git a/tippspiel/src/Views/info/guide_admin.php b/tippspiel/src/Views/info/guide_admin.php new file mode 100644 index 0000000..0b20472 --- /dev/null +++ b/tippspiel/src/Views/info/guide_admin.php @@ -0,0 +1,115 @@ + number_format($amount, 2, ',', '.') . ' €'; +?> + +
+ +

Anleitung-Admin

+

So verwaltest du Saisons und Quoten. Dieser Bereich richtet sich ausschließlich an Administratoren.

+ + + +

1. Neue Saison anlegen

+
    +
  1. Öffne unter Administration → Saisons verwalten die Saisonverwaltung.
  2. +
  3. Fülle das Formular „Neue Saison anlegen" aus: +
      +
    • Name: z. B. „HINRUNDE 26/27".
    • +
    • Runden: Anzahl der Spieltage. Pro Runde werden automatisch Spiele angelegt.
    • +
    • Max. gleiche Joker: Wie oft dasselbe Ergebnis pro Saison mit Joker getippt werden darf (Standard ).
    • +
    +
  4. +
  5. Lege die Quoten fest (siehe Abschnitt Quoten). Es gelten die Standardwerte, du kannst sie aber anpassen.
  6. +
  7. Klicke „Anlegen". Die Saison wird erstellt und automatisch als aktiv gesetzt.
  8. +
+
+ Wichtig nach dem Anlegen: Die Saison enthält zunächst nur Platzhalter-Runden + („1. Spieltag", „2. Spieltag", …) mit Platzhalter-Spielen („Mannschaft 1" bis „Mannschaft 8"), + deren Anstoßzeiten 7 Monate in der Zukunft liegen. Trage unter + Administration → Spiele & Ergebnisse eintragen die echten Paarungen und Anstoßzeiten ein. + Erst dadurch werden die Runden tippbar und später (nach dem Anpfiff) gesperrt. +
+ +

2. Saison umschalten & verwalten

+
    +
  • Die Saison-Liste zeigt alle Saisons; die aktive ist fett markiert (Spalte „Aktiv").
  • +
  • Mit „Als aktiv setzen" wechselst du die aktive Saison. Alle Bereiche + (Startseite, Tipps, Rangliste, Quoten, Erinnerungen) beziehen sich danach auf die neue Saison.
  • +
  • Über „Bearbeiten" kannst du Name, Rundenanzahl, Joker-Limit und Quoten nachträglich anpassen. + Hinweis: Eine Änderung der Rundenanzahl legt keine neuen Runden an und löscht keine.
  • +
  • „Löschen" entfernt eine Saison samt Runden, Spielen, Tipps, Zahlungen und Quoten. + Die aktive Saison kann nicht gelöscht werden – schalte zuerst auf eine andere um.
  • +
+ +

3. Wie die Quoten funktionieren

+

Die Quoten legen fest, wie der Pott verteilt wird. Der Pott ergibt sich aus +bezahlte Spieler × Einsatz.

+ +

Die drei Quoten-Gruppen

+ + + + + + + + +
QuoteBedeutungStandard
EinsatzBetrag, den jeder aktive Spieler pro Saison zahlt (in €) €
TagessiegAnteil des Potts für die Tagessiege (in %) %
PlatzierungAnteil des Potts für das Platzierungsgeld (in %) %
Platz 1 … Aufteilung des Platzierungstopfs auf die Plätze (in %)siehe Tabelle unten
+ +

Regeln: Tagessieg + Platzierung müssen zusammen 100 % ergeben, +und Platz 1 bis ebenfalls 100 %. Das Formular prüft das beim Speichern.

+ +

Standard-Platzierungsquoten

+ + + + + + + + + + + +
Platz
Anteil %
+ +

So wird gerechnet

+
    +
  • Pott = bezahlte Spieler × Einsatz.
  • +
  • Tagessieg je Runde = Pott × Tagessieg-% ÷ Rundenzahl, abgerundet auf einen durch 6 teilbaren Betrag. + Der Rundungsrest wandert in den Platzierungstopf.
  • +
  • Platzierungstopf = Pott × Platzierung-% + Rundungsrest der Tagessiege.
  • +
  • Platz N = Platzierungstopf × Platz-N-%, abgerundet auf einen durch 6 teilbaren Betrag.
  • +
  • Was danach vom Pott übrig bleibt (Rundungsreste), geht zusätzlich an Platz 1.
  • +
+

Die konkreten Beträge für die aktive Saison siehst du in der Saisonverwaltung +(rechts neben jedem Quotenfeld) und unter Quoten.

+ +
+ + + + diff --git a/tippspiel/src/Views/info/money_ranking.php b/tippspiel/src/Views/info/money_ranking.php index 9d25df9..7141e7e 100644 --- a/tippspiel/src/Views/info/money_ranking.php +++ b/tippspiel/src/Views/info/money_ranking.php @@ -5,6 +5,7 @@ require __DIR__ . '/../partials/header.php'; $myId = (int)$user['id']; ?> +

Geldrangliste

@@ -25,6 +26,7 @@ $myId = (int)$user['id'];
+
diff --git a/tippspiel/src/Views/info/quotas.php b/tippspiel/src/Views/info/quotas.php index 7e77bfc..423ebb0 100644 --- a/tippspiel/src/Views/info/quotas.php +++ b/tippspiel/src/Views/info/quotas.php @@ -10,8 +10,10 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';

Es gibt noch keine Saison.

+

Ausschüttungs-Quoten

+

Spiel-Einsatz

@@ -39,6 +41,7 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';