updates
This commit is contained in:
parent
565c5c43f9
commit
ab2311587c
12 changed files with 241 additions and 27 deletions
|
|
@ -187,6 +187,10 @@ if ($page === 'reminder') {
|
|||
}
|
||||
$games = Game::getGamesByRound($round['id']);
|
||||
$error = null;
|
||||
$jokerUsage = Tipp::formatJokerUsage(
|
||||
Tipp::getJokerUsage($user['id'], $activeSeason['id'], null, $round['id'])
|
||||
);
|
||||
$maxIdenticalJokertipps = (int)$activeSeason['max_identical_jokertipps'];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$jokerGameId = isset($_POST['joker']) && $_POST['joker'] !== '' ? (int)$_POST['joker'] : null;
|
||||
|
|
@ -225,6 +229,10 @@ if ($page === 'reminder') {
|
|||
exit;
|
||||
}
|
||||
$error = null;
|
||||
$jokerUsage = Tipp::formatJokerUsage(
|
||||
Tipp::getJokerUsage($user['id'], $activeSeason['id'], null, $round['id'])
|
||||
);
|
||||
$maxIdenticalJokertipps = (int)$activeSeason['max_identical_jokertipps'];
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$error = Tipp::saveSingle($user['id'], $game['id'], $_POST['score1'] ?? '', $_POST['score2'] ?? '', isset($_POST['joker']));
|
||||
if ($error === null) {
|
||||
|
|
@ -248,6 +256,10 @@ if ($page === 'reminder') {
|
|||
$currentSeason = Season::getCurrent();
|
||||
$payouts = $currentSeason ? Quota::computePayouts($currentSeason['id']) : null;
|
||||
$maxIdenticalJokertipps = (int)($currentSeason['max_identical_jokertipps'] ?? Season::DEFAULT_MAX_IDENTICAL_JOKERTIPPS);
|
||||
$jackpot = $currentSeason ? (float)$currentSeason['jackpot'] : 0.0;
|
||||
$jackpotStatus = $currentSeason
|
||||
? Ranking::getJackpotStatus($currentSeason['id'])
|
||||
: ['won' => false, 'amount' => 0.0, 'perWinner' => 0.0, 'winners' => []];
|
||||
require __DIR__ . '/../src/Views/info/guide.php';
|
||||
} elseif ($page === 'guide_admin') {
|
||||
// Info -> Anleitung-Admin: Saison-/Quoten-Verwaltung (nur für Admins)
|
||||
|
|
@ -261,6 +273,10 @@ if ($page === 'reminder') {
|
|||
$payouts = $currentSeason ? Quota::computePayouts($currentSeason['id']) : null;
|
||||
$activeUserCount = $currentSeason ? count(User::getPaid($currentSeason['id'])) : 0;
|
||||
$stake = $currentSeason ? (Quota::getMapBySeason($currentSeason['id'])['einsatz'] ?? 0) : 0;
|
||||
$jackpot = $currentSeason ? (float)$currentSeason['jackpot'] : 0.0;
|
||||
$jackpotStatus = $currentSeason
|
||||
? Ranking::getJackpotStatus($currentSeason['id'])
|
||||
: ['won' => false, 'amount' => 0.0, 'perWinner' => 0.0, 'winners' => []];
|
||||
require __DIR__ . '/../src/Views/info/quotas.php';
|
||||
} elseif ($page === 'money_ranking') {
|
||||
// Info -> Geldrangliste (Legacy UsersController::money_ranking / money_ranking_detail)
|
||||
|
|
@ -373,10 +389,12 @@ if ($page === 'reminder') {
|
|||
'name' => trim($_POST['name'] ?? ''),
|
||||
'rounds' => $_POST['rounds'] ?? '',
|
||||
'max_identical_jokertipps' => $_POST['max_identical_jokertipps'] ?? '',
|
||||
'jackpot' => str_replace(',', '.', trim($_POST['jackpot'] ?? '')),
|
||||
];
|
||||
if ($data['name'] === '' || !ctype_digit((string)$data['rounds']) || (int)$data['rounds'] < 1
|
||||
|| !ctype_digit((string)$data['max_identical_jokertipps'])) {
|
||||
throw new \Exception('Name, Runden und maximale Anzahl gleicher Joker sind erforderlich.');
|
||||
|| !ctype_digit((string)$data['max_identical_jokertipps'])
|
||||
|| !is_numeric($data['jackpot']) || (float)$data['jackpot'] < 0) {
|
||||
throw new \Exception('Name, Runden, maximale Anzahl gleicher Joker und Jackpot sind erforderlich.');
|
||||
}
|
||||
|
||||
$quotasToSave = [];
|
||||
|
|
@ -443,6 +461,7 @@ if ($page === 'reminder') {
|
|||
'name' => $editSeason['name'] ?? '',
|
||||
'rounds' => $template['rounds'] ?? 48,
|
||||
'max_identical_jokertipps' => $template['max_identical_jokertipps'] ?? Season::DEFAULT_MAX_IDENTICAL_JOKERTIPPS,
|
||||
'jackpot' => $template['jackpot'] ?? Season::DEFAULT_JACKPOT,
|
||||
'quotas' => array_merge(Quota::defaults(), $template ? Quota::getMapBySeason($template['id']) : []),
|
||||
];
|
||||
if ($editSeason) {
|
||||
|
|
@ -583,11 +602,12 @@ if ($page === 'reminder') {
|
|||
}
|
||||
|
||||
$sender = Auth::user();
|
||||
$currentSeason = Season::getCurrent();
|
||||
$html = Roundmail::textToHtml($text);
|
||||
$failed = Mailer::send($recipients['valid'], $topic, $html, $sender['email'] ?? null);
|
||||
$sent = array_values(array_diff($recipients['valid'], $failed));
|
||||
if (!empty($sent)) {
|
||||
Roundmail::create((int)$sender['id'], $sent, $topic, $html);
|
||||
Roundmail::create((int)$sender['id'], $sent, $topic, $html, $currentSeason ? (int)$currentSeason['id'] : 0);
|
||||
}
|
||||
|
||||
$_SESSION['admin_message'] = 'Mail an ' . count($sent) . ' Empfänger versendet.';
|
||||
|
|
@ -788,10 +808,22 @@ if ($page === 'reminder') {
|
|||
$ranking = [];
|
||||
$games = [];
|
||||
$teamLogos = [];
|
||||
$roundCompleted = false;
|
||||
$isFinalRound = false;
|
||||
$roundHasJackpot = false;
|
||||
if ($selectedRound) {
|
||||
$result = Ranking::compute($currentSeason['id'], $selectedRound['id']);
|
||||
$ranking = Ranking::roundTable($result);
|
||||
$games = $result['rounds'][$selectedRound['id']]['games'] ?? [];
|
||||
$roundCompleted = (bool)($result['rounds'][$selectedRound['id']]['completed'] ?? false);
|
||||
$isFinalRound = (bool)$result['is_final'];
|
||||
$roundEntries = $result['rounds'][$selectedRound['id']]['entries'] ?? [];
|
||||
foreach ($roundEntries as $entry) {
|
||||
if (($entry['jackpot_payout'] ?? 0) > 0) {
|
||||
$roundHasJackpot = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$teamIds = [];
|
||||
foreach ($games as $game) {
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ class Ranking {
|
|||
$tippsByRound = self::loadTipps($seasonId, $maxRoundId);
|
||||
$payouts = Quota::computePayouts($seasonId);
|
||||
|
||||
$season = Season::findById($seasonId);
|
||||
$jackpot = $season ? (float)$season['jackpot'] : 0.0;
|
||||
|
||||
$users = [];
|
||||
foreach (User::getPaid($seasonId) as $user) {
|
||||
$users[(int)$user['id']] = $user;
|
||||
|
|
@ -56,6 +59,7 @@ class Ranking {
|
|||
$totals = array_fill_keys($userIds, 0);
|
||||
$rounds = [];
|
||||
$dayPrizePot = 0.0;
|
||||
$jackpotAwarded = false;
|
||||
|
||||
foreach ($allRounds as $round) {
|
||||
$roundId = (int)$round['id'];
|
||||
|
|
@ -81,6 +85,8 @@ class Ranking {
|
|||
$entry['total'] = $totals[$userId];
|
||||
$entry['is_day_winner'] = false;
|
||||
$entry['payout'] = 0.0;
|
||||
$entry['is_jackpot_winner'] = false;
|
||||
$entry['jackpot_payout'] = 0.0;
|
||||
$entries[$userId] = $entry;
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +102,19 @@ class Ranking {
|
|||
}
|
||||
}
|
||||
|
||||
// Jackpot: einmal pro Saison, wenn alle Spiele der Runde exakt getippt wurden
|
||||
if (!$jackpotAwarded && $completed && $jackpot > 0) {
|
||||
$jackpotWinners = self::determineJackpotWinners($entries, count($games));
|
||||
if (!empty($jackpotWinners)) {
|
||||
$perJackpot = round($jackpot / count($jackpotWinners), 2);
|
||||
foreach ($jackpotWinners as $userId) {
|
||||
$entries[$userId]['is_jackpot_winner'] = true;
|
||||
$entries[$userId]['jackpot_payout'] = $perJackpot;
|
||||
}
|
||||
$jackpotAwarded = true;
|
||||
}
|
||||
}
|
||||
|
||||
$rounds[$roundId] = [
|
||||
'round' => $round,
|
||||
'games' => $games,
|
||||
|
|
@ -119,6 +138,7 @@ class Ranking {
|
|||
'is_final' => $isFinal,
|
||||
'ranking_payouts' => $isFinal ? self::computeRankingPayouts($ranks, $payouts) : [],
|
||||
'payouts' => $payouts,
|
||||
'jackpot' => $jackpot,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -163,6 +183,8 @@ class Ranking {
|
|||
'is_day_winner' => $entry['is_day_winner'],
|
||||
'payout' => $entry['payout'],
|
||||
'ranking_payout' => $result['ranking_payouts'][$userId] ?? 0,
|
||||
'is_jackpot_winner' => $entry['is_jackpot_winner'],
|
||||
'jackpot_payout' => $entry['jackpot_payout'],
|
||||
'cells' => $cells,
|
||||
];
|
||||
}
|
||||
|
|
@ -186,6 +208,12 @@ class Ranking {
|
|||
'amount' => $entry['payout'],
|
||||
];
|
||||
}
|
||||
if ($entry['jackpot_payout'] > 0) {
|
||||
$items[$userId][] = [
|
||||
'label' => $round['round']['name'] . ' (Jackpot)',
|
||||
'amount' => $entry['jackpot_payout'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -201,6 +229,54 @@ class Ranking {
|
|||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Status des Saison-Jackpots: ob er bereits gewonnen wurde und von wem.
|
||||
* Gewonnen ist er, sobald in einer abgeschlossenen Runde mindestens ein Spieler
|
||||
* alle Spiele exakt getippt hat (einmal pro Saison).
|
||||
*
|
||||
* @param int $seasonId
|
||||
* @return array ['won' => bool, 'amount' => float, 'perWinner' => float, 'winners' => string[]]
|
||||
*/
|
||||
public static function getJackpotStatus($seasonId) {
|
||||
$season = Season::findById($seasonId);
|
||||
$jackpot = $season ? (float)$season['jackpot'] : 0.0;
|
||||
|
||||
if ($jackpot <= 0) {
|
||||
return ['won' => false, 'amount' => $jackpot, 'perWinner' => 0.0, 'winners' => []];
|
||||
}
|
||||
|
||||
$users = [];
|
||||
foreach (User::getPaid($seasonId) as $user) {
|
||||
$users[(int)$user['id']] = $user['name'];
|
||||
}
|
||||
|
||||
foreach (Round::getBySeason($seasonId) as $round) {
|
||||
$games = Game::getGamesByRound($round['id']);
|
||||
if (empty($games) || !Round::isCompleted($games)) {
|
||||
continue;
|
||||
}
|
||||
$gameCount = count($games);
|
||||
$tippsByUser = Tipp::findByRound($round['id']);
|
||||
$winners = [];
|
||||
foreach ($users as $userId => $name) {
|
||||
$entry = Tipp::evaluateRound($games, $tippsByUser[$userId] ?? []);
|
||||
if ($entry['exact'] === $gameCount) {
|
||||
$winners[] = $name;
|
||||
}
|
||||
}
|
||||
if (!empty($winners)) {
|
||||
return [
|
||||
'won' => true,
|
||||
'amount' => $jackpot,
|
||||
'perWinner' => round($jackpot / count($winners), 2),
|
||||
'winners' => $winners,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return ['won' => false, 'amount' => $jackpot, 'perWinner' => 0.0, 'winners' => []];
|
||||
}
|
||||
|
||||
/**
|
||||
* Wertung für Geldrangliste und Kontoliste (Legacy UsersController::money_ranking):
|
||||
* gerechnet wird bis zur letzten gesperrten Runde, angezeigt erst, wenn mindestens
|
||||
|
|
@ -292,6 +368,23 @@ class Ranking {
|
|||
return $winners;
|
||||
}
|
||||
|
||||
/**
|
||||
* Jackpot-Gewinner einer Runde: Spieler, die alle Spiele exakt getippt haben.
|
||||
*
|
||||
* @param array $entries user_id => Auswertung (Tipp::evaluateRound)
|
||||
* @param int $gameCount Anzahl der Spiele der Runde
|
||||
* @return array user_ids
|
||||
*/
|
||||
private static function determineJackpotWinners(array $entries, $gameCount) {
|
||||
if ($gameCount <= 0) {
|
||||
return [];
|
||||
}
|
||||
return array_keys(array_filter(
|
||||
$entries,
|
||||
fn($entry) => $entry['exact'] === $gameCount
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ränge nach Gesamtpunkten (geteilte Ränge bei Gleichstand), bei Gleichstand nach Name sortiert.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -47,9 +47,12 @@ class Roundmail {
|
|||
*/
|
||||
public static function getPage($limit, $offset, $excludeReminders = false) {
|
||||
$db = Database::getConnection();
|
||||
$sql = "SELECT m.id, m.send_date, m.topic, m.recipients, COALESCE(u.name, 'Automailer') AS sender_name
|
||||
$sql = "SELECT m.id, m.send_date, m.topic, m.recipients, m.season_id,
|
||||
COALESCE(u.name, 'Automailer') AS sender_name,
|
||||
s.name AS season_name
|
||||
FROM roundmails m
|
||||
LEFT JOIN users u ON u.id = m.user_id";
|
||||
LEFT JOIN users u ON u.id = m.user_id
|
||||
LEFT JOIN seasons s ON s.id = m.season_id";
|
||||
if ($excludeReminders) {
|
||||
$sql .= " WHERE m.topic <> :topic";
|
||||
}
|
||||
|
|
@ -72,9 +75,10 @@ class Roundmail {
|
|||
public static function findById($id) {
|
||||
$db = Database::getConnection();
|
||||
$stmt = $db->prepare(
|
||||
"SELECT m.*, COALESCE(u.name, 'Automailer') AS sender_name
|
||||
"SELECT m.*, COALESCE(u.name, 'Automailer') AS sender_name, s.name AS season_name
|
||||
FROM roundmails m
|
||||
LEFT JOIN users u ON u.id = m.user_id
|
||||
LEFT JOIN seasons s ON s.id = m.season_id
|
||||
WHERE m.id = ?"
|
||||
);
|
||||
$stmt->execute([$id]);
|
||||
|
|
@ -88,15 +92,16 @@ class Roundmail {
|
|||
* @param string[] $recipients
|
||||
* @param string $topic
|
||||
* @param string $messageHtml
|
||||
* @param int $seasonId Zugeordnete Saison (0 = keine/ohne Saisonbezug)
|
||||
* @return int ID
|
||||
*/
|
||||
public static function create($userId, array $recipients, $topic, $messageHtml) {
|
||||
public static function create($userId, array $recipients, $topic, $messageHtml, $seasonId = 0) {
|
||||
$db = Database::getConnection();
|
||||
$stmt = $db->prepare(
|
||||
"INSERT INTO roundmails (user_id, send_date, recipients, topic, message, created_at, updated_at)
|
||||
VALUES (?, CURDATE(), ?, ?, ?, NOW(), NOW())"
|
||||
"INSERT INTO roundmails (user_id, season_id, send_date, recipients, topic, message, created_at, updated_at)
|
||||
VALUES (?, ?, CURDATE(), ?, ?, ?, NOW(), NOW())"
|
||||
);
|
||||
$stmt->execute([$userId, implode(',', $recipients), $topic, $messageHtml]);
|
||||
$stmt->execute([$userId, (int)$seasonId, implode(',', $recipients), $topic, $messageHtml]);
|
||||
return (int)$db->lastInsertId();
|
||||
}
|
||||
|
||||
|
|
@ -224,7 +229,7 @@ class Roundmail {
|
|||
$failed = Mailer::send($recipients, $topic, $html);
|
||||
$sent = array_values(array_diff($recipients, $failed));
|
||||
if (!empty($sent)) {
|
||||
self::create(0, $sent, $topic, $html);
|
||||
self::create(0, $sent, $topic, $html, (int)$season['id']);
|
||||
}
|
||||
|
||||
$result = sprintf('%s: Erinnerung an %d Empfänger versendet.', $round['name'], count($sent));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ class Season {
|
|||
/** Legacy-Default für seasons.max_identical_jokertipps */
|
||||
const DEFAULT_MAX_IDENTICAL_JOKERTIPPS = 6;
|
||||
|
||||
/** Default für seasons.jackpot (in Euro) */
|
||||
const DEFAULT_JACKPOT = 0;
|
||||
|
||||
/** Jede Runde besteht aus 4 Spielen (Legacy-Konvention) */
|
||||
const GAMES_PER_ROUND = 4;
|
||||
|
||||
|
|
@ -67,25 +70,29 @@ class Season {
|
|||
*
|
||||
* Tipps werden NICHT vorab angelegt - sie entstehen beim ersten Tippen (siehe Tipp::saveRound).
|
||||
*
|
||||
* @param array $data ['name', 'rounds', optional 'max_identical_jokertipps']
|
||||
* @param array $data ['name', 'rounds', optional 'max_identical_jokertipps', 'jackpot']
|
||||
* @return int|false Die ID der neuen Saison oder false bei einem Fehler.
|
||||
*/
|
||||
public static function create($data) {
|
||||
$db = Database::getConnection();
|
||||
$roundCount = (int)$data['rounds'];
|
||||
$maxJoker = (int)($data['max_identical_jokertipps'] ?? self::DEFAULT_MAX_IDENTICAL_JOKERTIPPS);
|
||||
$jackpot = isset($data['jackpot']) && is_numeric($data['jackpot'])
|
||||
? (float)$data['jackpot']
|
||||
: self::DEFAULT_JACKPOT;
|
||||
|
||||
$db->beginTransaction();
|
||||
|
||||
try {
|
||||
$stmt = $db->prepare(
|
||||
"INSERT INTO seasons (name, rounds, max_identical_jokertipps, created_at, updated_at)
|
||||
VALUES (:name, :rounds, :max_joker, NOW(), NOW())"
|
||||
"INSERT INTO seasons (name, rounds, max_identical_jokertipps, jackpot, created_at, updated_at)
|
||||
VALUES (:name, :rounds, :max_joker, :jackpot, NOW(), NOW())"
|
||||
);
|
||||
$stmt->execute([
|
||||
':name' => $data['name'],
|
||||
':rounds' => $roundCount,
|
||||
':max_joker' => $maxJoker,
|
||||
':jackpot' => $jackpot,
|
||||
]);
|
||||
$seasonId = (int)$db->lastInsertId();
|
||||
|
||||
|
|
@ -128,7 +135,7 @@ class Season {
|
|||
* Hinweis: Eine Änderung von 'rounds' legt keine Runden an oder löscht welche.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data ['name', 'rounds', optional 'max_identical_jokertipps']
|
||||
* @param array $data ['name', 'rounds', optional 'max_identical_jokertipps', 'jackpot']
|
||||
* @return bool
|
||||
*/
|
||||
public static function update($id, $data) {
|
||||
|
|
@ -146,6 +153,11 @@ class Season {
|
|||
$params[':max_joker'] = (int)$data['max_identical_jokertipps'];
|
||||
}
|
||||
|
||||
if (isset($data['jackpot'])) {
|
||||
$sql .= ", jackpot = :jackpot";
|
||||
$params[':jackpot'] = (float)$data['jackpot'];
|
||||
}
|
||||
|
||||
$sql .= " WHERE id = :id";
|
||||
$stmt = $db->prepare($sql);
|
||||
return $stmt->execute($params);
|
||||
|
|
@ -153,7 +165,7 @@ class Season {
|
|||
|
||||
/**
|
||||
* Löscht eine Saison mit allen abhängigen Daten (Tipps, Spiele, Runden,
|
||||
* Quoten, Zahlungen, manuelle Ausschüttungen). Die aktive Saison kann nicht gelöscht werden.
|
||||
* Quoten, Zahlungen, manuelle Ausschüttungen, Rundmails). Die aktive Saison kann nicht gelöscht werden.
|
||||
*
|
||||
* @param int $id
|
||||
* @throws \Exception wenn die Saison aktiv ist oder nicht existiert
|
||||
|
|
@ -178,6 +190,7 @@ class Season {
|
|||
"DELETE FROM quotas WHERE season_id = ?",
|
||||
"DELETE FROM payments WHERE season_id = ?",
|
||||
"DELETE FROM manual_payouts WHERE season_id = ?",
|
||||
"DELETE FROM roundmails WHERE season_id = ?",
|
||||
"DELETE FROM seasons WHERE id = ?",
|
||||
];
|
||||
foreach ($statements as $sql) {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ $reminderParam = ($excludeReminders ?? false) ? '&hide_reminders=1' : '';
|
|||
<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>Saison</th><td><?php echo !empty($viewMail['season_name']) ? htmlspecialchars($viewMail['season_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>
|
||||
|
|
@ -109,6 +110,7 @@ $reminderParam = ($excludeReminders ?? false) ? '&hide_reminders=1' : '';
|
|||
<tr>
|
||||
<th>Datum</th>
|
||||
<th>Thema</th>
|
||||
<th>Saison</th>
|
||||
<th>Versender</th>
|
||||
<th>Empfänger</th>
|
||||
</tr>
|
||||
|
|
@ -118,12 +120,13 @@ $reminderParam = ($excludeReminders ?? false) ? '&hide_reminders=1' : '';
|
|||
<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 $reminderParam; ?>"><?php echo htmlspecialchars($mail['topic']); ?></a></td>
|
||||
<td><?php echo !empty($mail['season_name']) ? htmlspecialchars($mail['season_name']) : '-'; ?></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>
|
||||
<tr><td colspan="5">Noch keine Mails versendet.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -24,19 +24,16 @@ require __DIR__ . '/../partials/header.php';
|
|||
<?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>
|
||||
<label for="name">Name:</label><input type="text" id="name" name="name" value="<?php echo htmlspecialchars($formValues['name']); ?>" style="width: 240px;" 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>
|
||||
<label for="rounds">Runden:</label><input type="text" id="rounds" name="rounds" value="<?php echo htmlspecialchars($formValues['rounds']); ?>" style="width: 100px;" 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>
|
||||
<label for="max_identical_jokertipps">Max. gleiche Joker:</label><input type="text" id="max_identical_jokertipps" name="max_identical_jokertipps" value="<?php echo htmlspecialchars($formValues['max_identical_jokertipps']); ?>" style="width: 100px;" required>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
|
@ -44,7 +41,7 @@ require __DIR__ . '/../partials/header.php';
|
|||
$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="'
|
||||
echo '<input type="text" id="quota_' . $name . '" name="quotas[' . $name . ']" value="'
|
||||
. htmlspecialchars((string)($q[$name] ?? '')) . '" style="width: 100px;" required> ' . $unit;
|
||||
if ($amount !== null) {
|
||||
echo ' = ' . number_format($amount, 2, ',', '.') . ' €';
|
||||
|
|
@ -60,6 +57,11 @@ require __DIR__ . '/../partials/header.php';
|
|||
Beträge berechnet aus den gespeicherten Quoten.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>Jackpot (4-Spiele Treffer)</h2>
|
||||
<div class="form-group">
|
||||
<label for="jackpot">Jackpot:</label><input type="text" id="jackpot" name="jackpot" value="<?php echo htmlspecialchars((string)(int)$formValues['jackpot']); ?>" style="width: 100px;" required> €
|
||||
</div>
|
||||
|
||||
<h2>Spielquoten</h2>
|
||||
<?php
|
||||
$placementSum = 0;
|
||||
|
|
@ -130,7 +132,7 @@ require __DIR__ . '/../partials/header.php';
|
|||
|
||||
<style>
|
||||
.season-centered { text-align: center; }
|
||||
.season-centered form { display: inline-block; text-align: left; }
|
||||
.season-centered form { display: block; max-width: 480px; margin: 0 auto; text-align: left; }
|
||||
.season-centered form h2 { text-align: center; }
|
||||
.season-centered table { margin: 1em auto 0; text-align: left; }
|
||||
/* From users.php, for consistency */
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ $exactExamples = ['1:0', '2:1', '2:2', '3:1', '3:2', '4:2', '5:3'];
|
|||
<a href="#punkte">Punkte</a>
|
||||
<a href="#rangliste">Rangliste</a>
|
||||
<a href="#tagessieg">Tagessieg</a>
|
||||
<a href="#jackpot">Jackpot</a>
|
||||
<a href="#gewinne">Gewinne</a>
|
||||
<a href="#app">Als App installieren</a>
|
||||
</nav>
|
||||
|
|
@ -127,7 +128,16 @@ Dasselbe Ergebnis darfst du pro Saison höchstens
|
|||
<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>
|
||||
<h2 id="jackpot">6. Jackpot</h2>
|
||||
<ul>
|
||||
<li>Der aktuelle Jackpot dieser Saison beträgt <strong><?php echo rtrim(rtrim(number_format($jackpot, 2, ',', '.'), '0'), ','); ?> €</strong><?php if ($jackpotStatus['won']): ?> und wurde bereits von <?php echo htmlspecialchars(implode(', ', $jackpotStatus['winners'])); ?> abgeräumt<?php endif; ?>.</li>
|
||||
<li>Er speist sich <strong>nicht</strong> aus dem Pott, sondern wird separat vorgehalten.</li>
|
||||
<li>Er wird <strong>maximal einmal pro Saison</strong> ausgeschüttet, wenn ein Spieler <strong>alle Spiele exakt richtig</strong> tippt.</li>
|
||||
<li>Schaffen das in derselben Runde mehrere Spieler, teilen sie sich den Jackpot.</li>
|
||||
<li>In der Rangliste wird der Gewinn in der Spalte <span style="font-size:1.2em;">💰</span> <strong>Jackpot</strong> ausgewiesen. Er fließt auch in die <a href="/index.php?page=money_ranking">Geldrangliste</a> und die Kontoliste ein.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="gewinne">7. 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>
|
||||
|
|
@ -137,7 +147,7 @@ Dasselbe Ergebnis darfst du pro Saison höchstens
|
|||
<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>
|
||||
<h2 id="app">8. 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>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,16 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="quota-section">
|
||||
<h3>Jackpot</h3>
|
||||
<table class="info-table">
|
||||
<tr><th>Jackpot (4-Spiele Treffer)</th><td><?php echo $euro($jackpot); ?></td></tr>
|
||||
<?php if ($jackpotStatus['won']): ?>
|
||||
<tr><th>Gewonnen von</th><td><?php echo htmlspecialchars(implode(', ', $jackpotStatus['winners'])); ?></td></tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="quota-section">
|
||||
<h3>Spielquoten</h3>
|
||||
<table class="info-table">
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
font-size: 2rem; /* Größe verdoppeln */
|
||||
vertical-align: middle;
|
||||
}
|
||||
.jackpot-icon {
|
||||
font-size: 1.6rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#round_id {
|
||||
font-size: inherit; /* Schriftgröße an die Umgebung anpassen */
|
||||
}
|
||||
|
|
@ -116,6 +120,7 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
.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; }
|
||||
.legend.legend-footer .jackpot-icon { font-size: 1em; }
|
||||
|
||||
/* Rundenpunkte als Link mit Aufschlüsselungs-Popup */
|
||||
.round-points-link {
|
||||
|
|
@ -223,6 +228,18 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
<span class="rotated-label">Joker</span>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($roundCompleted): ?>
|
||||
<th class="rotated-header"><span class="rotated-label">Preisgeld Tagessieg</span></th>
|
||||
<?php endif; ?>
|
||||
<?php if ($roundHasJackpot): ?>
|
||||
<th class="game-header" title="Jackpot">
|
||||
<span class="jackpot-icon">💰</span>
|
||||
<span class="rotated-label">Jackpot</span>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php if ($isFinalRound): ?>
|
||||
<th class="rotated-header"><span class="rotated-label">Preisgeld Platzierung</span></th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -280,6 +297,15 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($roundCompleted): ?>
|
||||
<td class="text-center"><?php echo $entry['payout'] > 0 ? number_format($entry['payout'], 2, ',', '.') . ' €' : ''; ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($roundHasJackpot): ?>
|
||||
<td class="text-center"><?php echo $entry['jackpot_payout'] > 0 ? '<span class="jackpot-icon">💰</span> ' . number_format($entry['jackpot_payout'], 2, ',', '.') . ' €' : ''; ?></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($isFinalRound): ?>
|
||||
<td class="text-center"><?php echo $entry['ranking_payout'] > 0 ? number_format($entry['ranking_payout'], 2, ',', '.') . ' €' : ''; ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
@ -295,6 +321,15 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
<td class="text-center"><?php echo ((int)$game['score2'] > -1) ? (int)$game['score2'] : ''; ?></td>
|
||||
<td></td>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($roundCompleted): ?>
|
||||
<td></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($roundHasJackpot): ?>
|
||||
<td></td>
|
||||
<?php endif; ?>
|
||||
<?php if ($isFinalRound): ?>
|
||||
<td></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
@ -304,6 +339,9 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
|
||||
<div class="legend legend-footer">
|
||||
<div class="legend-item"><span class="daily-winner-icon">🏆</span> Tagessieger</div>
|
||||
<?php if ($roundHasJackpot): ?>
|
||||
<div class="legend-item"><span class="jackpot-icon">💰</span> Jackpot</div>
|
||||
<?php endif; ?>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ $teamLogo = function ($name) {
|
|||
|
||||
<h1>Spieltipp:</h1>
|
||||
|
||||
<div>Bereits verwendete Joker: <?php echo htmlspecialchars($jokerUsage); ?></div>
|
||||
<div>Maximale Anzahl gleicher Joker: <?php echo $maxIdenticalJokertipps; ?></div>
|
||||
|
||||
<p><strong>
|
||||
<span class="team-cell"><?php $l1 = $teamLogo($game['team1']); if ($l1): ?><img src="<?php echo htmlspecialchars($l1); ?>" alt="" class="team-logo"><?php endif; ?><?php echo htmlspecialchars($game['team1']); ?></span>
|
||||
:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ $teamLogo = function ($name) {
|
|||
|
||||
<h2><?php echo htmlspecialchars($round['name']); ?></h2>
|
||||
|
||||
<div>Bereits verwendete Joker: <?php echo htmlspecialchars($jokerUsage); ?></div>
|
||||
<div>Maximale Anzahl gleicher Joker: <?php echo $maxIdenticalJokertipps; ?></div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<p style="color: red;"><?php echo htmlspecialchars($error); ?></p>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ CREATE TABLE `seasons` (
|
|||
`name` varchar(100) NOT NULL,
|
||||
`rounds` int(11) NOT NULL DEFAULT '36',
|
||||
`max_identical_jokertipps` int(11) NOT NULL DEFAULT '6',
|
||||
`jackpot` decimal(10,2) NOT NULL DEFAULT '0.00',
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
|
|
@ -133,6 +134,7 @@ DROP TABLE IF EXISTS `roundmails`;
|
|||
CREATE TABLE `roundmails` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) NOT NULL,
|
||||
`season_id` int(11) NOT NULL DEFAULT '0',
|
||||
`send_date` date NOT NULL,
|
||||
`recipients` text NOT NULL,
|
||||
`topic` varchar(200) NOT NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue