102 lines
3.5 KiB
PHP
102 lines
3.5 KiB
PHP
<?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;
|
|
}
|
|
}
|
|
|
|
$menuSections = [
|
|
[
|
|
'title' => 'Operations',
|
|
'items' => [
|
|
//['label' => 'My Dashboard', 'href' => 'personal/dashboard.php'],
|
|
['label' => 'Overview', 'href' => 'overview.php'],
|
|
['label' => 'Milling', 'href' => 'milling.php'],
|
|
['label' => 'Boilers', 'href' => 'boilers.php'],
|
|
['label' => 'CVP', 'href' => 'cvp.php'],
|
|
['label' => 'Fabrication', 'href' => 'fabrication.php'],
|
|
['label' => 'Tables', 'href' => 'tables.php'],
|
|
['label' => 'Truck Dumps', 'href' => 'truckdump.php'],
|
|
['label' => 'Cameras', 'href' => 'cameras.php'],
|
|
],
|
|
],
|
|
|
|
[
|
|
'title' => 'Analytics',
|
|
'items' => [
|
|
['label' => 'Database Search', 'href' => 'opcsearch.php'],
|
|
['label' => 'Live Charts', 'href' => 'trends/live/index.php'],
|
|
['label' => 'Grind Target', 'href' => 'trends/targets/grind-target.php'],
|
|
['label' => 'Cohort Comparison', 'href' => 'trends/cohort.php'],
|
|
['label' => 'Alert History', 'href' => 'alert-log.php'],
|
|
['label' => 'Tag Health Audit', 'href' => 'trends/tag-health.php'],
|
|
],
|
|
],
|
|
|
|
[
|
|
'title' => 'Reports',
|
|
'items' => [
|
|
//['label' => 'Mill Dashboard', 'href' => 'reports/milldata-dashboard.php'],
|
|
['label' => 'Mill Weekly Report', 'href' => 'reports/milldata.php'],
|
|
],
|
|
],
|
|
|
|
[
|
|
'title' => 'Controls',
|
|
'items' => [
|
|
['label' => 'Alerts Admin', 'href' => 'alerts-admin.php'],
|
|
['label' => 'Tag Overrides', 'href' => 'tag-controls.php'],
|
|
['label' => 'Power', 'href' => 'power.php'],
|
|
['label' => 'Latency Monitor', 'href' => 'latency-monitor.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>
|
|
<?php foreach ($menuSections as $section) : ?>
|
|
<div class="sidebar-heading"><?php echo htmlspecialchars($section['title']); ?></div>
|
|
<ul class="nav-list">
|
|
<?php foreach ($section['items'] 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); ?>"
|
|
<?php if (!empty($item['target'])) : ?>target="<?php echo htmlspecialchars($item['target']); ?>" rel="noopener"<?php endif; ?>
|
|
>
|
|
<span><?php echo htmlspecialchars($item['label']); ?></span>
|
|
<?php if (!empty($item['target'])) : ?>
|
|
<span aria-hidden="true">↗</span>
|
|
<?php endif; ?>
|
|
</a>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<br>
|
|
<?php endforeach; ?>
|
|
</aside>
|