";
echo "header_myclass_percent=".$header_myclass_percent."
";
echo "header_onboarding_percent=".$header_onboarding_percent."
";
echo "header_legal_percent=".$header_legal_percent."
";
*/
//exit;
}
if ($isLoggedIn) {
try {
require_once __DIR__ . '/../../bbs/db_conn.php';
$pdoHeader = db_conn();
$corpCode = (string)($_SESSION['sys_comp_code'] ?? '');
$stmtNotif = $pdoHeader->prepare("
SELECT n.seq,
fn_get_code_name(n.type_code) AS type_name,
n.type_code,
n.message,
n.sent_at,
n.end_date
FROM edu_notifications n
WHERE n.member_id = ?
AND n.corp_code = ?
AND n.end_date >= CURDATE()
ORDER BY n.sent_at DESC
");
$stmtNotif->execute([$memberId, $corpCode]);
$notifications = $stmtNotif->fetchAll(PDO::FETCH_ASSOC);
$stmtAuth = $pdoHeader->prepare(
"SELECT auth_level
FROM edu_users
WHERE member_id = ?
ORDER BY (sys_comp_code = ?) DESC, sys_comp_code ASC
LIMIT 1"
);
$stmtAuth->execute([$memberId, $corpCode]);
$authLevelFromDb = $stmtAuth->fetchColumn();
$authLevel = strtoupper(trim((string)($authLevelFromDb ?? '')));
$canSeePrivilegedButtons = $isLoggedIn && in_array($authLevel, ['LE10001', 'LE10002'], true);
$adminLandingUrl = ($authLevel === 'LE10002')
? '/admin/skin/legal_edu.php'
: '/admin/skin/index.php';
// sent_at 이 오늘인 알림이 있으면 on 표시
$today = date('Y-m-d');
foreach ($notifications as $notif) {
if (!empty($notif['sent_at']) && substr($notif['sent_at'], 0, 10) === $today) {
$hasNewAlert = true;
break;
}
}
if($memberId=="M21420" ){/*
echo "memberId=".$memberId."
";
echo "header_myclass_percent=".$header_myclass_percent."
";
echo "header_onboarding_percent=".$header_onboarding_percent."
";
echo "header_legal_percent=".$header_legal_percent."
";
*/
}
} catch (Exception $e) {
// DB 오류 시 빈 배열 유지
$notifications = [];
$hasNewAlert = false;
}
}
if (!isset($learningGuideDefaultTab)) {
$guideScript = strtolower(basename($_SERVER['SCRIPT_NAME'] ?? '', '.php'));
$guideUri = strtolower(parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH) ?: '');
$guidePageMap = [
'index' => 'main',
'main' => 'main',
'myclass' => 'myclass',
'myclass_list' => 'myclass',
'onboarding' => 'onboarding',
'learning' => 'legal',
'legal_edu' => 'legal',
'legal' => 'legal',
'leadership' => 'leadership',
'insight' => 'insight',
'biztrend' => 'biztrend',
'mypage' => 'mypage',
'player' => 'player',
];
if (isset($guidePageMap[$guideScript])) {
$learningGuideDefaultTab = $guidePageMap[$guideScript];
} else {
foreach ($guidePageMap as $needle => $key) {
if ($needle !== 'player' && (strpos($guideUri, '/' . $needle) !== false || strpos($guideUri, $needle . '.php') !== false)) {
$learningGuideDefaultTab = $key;
break;
}
}
}
}
$learningGuideDefaultTab = $learningGuideDefaultTab ?? 'player';
?>