umfassende updates
This commit is contained in:
parent
3331f08091
commit
50cd802d33
16 changed files with 441 additions and 78 deletions
|
|
@ -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.";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue