get('mb_level'); $isAdmin = ($mbLevel === \Config\Roles::LEVEL_SUPER_ADMIN || $mbLevel === \Config\Roles::LEVEL_LOCAL_ADMIN); $dashboardPathAliases = ['dashboard', 'dashboard/blend']; $effectiveLgIdx = admin_effective_lg_idx(); $effectiveLgName = null; if ($effectiveLgIdx) { $lgRow = model(\App\Models\LocalGovernmentModel::class)->find($effectiveLgIdx); $effectiveLgName = $lgRow ? $lgRow->lg_name : null; } $userNav = session_user_nav_display(); $activeTopNav = null; $activeTopLen = -1; $activeTopNum = PHP_INT_MAX; foreach ($siteNavTree as $topNode) { $nodeLen = -1; $activeChild = site_nav_active_child_for_parent($topNode, $currentPath, $dashboardPathAliases); if ($activeChild !== null) { $nodeLen = strlen(menu_link_preferred_href_path($activeChild->mm_link ?? null, $currentPath)); } elseif (site_nav_link_matches_current($topNode->mm_link ?? null, $currentPath, $dashboardPathAliases)) { $nodeLen = strlen(menu_link_preferred_href_path($topNode->mm_link ?? null, $currentPath)); } if ($nodeLen > $activeTopLen || ($nodeLen === $activeTopLen && (int) ($topNode->mm_num ?? 0) < $activeTopNum)) { $activeTop = $topNode; $activeTopLen = $nodeLen; $activeTopNum = (int) ($topNode->mm_num ?? 0); } } ?>