<?php
// teacher_navbar.php
// This file should be included in your teacher-specific pages.
// It assumes session_start() and config.php are already handled in the parent file.
// All database queries and role checks are removed as they should be handled by the main script.

// Variables like $username, $school_name, $school_logo_path, $photo are expected to be set
// in the including script (e.g., teacher_settings.php) before this file is included.

$current_page = basename($_SERVER['PHP_SELF']);

// Default values in case variables are not set by the including script (for robustness)
$username = isset($username) ? htmlspecialchars($username) : 'Guest';
$school_name = isset($school_name) ? htmlspecialchars($school_name) : 'Your School';
$school_logo_path = isset($school_logo_path) ? htmlspecialchars($school_logo_path) : 'images/default_school_logo.png';
$photo = isset($photo) ? htmlspecialchars($photo) : 'https://via.placeholder.com/80/cccccc/FFFFFF?text=TR';

// Determine role name for display (assuming $user_role_code is passed or available from session)
$role_name = "Unknown";
if (isset($_SESSION["role"])) {
    switch ($_SESSION["role"]) {
        case (defined('ROLE_SUPER_ADMIN') ? ROLE_SUPER_ADMIN : 0): $role_name = "Super Admin"; break;
        case (defined('ROLE_ADMIN') ? ROLE_ADMIN : 0):        $role_name = "Admin";       break;
        case (defined('ROLE_TEACHER') ? ROLE_TEACHER : 0):      $role_name = "Teacher";     break;
        case (defined('ROLE_STUDENT') ? ROLE_STUDENT : 0):      $role_name = "Student";     break;
        case (defined('ROLE_PARENT') ? ROLE_PARENT : 0):       $role_name = "Parent";      break;
        case (defined('ROLE_STAFF') ? ROLE_STAFF : 0):        $role_name = "Staff";       break;
    }
}
?>

<nav class="p-4 shadow-md"> <!-- Removed bg-blue-800 and text-white -->
    <div class="container mx-auto flex justify-between items-center">
        <div class="text-xl font-bold text-gray-800"> <!-- Added text-gray-800 for visibility -->
            <?php echo $school_name; ?> - Teacher Dashboard
        </div>
        <div class="flex items-center space-x-4">
            <span class="text-lg text-gray-700">Welcome, <?php echo $username; ?>!</span> <!-- Added text-gray-700 for visibility -->
            <!-- The Logout button has been removed from here as per your request -->
        </div>
    </div>
</nav>

<div class="flex">
    <!-- Sidebar -->
    <aside class="w-64 bg-gray-100 text-gray-800 min-h-screen p-4 shadow-lg"> <!-- Changed bg-gray-800 to bg-gray-100 and text-white to text-gray-800 -->
        <nav>
            <ul>
                <li class="mb-4">
                    <a href="teacher_dashboard.php" class="block py-2 px-4 rounded-lg transition duration-300 ease-in-out
                        <?php echo ($current_page == 'teacher_dashboard.php') ? 'bg-gray-300 text-gray-900' : 'hover:bg-gray-200 text-gray-700'; ?>">
                        <i class="fas fa-home mr-2"></i> Dashboard
                    </a>
                </li>
                <li class="mb-4">
                    <a href="teacher_profile.php" class="block py-2 px-4 rounded-lg transition duration-300 ease-in-out
                        <?php echo ($current_page == 'teacher_profile.php') ? 'bg-gray-300 text-gray-900' : 'hover:bg-gray-700'; ?>">
                        <i class="fas fa-user-circle mr-2"></i> Profile
                    </a>
                </li>
                <li class="mb-4">
                    <a href="manage_marks.php" class="block py-2 px-4 rounded-lg transition duration-300 ease-in-out
                        <?php echo ($current_page == 'manage_marks.php') ? 'bg-gray-300 text-gray-900' : 'hover:bg-gray-700'; ?>">
                        <i class="fas fa-edit mr-2"></i> Manage Marks
                    </a>
                </li>
                <li class="mb-4">
                    <a href="view_reports.php" class="block py-2 px-4 rounded-lg transition duration-300 ease-in-out
                        <?php echo ($current_page == 'view_reports.php') ? 'bg-gray-300 text-gray-900' : 'hover:bg-gray-700'; ?>">
                        <i class="fas fa-chart-bar mr-2"></i> View Reports
                    </a>
                </li>
                <li class="mb-4">
                    <a href="create_assignment.php" class="block py-2 px-4 rounded-lg transition duration-300 ease-in-out
                        <?php echo ($current_page == 'create_assignment.php') ? 'bg-gray-300 text-gray-900' : 'hover:bg-gray-700'; ?>">
                        <i class="fas fa-tasks mr-2"></i> Create Assignment
                    </a>
                </li>
                <!-- Add more teacher-specific links here -->
            </ul>
        </nav>
    </aside>

    <!-- Main Content Area (will be closed in the actual page file) -->
    <main class="flex-1 p-6">
        <!-- Content will be injected here by the including PHP file -->
