70 lines
2.3 KiB
PHP
70 lines
2.3 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';
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<!-- Begin Head -->
|
|
<?php require $partialsPath . '/head.php'; ?>
|
|
<!-- End of Head -->
|
|
<body id="page-top">
|
|
|
|
<!-- Page Wrapper -->
|
|
<div id="wrapper">
|
|
<!-- Begin Sidebar -->
|
|
<?php if (!defined('LOGIN_PAGE')): require $partialsPath . '/sidebar.php'; endif ?>
|
|
<!-- End of Sidebar -->
|
|
<!-- Content Wrapper -->
|
|
<div id="content-wrapper" class="d-flex flex-column">
|
|
|
|
<!-- Main Content -->
|
|
<div id="content">
|
|
<!-- Begin Topbar -->
|
|
<?php if (!defined('LOGIN_PAGE')): require $partialsPath . '/topbar.php'; endif; ?>
|
|
<!-- End of Topbar -->
|
|
<!-- Begin Page Content -->
|
|
<div class="container-fluid">
|
|
<?php require $contentView; ?>
|
|
</div>
|
|
<!-- End of Page Content -->
|
|
</div>
|
|
<!-- End of Main Content -->
|
|
<!-- Begin Footer -->
|
|
<?php require $partialsPath . '/footer.php'; ?>
|
|
<!-- End of Footer -->
|
|
</div>
|
|
<!-- End of Content Wrapper -->
|
|
</div>
|
|
<!-- End of Page Wrapper -->
|
|
<?php require $partialsPath . '/scripts.php'; ?>
|
|
</body>
|
|
</html>
|
|
<?php
|
|
}
|