get('role') ?? '')); $roleDefaultStyle = in_array($role, ['parent', 'teacher', 'teacher_assistant'], true) ? 'green' : ($styleCfg->defaultStyle ?? 'blue'); $styleKey = $sess->get('style_color') ?? $roleDefaultStyle; // Default parent/teacher menu to a greenish palette (emerald) $roleDefaultMenu = in_array($role, ['parent', 'teacher', 'teacher_assistant'], true) ? 'emerald' : ($styleCfg->defaultMenu ?? 'white'); $menuKey = $sess->get('menu_color') ?? $roleDefaultMenu; $style = $styleCfg->stylePalettes[$styleKey] ?? ($styleCfg->stylePalettes[$styleCfg->defaultStyle] ?? [ 'primary' => '#4da3ff', ]); if ($menuKey === 'custom') { $menu = [ 'bg' => (string)($sess->get('menu_custom_bg') ?? '#0f172a'), 'text' => (string)($sess->get('menu_custom_text') ?? '#e2e8f0'), 'mode' => (string)($sess->get('menu_custom_mode') ?? 'dark'), ]; } else { $menu = $styleCfg->menuPalettes[$menuKey] ?? ($styleCfg->menuPalettes[$styleCfg->defaultMenu] ?? [ 'bg' => '#ffffff', 'text' => '#334155', 'mode' => 'light', ]); } $resolveMenuMode = function (string $mode, string $bg): string { $mode = strtolower(trim($mode)); if ($mode === 'light' || $mode === 'dark') return $mode; $hex = ltrim(trim($bg), '#'); if (strlen($hex) === 3) { $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; } if (strlen($hex) !== 6) return 'dark'; $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); $lum = (0.2126 * $r + 0.7152 * $g + 0.0722 * $b) / 255.0; return ($lum < 0.5) ? 'dark' : 'light'; }; $appMenuMode = $resolveMenuMode((string)($menu['mode'] ?? 'light'), (string)($menu['bg'] ?? '#0f172a')); ?> getPath(), '/'); $widePaths = [ 'teacher/class_view', 'teacher/scores', 'teacher/addHomework', 'teacher/addQuiz', 'teacher/addProject', 'student/score-card', 'student/score-card/list', ]; $mainContainerClass = in_array($path, $widePaths) ? 'container-fluid' : 'container'; // Teacher class switcher (page-level, outside navbar) $role = strtolower((string)(session()->get('role') ?? 'guest')); $isTeacher = in_array($role, ['teacher', 'teacher_assistant'], true); $classOptions = []; $activeClassId = (int)(session()->get('class_section_id') ?? 0); if ($isTeacher) { $cfg = new \App\Models\ConfigurationModel(); $tcModel = new \App\Models\TeacherClassModel(); $sy = (string)($cfg->getConfig('school_year') ?? ''); $sem = (string)($cfg->getConfig('semester') ?? ''); $uid = (int)(session()->get('user_id') ?? 0); if ($uid) { $classOptions = $tcModel->getClassAssignmentsByUserId($uid, $sy, $sem); } } $qsBody = $_SERVER['QUERY_STRING'] ?? ''; $redirectBody = current_url() . ($qsBody ? '?' . $qsBody : ''); $switchFormId = 'pageClassSwitchForm'; $switchInputId = 'pageClassSwitchValue'; ?>
1): ?>
renderSection('content') ?>
renderSection('scripts') ?>