LuminaWebsite/raids.php
Maaxxs c4f94bf84a Member feedback: raid input checks and fixed raid points, premades in the raid form, live raid page, Lumina-style dialogs, leadership calendar entries, class-based weapon picker, map and tactics fixes
- Raids: "Max. Spieler" only whole numbers up to groups x 5 (max. 10 groups / 50), gearscore only a number; fixed +1 Lumipunkt per participation, other values only with the new raids.points permission; pick an existing premade per group when creating a raid; unchanged legacy values no longer block editing
- Raid page updates itself every 15 s while visible (raids_live.php, cards rendered by includes/raid_card.php), open editors and confirm dialogs are kept
- Restore takes the new raid_id from the bot (archived messages are now deleted in Discord) and moves settings, attendance and awards; website signups send the server display name
- Premades: dissolve by leadership needs a reason, lead gets DMs on join/assign/decline/remove (source/actor_id sent to the bot), transfer picker skips players who already lead a group, website accept keeps the one-group rule, no commas in names
- Site-wide Lumina dialog (assets/js/confirm-dialog.js) replaces confirm/prompt/alert via data-confirm; error flashes are a dialog you confirm with OK
- Calendar: audience per entry (all / leadership takes part / internal) with the new calendar.leadership permission; day cells list all entries and scroll
- Gear planner: main-hand picker filtered by the set's class, mismatches marked, "keine Klasse" option, link to an external skill/Daevanion plan per set
- Map: correct kisk icons (Elyos on Verteron/Abyss, Altgard fixed), per-map max zoom and bounded panning, German texts, data source note
- Tactics: toolbar as a uniform grid, whole-tactic copy, automatic versions with restore and a 90-day trash, official tactics protected
- Global thin gold scrollbars, readable hover colours, "Sedes Luminis" spelling, patch notes and README, schema version 34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 16:12:18 +02:00

