59 lines
2.7 KiB
PHP
59 lines
2.7 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_auth();
|
|
|
|
$service = dashboards();
|
|
$ownerKey = auth_user_key();
|
|
$groups = auth_groups();
|
|
$pageModuleId = (int) ($_GET['id'] ?? 0);
|
|
$pageModule = $service->getPageModule($pageModuleId, $ownerKey, $groups);
|
|
|
|
if ($pageModule === null) {
|
|
http_response_code(404);
|
|
echo '<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack"><section class="section-box">Seitenmodul nicht gefunden.</section></div></div></div>';
|
|
return;
|
|
}
|
|
|
|
$targetUrl = trim((string) ($pageModule['target_url'] ?? ''));
|
|
$openMode = (string) ($pageModule['open_mode'] ?? 'embed');
|
|
if ($targetUrl !== '' && $openMode === 'same_tab') {
|
|
redirect($targetUrl);
|
|
}
|
|
|
|
$GLOBALS['layout_header_base_title'] = 'Nexus';
|
|
$GLOBALS['layout_header_title'] = 'Nexus';
|
|
$GLOBALS['layout_header_context'] = (string) ($pageModule['title'] ?? 'Seitenmodul');
|
|
$GLOBALS['layout_header_text'] = (string) ($pageModule['description'] ?? 'On-the-fly angelegtes Seitenmodul.');
|
|
?>
|
|
<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="Seitenmodul Navigation">
|
|
<a class="module-button module-button--tab" href="/dashboard">Dashboard</a>
|
|
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
|
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
|
|
<a class="module-button module-button--tab-active" href="/page-modules">Seitenmodule</a>
|
|
</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">
|
|
<h2><?= e((string) ($pageModule['title'] ?? 'Seitenmodul')) ?></h2>
|
|
<p class="muted"><?= e((string) ($pageModule['description'] ?? '')) ?></p>
|
|
<?php if ($targetUrl === ''): ?>
|
|
<div class="dashboard-empty">Dieses Seitenmodul hat noch keine Ziel-URL.</div>
|
|
<?php elseif ((string) ($pageModule['module_type'] ?? 'link') === 'iframe' || $openMode === 'embed'): ?>
|
|
<iframe class="dashboard-widget__frame dashboard-widget__frame--page" src="<?= e($targetUrl) ?>" loading="lazy" referrerpolicy="no-referrer"></iframe>
|
|
<?php else: ?>
|
|
<div class="dashboard-widget__meta">
|
|
<p><?= e($targetUrl) ?></p>
|
|
<a class="module-button module-button--secondary module-button--small" href="<?= e($targetUrl) ?>" target="_blank" rel="noreferrer">Extern öffnen</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</section>
|
|
</div></div></div>
|