LuminaWebsite/includes/header.php
Maaxxs 5aaf44eaec Consilium Elyseum: allied legions get their own view - own raids, calendar entries, member tab and shared live map sessions
Asked for: alliances ("Consilium Elyseum") with their own view, a member-list tab with the allied legions and their
members, an own raid area, a calendar that shows them only alliance entries, and live map sessions the legion can
share with them - watching only, or drawing only with an extra permission. There is one Discord role "Consilium
Elyseum" for all allies, so which legion each ally belongs to is stored on the website.

- Permissions consilium.view / consilium.draw / consilium.manage. An account with consilium.view but without
  dashboard.view is a guest of the Consilium (consilium_only(), sql_is_consilium_only()) and sees only the alliance
  area; raids, calendar and map stay restricted even with extra rights like raids.view or map.view.
- includes/consilium.php; consilium.php is the allies' start page instead of the dashboard (next raids and entries,
  legions, running shared map sessions); admin/consilium.php: setup hints, allied legions, member assignment.
  users.consilium_legion_id, table consilium_legions (schema 69); allies pick their legion under Mein Profil.
- Members: new tab "Consilium Elyseum" (legions with their members), the only tab allies see. Legion-only lists
  (dues, Lumipunkte, member pickers, raid and activity points) leave allies out.
- Raids: two areas, legion and Consilium, told apart by the Discord channel ("Consilium-Raids" under Verwaltung ->
  Discord-Bot, settings.consilium_raid_channel; the bot API returns channel_id). Allies only see and sign up for
  Consilium raids, which give no Lumipunkte; raids created in the Consilium area are posted to its channel.
- Calendar: audience "Consilium Elyseum". Allies see only those entries and the Consilium raids (also in their iCal
  subscription), their own entries are always Consilium entries; the public calendar shows no Consilium raids; the
  legion sees them marked with 🤝.
- Map: whoever may edit a public tactic shares its running live session with the Consilium (consilium_share, logged).
  The share lives in the bot's live relay and only for that session: it ends with "Freigabe beenden" or 60 s after
  the last legion member left; making the tactic private or deleting it ends it as well. Allies see only running
  shared sessions under Karte (and on their start page), join and watch; with consilium.draw they add strokes,
  areas, points and text - no figures, nothing moved, erased or undone, no tactics, steps, copies or history.
  Enforced in tactics_api.php (guest branch: shared tactics only, only live_token and shape_create) and in the relay
  (guest tickets, event whitelist, guests are disconnected when the share ends). Needs the bot update (api.py,
  database/db.py, live_tactics.py).
- Navigation, privacy page, patch note, README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 01:36:49 +02:00

489 lines
32 KiB
PHP

