getUri(); $n = $uriObj->getTotalSegments(); $uri = $n >= 2 ? $uriObj->getSegment(2) : ''; $seg3 = $n >= 3 ? $uriObj->getSegment(3) : ''; $mbLevel = (int) session()->get('mb_level'); $isSuperAdmin = \Config\Roles::isSuperAdminEquivalent($mbLevel); $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(); $currentPath = current_nav_request_path(); $adminNavTree = get_admin_nav_tree(); $activeAdminTopNav = null; $activeAdminTopLen = -1; $activeAdminTopNum = PHP_INT_MAX; foreach ($adminNavTree as $topNode) { $nodeLen = -1; $activeChild = site_nav_active_child_for_parent($topNode, $currentPath, []); if ($activeChild !== null) { $nodeLen = strlen(menu_link_preferred_href_path($activeChild->mm_link ?? null, $currentPath)); } elseif (menu_link_matches_request($topNode->mm_link ?? null, $currentPath, [])) { $nodeLen = strlen(menu_link_preferred_href_path($topNode->mm_link ?? null, $currentPath)); } if ($nodeLen > $activeAdminTopLen || ($nodeLen === $activeAdminTopLen && (int) ($topNode->mm_num ?? 0) < $activeAdminTopNum)) { $activeAdminTopNav = $topNode; $activeAdminTopLen = $nodeLen; $activeAdminTopNum = (int) ($topNode->mm_num ?? 0); } } /** 메뉴가 DB에서 안 쓰일 때만(폴백 상단바) 세그먼트 기반 활성 */ $isActive = static function (string $path) use ($uri, $seg3) { if ($path === 'admin' || $path === '') return $uri === ''; if ($path === 'users') return $uri === 'users'; if ($path === 'login-history') return $uri === 'access' && $seg3 === 'login-history'; if ($path === 'approvals') return $uri === 'access' && $seg3 === 'approvals'; if ($path === 'roles') return $uri === 'roles'; if ($path === 'menus') return $uri === 'menus'; if ($path === 'local-governments') return $uri === 'local-governments'; if ($path === 'select-local-government') return $uri === 'select-local-government'; if ($path === 'designated-shops') return $uri === 'designated-shops'; return false; }; ?>
= esc($err) ?>