diff --git a/README.md b/README.md
index 6142753..8be473f 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,8 @@ und wird später ausgebaut. Fokus dieser Version ist der Mitglieder-/Admin-Berei
- Berechtigungen: feste Kern-Berechtigungen + eigene, frei anlegbare Berechtigungs-Schlüssel
für zukünftige Funktionen
- Jeder Benutzer kann mehreren Berechtigungsgruppen angehören
+- Raids-Seite: zeigt anstehende Raid-Termine, Anforderungen, Gruppen und Anmeldungen,
+ bezogen von einer externen API (`config.php: raids_api`)
## Ordnerstruktur
@@ -59,6 +61,23 @@ Spalte `must_change_password`), muss sie nachträglich ergänzt werden:
ALTER TABLE users ADD COLUMN must_change_password TINYINT(1) NOT NULL DEFAULT 0 AFTER status;
```
+### Raids-API einrichten
+
+In `config.php` einen Abschnitt `raids_api` mit URL und Schlüssel deiner API ergänzen:
+
+```php
+'raids_api' => [
+ 'url' => 'https://api.maaxxs-coding.de/api/raids',
+ 'key' => 'dein-api-key',
+],
+```
+
+Falls dein Account bereits vor diesem Update installiert wurde, kennt deine Datenbank die
+Berechtigung `raids.view` noch nicht automatisch. Leg sie einmalig unter **Berechtigungsgruppen
+-> Neue Berechtigung anlegen** mit dem Schlüssel `raids.view` an und hake sie bei den Gruppen ab,
+die Raids sehen sollen (z.B. Administrator und Mitglied). Bei einer frischen Installation über
+`install.php` passiert das automatisch.
+
## Berechtigungskonzept
- **Berechtigungen** sind einzelne Schlüssel wie `users.view`, `roles.manage`, `dashboard.view`.
diff --git a/assets/css/style.css b/assets/css/style.css
index 0bb2ea6..8cd1384 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -361,6 +361,34 @@ input:focus, select:focus, textarea:focus {
.stat-card h3 { margin: 0 0 0.15rem; color: var(--text); font-size: 1rem; }
.stat-card p { margin: 0; }
+.raid-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 1rem;
+ flex-wrap: wrap;
+}
+
+.raid-header h2 { margin: 0; }
+
+.raid-groups {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+ gap: 1rem;
+ margin-top: 1rem;
+}
+
+.raid-group {
+ background: var(--bg-panel-alt);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ padding: 1rem;
+}
+
+.raid-group h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--text); }
+.raid-group ul { margin: 0; padding-left: 1.1rem; }
+.raid-group li { margin-bottom: 0.25rem; }
+
@media (max-width: 860px) {
.app-shell {
flex-direction: column;
diff --git a/config.example.php b/config.example.php
index 0b888a0..8b49bb8 100644
--- a/config.example.php
+++ b/config.example.php
@@ -13,4 +13,8 @@ return [
'app' => [
'name' => 'Aion2 Gilde',
],
+ 'raids_api' => [
+ 'url' => 'https://api.maaxxs-coding.de/api/raids',
+ 'key' => 'dein-api-key',
+ ],
];
diff --git a/dashboard.php b/dashboard.php
index 61fa7d4..00c1cd5 100644
--- a/dashboard.php
+++ b/dashboard.php
@@ -5,6 +5,7 @@ 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';
@@ -14,6 +15,20 @@ include __DIR__ . '/includes/header.php';
Dies ist dein Mitgliederbereich. Die eigentliche Gilden-Homepage folgt hier später.
+
+
+
+
+
= icon('calendar') ?>
+
+
+
+
+
+
Administration
diff --git a/includes/functions.php b/includes/functions.php
index aea7b25..6e43e8d 100644
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -69,6 +69,7 @@ function icon(string $name): string
'shield' => '
',
'log-out' => '
',
'lock' => '
',
+ 'calendar' => '
',
];
$path = $paths[$name] ?? '';
diff --git a/includes/header.php b/includes/header.php
index 86a11c4..effeb72 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -3,10 +3,12 @@
$currentUser = current_user();
$canViewUsers = $currentUser && user_has_permission('users.view');
$canManageRoles = $currentUser && user_has_permission('roles.manage');
+$canViewRaids = $currentUser && user_has_permission('raids.view');
$showAdminMenu = $canViewUsers || $canManageRoles;
$currentScript = basename((string) ($_SERVER['SCRIPT_NAME'] ?? ''));
$isDashboardActive = $currentScript === 'dashboard.php';
+$isRaidsActive = $currentScript === 'raids.php';
$isUsersActive = in_array($currentScript, ['users.php', 'user_form.php', 'user_delete.php'], true);
$isRolesActive = in_array($currentScript, ['roles.php', 'role_form.php', 'role_delete.php'], true);
?>
@@ -27,6 +29,11 @@ $isRolesActive = in_array($currentScript, ['roles.php', 'role_form.php', 'role_d
+
+
+
diff --git a/includes/permissions.php b/includes/permissions.php
index 9d18cf4..fe5986a 100644
--- a/includes/permissions.php
+++ b/includes/permissions.php
@@ -12,6 +12,7 @@ const CORE_PERMISSIONS = [
['key' => 'users.edit', 'description' => 'Benutzer bearbeiten'],
['key' => 'users.delete', 'description' => 'Benutzer löschen'],
['key' => 'roles.manage', 'description' => 'Berechtigungsgruppen verwalten'],
+ ['key' => 'raids.view', 'description' => 'Raids einsehen'],
];
function user_has_permission(string $key): bool
diff --git a/includes/raids_api.php b/includes/raids_api.php
new file mode 100644
index 0000000..c236464
--- /dev/null
+++ b/includes/raids_api.php
@@ -0,0 +1,52 @@
+>
+ * @throws RuntimeException
+ */
+function fetch_raids(): array
+{
+ $configPath = __DIR__ . '/../config.php';
+ if (!file_exists($configPath)) {
+ throw new RuntimeException('Konfigurationsdatei fehlt.');
+ }
+
+ $config = require $configPath;
+ $apiUrl = $config['raids_api']['url'] ?? '';
+ $apiKey = $config['raids_api']['key'] ?? '';
+
+ if ($apiUrl === '' || $apiKey === '') {
+ throw new RuntimeException('Raid-API ist nicht konfiguriert (config.php: raids_api.url / raids_api.key fehlt).');
+ }
+
+ if (!function_exists('curl_init')) {
+ throw new RuntimeException('Die PHP-cURL-Erweiterung ist auf diesem Server nicht aktiviert.');
+ }
+
+ $ch = curl_init($apiUrl);
+ curl_setopt_array($ch, [
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_HTTPHEADER => ['X-API-Key: ' . $apiKey],
+ CURLOPT_TIMEOUT => 10,
+ CURLOPT_SSL_VERIFYPEER => true,
+ ]);
+ $response = curl_exec($ch);
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $curlError = curl_error($ch);
+ curl_close($ch);
+
+ if ($response === false) {
+ throw new RuntimeException('Verbindung zur Raid-API fehlgeschlagen: ' . $curlError);
+ }
+ if ($httpCode !== 200) {
+ throw new RuntimeException('Raid-API antwortete mit Statuscode ' . $httpCode . '.');
+ }
+
+ $data = json_decode($response, true);
+ if (!is_array($data) || ($data['status'] ?? '') !== 'success' || !isset($data['raids']) || !is_array($data['raids'])) {
+ throw new RuntimeException('Unerwartetes Antwortformat der Raid-API.');
+ }
+
+ return $data['raids'];
+}
diff --git a/install.php b/install.php
index 40d5764..4152211 100644
--- a/install.php
+++ b/install.php
@@ -51,6 +51,8 @@ function seed_defaults(PDO $pdo): array
$pdo->prepare('INSERT IGNORE INTO role_permissions (role_id, permission_id) VALUES (?, ?)')
->execute([$memberRoleId, $permissionIds['dashboard.view']]);
+ $pdo->prepare('INSERT IGNORE INTO role_permissions (role_id, permission_id) VALUES (?, ?)')
+ ->execute([$memberRoleId, $permissionIds['raids.view']]);
return ['admin_role_id' => $adminRoleId];
}
diff --git a/raids.php b/raids.php
new file mode 100644
index 0000000..50d7f37
--- /dev/null
+++ b/raids.php
@@ -0,0 +1,91 @@
+getMessage();
+}
+
+$pageTitle = 'Raids';
+include __DIR__ . '/includes/header.php';
+?>
+
+
Raids
+
Anstehende Raid-Termine deiner Gilde.
+
+
+
+
+
Raid-Daten konnten nicht geladen werden: = e($apiError) ?>
+
+
+
+
Aktuell sind keine Raids geplant.
+
+
+
+
+
+
+
= e($dateLabel) ?>
+
+
Anforderungen: = e($requirements) ?>
+
+
+
Gearscore: = e($gearscore) ?>
+
+
+
+
+ $groupName): ?>
+
+
+
= e($groupName) ?>
+
+
Keine Anmeldungen
+
+
+
+ -
+ = e((string) ($member['name'] ?? '?')) ?>
+ (= e((string) ($member['class'] ?? '')) ?>)
+
+
+
+
+
+
+
+
+
+
+
+
+