Folder reorganize 1
This commit is contained in:
53
menu.php
Normal file
53
menu.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php // phpcs:ignoreFile
|
||||
|
||||
$assetBasePath = $assetBasePath ?? '';
|
||||
|
||||
$cropDayValue = null;
|
||||
$cropDaySource = __DIR__ . '/includes/cropday.php';
|
||||
|
||||
if (is_file($cropDaySource)) {
|
||||
ob_start();
|
||||
include $cropDaySource;
|
||||
$captured = trim(ob_get_clean());
|
||||
|
||||
if ($captured !== '') {
|
||||
$cropDayValue = $captured;
|
||||
}
|
||||
}
|
||||
|
||||
$menuItems = [
|
||||
//['label' => 'My Dashboard', 'href' => 'personal/dashboard.php'],
|
||||
['label' => 'Overview', 'href' => 'overview.php'],
|
||||
['label' => 'Milling', 'href' => 'milling.php'],
|
||||
['label' => 'Boilers', 'href' => 'boilers.php'],
|
||||
['label' => 'Fabrication', 'href' => 'fabrication.php'],
|
||||
['label' => 'Tables', 'href' => 'tables.php'],
|
||||
];
|
||||
?>
|
||||
|
||||
<aside class="app-sidebar">
|
||||
<div class="sidebar-meta" role="presentation">
|
||||
<span class="sidebar-meta__label">Crop Day</span>
|
||||
<span class="sidebar-meta__value"><?php echo $cropDayValue !== null ? htmlspecialchars($cropDayValue) : '—'; ?></span>
|
||||
</div>
|
||||
<div class="sidebar-heading">Operations</div>
|
||||
<ul class="nav-list">
|
||||
<?php foreach ($menuItems as $item) : ?>
|
||||
<?php
|
||||
$href = $item['href'];
|
||||
$normalizedHref = ltrim($href, '/');
|
||||
$isExternal = preg_match('/^https?:\/\//i', $href);
|
||||
$renderHref = $isExternal ? $href : ($assetBasePath . $normalizedHref);
|
||||
$isActive = !$isExternal && ($currentPage === basename($normalizedHref) || (!empty($currentPath) && $currentPath === $normalizedHref));
|
||||
?>
|
||||
<li>
|
||||
<a
|
||||
class="nav-link <?php echo $isActive ? 'nav-link--active' : ''; ?>"
|
||||
href="<?php echo htmlspecialchars($renderHref); ?>"
|
||||
>
|
||||
<span><?php echo htmlspecialchars($item['label']); ?></span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</aside>
|
||||
Reference in New Issue
Block a user