44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Zentrales Layout für das AD Admin Tool.
|
|
*
|
|
* Erwartet (aus index.php übergeben):
|
|
* - string $contentView Pfad zur Content-View (z. B. public/views/dashboard.php)
|
|
* - array<string, mixed> $viewData Daten-Array für die View
|
|
* - string $pageTitle Seitentitel
|
|
* - string|null $activeMenu Kennung für die Sidebar (z. B. 'dashboard' oder 'users')
|
|
*/
|
|
|
|
// Daten-Array in einzelne Variablen entpacken,
|
|
// sodass die Content-Views direkt mit $users, $groups, $serverStatus, $error etc. arbeiten können.
|
|
function renderLayout(string $contentView, array $viewData, string $pageTitle, ?string $activeMenu): void
|
|
{
|
|
// Daten-Array in einzelne Variablen entpacken
|
|
foreach ($viewData as $key => $value) {
|
|
if (is_string($key) && $key !== '') {
|
|
$cleanKey = preg_replace('/[^a-zA-Z0-9_]/', '', $key);
|
|
if ($cleanKey !== '') {
|
|
$$cleanKey = $value;
|
|
}
|
|
}
|
|
}
|
|
|
|
$partialsPath = __DIR__ . '/partials';
|
|
|
|
require $partialsPath . '/head.php';
|
|
require $partialsPath . '/sidebar.php';
|
|
require $partialsPath . '/topbar.php';
|
|
?>
|
|
<!-- Begin Page Content -->
|
|
<div class="container-fluid">
|
|
<?php require $contentView; ?>
|
|
</div>
|
|
<!-- /.container-fluid -->
|
|
<?php
|
|
require $partialsPath . '/footer.php';
|
|
require $partialsPath . '/scripts.php';
|
|
}
|