85 lines
3.5 KiB
PHP
85 lines
3.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/helpers.php';
|
|
|
|
@date_default_timezone_set('Asia/Jakarta');
|
|
|
|
function render_header(string $pageTitle, string $active = ''): void {
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
$metaDescription = $projectDescription !== '' ? $projectDescription : 'Aplikasi tata kelola surat internal perusahaan.';
|
|
$siteTitle = 'SuratFlow';
|
|
$fullTitle = $pageTitle !== '' ? $pageTitle . ' | ' . $siteTitle : $siteTitle;
|
|
$cssPath = __DIR__ . '/../assets/css/custom.css';
|
|
$jsPath = __DIR__ . '/../assets/js/main.js';
|
|
$cssVer = file_exists($cssPath) ? (string)filemtime($cssPath) : (string)time();
|
|
$jsVer = file_exists($jsPath) ? (string)filemtime($jsPath) : (string)time();
|
|
$GLOBALS['asset_js_ver'] = $jsVer;
|
|
?>
|
|
<!doctype html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= h($fullTitle) ?></title>
|
|
<meta name="description" content="<?= h($metaDescription) ?>" />
|
|
<?php if ($projectDescription): ?>
|
|
<meta property="og:description" content="<?= h($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= h($projectDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= h($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= h($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="/assets/css/custom.css?v=<?= h($cssVer) ?>" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-expand-lg navbar-light">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="/index.php">SuratFlow</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav">
|
|
<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 === 'masuk' ? 'active' : '' ?>" href="/surat_masuk.php">Surat Masuk</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= $active === 'keluar' ? 'active' : '' ?>" href="/surat_keluar.php">Surat Keluar</a>
|
|
</li>
|
|
</ul>
|
|
<div class="d-flex align-items-center gap-2">
|
|
<span class="tag">Internal • 1 Perusahaan</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<main class="container py-4">
|
|
<?php
|
|
}
|
|
|
|
function render_footer(): void {
|
|
?>
|
|
</main>
|
|
<footer class="container footer">
|
|
<div class="d-flex flex-wrap justify-content-between align-items-center gap-2">
|
|
<span>© <?= date('Y') ?> SuratFlow — Tata kelola surat internal.</span>
|
|
<span>Semua waktu: <?= date('d M Y H:i') ?> WIB</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=<?= h((string)($GLOBALS['asset_js_ver'] ?? time())) ?>"></script>
|
|
</body>
|
|
</html>
|
|
<?php
|
|
}
|