LuminaWebsite/admin/consilium.php
Maaxxs 8b59cb503b DACH Elyos: the Consilium Elyseum is now called DACH Elyos across the website
Asked for: "das consilium elyseum wurde umbenannt zu DACH Elyos. pass das bitte an auf der website".

- CONSILIUM_NAME is 'DACH Elyos', and every visible text follows it: sidebar, the alliance page, member tab, raid
  area, calendar audience and badge, iCal note, map live sessions and share buttons, admin pages (Verwaltung ->
  DACH Elyos, Discord-Bot, Berechtigungsgruppen), flash messages, log entries, permission descriptions (synced to
  the database by schema_sync_core_permissions()) and the privacy page.
- The name takes no article, so the sentences around it changed too: "von DACH Elyos", "in DACH Elyos", "für DACH
  Elyos" instead of "des Consiliums", "im Consilium", "für das Consilium". The bot channel label is now
  "Raid-Kanal DACH Elyos".
- Internal names stay "consilium": permission keys, tables, settings, files and URLs (?bereich=consilium,
  ?tab=consilium), so nothing in the database or in existing links changes. includes/consilium.php says so.
- README: section renamed to "DACH Elyos" (anchor #dach-elyos).
- No patch note (alliance topics stay out of them). The bot's two "Consilium" error texts in live_tactics.py never
  reach the page - the map only reads the status code - so the bot needs no update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:15:10 +02:00

173 lines
11 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
/**
* Consilium Elyseum verwalten: die verbuendeten Legionen und welche Mitglieder zu welcher gehoeren
* (includes/consilium.php). Formulare gehen an admin/consilium_action.php.
*/
require_once __DIR__ . '/../includes/bootstrap.php';
require_once __DIR__ . '/../includes/consilium.php';
require_permission('consilium.manage');
$legions = consilium_legions();
$members = consilium_members(true);
$consiliumGuild = consilium_guild_id();
// Die Einrichtung (Server, Gruppen, Rechte) ist Sache unserer Admins - nicht aller mit consilium.manage
$showSetup = user_has_permission('roles.manage');
// Gruppen des Consiliums: die mit einer Rolle des Servers des Consiliums, dazu ihre Consilium-Rechte (und ob sie
// versehentlich dashboard.view haben - dann zaehlten Verbuendete als Legion)
$groups = [];
if ($showSetup) {
$stmt = db()->prepare(
"SELECT r.id, COALESCE(NULLIF(r.display_name, ''), r.name) AS label,
GROUP_CONCAT(CASE WHEN p.`key` LIKE 'consilium.%' OR p.`key` = 'dashboard.view' THEN p.`key` END
ORDER BY p.`key` SEPARATOR ' ') AS perms
FROM roles r
LEFT JOIN role_permissions rp ON rp.role_id = r.id
LEFT JOIN permissions p ON p.id = rp.permission_id
WHERE r.discord_guild_id = ?
GROUP BY r.id
ORDER BY " . ROLE_TAG_ORDER_SQL
);
$stmt->execute([$consiliumGuild]);
$groups = $stmt->fetchAll();
}
$setUp = $consiliumGuild !== '' && ($groups || !$showSetup) && $legions;
$nameOf = static fn (array $m): string => $m['display_name'] !== '' ? (string) $m['display_name'] : (string) $m['username'];
$pageTitle = CONSILIUM_NAME;
include __DIR__ . '/../includes/header.php';
?>
<div class="panel consilium-hero">
<h1><?= icon('shield-check') ?> <?= e(CONSILIUM_NAME) ?></h1>
<p class="text-muted">
Das Bündnis mit anderen Legionen, mit eigenem Discord-Server. Wer dort eine Rolle hat, sieht auf der Website den
Bereich <?= e(CONSILIUM_NAME) ?>: die Mitglieder, die Raids, die Termine und die Karten-Sitzungen, die ihr freigebt.
Verbündete sehen nichts von der Legion, und wer von uns nicht auf dem Server ist, nichts von <?= e(CONSILIUM_NAME) ?>.
</p>
<?php if ($showSetup): ?>
<details class="consilium-setup"<?= $setUp ? '' : ' open' ?>>
<summary>So richtest du <?= e(CONSILIUM_NAME) ?> ein</summary>
<ol>
<li>Unter <a href="/admin/bot.php">Discord-Bot</a> den Server von <?= e(CONSILIUM_NAME) ?> eintragen
(<?= $consiliumGuild !== '' ? 'ist eingetragen: <code>' . e($consiliumGuild) . '</code>' : '<strong>fehlt noch</strong>' ?>) und
den Bot dort einladen. Dort auch den „Raid-Kanal <?= e(CONSILIUM_NAME) ?>“ wählen.</li>
<li>Unter <a href="/admin/roles.php">Berechtigungsgruppen</a> für jede Rolle des Servers eine Gruppe anlegen und
mit ihr verknüpfen (Auswahl „Discord-Server von <?= e(CONSILIUM_NAME) ?>“) – mit diesen Rechten und
<strong>ohne <code>dashboard.view</code></strong>:
<ul>
<li>Force Commander: <code>consilium.view</code>, <code>consilium.draw</code>, <code>consilium.manage</code>, <code>consilium.raids.manage</code></li>
<li>Legion Lead: <code>consilium.view</code>, <code>consilium.draw</code>, <code>consilium.raids.manage</code> (damit auch Raids anlegen)</li>
<li>Legion Officer: <code>consilium.view</code>, <code>consilium.draw</code>, <code>consilium.raids</code></li>
<li>Legionär: <code>consilium.view</code></li>
</ul>
Termine für <?= e(CONSILIUM_NAME) ?> im Kalender eintragen: <code>consilium.calendar</code> – gebt es, wem ihr es zutraut.</li>
<li>Unten die verbündeten Legionen anlegen und ihre Mitglieder zuordnen. Jedes Mitglied kann seine Legion auch
selbst unter „Mein Profil“ wählen. Wer von uns auf dem Server ist, steht automatisch unter
„<?= e(CONSILIUM_HOME_LEGION) ?>“.</li>
<li>Neue Konten schaltet ihr wie gewohnt in der <a href="/admin/users.php">Benutzerverwaltung</a> frei.</li>
</ol>
<p class="consilium-setup-status">
<strong>Gruppen mit Rolle auf dem Server von <?= e(CONSILIUM_NAME) ?>:</strong>
<?php if (!$groups): ?>
<span class="text-muted">noch keine</span>
<?php endif; ?>
</p>
<?php if ($groups): ?>
<ul class="consilium-group-list">
<?php foreach ($groups as $group): ?>
<?php $perms = array_filter(explode(' ', (string) ($group['perms'] ?? ''))); ?>
<li>
<?= role_tag_html((string) $group['label']) ?>
<span class="text-muted"><?= $perms ? e(implode(', ', array_diff($perms, ['dashboard.view']))) : 'keine Rechte für ' . e(CONSILIUM_NAME) ?></span>
<?php if (in_array('dashboard.view', $perms, true)): ?><span class="badge badge-danger" title="Dann zählen Verbündete als Legion und sehen alles">hat dashboard.view!</span><?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</details>
<?php endif; ?>
</div>
<div class="panel">
<h2>Legionen in <?= e(CONSILIUM_NAME) ?></h2>
<?php if (!$legions): ?>
<p class="text-muted">Noch keine verbündete Legion angelegt.</p>
<?php else: ?>
<ul class="consilium-legion-list">
<?php foreach ($legions as $i => $legion): ?>
<li>
<form method="post" action="/admin/consilium_action.php" class="consilium-legion-rename">
<?= csrf_field() ?>
<input type="hidden" name="action" value="legion_rename">
<input type="hidden" name="id" value="<?= $legion['id'] ?>">
<input type="text" name="name" value="<?= e($legion['name']) ?>" maxlength="<?= CONSILIUM_LEGION_NAME_MAX ?>" required aria-label="Name der Legion">
<button type="submit" class="button-secondary button-small">Umbenennen</button>
</form>
<span class="text-muted consilium-legion-count"><?= $legion['member_count'] ?> <?= $legion['member_count'] === 1 ? 'Mitglied' : 'Mitglieder' ?></span>
<form method="post" action="/admin/consilium_action.php" class="inline-form">
<?= csrf_field() ?>
<input type="hidden" name="action" value="legion_move">
<input type="hidden" name="id" value="<?= $legion['id'] ?>">
<button type="submit" name="direction" value="up" class="icon-button" title="Nach oben"<?= $i === 0 ? ' disabled' : '' ?>>▲</button>
<button type="submit" name="direction" value="down" class="icon-button" title="Nach unten"<?= $i === count($legions) - 1 ? ' disabled' : '' ?>>▼</button>
</form>
<form method="post" action="/admin/consilium_action.php" class="inline-form"
data-confirm="Die Legion „<?= e($legion['name']) ?>“ löschen? Ihre Mitglieder bleiben in <?= e(CONSILIUM_NAME) ?>, nur ohne Legion." data-confirm-title="Legion löschen" data-confirm-danger data-confirm-ok="Löschen">
<?= csrf_field() ?>
<input type="hidden" name="action" value="legion_delete">
<input type="hidden" name="id" value="<?= $legion['id'] ?>">
<button type="submit" class="icon-button icon-button-danger" title="Löschen" aria-label="<?= e($legion['name']) ?> löschen"><?= icon('trash') ?></button>
</form>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<form method="post" action="/admin/consilium_action.php" class="consilium-legion-add">
<?= csrf_field() ?>
<input type="hidden" name="action" value="legion_add">
<input type="text" name="name" maxlength="<?= CONSILIUM_LEGION_NAME_MAX ?>" required placeholder="Name der verbündeten Legion" aria-label="Name der verbündeten Legion">
<button type="submit">+ Legion hinzufügen</button>
</form>
</div>
<div class="panel">
<h2>Mitglieder von <?= e(CONSILIUM_NAME) ?> <span class="chip-count"><?= count($members) ?></span></h2>
<?php if (!$members): ?>
<p class="text-muted">Noch niemand. Wer von den verbündeten Legionen eine Rolle auf dem Discord-Server von <?= e(CONSILIUM_NAME) ?> hat und sich auf der Website anmeldet, erscheint hier.</p>
<?php else: ?>
<div class="table-scroll">
<table>
<thead>
<tr><th>Mitglied</th><th>Discord</th><th>Legion</th><th>Zuletzt aktiv</th></tr>
</thead>
<tbody>
<?php foreach ($members as $member): ?>
<tr>
<td>
<span class="consilium-member-name"><?= avatar_html($member, 28) ?> <?= e($nameOf($member)) ?></span>
<?php if ($member['status'] === 'pending'): ?><a class="badge badge-pending" href="/admin/users.php">Wartet auf Freischaltung</a><?php endif; ?>
</td>
<td class="text-muted"><?= e((string) ($member['discord_username'] ?? '')) ?></td>
<td>
<form method="post" action="/admin/consilium_action.php" class="inline-form">
<?= csrf_field() ?>
<input type="hidden" name="action" value="member_legion">
<input type="hidden" name="user_id" value="<?= (int) $member['id'] ?>">
<select name="legion_id" onchange="this.form.submit()" aria-label="Legion von <?= e($nameOf($member)) ?>">
<option value="">– keine –</option>
<?php foreach ($legions as $legion): ?>
<option value="<?= $legion['id'] ?>"<?= (int) $member['consilium_legion_id'] === $legion['id'] ? ' selected' : '' ?>><?= e($legion['name']) ?></option>
<?php endforeach; ?>
</select>
<noscript><button type="submit" class="button-secondary button-small">Speichern</button></noscript>
</form>
</td>
<td class="text-muted"><?= e(last_active_label($member['last_active'] ?? null)) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
<?php include __DIR__ . '/../includes/footer.php'; ?>