flexday/nav-mobile.php

31 lines
1.9 KiB
PHP

<?php
$current_path = isset($MY_PATH) ? basename($MY_PATH) : basename($_SERVER['PHP_SELF']);
$is_index = ($current_path === 'index.php');
$is_all = ($current_path === 'allsessions.php');
$is_hist = ($current_path === 'history.php');
$is_report = ($current_path === 'report.php');
$link_base = 'px-3 py-2 rounded focus:outline-none focus:ring-2 focus:ring-white/70';
$link_active = 'bg-white text-blue-700';
$link_inactive = 'hover:bg-blue-700';
// Determine report access from conf_uinforecord id=6 (CSV of conf_users.id)
$allowed_ids_csv = '';
if (function_exists('single_row_select')) {
$row6 = single_row_select("SELECT value FROM conf_uinforecord WHERE id=6", 0);
if ($row6 && isset($row6['value'])) { $allowed_ids_csv = $row6['value']; }
}
$allowed_ids = array_filter(array_map('trim', explode(',', (string)$allowed_ids_csv)));
$current_uid = isset($USER['conf_id']) ? (string)$USER['conf_id'] : '';
$has_report_access = in_array($current_uid, $allowed_ids, true);
?>
<!-- Mobile sticky nav bar (now at the TOP; visible only on small screens) -->
<header class="fixed top-0 left-0 w-full bg-blue-600 text-white border-b p-3 flex justify-around text-base font-semibold shadow z-50 md:hidden">
<a href="index.php" class="<?= $link_base ?> <?= $is_index ? $link_active : $link_inactive ?>" <?= $is_index ? 'aria-current="page"' : '' ?>>My Itinerary</a>
<a href="allsessions.php" class="<?= $link_base ?> <?= $is_all ? $link_active : $link_inactive ?>" <?= $is_all ? 'aria-current="page"' : '' ?>>All Sessions</a>
<a href="history.php" class="<?= $link_base ?> <?= $is_hist ? $link_active : $link_inactive ?>" <?= $is_hist ? 'aria-current="page"' : '' ?>>History</a>
<?php if ($has_report_access) { ?>
<a href="report.php" class="<?= $link_base ?> <?= $is_report ? $link_active : $link_inactive ?>" <?= $is_report ? 'aria-current="page"' : '' ?>>Reports</a>
<?php } ?>
</header>