209 lines
9.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/raids_api.php';
require_once __DIR__ . '/includes/raid_attendance.php';
require_once __DIR__ . '/includes/raid_card.php';
require_permission('raids.view');
$currentUser = current_user();
$currentDiscordId = $currentUser['discord_id'] ?? null;
$canManageRaids = user_has_permission('raids.manage');
$canSetRaidPoints = $canManageRaids && user_has_permission('raids.points');
$classOptions = AION_CLASSES;
$status = (string) ($_GET['status'] ?? 'active');
if (!in_array($status, RAID_STATUSES, true)) {
$status = 'active';
}
$raids = [];
$apiError = null;
try {
$raids = fetch_raids($status);
} catch (Throwable $e) {
$apiError = $e->getMessage();
}
// Automatische Lumipunkte fuer inzwischen archivierte Raids (auch im Discord archivierte).
foreach (raid_process_auto_points($apiError ? null : $raids) as $autoMessage) {
if ($autoMessage !== '' && $canManageRaids) {
set_flash('info', $autoMessage);
}
}
try {
$raidSettings = raid_settings_all();
} catch (PDOException $e) {
$raidSettings = [];
}
$premades = [];
if ($canManageRaids) {
try {
$premades = fetch_premades();
} catch (Throwable $e) {
$premades = [];
}
}
$statusLabels = [
'active' => 'Aktiv',
'archived' => 'Archiviert',
'all' => 'Alle',
];
$emptyLabels = [
'active' => 'Aktuell sind keine aktiven Raids geplant.',
'archived' => 'Es sind keine archivierten Raids vorhanden.',
'all' => 'Aktuell sind keine Raids vorhanden.',
];
$pageTitle = 'Raids';
include __DIR__ . '/includes/header.php';
?>
<div class="panel">
<div class="raid-header">
<h1>Raids</h1>
<?php if ($canManageRaids): ?>
<button type="button" class="button" id="raid-create-toggle">+ Neuer Raid</button>
<?php endif; ?>
</div>
<p class="text-muted">Raid-Termine deiner Legion.</p>
<div class="filter-tabs">
<?php foreach ($statusLabels as $value => $label): ?>
<a href="/raids.php?status=<?= e($value) ?>" class="filter-tab<?= $status === $value ? ' active' : '' ?>"><?= e($label) ?></a>
<?php endforeach; ?>
</div>
<?php if (!$apiError && !empty($raids)): ?>
<div class="list-search-bar">
<label class="search-field">
<?= icon('search') ?>
<input type="search" id="raid-search" placeholder="Raid, Termin, Spieler oder Klasse suchen …" aria-label="Raids durchsuchen"
value="<?= e((string) ($_GET['q'] ?? '')) ?>">
</label>
<span class="list-search-count text-muted" id="raid-search-count"></span>
</div>
<?php endif; ?>
</div>
<p class="panel text-muted" id="raid-search-empty" hidden>Kein Raid passt zur Suche.</p>
<?php if ($canManageRaids): ?>
<div class="panel" id="raid-create-panel" style="display:none;">
<h2>Neuen Raid erstellen</h2>
<form id="raid-create-form">
<div class="raid-edit-grid">
<div>
<label>Titel</label>
<input type="text" name="title" placeholder="z. B. Zauberreum HM" maxlength="60" required>
</div>
<div>
<label>Datum &amp; Uhrzeit</label>
<input type="datetime-local" name="date_local" required>
</div>
<div>
<label>Max. Spieler</label>
<input type="number" name="max_slots" value="<?= RAID_GROUP_SIZE ?>" min="1" max="<?= RAID_GROUP_SIZE ?>" step="1" inputmode="numeric" required>
</div>
<div>
<label>Gearscore</label>
<input type="text" name="gearscore" placeholder="optional, z. B. 2.100" maxlength="6" inputmode="numeric" pattern="[0-9. ]{1,6}" title="Nur Zahlen, z. B. 2.100">
</div>
</div>
<div class="raid-edit-requirements">
<label>Anforderungen</label>
<textarea name="requirements" rows="3" placeholder="Setup / Rollenvorgabe" maxlength="80" required></textarea>
</div>
<?php if ($canSetRaidPoints): ?>
<div class="raid-points-fields">
<div>
<label><?= contribution_coin(16) ?> Punkte für Anwesende beim Archivieren</label>
<input type="number" name="points_present" min="0" max="<?= RAID_POINTS_MAX ?>" step="1" value="<?= RAID_POINTS_DEFAULT_PRESENT ?>">
</div>
<div>
<label>Abzug für Abwesende</label>
<input type="number" name="points_absent" min="0" max="<?= RAID_POINTS_MAX ?>" step="1" value="<?= RAID_POINTS_DEFAULT_ABSENT ?>">
</div>
<p class="field-hint">Wird beim Archivieren automatisch vergeben - außer es wurden vorher schon Punkte für den Raid verteilt. Ohne Anwesenheitsliste bekommen alle in den Gruppen die Punkte, einen Abzug gibt es dann nicht. Standard: +<?= RAID_POINTS_DEFAULT_PRESENT ?> pro Teilnahme, höchstens <?= RAID_POINTS_MAX ?>; 0 = keine Automatik.</p>
</div>
<?php else: ?>
<p class="field-hint raid-points-fixed"><?= contribution_coin(15) ?> <?= e(raid_points_summary(RAID_POINTS_DEFAULT_PRESENT, RAID_POINTS_DEFAULT_ABSENT)) ?> – die Werte legt die Legionsleitung fest.</p>
<?php endif; ?>
<?php
$premadeOptions = array_map(static fn (array $p): array => ['id' => (int) ($p['id'] ?? 0), 'name' => (string) ($p['name'] ?? '')], $premades);
?>
<div class="group-editor" data-locks="0" data-max-groups="<?= RAID_MAX_GROUPS ?>" data-group-size="<?= RAID_GROUP_SIZE ?>"
<?php if (!empty($premadeOptions)): ?>data-premades='<?= e(json_encode($premadeOptions, JSON_UNESCAPED_UNICODE)) ?>'<?php endif; ?>>
<label>Gruppen</label>
<p class="field-hint">Jede Gruppe hat <?= RAID_GROUP_SIZE ?> Plätze (1 Tank, 1 Heiler, 3 DPS) und füllt sich über die Anmeldungen.<?php if (!empty($premadeOptions)): ?> Eine feste Premade kannst du direkt einer Gruppe zuordnen – die Gruppe heißt dann wie die Premade, wird gesperrt und die Mitglieder bekommen eine Einladung per Discord-PN.<?php endif; ?></p>
<div class="group-editor-rows">
<div class="group-editor-row">
<input type="text" class="group-editor-name" value="Gruppe 1" placeholder="Gruppenname">
<button type="button" class="icon-button group-editor-remove" title="Gruppe entfernen"><?= icon('x') ?></button>
</div>
</div>
<button type="button" class="button-secondary group-editor-add">+ Gruppe hinzufügen</button>
</div>
<div class="actions">
<button type="submit">Raid erstellen</button>
<span class="raid-create-feedback text-muted"></span>
</div>
</form>
</div>
<?php endif; ?>
<?php if ($apiError): ?>
<div class="panel">
<div class="flash flash-error">Raid-Daten konnten nicht geladen werden: <?= e($apiError) ?></div>
</div>
<?php elseif (empty($raids)): ?>
<div id="raid-list" data-status="<?= e($status) ?>">
<div class="panel">
<p class="text-muted"><?= e($emptyLabels[$status]) ?></p>
</div>
</div>
<?php else: ?>
<?php
$cardContext = [
'status' => $status,
'current_discord_id' => $currentDiscordId,
'can_manage' => $canManageRaids,
'can_set_points' => $canSetRaidPoints,
'settings' => $raidSettings,
'premades' => $premades,
];
?>
<div id="raid-list" data-status="<?= e($status) ?>">
<?php foreach ($raids as $raid): ?>
<?php render_raid_card($raid, $cardContext); ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<!-- Gemeinsames Anmelde-Popup fuer alle Raids auf dieser Seite -->
<div id="raid-signup-modal" class="modal-overlay" hidden>
<div class="modal">
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
<h2>Zum Raid anmelden</h2>
<p class="text-muted">Wähle deine Klasse. Die Gruppe ist optional – ohne Auswahl teilt der Bot dich automatisch sinnvoll ein.</p>
<div class="class-picker">
<?php foreach ($classOptions as $classOption): ?>
<button type="button" class="class-picker-option" data-class="<?= e($classOption) ?>">
<span class="class-icon-frame"><img src="<?= e(class_icon_url($classOption)) ?>" alt=""></span>
<span class="class-picker-label"><?= e($classOption) ?></span>
</button>
<?php endforeach; ?>
</div>
<div>
<label>Wunschgruppe (optional)</label>
<div class="group-picker" id="raid-signup-group-picker"></div>
</div>
<div id="raid-signup-feedback" class="raid-modal-feedback"></div>
<div class="actions">
<button type="button" id="raid-signup-confirm">Anmelden</button>
</div>
</div>
</div>
<script src="<?= e(asset_url('/assets/js/raids.js')) ?>"></script>
<script src="<?= e(asset_url('/assets/js/raid-search.js')) ?>"></script>
<?php include __DIR__ . '/includes/footer.php'; ?>