0 ? fetch_raid_by_id($raidId) : null; } catch (Throwable $e) { $apiError = $e->getMessage(); } if (!$raid && !$apiError) { set_flash('error', 'Dieser Raid wurde nicht gefunden.'); redirect('/raids.php'); } $settings = raid_settings_get($raidId); $attendance = raid_attendance_get($raidId); $userIds = raid_user_ids_by_discord(); // Zeilen der Liste: alle Anmeldungen plus bereits erfasste Personen, die (inzwischen) nicht // mehr angemeldet sind oder von Hand hinzugefuegt wurden. $rows = []; if ($raid) { $split = raid_signups_split($raid); $groupNames = array_values(array_filter(array_map('trim', explode(',', (string) ($raid['groups'] ?? ''))))); foreach (['groups' => null, 'bench' => 'Ersatzbank', 'declined' => 'Abgemeldet'] as $key => $label) { foreach ($split[$key] as $signup) { $discordId = (string) ($signup['user_id'] ?? ''); if ($discordId === '') { continue; } $group = (int) ($signup['group'] ?? 0); $rows[$discordId] = [ 'discord_id' => $discordId, 'name' => (string) ($signup['name'] ?? '?'), 'class' => (string) ($signup['class'] ?? ''), 'where' => $label ?? ($groupNames[$group - 1] ?? 'Gruppe ' . $group), 'section' => $key, ]; } } } foreach ($attendance as $discordId => $entry) { if (!isset($rows[$discordId])) { $rows[$discordId] = [ 'discord_id' => $discordId, 'name' => $entry['name'] !== '' ? $entry['name'] : $discordId, 'class' => '', 'where' => 'Nachgetragen', 'section' => 'extra', ]; } } // Zum Nachtragen: Website-Konten mit Discord-Verknuepfung, die noch nicht in der Liste stehen. $addable = array_values(array_filter(member_picker_rows(), static fn (array $u): bool => !empty($u['discord_id']) && !isset($rows[(string) $u['discord_id']]))); $title = $raid ? (string) ($raid['title'] ?? 'Raid') : 'Raid'; $timestamp = $raid ? (int) ($raid['timestamp'] ?? 0) : 0; $isArchived = $raid && (!empty($raid['archived']) || !empty($raid['archived_at'])); $pageTitle = 'Anwesenheit'; include __DIR__ . '/includes/header.php'; ?>
= $timestamp ? e(date('d.m.Y H:i', $timestamp)) . ' Uhr' : '' ?> = $isArchived ? ' · archiviert' : '' ?>