nexus basic

This commit is contained in:
2026-06-04 22:07:25 +02:00
parent aa7ec1d321
commit 3c1cc30fe9
11 changed files with 1222 additions and 197 deletions

View File

@@ -12,6 +12,7 @@ $timezoneOptions = modules()->timezones();
$nexusSettings = nexus_settings();
$isAdmin = auth_is_admin();
$notice = null;
$publicDashboards = $isAdmin ? dashboards()->listPublicDashboards() : [];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$settingsSection = trim((string) ($_POST['settings_section'] ?? 'theme'));
@@ -19,6 +20,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$displayTimezoneCustom = isset($_POST['display_timezone_custom']) ? '1' : '0';
$displayTimezone = trim((string) ($_POST['display_timezone'] ?? ''));
$cronTimezone = trim((string) ($_POST['cron_timezone'] ?? ''));
$globalHomeDashboardId = (int) ($_POST['global_home_dashboard_id'] ?? 0);
foreach (['displayTimezone' => $displayTimezone, 'cronTimezone' => $cronTimezone] as $key => $value) {
if ($value !== '') {
@@ -33,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nexusSettings['display_timezone_custom'] = $displayTimezoneCustom;
$nexusSettings['display_timezone'] = $displayTimezoneCustom === '1' ? $displayTimezone : '';
$nexusSettings['cron_timezone'] = $cronTimezone;
$nexusSettings['global_home_dashboard_id'] = $globalHomeDashboardId > 0 ? (string) $globalHomeDashboardId : '';
nexus_save_settings($nexusSettings);
$nexusSettings = nexus_settings();
$notice = 'Nexus-Einstellungen gespeichert.';
@@ -53,11 +56,35 @@ $effectiveCronTimezone = nexus_cron_timezone_name();
$displayTimezoneCustom = !empty($nexusSettings['display_timezone_custom']);
$savedDisplayTimezone = trim((string) ($nexusSettings['display_timezone'] ?? ''));
$savedCronTimezone = trim((string) ($nexusSettings['cron_timezone'] ?? ''));
$globalHomeDashboardId = (int) ($nexusSettings['global_home_dashboard_id'] ?? 0);
$GLOBALS['layout_header_base_title'] = 'Nexus Setup';
$GLOBALS['layout_header_title'] = 'Nexus Setup';
$GLOBALS['layout_header_context'] = 'Allgemein';
$GLOBALS['layout_header_text'] = 'Globale Grundeinstellungen, Home-Dashboard und systemweite Standardwerte.';
?>
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
<header class="module-hero submenu-box">
<div class="module-hero-top module-hero-top--compact">
<nav class="module-tabs" aria-label="Nexus Setup Navigation">
<a class="module-button module-button--tab-active" href="/settings">Allgemein</a>
<?php if ($isAdmin): ?>
<a class="module-button module-button--tab" href="/settings/widgets">Widgets</a>
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
<a class="module-button module-button--tab" href="/settings/search-engines">Suchmaschinen</a>
<a class="module-button module-button--tab" href="/settings/apps">Apps</a>
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
<?php endif; ?>
</nav>
<div class="module-hero-actions module-submenu-actions">
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
</div>
</div>
</header>
<section class="section-box">
<h1>Nexus Einstellungen</h1>
<p class="muted">Persönliche Anzeige und systemweite Standardwerte.</p>
<p class="muted">Persönliche Anzeige, Home-Dashboard und systemweite Standardwerte.</p>
<?php if ($notice): ?>
<div class="section-box" style="margin-top:1rem; border-color:var(--accent-2);">
@@ -115,6 +142,18 @@ $savedCronTimezone = trim((string) ($nexusSettings['cron_timezone'] ?? ''));
<div><?= e($systemTimezone) ?></div>
<small class="muted">Diese Zeitzone wird genutzt, wenn keine globale Anzeige-Zeitzone gesetzt ist.</small>
</div>
<label class="setup-field muted">
<span>Öffentliches Home-Dashboard</span>
<select name="global_home_dashboard_id">
<option value="0">Kein öffentliches Home-Dashboard</option>
<?php foreach ($publicDashboards as $dashboard): ?>
<option value="<?= (int) ($dashboard['id'] ?? 0) ?>" <?= (int) ($dashboard['id'] ?? 0) === $globalHomeDashboardId ? 'selected' : '' ?>>
<?= e((string) ($dashboard['title'] ?? 'Dashboard')) ?>
</option>
<?php endforeach; ?>
</select>
<small class="muted">Dieses öffentliche Dashboard wird am Root-Pfad angezeigt, wenn Nutzer nicht eingeloggt sind.</small>
</label>
<div class="setup-field muted">
<span>Anzeige-Zeitzone</span>
<label style="display:flex; align-items:center; gap:10px;">