<?php
// includes/dynamic-header.php - Dynamic Header Section
// Include this after require_once 'includes/config.php'

// Get dynamic settings
$site_title = getSiteTitle($pdo);
$logo_text = getSetting($pdo, 'logo_text', 'বাংলা LMS');
$logo_icon = getSetting($pdo, 'logo_icon', 'fa-graduation-cap');
$use_image = getSetting($pdo, 'use_image_logo', '0');
$logo_image = getSetting($pdo, 'logo_image', '');
$primary_color = getSetting($pdo, 'primary_color', '#6C5CE7');
$site_subtitle = getSetting($pdo, 'site_subtitle', 'অনলাইন লার্নিং প্ল্যাটফর্ম');
$footer_text = getSetting($pdo, 'footer_text', 'বাংলা LMS | সর্বস্বত্ব সংরক্ষিত');
$site_description = getSetting($pdo, 'site_description', '');

/**
 * Display dynamic logo HTML
 */
function showLogo() {
    global $use_image, $logo_image, $logo_icon, $logo_text, $site_title;
    if($use_image == '1' && !empty($logo_image) && file_exists('uploads/logo/' . $logo_image)) {
        return '<img src="uploads/logo/' . $logo_image . '" alt="' . htmlspecialchars($site_title) . '" style="height:36px;">';
    } else {
        return '<i class="fas ' . $logo_icon . ' me-2"></i>' . htmlspecialchars($logo_text);
    }
}

/**
 * Display dynamic page title
 */
function pageTitle($sub = '') {
    global $site_title;
    return $sub ? htmlspecialchars($sub . ' - ' . $site_title) : htmlspecialchars($site_title);
}
?>