83 lines
2.7 KiB
PHP
83 lines
2.7 KiB
PHP
<?php
|
|
class ModuleService {
|
|
private static $modules = [
|
|
'dinos' => [
|
|
'slug' => 'dinos',
|
|
'name' => 'Dino Generator',
|
|
'icon' => '🦖',
|
|
'badge' => 'AI Art',
|
|
'description' => 'KI Dino-Bilderstellung & Google Photos Sync',
|
|
'path' => '/dinos',
|
|
'adminOnly' => false
|
|
],
|
|
'plants' => [
|
|
'slug' => 'plants',
|
|
'name' => 'Plant Tracker',
|
|
'icon' => '🪴',
|
|
'badge' => 'AI Vision',
|
|
'description' => 'Pflanzen-Tracking, Pflege & KI-Erkennung',
|
|
'path' => '/plants',
|
|
'adminOnly' => false
|
|
],
|
|
'storymachine' => [
|
|
'slug' => 'storymachine',
|
|
'name' => 'Story Machine',
|
|
'icon' => '📖',
|
|
'badge' => 'Creative',
|
|
'description' => 'Interaktive Kinder-Geschichtenmaschine',
|
|
'path' => '/storymachine',
|
|
'adminOnly' => false
|
|
],
|
|
'cooles-feature' => [
|
|
'slug' => 'cooles-feature',
|
|
'name' => 'Web Audio Synth',
|
|
'icon' => '🎛️',
|
|
'badge' => 'Audio Lab',
|
|
'description' => 'Interaktive Web Audio API Synthese',
|
|
'path' => '/cooles-feature',
|
|
'adminOnly' => false
|
|
],
|
|
'admin-tools' => [
|
|
'slug' => 'admin-tools',
|
|
'name' => 'Admin Tools',
|
|
'icon' => '🛠️',
|
|
'badge' => 'System',
|
|
'description' => 'Hash Generator, Diagnostik & Systemwerkzeuge',
|
|
'path' => '/admin-tools',
|
|
'adminOnly' => true
|
|
],
|
|
'test' => [
|
|
'slug' => 'test',
|
|
'name' => 'Test Environment',
|
|
'icon' => '🧪',
|
|
'badge' => 'Sandbox',
|
|
'description' => 'Test- und Entwicklungsumgebung',
|
|
'path' => '/test',
|
|
'adminOnly' => false
|
|
]
|
|
];
|
|
|
|
public static function getAll(): array {
|
|
return self::$modules;
|
|
}
|
|
|
|
public static function getBySlug(string $slug): ?array {
|
|
return self::$modules[$slug] ?? null;
|
|
}
|
|
|
|
public static function getAccessibleForUser(array $userProjects, bool $isAdmin = false): array {
|
|
$accessible = [];
|
|
foreach (self::$modules as $slug => $module) {
|
|
if ($isAdmin) {
|
|
$accessible[$slug] = $module;
|
|
} elseif (in_array($slug, $userProjects, true) && !$module['adminOnly']) {
|
|
$accessible[$slug] = $module;
|
|
}
|
|
}
|
|
return $accessible;
|
|
}
|
|
|
|
public static function isValidModule(string $slug): bool {
|
|
return isset(self::$modules[$slug]);
|
|
}
|
|
}
|