LuminaWebsite/dashboard.php
Maaxxs 8c703f0e1f Add Discord account linking and raid signup/management from the website
- Class name on raid signups now shows only as an icon tooltip instead
  of trailing text (falls back to text when no icon matches).
- Discord OAuth2 linking (discord_login.php/discord_callback.php,
  includes/discord.php): members connect their Discord account from
  the dashboard, storing discord_id/discord_username so raid signups
  can be attributed to their real Discord identity. Needs a Discord
  application's client_id/client_secret in config.php.
- raids.php gets self-service signup/withdraw controls (class + group
  picker, upsert semantics) for members with a linked Discord account,
  plus archive/restore controls gated behind a new raids.manage
  permission. New action scripts raid_signup.php, raid_unsignup.php,
  raid_archive.php, raid_restore.php call the corresponding
  includes/raids_api.php functions.
- Archive/restore already work today (verified live against the bot's
  API - archived and restored the one active raid, signups intact).
  Signup/withdraw are fully wired on the website side but need two new
  bot-side endpoints (POST .../signup, DELETE .../signup/{user_id})
  that don't exist yet - contract documented in the README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-18 13:25:41 +02:00

72 lines
2.7 KiB
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_permission('dashboard.view');
$user = current_user();
$canViewUsers = user_has_permission('users.view');
$canManageRoles = user_has_permission('roles.manage');
$canViewRaids = user_has_permission('raids.view');
$pageTitle = 'Dashboard';
include __DIR__ . '/includes/header.php';
?>
<div class="panel">
<h1>Willkommen, <?= e($user['display_name'] !== '' ? $user['display_name'] : $user['username']) ?>!</h1>
<p class="text-muted">Dies ist dein Mitgliederbereich. Die eigentliche Gilden-Homepage folgt hier später.</p>
</div>
<div class="panel">
<h2>Discord-Verknüpfung</h2>
<?php if (!empty($user['discord_id'])): ?>
<p>Verknüpft als <strong><?= e((string) $user['discord_username']) ?></strong></p>
<form method="post" action="/discord_unlink.php" class="inline-form" onsubmit="return confirm('Discord-Verknüpfung wirklich entfernen?');">
<?= csrf_field() ?>
<button type="submit" class="button-secondary">Verknüpfung entfernen</button>
</form>
<?php else: ?>
<p class="text-muted">Verknüpfe deinen Discord-Account, um dich über die Website zu Raids anmelden zu können.</p>
<a class="button" href="/discord_login.php">Mit Discord verknüpfen</a>
<?php endif; ?>
</div>
<?php if ($canViewRaids): ?>
<div class="panel">
<div class="card-grid">
<div class="panel stat-card">
<div class="icon-badge"><?= icon('calendar') ?></div>
<div>
<h3>Raids</h3>
<p class="text-muted"><a href="/raids.php">Anstehende Raid-Termine ansehen</a></p>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php if ($canViewUsers || $canManageRoles): ?>
<div class="panel">
<h2>Administration</h2>
<div class="card-grid">
<?php if ($canViewUsers): ?>
<div class="panel stat-card">
<div class="icon-badge"><?= icon('users') ?></div>
<div>
<h3>Benutzerverwaltung</h3>
<p class="text-muted"><a href="/admin/users.php">Mitglieder anlegen, bearbeiten, deaktivieren</a></p>
</div>
</div>
<?php endif; ?>
<?php if ($canManageRoles): ?>
<div class="panel stat-card">
<div class="icon-badge"><?= icon('shield') ?></div>
<div>
<h3>Berechtigungsgruppen</h3>
<p class="text-muted"><a href="/admin/roles.php">Rollen und Berechtigungen verwalten</a></p>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php include __DIR__ . '/includes/footer.php'; ?>