new features

This commit is contained in:
torsten 2026-10-21 20:22:20 +02:00
parent 9fcd228eb2
commit a73358d2f1
9 changed files with 538 additions and 2 deletions

View file

@ -0,0 +1,34 @@
<?php
$pageTitle = 'Aktuelle Mitteilung';
require __DIR__ . '/../partials/header.php';
?>
<h1>Aktuelle Mitteilung</h1>
<?php if (!empty($flashMessage)): ?>
<p style="color: green;"><?php echo htmlspecialchars($flashMessage); ?></p>
<?php endif; ?>
<?php if (!empty($error)): ?>
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
<?php endif; ?>
<p>Die Mitteilung erscheint in großer Schrift oben auf der Startseite. Leer lassen und speichern entfernt die Mitteilung.</p>
<form method="post" action="/index.php?page=admin_message" class="message-form">
<div class="form-group">
<label for="message">Mitteilung:</label>
<textarea id="message" name="message" rows="8"><?php echo htmlspecialchars($currentMessage); ?></textarea>
</div>
<div class="form-group">
<button type="submit">Speichern</button>
</div>
</form>
<style>
.message-form { max-width: 760px; }
.message-form .form-group { margin-bottom: 1rem; }
.message-form label { display: block; font-weight: bold; margin-bottom: 0.3rem; }
.message-form textarea { width: 100%; box-sizing: border-box; font-size: 1.2em; }
</style>
<?php require __DIR__ . '/../partials/footer.php'; ?>

View file

@ -7,6 +7,10 @@ require __DIR__ . '/partials/header.php';
<h1>Willkommen bei Tippspiel 2027</h1>
<?php if (!empty($message)): ?>
<div class="announcement"><?php echo nl2br(htmlspecialchars($message)); ?></div>
<?php endif; ?>
<h2>Abgeschlossene Runden:</h2>
<?php if ($currentSeason): ?>
<p>Saison: <strong><?php echo htmlspecialchars($currentSeason['name']); ?></strong></p>

View file

