39065-vm/includes/layout.php
2026-03-09 14:12:06 +00:00

69 lines
3.1 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../db/config.php';
require_once __DIR__ . '/db_init.php';
require_once __DIR__ . '/helpers.php';
function render_header(string $title, string $active = ''): void {
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<!doctype html>
<html lang="id">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?= e($title) ?></title>
<?php if ($projectDescription): ?>
<meta name="description" content='<?= e($projectDescription) ?>' />
<meta property="og:description" content="<?= e($projectDescription) ?>" />
<meta property="twitter:description" content="<?= e($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<meta property="og:image" content="<?= e($projectImageUrl) ?>" />
<meta property="twitter:image" content="<?= e($projectImageUrl) ?>" />
<?php endif; ?>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>" />
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top app-nav">
<div class="container">
<a class="navbar-brand fw-semibold" href="index.php">Sistem Informasi Kepegawaian</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav" aria-controls="mainNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNav">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link <?= $active === 'dashboard' ? 'active' : '' ?>" href="index.php">Dashboard</a></li>
<li class="nav-item"><a class="nav-link <?= $active === 'employees' ? 'active' : '' ?>" href="employees.php">Pegawai</a></li>
<li class="nav-item"><a class="nav-link <?= $active === 'departments' ? 'active' : '' ?>" href="departments.php">Departemen</a></li>
<li class="nav-item"><a class="nav-link <?= $active === 'positions' ? 'active' : '' ?>" href="positions.php">Jabatan</a></li>
</ul>
<div class="d-flex gap-2">
<a href="employee_new.php" class="btn btn-primary btn-sm">Tambah Pegawai</a>
</div>
</div>
</div>
</nav>
<main class="container my-4 my-lg-5">
<?php
}
function render_footer(): void {
?>
</main>
<footer class="border-top py-3 mt-4">
<div class="container d-flex flex-wrap justify-content-between small text-muted">
<span>© <?= date('Y') ?> HRIS · Sistem Informasi Kepegawaian</span>
<span>Updated <?= date('d M Y, H:i') ?> UTC</span>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?= time() ?>"></script>
</body>
</html>
<?php
}