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' : ''; ?>
| - | + |