@ -1,4 +1,16 @@
<?php $pageTitle = $pageTitle ?? 'Tippspiel 2027'; ?>
<?php
$pageTitle = $pageTitle ?? 'Tippspiel 2027';
// Leucht-Hinweis am Menüpunkt "Fragen", wenn eine neue Antwort oder (für
// Admins) eine neue Frage vorliegt.
$questionsGlow = false;
if (App\Core\Auth::check()) {
$questionsGlow = App\Models\Question::hasNewAnswer((int)App\Core\Auth::id());
if (App\Core\Auth::isAdmin()) {
$questionsGlow = $questionsGlow || App\Models\Question::hasNewQuestion();
}
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
@ -14,9 +26,10 @@
<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 class="<?php echo htmlspecialchars($bodyClass ?? ''); ?>">
<?php if (App\Core\Auth::check()): ?>
<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>
<a href="/index.php?page=questions"<?php if ($questionsGlow): ?> class="is-glowing"<?php endif; ?>>Fragen</a>
<?php if (App\Core\Auth::isAdmin()): $registrationOpen = App\Models\Setting::isRegistrationOpen(); ?>
<span class="nav-dropdown">
<a href="#" onclick="return false;">Administration</a>
@ -26,6 +39,7 @@
<a href="/index.php?page=admin_rounds">Spiele &amp; Ergebnisse eintragen</a>
<a href="/index.php?page=admin_roundmails">Runden-E-Mails versenden</a>
<a href="/index.php?page=admin_accounts">Kontoliste</a>
<a href="/index.php?page=admin_message">Aktuelle Mitteilung</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'; ?>">
@ -65,4 +79,5 @@
<?php endif; ?>
</span>
</nav>
<?php endif; ?>
<main class="page">

View file

@ -0,0 +1,138 @@
<?php
$pageTitle = 'Fragen';
require __DIR__ . '/partials/header.php';
?>
<h1>Fragen</h1>
<?php if (!empty($message)): ?>
<p class="flash flash-ok"><?php echo htmlspecialchars($message); ?></p>
<?php endif; ?>
<?php if (!empty($error)): ?>
<p class="flash flash-err"><?php echo htmlspecialchars($error); ?></p>
<?php endif; ?>
<?php if ($answerQuestion): ?>
<h2>Frage beantworten</h2>
<div class="question-entry">
<p class="question-meta">
Von <?php echo htmlspecialchars($answerQuestion['user_name']); ?>
· <?php echo date('d.m.Y H:i', strtotime($answerQuestion['question_date'])); ?>
</p>
<p class="question-text"><?php echo nl2br(htmlspecialchars($answerQuestion['question'])); ?></p>
</div>
<form method="post" action="/index.php?page=questions" class="questions-form">
<input type="hidden" name="action" value="answer">
<input type="hidden" name="id" value="<?php echo (int)$answerQuestion['id']; ?>">
<div class="form-group">
<label for="answer">Antwort:</label>
<textarea id="answer" name="answer" rows="6" required></textarea>
</div>
<div class="form-group buttons">
<button type="submit">Antwort speichern</button>
<a href="/index.php?page=questions">Abbrechen</a>
</div>
</form>
<?php else: ?>
<?php if ($isAdmin): ?>
<p>Hier siehst du alle Fragen der Spieler. Offene Fragen kannst du direkt beantworten.</p>
<?php else: ?>
<p>Hier siehst du deine Fragen an die Admins und deren Antworten.</p>
<?php endif; ?>
<h2>Neue Frage stellen</h2>
<form method="post" action="/index.php?page=questions" class="questions-form">
<input type="hidden" name="action" value="ask">
<div class="form-group">
<label for="question">Deine Frage:</label>
<textarea id="question" name="question" rows="4" required maxlength="5000"></textarea>
</div>
<div class="form-group buttons">
<button type="submit">Absenden</button>
</div>
</form>
<h2><?php echo $isAdmin ? 'Alle Fragen' : 'Deine Fragen'; ?></h2>
<?php if (!$questions): ?>
<p><?php echo $isAdmin ? 'Noch keine Fragen vorhanden.' : 'Du hast noch keine Fragen gestellt.'; ?></p>
<?php else: ?>
<?php foreach ($questions as $q): ?>
<div class="question-entry<?php echo $q['answer'] === null ? ' is-open' : ''; ?>">
<p class="question-meta">
<?php if ($isAdmin): ?>
Von <?php echo htmlspecialchars($q['user_name']); ?>
<?php endif; ?>
· <?php echo date('d.m.Y H:i', strtotime($q['question_date'])); ?>
</p>
<p class="question-text"><?php echo nl2br(htmlspecialchars($q['question'])); ?></p>
<?php if ($q['answer'] === null): ?>
<p class="question-status open">Noch nicht beantwortet</p>
<?php if ($isAdmin): ?>
<p><a class="answer-link" href="/index.php?page=questions&amp;answer_id=<?php echo (int)$q['id']; ?>">Antworten</a></p>
<?php endif; ?>
<?php else: ?>
<div class="answer-box">
<p class="question-meta">Antwort · <?php echo date('d.m.Y H:i', strtotime($q['answer_date'])); ?></p>
<p class="question-text"><?php echo nl2br(htmlspecialchars($q['answer'])); ?></p>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
<style>
.flash { padding: 0.6em 0.9em; border-radius: 6px; }
.flash-ok { background: #e8f3ec; border-left: 4px solid var(--pitch); color: var(--pitch-dark); }
.flash-err { background: #fdecea; border-left: 4px solid #d62d2d; color: #a32626; }
.questions-form { max-width: 760px; margin-bottom: 2em; }
.questions-form .form-group { margin-bottom: 1rem; }
.questions-form label { display: block; font-weight: bold; margin-bottom: 0.3rem; }
.questions-form textarea { width: 100%; box-sizing: border-box; }
.questions-form .buttons a { margin-left: 1em; }
.question-entry {
max-width: 760px;
margin: 1em 0;
padding: 0.8em 1em;
border: 1px solid var(--line);
border-left: 5px solid var(--pitch);
border-radius: 8px;
background: #fff;
}
.question-entry.is-open { border-left-color: var(--gold); background: #fffdf3; }
.question-meta { color: var(--muted); font-size: 0.85em; margin: 0 0 0.35em; }
.question-text { margin: 0.35em 0; white-space: normal; }
.question-status { font-size: 0.85em; font-weight: 700; margin: 0.5em 0; }
.question-status.open { color: var(--col-joker-exact); }
.answer-link {
display: inline-block;
font-family: var(--font-display);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
padding: 0.35em 1.1em;
border-radius: 999px;
color: #fff;
background: linear-gradient(180deg, #1b7a3b, var(--pitch));
text-decoration: none;
box-shadow: 0 2px 0 var(--pitch-dark);
}
.answer-link:hover { background: var(--pitch-dark); color: var(--gold); }
.answer-box {
margin-top: 0.6em;
padding: 0.6em 0.9em;
background: var(--pitch-light);
border-radius: 6px;
}
</style>
<?php require __DIR__ . '/partials/footer.php'; ?>