- Discord sync (login and live check) stores every class role of a member in users.classes (role names match the classes, German and English names are recognised); users.class_name is the main class: the one chosen in the profile (users.main_class) while the member still has it, otherwise the highest class role; no class role means no class - The guild role list is fetched once per request and kept when the bot is briefly unreachable (it used to be emptied); nothing is changed while the role list is unknown - Profile: the manual class select is gone; new "Klassen" card with the detected classes, main class choice for members with several classes and a "Jetzt mit Discord abgleichen" button (at most every 30 s and 10 per hour, new security bucket discord_sync with a log entry) - Main class first on the profile page, in the member list (the class filter also finds secondary classes), in the raid signup and premade class pickers (own classes first, main preselected for new raid signups) - Berechtigungsgruppen shows which Discord roles count as classes - Schema version 36 (users.classes filled from class_name until the first sync, users.main_class), patch notes, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
424 lines
26 KiB
PHP
424 lines
26 KiB
PHP
<?php
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/raids_api.php';
|
||
require_permission('premades.view');
|
||
|
||
$user = current_user();
|
||
$discordId = $user['discord_id'] ? (int) $user['discord_id'] : null;
|
||
$canManage = user_has_permission('premades.manage');
|
||
|
||
$premades = [];
|
||
$apiError = null;
|
||
try {
|
||
$premades = fetch_premades();
|
||
} catch (Throwable $e) {
|
||
$apiError = $e->getMessage();
|
||
}
|
||
|
||
// Alle vorkommenden Discord-IDs (Owner + Mitglieder) auf Website-Accounts abbilden,
|
||
// damit echte Anzeigenamen statt roher Discord-IDs gezeigt werden koennen.
|
||
$allDiscordIds = [];
|
||
foreach ($premades as $p) {
|
||
$allDiscordIds[] = (int) ($p['owner_id'] ?? 0);
|
||
foreach ($p['members'] ?? [] as $m) {
|
||
$allDiscordIds[] = (int) ($m['user_id'] ?? 0);
|
||
}
|
||
}
|
||
$allDiscordIds = array_values(array_unique(array_filter($allDiscordIds)));
|
||
|
||
$namesByDiscordId = [];
|
||
$linkedUsersByDiscordId = [];
|
||
if (!empty($allDiscordIds)) {
|
||
$placeholders = implode(',', array_fill(0, count($allDiscordIds), '?'));
|
||
$stmt = db()->prepare("SELECT id, discord_id, discord_username, display_name, avatar_filename, class_name FROM users WHERE discord_id IN ($placeholders)");
|
||
$stmt->execute($allDiscordIds);
|
||
foreach ($stmt->fetchAll() as $row) {
|
||
$name = $row['display_name'] !== '' ? $row['display_name'] : $row['discord_username'];
|
||
$namesByDiscordId[(int) $row['discord_id']] = $name;
|
||
$linkedUsersByDiscordId[(int) $row['discord_id']] = $row;
|
||
}
|
||
}
|
||
|
||
$myPendingInvites = $discordId ? find_my_pending_invites($premades, $discordId) : [];
|
||
|
||
// Eigene Premades (als Lead oder Mitglied - die Leitung kann Spieler in mehrere Gruppen
|
||
// einteilen) stehen immer ganz oben in der Liste.
|
||
if ($discordId) {
|
||
usort($premades, function (array $a, array $b) use ($discordId): int {
|
||
return (int) premade_has_user($b, $discordId, false) <=> (int) premade_has_user($a, $discordId, false);
|
||
});
|
||
}
|
||
|
||
// Wer als Lead oder angenommenes Mitglied schon in einer Gruppe ist (Regel im Bot fuer
|
||
// normale Einladungen), bzw. wer selbst eine Gruppe leitet.
|
||
$busyDiscordIds = [];
|
||
$ownerDiscordIds = [];
|
||
foreach ($premades as $p) {
|
||
if ((int) ($p['owner_id'] ?? 0) > 0) {
|
||
$busyDiscordIds[] = (int) $p['owner_id'];
|
||
$ownerDiscordIds[] = (int) $p['owner_id'];
|
||
}
|
||
foreach ($p['members'] ?? [] as $m) {
|
||
if (($m['status'] ?? '') === 'accepted') {
|
||
$busyDiscordIds[] = (int) ($m['user_id'] ?? 0);
|
||
}
|
||
}
|
||
}
|
||
// Alle verknuepften Konten fuer das Einladen-Popup - welche davon pro Gruppe infrage kommen,
|
||
// entscheidet premade_invite_candidates().
|
||
$inviteCandidates = db()->query("SELECT id, discord_id, discord_username, display_name, avatar_filename FROM users WHERE discord_id IS NOT NULL AND status = 'active' ORDER BY display_name, username")->fetchAll();
|
||
|
||
/**
|
||
* Discord-IDs, die in diese Premade eingeladen bzw. eingeteilt werden koennen: die Leitung
|
||
* teilt jeden ein, der noch nicht drin ist (auch in mehrere Gruppen); ein Lead laedt nur
|
||
* Spieler ein, die noch in keiner Gruppe sind.
|
||
*
|
||
* @return array<int, int>
|
||
*/
|
||
function premade_invite_candidates(array $premade, array $inviteCandidates, array $busyDiscordIds, bool $canManage): array
|
||
{
|
||
$ids = [];
|
||
foreach ($inviteCandidates as $row) {
|
||
$id = (int) $row['discord_id'];
|
||
if (premade_has_user($premade, $id) || (!$canManage && in_array($id, $busyDiscordIds, true))) {
|
||
continue;
|
||
}
|
||
$ids[] = $id;
|
||
}
|
||
return $ids;
|
||
}
|
||
|
||
$pageTitle = 'Premades';
|
||
include __DIR__ . '/includes/header.php';
|
||
?>
|
||
<div class="panel">
|
||
<h1>Premades</h1>
|
||
<p class="text-muted">Feste Gruppen für Raids. Jeder kann höchstens einer Premade gleichzeitig angehören.</p>
|
||
</div>
|
||
|
||
<?php if ($apiError): ?>
|
||
<div class="panel">
|
||
<div class="flash flash-error">Premades konnten nicht geladen werden: <?= e($apiError) ?></div>
|
||
</div>
|
||
<?php else: ?>
|
||
|
||
<?php if (!empty($myPendingInvites)): ?>
|
||
<div class="panel">
|
||
<h2>Meine Einladungen</h2>
|
||
<?php foreach ($myPendingInvites as $invite): ?>
|
||
<div class="premade-invite-row">
|
||
<div>
|
||
Einladung zu <strong><?= e((string) ($invite['name'] ?? '')) ?></strong>
|
||
von <?= e(premade_name_for((int) ($invite['owner_id'] ?? 0), $namesByDiscordId, $invite['owner_name'] ?? null)) ?>
|
||
</div>
|
||
<div class="actions">
|
||
<form method="post" action="/premade_action.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="accept">
|
||
<input type="hidden" name="premade_id" value="<?= (int) ($invite['id'] ?? 0) ?>">
|
||
<button type="submit">Annehmen</button>
|
||
</form>
|
||
<form method="post" action="/premade_action.php" class="inline-form">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="decline">
|
||
<input type="hidden" name="premade_id" value="<?= (int) ($invite['id'] ?? 0) ?>">
|
||
<button type="submit" class="button-secondary">Ablehnen</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
// Mitglieder gruenden fuer sich selbst, solange sie in keiner Premade sind. Die Leitung
|
||
// (premades.manage) gruendet beliebig viele Gruppen - ohne Lead oder mit einem Lead, der
|
||
// noch keine eigene Gruppe leitet.
|
||
$canFoundSelf = $discordId && find_my_premade($premades, $discordId) === null;
|
||
$leadItems = [];
|
||
if ($canManage) {
|
||
foreach (member_picker_rows() as $row) {
|
||
if (!empty($row['discord_id']) && !in_array((int) $row['discord_id'], $ownerDiscordIds, true)) {
|
||
$leadItems[] = member_picker_item($row, 'discord_id');
|
||
}
|
||
}
|
||
}
|
||
?>
|
||
<?php if ($canFoundSelf || $canManage): ?>
|
||
<div class="panel">
|
||
<h2>Neue Premade gründen</h2>
|
||
<?php if ($canManage): ?>
|
||
<p class="text-muted">Als Leitung kannst du beliebig viele Gruppen anlegen. Ohne Auswahl entsteht die Gruppe ohne Lead - Spieler teilst du danach über die freien Plätze ein (auch in mehrere Gruppen). Einen Lead kannst du später aus den Mitgliedern bestimmen.</p>
|
||
<?php endif; ?>
|
||
<form method="post" action="/premade_action.php" class="raid-premade-row">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="create">
|
||
<input type="text" name="name" placeholder="Name der Premade-Gruppe" minlength="<?= PREMADE_NAME_MIN ?>" maxlength="<?= PREMADE_NAME_MAX ?>" required style="width:auto;flex:1;min-width:200px;">
|
||
<?php if ($canManage): ?>
|
||
<?= member_picker('lead_id', 'premade-lead-list', $leadItems, [
|
||
'input_id' => 'premade-lead-search',
|
||
'placeholder' => 'Lead (optional) …',
|
||
]) ?>
|
||
<?php endif; ?>
|
||
<button type="submit">Gründen</button>
|
||
</form>
|
||
</div>
|
||
<?php elseif (!$discordId): ?>
|
||
<div class="panel">
|
||
<p class="text-muted">Verknüpfe deinen <a href="/profile.php">Discord-Account</a>, um eine Premade zu gründen oder beizutreten.</p>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (empty($premades)): ?>
|
||
<div class="panel">
|
||
<p class="text-muted">Aktuell gibt es keine Premade-Gruppen.</p>
|
||
</div>
|
||
<?php else: ?>
|
||
<?php foreach ($premades as $premade): ?>
|
||
<?php
|
||
$premadeId = (int) ($premade['id'] ?? 0);
|
||
$premadeName = (string) ($premade['name'] ?? '');
|
||
$ownerId = (int) ($premade['owner_id'] ?? 0);
|
||
$members = is_array($premade['members'] ?? null) ? $premade['members'] : [];
|
||
$accepted = array_filter($members, fn ($m) => ($m['status'] ?? '') === 'accepted' && (int) ($m['user_id'] ?? 0) !== $ownerId);
|
||
$pending = array_filter($members, fn ($m) => ($m['status'] ?? '') === 'pending');
|
||
$canManageThis = $canManage || ($discordId !== null && $ownerId === $discordId);
|
||
$memberCount = count($accepted) + ($ownerId > 0 ? 1 : 0);
|
||
$candidateIds = $canManageThis ? premade_invite_candidates($premade, $inviteCandidates, $busyDiscordIds, $canManage) : [];
|
||
?>
|
||
<div class="panel premade-panel" data-premade-id="<?= $premadeId ?>">
|
||
<div class="raid-header">
|
||
<h2>⚔️ <?= e($premadeName) ?></h2>
|
||
<div class="badge-group">
|
||
<?php if ($canManageThis): ?>
|
||
<button type="button" class="icon-button premade-edit-toggle" title="Premade bearbeiten" aria-pressed="false"><?= icon('edit') ?></button>
|
||
<?php endif; ?>
|
||
<?php if ($ownerId <= 0): ?><span class="badge" title="Diese Gruppe hat noch keinen Lead">Ohne Lead</span><?php endif; ?>
|
||
<span class="badge"><?= $memberCount ?> <?= $memberCount === 1 ? 'Mitglied' : 'Mitglieder' ?></span>
|
||
</div>
|
||
</div>
|
||
|
||
<?php
|
||
// Premades bilden eine volle 5er-Gruppe ab (Lead + bis zu 4 weitere) - freie
|
||
// Plaetze werden mit ausgegrauten Platzhaltern aufgefuellt.
|
||
$slots = build_premade_slots($premade, $namesByDiscordId);
|
||
$isMemberHere = false;
|
||
$myClass = null;
|
||
?>
|
||
<div class="premade-roster">
|
||
<?php foreach ($slots as $slot): ?>
|
||
<?php if ($slot['type'] === 'empty'): ?>
|
||
<?php $isInvitable = $canManageThis && !empty($candidateIds); ?>
|
||
<div class="premade-slot premade-slot-empty<?= $isInvitable ? ' premade-slot-invitable' : '' ?>">
|
||
<div class="premade-slot-inner">
|
||
<?php if ($isInvitable): ?>
|
||
<button type="button" class="premade-slot-invite-btn premade-edit-only" data-premade-id="<?= $premadeId ?>" data-candidates="<?= e(implode(',', $candidateIds)) ?>" data-direct="<?= $canManage ? '1' : '0' ?>" title="<?= $canManage ? 'Spieler einteilen' : 'Mitglied einladen' ?>">+</button>
|
||
<span class="premade-slot-placeholder premade-view-only" title="Zum Einladen oben rechts den Bearbeiten-Modus öffnen">+</span>
|
||
<?php elseif (!$canManageThis): ?>
|
||
<span class="premade-slot-placeholder" title="Nur der Leiter oder Verwalter kann hier einladen">+</span>
|
||
<?php else: ?>
|
||
<span class="premade-slot-placeholder" title="Aktuell gibt es keine einladbaren Mitglieder">+</span>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<?php else: ?>
|
||
<?php
|
||
$slotUser = premade_avatar_user((int) $slot['id'], $linkedUsersByDiscordId, $slot['name']);
|
||
$isMe = $discordId !== null && (int) $slot['id'] === $discordId;
|
||
if ($isMe && $slot['type'] !== 'pending') {
|
||
$myClass = $slot['class'] ?? null;
|
||
$isMemberHere = true;
|
||
}
|
||
?>
|
||
<div class="premade-slot premade-slot-<?= e($slot['type']) ?>">
|
||
<div class="premade-slot-inner">
|
||
<?= avatar_html($slotUser, 40) ?>
|
||
<div class="premade-slot-name">
|
||
<strong><?= $slot['type'] === 'pending' ? '⏳ ' : '' ?><?= e($slot['name']) ?></strong>
|
||
<?php if ($slot['type'] === 'pending'): ?>
|
||
<span class="text-muted">Einladung offen</span>
|
||
<?php elseif (!empty($slot['class'])): ?>
|
||
<?php $slotClassIcon = class_icon_url($slot['class']); ?>
|
||
<span class="premade-slot-class">
|
||
<?php if ($slotClassIcon): ?>
|
||
<img class="premade-slot-class-icon" src="<?= e($slotClassIcon) ?>" alt="">
|
||
<?php endif; ?>
|
||
<span class="text-muted"><?= e($slot['class']) ?></span>
|
||
</span>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php if ($slot['type'] === 'lead'): ?>
|
||
<span class="premade-crown" title="Lead der Premade"><?= icon('crown') ?></span>
|
||
<?php elseif ($canManageThis): ?>
|
||
<form method="post" action="/premade_action.php" class="inline-form premade-edit-only">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="remove_member">
|
||
<input type="hidden" name="premade_id" value="<?= $premadeId ?>">
|
||
<input type="hidden" name="user_id" value="<?= (int) $slot['id'] ?>">
|
||
<button type="submit" class="icon-button icon-button-danger" title="<?= $slot['type'] === 'pending' ? 'Einladung zurückziehen' : 'Aus der Premade entfernen' ?>"><?= icon('x') ?></button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php endforeach; ?>
|
||
|
||
<?php if ($isMemberHere): ?>
|
||
<?php $myClassIcon = !empty($myClass) ? class_icon_url($myClass) : null; ?>
|
||
<button type="button" class="premade-class-action" data-premade-id="<?= $premadeId ?>" data-current-class="<?= e((string) ($myClass ?? '')) ?>">
|
||
<span class="class-icon-frame premade-class-action-icon">
|
||
<?php if ($myClassIcon): ?>
|
||
<img src="<?= e($myClassIcon) ?>" alt="">
|
||
<?php else: ?>
|
||
<?= icon('edit') ?>
|
||
<?php endif; ?>
|
||
</span>
|
||
<span class="premade-slot-name">
|
||
<strong>Deine Klasse</strong>
|
||
<span class="text-muted"><?= $myClass ? e($myClass) : 'Nicht festgelegt' ?></span>
|
||
</span>
|
||
<span class="premade-class-action-label"><?= $myClass ? 'Ändern' : 'Festlegen' ?></span>
|
||
</button>
|
||
<?php endif; ?>
|
||
</div>
|
||
|
||
<?php if ($canManageThis): ?>
|
||
<div class="premade-manage premade-edit-only">
|
||
<form method="post" action="/premade_action.php" class="raid-premade-row">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="rename">
|
||
<input type="hidden" name="premade_id" value="<?= $premadeId ?>">
|
||
<input type="text" name="name" value="<?= e($premadeName) ?>" minlength="<?= PREMADE_NAME_MIN ?>" maxlength="<?= PREMADE_NAME_MAX ?>" required style="width:auto;flex:1;min-width:160px;">
|
||
<button type="submit" class="button-secondary">Umbenennen</button>
|
||
</form>
|
||
|
||
<?php
|
||
// Die Leitung kann nur an jemanden gehen, der nicht schon eine andere Premade leitet.
|
||
$transferCandidates = array_values(array_filter(
|
||
$accepted,
|
||
static fn (array $m): bool => !in_array((int) ($m['user_id'] ?? 0), $ownerDiscordIds, true)
|
||
));
|
||
?>
|
||
<?php if (!empty($accepted) && empty($transferCandidates)): ?>
|
||
<p class="field-hint">Alle Mitglieder leiten bereits eine eigene Premade – die Leitung kann gerade an niemanden übergehen.</p>
|
||
<?php elseif (!empty($transferCandidates)): ?>
|
||
<form method="post" action="/premade_action.php" class="raid-premade-row">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="transfer">
|
||
<input type="hidden" name="premade_id" value="<?= $premadeId ?>">
|
||
<?php
|
||
// Kandidaten als Suchliste: Name wie in der Premade, Avatar vom Website-Konto
|
||
$ownerItems = array_map(static function (array $candidate) use ($namesByDiscordId, $linkedUsersByDiscordId): array {
|
||
$discordId = (int) ($candidate['user_id'] ?? 0);
|
||
$linked = $linkedUsersByDiscordId[$discordId] ?? [];
|
||
return member_picker_item([
|
||
'discord_id' => (string) $discordId,
|
||
'name' => premade_name_for($discordId, $namesByDiscordId, $candidate['name'] ?? null),
|
||
'avatar_filename' => $linked['avatar_filename'] ?? null,
|
||
'class_name' => $candidate['class'] ?? ($linked['class_name'] ?? null),
|
||
'top_role' => 'Premade-Mitglied',
|
||
], 'discord_id');
|
||
}, $transferCandidates);
|
||
?>
|
||
<?= member_picker('new_owner_id', 'premade-owner-' . $premadeId, $ownerItems, [
|
||
'required' => true,
|
||
'input_id' => 'premade-owner-search-' . $premadeId,
|
||
'placeholder' => $ownerId > 0 ? 'Neue Leitung wählen …' : 'Lead aus den Mitgliedern wählen …',
|
||
]) ?>
|
||
<button type="submit" class="button-secondary"><?= $ownerId > 0 ? 'Leitung übertragen' : 'Lead bestimmen' ?></button>
|
||
</form>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($canManage && $ownerId > 0 && $ownerId !== $discordId): ?>
|
||
<?php // Die Leitung loest eine fremde Gruppe nur mit Begruendung auf - der Lead bekommt sie per PN. ?>
|
||
<button type="button" class="button-danger premade-dissolve-btn" data-premade-id="<?= $premadeId ?>" data-premade-name="<?= e($premadeName) ?>">Gruppe auflösen</button>
|
||
<?php else: ?>
|
||
<form method="post" action="/premade_action.php" class="inline-form" data-confirm="<?= e('„' . $premadeName . '“ wirklich auflösen? Alle Mitglieder bekommen eine Discord-PN.') ?>" data-confirm-title="Premade auflösen" data-confirm-danger data-confirm-ok="Auflösen">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="delete">
|
||
<input type="hidden" name="premade_id" value="<?= $premadeId ?>">
|
||
<button type="submit" class="button-danger">Gruppe auflösen</button>
|
||
</form>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
|
||
<!-- Gemeinsames Einladen-Popup fuer alle Premades auf dieser Seite -->
|
||
<div id="premade-invite-modal" class="modal-overlay" hidden>
|
||
<div class="modal">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2 class="premade-invite-title">Mitglied einladen</h2>
|
||
<p class="text-muted premade-invite-hint" data-direct-text="Wähle einen Spieler für diese Premade. Er wird direkt eingeteilt und per Discord-PN benachrichtigt." data-invite-text="Wähle ein Mitglied für diese Premade. Es bekommt die Einladung per Discord-PN und muss sie dort oder hier annehmen."></p>
|
||
<div class="premade-invite-list">
|
||
<?php foreach ($inviteCandidates as $candidate): ?>
|
||
<?php $candidateName = $candidate['display_name'] !== '' ? $candidate['display_name'] : $candidate['discord_username']; ?>
|
||
<button type="button" class="premade-invite-option" data-user-id="<?= (int) $candidate['discord_id'] ?>" data-user-name="<?= e($candidateName) ?>">
|
||
<?= avatar_html(['id' => $candidate['id'], 'display_name' => $candidateName, 'username' => $candidateName, 'avatar_filename' => $candidate['avatar_filename'] ?? null], 32) ?>
|
||
<span><?= e($candidateName) ?></span>
|
||
</button>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<form id="premade-invite-form" method="post" action="/premade_action.php" style="display:none;">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="invite">
|
||
<input type="hidden" name="premade_id" id="premade-invite-premade-id">
|
||
<input type="hidden" name="user_id" id="premade-invite-user-id">
|
||
</form>
|
||
|
||
<?php if ($canManage): ?>
|
||
<!-- Aufloesen durch die Leitung: Begruendung fuer den Lead -->
|
||
<div id="premade-dissolve-modal" class="modal-overlay" hidden>
|
||
<div class="modal">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2>Premade auflösen</h2>
|
||
<p class="text-muted">Du löst <strong class="premade-dissolve-name"></strong> als Legionsleitung auf. Der Lead bekommt die Begründung per Discord-PN, die übrigen Mitglieder erfahren nur, dass die Legionsleitung die Gruppe aufgelöst hat.</p>
|
||
<form method="post" action="/premade_action.php">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="delete">
|
||
<input type="hidden" name="premade_id" id="premade-dissolve-premade-id">
|
||
<label for="premade-dissolve-reason">Begründung</label>
|
||
<textarea id="premade-dissolve-reason" name="reason" rows="3" minlength="<?= PREMADE_DISSOLVE_REASON_MIN ?>" maxlength="<?= PREMADE_DISSOLVE_REASON_MAX ?>" required placeholder="Warum wird die Gruppe aufgelöst?"></textarea>
|
||
<div class="actions">
|
||
<button type="button" class="button-secondary modal-cancel">Abbrechen</button>
|
||
<button type="submit" class="button-danger">Gruppe auflösen</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Gemeinsames Klassen-Popup - identisch zur Klassenauswahl bei der Raid-Anmeldung -->
|
||
<div id="premade-class-modal" class="modal-overlay" hidden>
|
||
<div class="modal">
|
||
<button type="button" class="modal-close icon-button" title="Schließen"><?= icon('x') ?></button>
|
||
<h2>Klasse wählen</h2>
|
||
<p class="text-muted">Welche Klasse spielst du in dieser Premade? Das ist optional und jederzeit änderbar.</p>
|
||
<div class="class-picker">
|
||
<?php $ownClasses = user_classes(current_user()); ?>
|
||
<?php foreach (class_options_for(current_user()) as $classOption): ?>
|
||
<button type="button" class="class-picker-option<?= in_array($classOption, $ownClasses, true) ? ' is-own' : '' ?>" data-class="<?= e($classOption) ?>">
|
||
<?php if ($classOption === ($ownClasses[0] ?? null)): ?><span class="class-picker-tag">Main</span><?php endif; ?>
|
||
<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>
|
||
</div>
|
||
<form id="premade-class-form" method="post" action="/premade_action.php" style="display:none;">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="set_class">
|
||
<input type="hidden" name="premade_id" id="premade-class-premade-id">
|
||
<input type="hidden" name="class" id="premade-class-value">
|
||
</form>
|
||
|
||
<script src="<?= e(asset_url('/assets/js/premades.js')) ?>"></script>
|
||
<?php endif; ?>
|
||
<script src="<?= e(asset_url('/assets/js/item-picker.js')) ?>"></script>
|
||
<?php endif; ?>
|
||
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|