31 lines
1.6 KiB
PHP
31 lines
1.6 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');
|
|
|
|
$base_link = 'px-4 py-2 rounded transition-colors';
|
|
$active = 'bg-blue-600 text-white shadow aria-current="page"';
|
|
$inactive = 'bg-gray-200 text-gray-900 hover:bg-gray-300';
|
|
|
|
// 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);
|
|
?>
|
|
<!-- Sidebar Nav (hidden on mobile, visible on md+) -->
|
|
<nav class="hidden md:flex flex-col gap-2 text-sm font-medium">
|
|
<a href="index.php" class="<?= $base_link ?> <?= $is_index ? $active : $inactive ?>">My Itinerary</a>
|
|
<a href="allsessions.php" class="<?= $base_link ?> <?= $is_all ? $active : $inactive ?>">All Sessions</a>
|
|
<a href="history.php" class="<?= $base_link ?> <?= $is_hist ? $active : $inactive ?>">My History</a>
|
|
<?php if ($has_report_access) { ?>
|
|
<a href="report.php" class="<?= $base_link ?> <?= $is_report ? $active : $inactive ?>">Reports</a>
|
|
<?php } ?>
|
|
</nav>
|