<?php
/** @var string|null $pageTitle */
$currentUser = current_user();
// Den Mitgliederbereich (Seitenleiste) bekommen nur freigeschaltete Konten - wer noch auf
// die Freischaltung wartet, sieht das schlichte Layout wie auf der Login-Seite.
$shellUser = ($currentUser && $currentUser['status'] === 'active') ? $currentUser : null;
// Oeffentliche Seiten (z.B. die Startseite) zeigen auch Eingeloggten die schlichte Kopfzeile.
$publicLayout = !empty($publicLayout);
if ($publicLayout) {
$shellUser = null;
}
$canViewUsers = $currentUser && user_has_permission('users.view');
$canManageRoles = $currentUser && user_has_permission('roles.manage');
$canViewRaids = $currentUser && user_has_permission('raids.view');
$canViewPremades = $currentUser && user_has_permission('premades.view');
$canViewEvents = $currentUser && user_has_permission('events.view');
$canManageActivity = $currentUser && user_has_permission('activity.manage');
$canManageDues = $currentUser && user_has_permission('dues.manage');
$canViewMap = $currentUser && user_has_permission('map.view');
$canViewWarehouse = $currentUser && user_has_permission('warehouse.view');
$canViewGear = $currentUser && user_has_permission('gear.view');
$canViewContributions = $currentUser && user_has_permission('contributions.view');
$canViewShop = $currentUser && user_has_permission('shop.view');
// Taegliche Belohnung: beim ersten Seitenaufruf des Tages Lumipunkte (includes/contributions.php)
if ($shellUser && user_has_permission('dashboard.view')) {
require_once __DIR__ . '/contributions.php';
if (contribution_daily_reward((int) $shellUser['id'])) {
set_flash('success', '+' . CONTRIBUTION_DAILY_POINTS . ' Lumipunkte - deine tägliche Belohnung. Schön, dass du vorbeischaust!');
}
}
$canViewMembers = $currentUser && user_has_permission('members.view');
$canViewWiki = $currentUser && user_has_permission('wiki.view');
$canViewReports = $currentUser && user_has_permission('reports.view');
$canManageBugs = $currentUser && user_has_permission('bugs.manage');
$canViewAudit = $currentUser && user_has_permission('audit.view');
$canModerate = $currentUser && user_has_permission('comments.moderate');
// Daten zuruecksetzen (Testdaten loeschen) nur fuer Entwickler
$canResetData = $currentUser && is_developer($currentUser);
$canManageSite = $currentUser && (user_has_permission('site.maintenance') || user_has_permission('site.announce'));
$canManageLegal = $currentUser && user_has_permission('site.legal');
$canManageBot = $currentUser && user_has_permission('bot.manage');
// Consilium Elyseum (includes/consilium.php): Wer nur zum Consilium gehoert, sieht nur dessen Bereiche; die Legion
// bekommt den Eintrag erst, wenn das Consilium eingerichtet ist
require_once __DIR__ . '/consilium.php';
$isConsiliumOnly = $shellUser && consilium_only();
$canViewConsilium = $currentUser && ($isConsiliumOnly || (consilium_can_view() && consilium_enabled()));
$canManageConsilium = $currentUser && user_has_permission('consilium.manage');
$showAdminMenu = $canViewUsers || $canManageRoles || $canManageActivity || $canManageDues || $canViewReports || $canManageBugs || $canViewAudit || $canModerate || $canResetData || $canManageSite || $canManageLegal || $canManageBot || $canManageConsilium;
$currentScript = basename((string) ($_SERVER['SCRIPT_NAME'] ?? ''));
$isDashboardActive = $currentScript === 'dashboard.php';
$isProfileActive = $currentScript === 'profile.php';
$isRaidsActive = $currentScript === 'raids.php';
$isPremadesActive = $currentScript === 'premades.php';
$isEventsActive = $currentScript === 'events.php';
$isCalendarActive = $currentScript === 'calendar.php';
$isActivityActive = $currentScript === 'activity.php';
$isDuesActive = $currentScript === 'dues.php';
$isMapActive = $currentScript === 'map.php';
$isRaidplanActive = $currentScript === 'raidplan.php';
$isWarehouseActive = $currentScript === 'warehouse.php';
$isGearActive = in_array($currentScript, ['gear.php', 'gear_items.php', 'gear_skills.php'], true);
$isProfessionsActive = $currentScript === 'professions.php';
$isContributionsActive = in_array($currentScript, ['contributions.php', 'contributions_award.php'], true);
$isShopActive = in_array($currentScript, ['shop.php', 'shop_orders.php', 'shop_manage.php'], true);
$isMembersActive = in_array($currentScript, ['members.php', 'member.php', 'member_edit.php', 'member_picture.php'], true);
$isGalleryActive = $currentScript === 'gallery.php';
$isWikiActive = in_array($currentScript, ['wiki.php', 'wiki_edit.php', 'wiki_history.php'], true);
$isReportsActive = $currentScript === 'reports.php';
$isBugsActive = $currentScript === 'bugs.php';
$isAuditActive = $currentScript === 'audit.php';
$isBotActive = $currentScript === 'bot.php';
$isResetActive = $currentScript === 'reset.php';
$isModerationActive = $currentScript === 'moderation.php';
$isSiteActive = $currentScript === 'site.php';
$isLegalActive = $currentScript === 'legal.php';
$isUsersActive = in_array($currentScript, ['users.php', 'user_form.php', 'user_delete.php', 'user_approve.php', 'user_export.php'], true);
$isRolesActive = in_array($currentScript, ['roles.php', 'role_form.php', 'role_delete.php'], true);
$isConsiliumActive = $currentScript === 'consilium.php' && !str_contains((string) ($_SERVER['SCRIPT_NAME'] ?? ''), '/admin/');
$isConsiliumAdminActive = $currentScript === 'consilium.php' && !$isConsiliumActive;
// Jeder Bereich bekommt ein eigenes, dezentes Hintergrundbild.
$pageBackgrounds = [
'dashboard.php' => 'bg-dashboard',
'profile.php' => 'bg-profile',
'raids.php' => 'bg-raids',
'raid_attendance.php' => 'bg-raids',
'change_password.php' => 'bg-profile',
'premades.php' => 'bg-premades',
'events.php' => 'bg-events',
'calendar.php' => 'bg-events',
'activity.php' => 'bg-events',
'map.php' => 'bg-map',
'raidplan.php' => 'bg-map',
'warehouse.php' => 'bg-warehouse',
'gear.php' => 'bg-warehouse',
'professions.php' => 'bg-warehouse',
'gear_items.php' => 'bg-admin',
'gear_skills.php' => 'bg-admin',
'contributions.php' => 'bg-contributions',
'contributions_award.php' => 'bg-contributions',
'shop.php' => 'bg-shop',
'shop_orders.php' => 'bg-shop',
'shop_manage.php' => 'bg-shop',
'members.php' => 'bg-members',
'member.php' => 'bg-members',
'member_edit.php' => 'bg-members',
'wiki.php' => 'bg-members',
'wiki_edit.php' => 'bg-members',
'wiki_history.php' => 'bg-members',
'users.php' => 'bg-admin',
'user_form.php' => 'bg-admin',
'user_delete.php' => 'bg-admin',
'user_export.php' => 'bg-admin',
'roles.php' => 'bg-roles',
'role_form.php' => 'bg-roles',
'role_delete.php' => 'bg-roles',
'reports.php' => 'bg-reports',
'bugs.php' => 'bg-reports',
'audit.php' => 'bg-admin',
'dues.php' => 'bg-admin',
'site.php' => 'bg-admin',
'bot.php' => 'bg-admin',
'legal.php' => 'bg-admin',
'reset.php' => 'bg-admin',
'moderation.php' => 'bg-reports',
'member_picture.php' => 'bg-members',
'gallery.php' => 'bg-members',
'patchnotes.php' => 'bg-members',
];
$pageBackgroundClass = $pageBackgrounds[$currentScript] ?? '';
// Eigene Reihenfolge der Menuepunkte (Seitenleiste -> "Menü anpassen", assets/js/sidebar-editor.js).
// Umgesetzt ueber die CSS-Eigenschaft "order" - so steht die Reihenfolge schon beim Laden fest.
$savedNavOrder = [];
$announcementDismissed = null;
$navBadges = [];
$sidebarPoints = null;
$liveFingerprint = null;
if ($shellUser) {
require_once __DIR__ . '/live_updates.php';
$navRow = [];
try {
$navStmt = db()->prepare('SELECT sidebar_order, patchnotes_seen, announcement_dismissed, gallery_seen_at, raids_seen_at FROM users WHERE id = ?');
$navStmt->execute([(int) $shellUser['id']]);
$navRow = $navStmt->fetch() ?: [];
$savedNavOrder = json_decode((string) ($navRow['sidebar_order'] ?? ''), true) ?: [];
$announcementDismissed = isset($navRow['announcement_dismissed']) ? (string) $navRow['announcement_dismissed'] : null;
} catch (PDOException $e) {
$savedNavOrder = [];
}
// Zahlen an den Menuepunkten, eigener Punktestand und Fingerabdruck der Seite - live.php liefert
// dieselben Werte fuer die Live-Aktualisierung (includes/live_updates.php, assets/js/live.js)
$navBadges = nav_badges($shellUser, $currentScript, $navRow);
$sidebarPoints = nav_points((int) $shellUser['id']);
$liveFingerprint = live_fingerprint((string) ($_SERVER['SCRIPT_NAME'] ?? ''), $_GET, (int) $shellUser['id']);
}
$navOrder = static function (string $key) use ($savedNavOrder): string {
$zone = in_array($key, SIDEBAR_NAV_ADMIN, true) ? 'admin' : 'main';
$base = $zone === 'admin' ? 10010 : 0;
$saved = array_search($key, (array) ($savedNavOrder[$zone] ?? []), true);
// Gespeicherte Punkte in ihrer Reihenfolge; neue (noch nicht gespeicherte) an ihrem Standardplatz
$position = $saved !== false ? $saved * 10 : (int) array_search($key, $zone === 'admin' ? SIDEBAR_NAV_ADMIN : SIDEBAR_NAV_MAIN, true) * 10 + 5;
return ' style="order: ' . ($base + $position) . '"';
};
// Ankuendigungsbanner (admin/site.php): im Mitgliederbereich immer, fuer Gaeste nur, wenn es als
// oeffentlich markiert ist. Auf der Verwaltungsseite selbst steht schon die Vorschau.
$announcementHtml = '';
$siteAnnouncement = announcement_current();
if ($siteAnnouncement !== null && $currentScript !== 'site.php' && ($shellUser || $siteAnnouncement['public'])) {
$announcementHtml = announcement_banner($siteAnnouncement, $announcementDismissed, (bool) $shellUser);
}
// Wer trotz Wartung hier ist, soll daran erinnert werden, dass sie noch laeuft.
$maintenanceNotice = $shellUser && maintenance_active();
// Erfolgsmeldungen ("Bestätigungen") bekommen ein zentriertes Popup mit Haken-Animation, das
// sich von selbst schliesst. Fehlermeldungen erscheinen als Meldung, die man mit OK bestaetigen
// muss (assets/js/confirm-dialog.js) - als Balken oben gingen sie leicht unter. Hinweise ("info")
// bleiben als Balken.
$allFlashes = get_flashes();
$successFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($f['type'] ?? '') === 'success'));
$errorFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($f['type'] ?? '') === 'error'));
$otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => !in_array($f['type'] ?? '', ['success', 'error'], true)));
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="<?= e(csrf_token()) ?>">
<title><?= e(($pageTitle ?? '') !== '' ? $pageTitle . ' - Lumina Ascendens' : 'Lumina Ascendens') ?></title>
<?php // Versionskennung (asset_url), sonst zeigen Browser noch lange das alte Symbol im Tab ?>
<link rel="icon" type="image/x-icon" href="<?= e(asset_url('/assets/images/favicon.ico')) ?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?= e(asset_url('/assets/images/favicon-16.png')) ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?= e(asset_url('/assets/images/favicon-32.png')) ?>">
<link rel="icon" type="image/png" sizes="48x48" href="<?= e(asset_url('/assets/images/favicon-48.png')) ?>">
<link rel="apple-touch-icon" href="<?= e(asset_url('/assets/images/apple-touch-icon.png')) ?>">
<?php if (!empty($metaRobots)): ?>
<meta name="robots" content="<?= e($metaRobots) ?>">
<?php endif; ?>
<?php if (!empty($metaDescription)): ?>
<meta name="description" content="<?= e($metaDescription) ?>">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Lumina Ascendens">
<meta property="og:title" content="<?= e(($pageTitle ?? '') !== '' ? $pageTitle . ' - Lumina Ascendens' : 'Lumina Ascendens') ?>">
<meta property="og:description" content="<?= e($metaDescription) ?>">
<?php if (!empty($ogImage)): ?>
<meta property="og:image" content="<?= e($ogImage) ?>">
<meta name="twitter:card" content="summary_large_image">
<?php endif; ?>
<?php endif; ?>
<link rel="stylesheet" href="<?= e(asset_url('/assets/css/style.css')) ?>">
</head>
<body class="<?= e(trim(($shellUser ? '' : 'guest-bg') . (!empty($bodyClass) ? ' ' . $bodyClass : ''))) ?>"<?= $shellUser
? ' data-live-path="' . e((string) ($_SERVER['SCRIPT_NAME'] ?? '')) . '" data-live-fp="' . e((string) $liveFingerprint) . '"'
: '' ?>>
<?php if (!empty($successFlashes)): ?>
<div class="success-popup-overlay" id="success-popup" role="status" title="Klicken zum Schließen">
<div class="success-popup">
<svg class="success-check" viewBox="0 0 52 52" aria-hidden="true">
<circle class="success-check-circle" cx="26" cy="26" r="24" fill="none"/>
<path class="success-check-mark" fill="none" d="M14 27l7 7 16-16"/>
</svg>
<?php foreach ($successFlashes as $flash): ?>
<p><?= e($flash['message']) ?></p>
<?php endforeach; ?>
</div>
</div>
<script src="<?= e(asset_url('/assets/js/success-popup.js')) ?>"></script>
<?php endif; ?>
<?php if (!empty($errorFlashes)): ?>
<script type="application/json" id="flash-errors"><?= json_encode(array_column($errorFlashes, 'message'), JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP) ?></script>
<?php endif; ?>
<?php if ($shellUser): ?>
<?php // Zahlen im Menue und Inhalt der Seite aktualisieren sich von selbst (live.php, includes/live_updates.php) ?>
<script src="<?= e(asset_url('/assets/js/live.js')) ?>" defer></script>
<div class="app-shell">
<div class="mobile-topbar">
<button type="button" class="sidebar-toggle" aria-label="Menü öffnen" aria-expanded="false">
<?= icon('menu') ?>
</button>
<a href="/" class="mobile-topbar-brand"><img src="<?= e(asset_url('/assets/images/logo-lumina-ascendens.webp')) ?>" alt="Lumina Ascendens" width="410" height="168"></a>
</div>
<div class="sidebar-backdrop"></div>
<aside class="sidebar">
<div class="sidebar-brand"><a href="/"><img src="<?= e(asset_url('/assets/images/logo-lumina-ascendens.webp')) ?>" alt="Lumina Ascendens" width="410" height="168"></a></div>
<nav class="sidebar-nav">
<?php if (!$isConsiliumOnly): ?>
<a href="/dashboard.php" data-nav="/dashboard.php"<?= $navOrder('/dashboard.php') ?> class="sidebar-link<?= $isDashboardActive ? ' active' : '' ?>" title="Dashboard">
<?= icon('home') ?><span class="label">Dashboard</span>
</a>
<?php endif; ?>
<?php if ($canViewConsilium): ?>
<a href="/consilium.php" data-nav="/consilium.php"<?= $navOrder('/consilium.php') ?> class="sidebar-link<?= $isConsiliumActive ? ' active' : '' ?>" title="<?= e(CONSILIUM_NAME) ?>: das Bündnis mit anderen Legionen">
<?= icon($isConsiliumOnly ? 'home' : 'shield-check') ?><span class="label"><?= e(CONSILIUM_NAME) ?></span>
</a>
<?php endif; ?>
<a href="/profile.php" data-nav="/profile.php"<?= $navOrder('/profile.php') ?> class="sidebar-link<?= $isProfileActive ? ' active' : '' ?>" title="Mein Profil">
<?= icon('profile') ?><span class="label">Mein Profil</span>
</a>
<?php if ($canViewMembers || $isConsiliumOnly): ?>
<a href="/members.php" data-nav="/members.php"<?= $navOrder('/members.php') ?> class="sidebar-link<?= $isMembersActive ? ' active' : '' ?>" title="Mitglieder">
<?= icon('users') ?><span class="label">Mitglieder</span>
</a>
<?php endif; ?>
<?php if ($canViewMembers): ?>
<a href="/gallery.php" data-nav="/gallery.php" data-badge="/gallery.php"<?= $navOrder('/gallery.php') ?> class="sidebar-link<?= $isGalleryActive ? ' active' : '' ?>" title="Galerie: Screenshots aller Mitglieder">
<?= icon('grid') ?><span class="label">Galerie</span><?= nav_badge_html($navBadges, '/gallery.php') ?>
</a>
<?php endif; ?>
<?php if ($canViewContributions): ?>
<a href="/contributions.php" data-nav="/contributions.php"<?= $navOrder('/contributions.php') ?> class="sidebar-link<?= $isContributionsActive ? ' active' : '' ?>" title="Lumipunkte">
<?= icon('heart') ?><span class="label">Lumipunkte</span>
</a>
<?php endif; ?>
<?php if ($canViewShop): ?>
<a href="/shop.php" data-nav="/shop.php" data-badge="/shop.php"<?= $navOrder('/shop.php') ?> class="sidebar-link<?= $isShopActive ? ' active' : '' ?>" title="Lumishop">
<?= icon('bag') ?><span class="label">Lumishop</span><?= nav_badge_html($navBadges, '/shop.php') ?>
</a>
<?php endif; ?>
<?php if ($canViewWiki || $canViewRaids || $canViewPremades || $canViewEvents || $canViewMap || $canViewWarehouse || $canViewGear || $canViewMembers || $isConsiliumOnly): ?>
<div class="sidebar-nav-gap" data-nav="gap"<?= $navOrder('gap') ?>></div>
<?php endif; ?>
<?php if ($canViewWiki): ?>
<a href="/wiki.php" data-nav="/wiki.php"<?= $navOrder('/wiki.php') ?> class="sidebar-link<?= $isWikiActive ? ' active' : '' ?>" title="Wiki">
<?= icon('book') ?><span class="label">Wiki</span>
</a>
<?php endif; ?>
<?php // Wer nur zum Consilium gehoert: die Consilium-Raids, sobald es dafuer einen Kanal gibt (includes/raids_api.php) ?>
<?php if ($canViewRaids || ($isConsiliumOnly && (int) setting_get('consilium_raid_channel') > 0)): ?>
<a href="/raids.php" data-nav="/raids.php" data-badge="/raids.php"<?= $navOrder('/raids.php') ?> class="sidebar-link<?= $isRaidsActive ? ' active' : '' ?>" title="Raids">
<?= icon('calendar') ?><span class="label">Raids</span><?= nav_badge_html($navBadges, '/raids.php') ?>
</a>
<?php endif; ?>
<?php if ($canViewPremades): ?>
<a href="/premades.php" data-nav="/premades.php" data-badge="/premades.php"<?= $navOrder('/premades.php') ?> class="sidebar-link<?= $isPremadesActive ? ' active' : '' ?>" title="Premades">
<?= icon('shield') ?><span class="label">Premades</span><?= nav_badge_html($navBadges, '/premades.php') ?>
</a>
<?php endif; ?>
<?php if ($canViewRaids || $canViewEvents || $isConsiliumOnly): ?>
<a href="/calendar.php" data-nav="/calendar.php"<?= $navOrder('/calendar.php') ?> class="sidebar-link<?= $isCalendarActive ? ' active' : '' ?>" title="Kalender">
<?= icon('calendar') ?><span class="label">Kalender</span>
</a>
<?php endif; ?>
<?php if ($canViewEvents): ?>
<a href="/events.php" data-nav="/events.php"<?= $navOrder('/events.php') ?> class="sidebar-link<?= $isEventsActive ? ' active' : '' ?>" title="Events">
<?= icon('bell') ?><span class="label">Events</span>
</a>
<?php endif; ?>
<?php if ($isConsiliumOnly): ?>
<?php // Gaeste des Consiliums: nur die fuer sie freigegebenen Live-Sitzungen der Karte (map.php) ?>
<a href="/map.php" data-nav="/map.php"<?= $navOrder('/map.php') ?> class="sidebar-link<?= $isMapActive || $isRaidplanActive ? ' active' : '' ?>" title="Karte: Live-Sitzungen, die für das Consilium freigegeben sind">
<?= icon('map') ?><span class="label">Karte</span>
</a>
<?php elseif ($canViewMap): ?>
<a href="/map.php" data-nav="/map.php"<?= $navOrder('/map.php') ?> class="sidebar-link<?= $isMapActive ? ' active' : '' ?>" title="Karte">
<?= icon('map') ?><span class="label">Karte</span>
</a>
<a href="/raidplan.php" data-nav="/raidplan.php"<?= $navOrder('/raidplan.php') ?> class="sidebar-link<?= $isRaidplanActive ? ' active' : '' ?>" title="Raidplaner: Taktiken für Dungeons und Raids">
<?= icon('tactic') ?><span class="label">Raidplaner</span>
</a>
<?php endif; ?>
<?php if ($canViewGear): ?>
<a href="/gear.php" data-nav="/gear.php"<?= $navOrder('/gear.php') ?> class="sidebar-link<?= $isGearActive ? ' active' : '' ?>" title="Gear-Planer">
<?= icon('sword') ?><span class="label">Gear-Planer</span>
</a>
<?php endif; ?>
<?php if ($canViewMembers): ?>
<a href="/professions.php" data-nav="/professions.php"<?= $navOrder('/professions.php') ?> class="sidebar-link<?= $isProfessionsActive ? ' active' : '' ?>" title="Berufe: wer in der Legion was herstellen kann">
<?= icon('hammer') ?><span class="label">Berufe</span>
</a>
<?php endif; ?>
<?php if ($canViewWarehouse): ?>
<a href="/warehouse.php" data-nav="/warehouse.php"<?= $navOrder('/warehouse.php') ?> class="sidebar-link<?= $isWarehouseActive ? ' active' : '' ?>" title="Lagerhaus">
<?= icon('box') ?><span class="label">Lagerhaus</span>
</a>
<?php endif; ?>
<?php if ($showAdminMenu): ?>
<div class="sidebar-section-label" data-nav-admin-label style="order: 10000">Admin</div>
<?php if ($canViewUsers): ?>
<a href="/admin/users.php" data-nav="/admin/users.php" data-badge="/admin/users.php"<?= $navOrder('/admin/users.php') ?> class="sidebar-link<?= $isUsersActive ? ' active' : '' ?>" title="Benutzerverwaltung">
<?= icon('users') ?><span class="label">Benutzerverwaltung</span><?= nav_badge_html($navBadges, '/admin/users.php') ?>
</a>
<?php endif; ?>
<?php if ($canManageRoles): ?>
<a href="/admin/roles.php" data-nav="/admin/roles.php"<?= $navOrder('/admin/roles.php') ?> class="sidebar-link<?= $isRolesActive ? ' active' : '' ?>" title="Berechtigungsgruppen">
<?= icon('shield') ?><span class="label">Berechtigungsgruppen</span>
</a>
<?php endif; ?>
<?php if ($canManageActivity): ?>
<a href="/activity.php" data-nav="/activity.php"<?= $navOrder('/activity.php') ?> class="sidebar-link<?= $isActivityActive ? ' active' : '' ?>" title="Aktivitätscheck">
<?= icon('check') ?><span class="label">Aktivitätscheck</span>
</a>
<?php endif; ?>
<?php if ($canManageDues): ?>
<a href="/admin/dues.php" data-nav="/admin/dues.php"<?= $navOrder('/admin/dues.php') ?> class="sidebar-link<?= $isDuesActive ? ' active' : '' ?>" title="Legionsbeiträge: wer seinen Beitrag in Kina bezahlt hat">
<?= icon('coins') ?><span class="label">Legionsbeiträge</span>
</a>
<?php endif; ?>
<?php if ($canViewReports): ?>
<a href="/reports.php" data-nav="/reports.php" data-badge="/reports.php"<?= $navOrder('/reports.php') ?> class="sidebar-link<?= $isReportsActive ? ' active' : '' ?>" title="Reports">
<?= icon('flag') ?><span class="label">Reports</span><?= nav_badge_html($navBadges, '/reports.php') ?>
</a>
<?php endif; ?>
<?php if ($canManageBugs): ?>
<a href="/bugs.php" data-nav="/bugs.php" data-badge="/bugs.php"<?= $navOrder('/bugs.php') ?> class="sidebar-link<?= $isBugsActive ? ' active' : '' ?>" title="Fehlermeldungen">
<?= icon('bug') ?><span class="label">Fehlermeldungen</span><?= nav_badge_html($navBadges, '/bugs.php') ?>
</a>
<?php endif; ?>
<?php if ($canModerate): ?>
<a href="/moderation.php" data-nav="/moderation.php" data-badge="/moderation.php"<?= $navOrder('/moderation.php') ?> class="sidebar-link<?= $isModerationActive ? ' active' : '' ?>" title="Moderation">
<?= icon('flag') ?><span class="label">Moderation</span><?= nav_badge_html($navBadges, '/moderation.php') ?>
</a>
<?php endif; ?>
<?php if ($canManageBot): ?>
<a href="/admin/bot.php" data-nav="/admin/bot.php"<?= $navOrder('/admin/bot.php') ?> class="sidebar-link<?= $isBotActive ? ' active' : '' ?>" title="Discord-Bot: Kanäle und Übersichten">
<?= icon('bot') ?><span class="label">Discord-Bot</span>
</a>
<?php endif; ?>
<?php if ($canManageConsilium): ?>
<a href="/admin/consilium.php" data-nav="/admin/consilium.php"<?= $navOrder('/admin/consilium.php') ?> class="sidebar-link<?= $isConsiliumAdminActive ? ' active' : '' ?>" title="<?= e(CONSILIUM_NAME) ?>: verbündete Legionen und ihre Mitglieder">
<?= icon('shield-check') ?><span class="label"><?= e(CONSILIUM_NAME) ?></span>
</a>
<?php endif; ?>
<?php if ($canManageSite): ?>
<a href="/admin/site.php" data-nav="/admin/site.php" data-badge="/admin/site.php"<?= $navOrder('/admin/site.php') ?> class="sidebar-link<?= $isSiteActive ? ' active' : '' ?>" title="Wartung & Ankündigung">
<?= icon('bell') ?><span class="label">Wartung & Ankündigung</span><?= nav_badge_html($navBadges, '/admin/site.php') ?>
</a>
<?php endif; ?>
<?php if ($canManageLegal): ?>
<a href="/admin/legal.php" data-nav="/admin/legal.php" data-badge="/admin/legal.php"<?= $navOrder('/admin/legal.php') ?> class="sidebar-link<?= $isLegalActive ? ' active' : '' ?>" title="Impressum & Datenschutz">
<?= icon('lock') ?><span class="label">Impressum & Datenschutz</span><?= nav_badge_html($navBadges, '/admin/legal.php') ?>
</a>
<?php endif; ?>
<?php if ($canViewAudit): ?>
<a href="/admin/audit.php" data-nav="/admin/audit.php"<?= $navOrder('/admin/audit.php') ?> class="sidebar-link<?= $isAuditActive ? ' active' : '' ?>" title="Audit-Log">
<?= icon('shield-check') ?><span class="label">Audit-Log</span>
</a>
<?php endif; ?>
<?php if ($canResetData): ?>
<a href="/admin/reset.php" data-nav="/admin/reset.php"<?= $navOrder('/admin/reset.php') ?> class="sidebar-link<?= $isResetActive ? ' active' : '' ?>" title="Daten zurücksetzen">
<?= icon('restore') ?><span class="label">Daten zurücksetzen</span>
</a>
<?php endif; ?>
<?php endif; ?>
<?php // Zusaetzliche Trennlinien, die das Mitglied unter "Menü anpassen" eingefuegt hat ?>
<?php foreach ((array) ($savedNavOrder['main'] ?? []) as $navKey): ?>
<?php if (is_string($navKey) && preg_match('/^gap-\d{1,3}$/', $navKey)): ?>
<div class="sidebar-nav-gap sidebar-nav-gap-extra" data-nav="<?= e($navKey) ?>"<?= $navOrder($navKey) ?>></div>
<?php endif; ?>
<?php endforeach; ?>
</nav>
<?php if ($sidebarPoints !== null): ?>
<a class="sidebar-points" href="/contributions.php" title="Deine Lumipunkte - zur Rangliste">
<img src="/assets/images/lumipunkt.svg" alt="" width="30" height="30">
<span>
<span class="sidebar-points-label">Deine Lumipunkte</span>
<strong data-live-points><?= e(number_format($sidebarPoints, 0, ',', '.')) ?></strong>
</span>
</a>
<?php endif; ?>
<div class="sidebar-footer">
<div class="sidebar-user">
<?= avatar_html($currentUser, 36) ?>
<div>
Angemeldet als<br><strong><?= e($currentUser['display_name'] !== '' ? $currentUser['display_name'] : $currentUser['username']) ?></strong>
</div>
</div>
<a href="/patchnotes.php" data-badge="/patchnotes.php" class="sidebar-link<?= $currentScript === 'patchnotes.php' ? ' active' : '' ?>" title="Patchnotes: Änderungen an der Website">
<?= icon('list') ?><span class="label">Patchnotes</span><?= nav_badge_html($navBadges, '/patchnotes.php') ?>
</a>
<button type="button" class="sidebar-link sidebar-edit-toggle" id="sidebar-edit-toggle" title="Reihenfolge der Menüpunkte ändern">
<?= icon('move') ?><span class="label">Menü anpassen</span>
</button>
<a href="/logout.php" class="sidebar-link" title="Abmelden">
<?= icon('log-out') ?><span class="label">Abmelden</span>
</a>
<?= legal_links_html('legal-links sidebar-legal') ?>
</div>
</aside>
<?php // $pageBackgroundImage: eigenes Hintergrundbild einer Seite (z.B. Profilseite eines Mitglieds) ?>
<div class="app-content<?= $pageBackgroundClass ? ' ' . e($pageBackgroundClass) : '' ?>"<?= !empty($pageBackgroundImage)
? ' style="--page-bg: linear-gradient(rgba(26, 26, 26, 0.5), rgba(26, 26, 26, 0.74)), url(\'' . e(str_replace(["'", '"', '(', ')', ' '], '', (string) $pageBackgroundImage)) . '\')"'
: '' ?>>
<main class="container<?= !empty($containerWide) ? ' container-wide' : '' ?>">
<?php if ($maintenanceNotice): ?>
<div class="maintenance-notice">🔧 <strong>Wartungsmodus ist aktiv</strong> - Mitglieder sehen gerade nur die Wartungsseite. <a href="/admin/site.php">Beenden</a></div>
<?php endif; ?>
<?= $announcementHtml ?>
<?php foreach ($otherFlashes as $flash): ?>
<div class="flash flash-<?= e($flash['type']) ?>"><?= e($flash['message']) ?></div>
<?php endforeach; ?>
<?php if (!empty($errorFlashes)): ?>
<noscript><?php foreach ($errorFlashes as $flash): ?><div class="flash flash-error"><?= e($flash['message']) ?></div><?php endforeach; ?></noscript>
<?php endif; ?>
<?php else: ?>
<header class="navbar">
<div class="navbar-brand"><a href="/"><img src="<?= e(asset_url('/assets/images/logo-lumina-ascendens.webp')) ?>" alt="Lumina Ascendens" width="410" height="168"></a></div>
<div class="navbar-user">
<?php if ($publicLayout && setting_get('calendar_public') === '1'): ?>
<a href="/calendar.php" class="navbar-discord navbar-calendar"><?= icon('calendar') ?>Termine</a>
<?php endif; ?>
<?php if ($publicLayout): ?>
<a href="<?= e(DISCORD_INVITE_URL) ?>" target="_blank" rel="noopener" class="navbar-discord" aria-label="Discord"><?= discord_logo(18) ?>Discord</a>
<?php endif; ?>
<?php if ($publicLayout && $currentUser && $currentUser['status'] === 'active'): ?>
<?php // Gleicher Effekt wie "Zum Lumishop" im Dashboard (.dashboard-cta) ?>
<a href="/dashboard.php" class="button button-small dashboard-cta dashboard-cta-primary">Mitgliederbereich</a>
<?php elseif ($currentUser): ?>
<a href="/logout.php">Abmelden</a>
<?php else: ?>
<a href="/login.php"<?= $publicLayout ? ' class="button button-small"' : '' ?>>Login</a>
<?php endif; ?>
</div>
</header>
<?php // $fullBleed: die Seite setzt ihre Abschnitte selbst (z.B. randloses Banner auf der Startseite). ?>
<main class="<?= !empty($fullBleed) ? 'page-full' : 'container' ?>">
<?php if ($announcementHtml !== ''): ?>
<div class="<?= !empty($fullBleed) ? 'site-announcement-wrap' : '' ?>"><?= $announcementHtml ?></div>
<?php endif; ?>
<?php foreach ($otherFlashes as $flash): ?>
<div class="flash flash-<?= e($flash['type']) ?>"><?= e($flash['message']) ?></div>
<?php endforeach; ?>
<?php if (!empty($errorFlashes)): ?>
<noscript><?php foreach ($errorFlashes as $flash): ?><div class="flash flash-error"><?= e($flash['message']) ?></div><?php endforeach; ?></noscript>
<?php endif; ?>
<?php endif; ?>