diff --git a/README.md b/README.md index 8eb7c4c..8480bab 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ und wird später ausgebaut. Fokus dieser Version ist der Mitglieder-/Admin-Berei - Jeder Benutzer kann mehreren Berechtigungsgruppen angehören - Raids-Seite: zeigt anstehende Raid-Termine, Anforderungen, Gruppen und Anmeldungen, bezogen von einer externen API (`config.php: raids_api`), Filter Aktiv/Archiviert/Alle +- "Mein Profil"-Seite: Anzeigename ändern, Passwort ändern, Discord-Verknüpfung verwalten - Discord-Verknüpfung: Mitglieder können ihren Discord-Account per OAuth mit ihrem Website-Account verknüpfen (nötig, um sich über die Website zu Raids anzumelden) - Raid-Anmeldung: verknüpfte Mitglieder können sich direkt über die Website zu einem Raid diff --git a/assets/css/style.css b/assets/css/style.css index abf0e76..4a70db0 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -401,6 +401,34 @@ input:focus, select:focus, textarea:focus { flex-shrink: 0; } +.class-icon-placeholder { + display: inline-flex; + align-items: center; + justify-content: center; + width: 28px; + height: 28px; + margin-right: 0.5rem; + flex-shrink: 0; + font-size: 1rem; +} + +.raid-group-bench { border-style: dashed; } + +.raid-signup-pending { color: var(--text-muted); font-style: italic; } + +.raid-declined { + margin-top: 0.75rem; + padding-top: 0.75rem; + border-top: 1px solid var(--border); +} + +.raid-meta-line { + display: flex; + align-items: center; + gap: 0.4rem; +} +.raid-meta-line .icon { color: var(--text-muted); } + .panel-archived { opacity: 0.7; } .raid-signup-note { diff --git a/dashboard.php b/dashboard.php index cdc803e..26a2716 100644 --- a/dashboard.php +++ b/dashboard.php @@ -15,33 +15,26 @@ include __DIR__ . '/includes/header.php';

Dies ist dein Mitgliederbereich. Die eigentliche Gilden-Homepage folgt hier später.

-
-

Discord-Verknüpfung

- -

Verknüpft als

-
- - -
- -

Verknüpfe deinen Discord-Account, um dich über die Website zu Raids anmelden zu können.

- Mit Discord verknüpfen - -
- -
+ + +
-
diff --git a/includes/functions.php b/includes/functions.php index dcdb0ec..df15251 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -70,6 +70,9 @@ function icon(string $name): string 'log-out' => '', 'lock' => '', 'calendar' => '', + 'profile' => '', + 'link' => '', + 'list' => '', ]; $path = $paths[$name] ?? ''; @@ -99,6 +102,8 @@ function class_icon_url(string $className): ?string 'magier' => 'Sorcerer_ICO.png', 'spiritmaster' => 'Spiritmaster_ICO.png', 'geisterbeschwörer' => 'Spiritmaster_ICO.png', + 'beschwörer' => 'Spiritmaster_ICO.png', + 'kantor' => 'Chanter_ICO.png', 'templar' => 'Templar_ICO.png', 'templer' => 'Templar_ICO.png', ]; diff --git a/includes/header.php b/includes/header.php index effeb72..6591544 100644 --- a/includes/header.php +++ b/includes/header.php @@ -8,6 +8,7 @@ $showAdminMenu = $canViewUsers || $canManageRoles; $currentScript = basename((string) ($_SERVER['SCRIPT_NAME'] ?? '')); $isDashboardActive = $currentScript === 'dashboard.php'; +$isProfileActive = $currentScript === 'profile.php'; $isRaidsActive = $currentScript === 'raids.php'; $isUsersActive = in_array($currentScript, ['users.php', 'user_form.php', 'user_delete.php'], true); $isRolesActive = in_array($currentScript, ['roles.php', 'role_form.php', 'role_delete.php'], true); @@ -29,6 +30,9 @@ $isRolesActive = in_array($currentScript, ['roles.php', 'role_form.php', 'role_d Dashboard + + Mein Profil + Raids diff --git a/profile.php b/profile.php new file mode 100644 index 0000000..0c61d59 --- /dev/null +++ b/profile.php @@ -0,0 +1,68 @@ +prepare('UPDATE users SET display_name = ? WHERE id = ?')->execute([$displayName, $user['id']]); + set_flash('success', 'Profil wurde aktualisiert.'); + redirect('/profile.php'); + } + $user['display_name'] = $displayName; +} + +$pageTitle = 'Mein Profil'; +include __DIR__ . '/includes/header.php'; +?> +
+

Mein Profil

+

Benutzername:

+
+ +
+

Anzeigename

+ +
+ +
+ +
+ + +
+ +
+
+ +
+ +
+
+
+

Discord-Verknüpfung

+ +

Verknüpft als

+
+ + +
+ +

Verknüpfe deinen Discord-Account, um dich über die Website zu Raids anmelden zu können.

+ Mit Discord verknüpfen + +
+
+ + diff --git a/raid_signup.php b/raid_signup.php index ab6fd11..b45adaa 100644 --- a/raid_signup.php +++ b/raid_signup.php @@ -22,13 +22,15 @@ if (empty($user['discord_id'])) { $raidId = (int) ($_POST['raid_id'] ?? 0); $class = trim((string) ($_POST['class'] ?? '')); -$group = (int) ($_POST['group'] ?? 0); +$groupRaw = $_POST['group'] ?? ''; -if ($raidId <= 0 || $class === '' || $group <= 0) { +if ($raidId <= 0 || $class === '' || !is_numeric($groupRaw) || (int) $groupRaw < 0) { set_flash('error', 'Bitte Klasse und Gruppe auswählen.'); redirect($redirectTo); } +$group = (int) $groupRaw; + try { raid_signup($raidId, (int) $user['discord_id'], (string) $user['discord_username'], $class, $group); set_flash('success', 'Anmeldung gespeichert.'); diff --git a/raids.php b/raids.php index a296ae6..46aa480 100644 --- a/raids.php +++ b/raids.php @@ -3,11 +3,38 @@ require_once __DIR__ . '/includes/bootstrap.php'; require_once __DIR__ . '/includes/raids_api.php'; require_permission('raids.view'); +function render_signup_list(array $members): void +{ + ?> +
    + + +
+ =1 echte Gruppe, 0 Ersatzbank, -1 abgemeldet. $signupsByGroup = []; + $benchSignups = []; + $declinedSignups = []; $mySignup = null; foreach ($signups as $signup) { $groupNumber = (int) ($signup['group'] ?? 0); - $signupsByGroup[$groupNumber][] = $signup; - if ($currentDiscordId && (string) ($signup['user_id'] ?? '') === (string) $currentDiscordId) { + if ($groupNumber >= 1) { + $signupsByGroup[$groupNumber][] = $signup; + } elseif ($groupNumber === 0) { + $benchSignups[] = $signup; + } else { + $declinedSignups[] = $signup; + } + if ($currentDiscordId && (string) ($signup['user_id'] ?? '') === (string) $currentDiscordId && $groupNumber >= 0) { $mySignup = $signup; } } + + // Wie im Bot-Embed zaehlen nur echte, bestaetigte Anmeldungen als "aktiv". + $activeCount = 0; + foreach ($signupsByGroup as $groupMembers) { + foreach ($groupMembers as $groupMember) { + if (($groupMember['class'] ?? '') !== 'Ausstehend') { + $activeCount++; + } + } + } ?>
@@ -89,7 +135,7 @@ include __DIR__ . '/includes/header.php'; Archiviert - / angemeldet + / angemeldet
@@ -111,7 +157,7 @@ include __DIR__ . '/includes/header.php';

-

Anforderungen:

+

Anforderungen:

Gearscore:

@@ -122,43 +168,42 @@ include __DIR__ . '/includes/header.php'; $groupName): ?>
-

+

()

Keine Anmeldungen

-
    - - -
  • - - <?= e($memberClass) ?> - - - - () - -
  • - -
+
+ +
+

Ersatzbank ()

+ +
+
+ +

+ Abgemeldet: (string) ($s['name'] ?? '?'), $declinedSignups))) ?> +

+ + - +