<?php
// includes/sidebar.php
// This file contains the HTML for the dashboard sidebar.
// It assumes $school_logo_path, $role_name, and role constants are defined in the calling script.

// Define role constants if not already defined (important for standalone testing or if config.php isn't always included before this)
if (!defined('ROLE_SUPER_ADMIN')) define('ROLE_SUPER_ADMIN', 1);
if (!defined('ROLE_ADMIN')) define('ROLE_ADMIN', 2);
if (!defined('ROLE_TEACHER')) define('ROLE_TEACHER', 3);
if (!defined('ROLE_STUDENT')) define('ROLE_STUDENT', 4);
if (!defined('ROLE_PARENT')) define('ROLE_PARENT', 5);
if (!defined('ROLE_STAFF')) define('ROLE_STAFF', 6);

// Determine the active link based on the current page.
// This requires the calling script to set a variable, e.g., $currentPage = 'dashboard';
// If $currentPage is not set, default to an empty string.
$currentPage = isset($currentPage) ? $currentPage : '';
?>

<aside class="sidebar" id="sidebar">
    <div class="logo">
        <img src="images/logo.png" alt="divine Logo">
        DIVINE REPORTS
    </div>
    <nav>
        <ul>
            <!-- Dashboard link -->
            <li class="<?php echo ($currentPage === 'dashboard') ? 'active' : ''; ?>">
                <a href="teacher_dashboard.php"><i class="fas fa-th-large"></i> Dashboard</a>
            </li>
            <!-- My Classes link -->
            <li class="<?php echo ($currentPage === 'my_classes') ? 'active' : ''; ?>">
                <a href="teacher_my_classes.php"><i class="fas fa-chalkboard"></i> My Classes</a>
            </li>
            <!-- My Students link -->
            <li class="<?php echo ($currentPage === 'my_students') ? 'active' : ''; ?>">
                <a href="teacher_my_students.php"><i class="fas fa-user-graduate"></i> My Students</a>
            </li>
            <!-- Assignments link -->
            <li class="<?php echo ($currentPage === 'assignments') ? 'active' : ''; ?>">
                <a href="create_assignment.php"><i class="fas fa-file-alt"></i> Assignments</a>
            </li>
            <!-- Grades link -->
            <li class="<?php echo ($currentPage === 'grades') ? 'active' : ''; ?>">
                <a href="teacher_grades.php"><i class="fas fa-award"></i> Grades</a>
            </li>
            <!-- Messages link -->
            <li class="<?php echo ($currentPage === 'messages') ? 'active' : ''; ?>">
                <a href="teacher_messages.php"><i class="fas fa-envelope"></i> Messages</a>
            </li>
            <!-- Calendar link -->
            <li class="<?php echo ($currentPage === 'calendar') ? 'active' : ''; ?>">
                <a href="teacher_calendar.php"><i class="far fa-calendar-alt"></i> Calendar</a>
            </li>
            <!-- Profile link -->
            <li class="<?php echo ($currentPage === 'profile') ? 'active' : ''; ?>">
                <a href="teacher_profile.php"><i class="fas fa-user-circle"></i> Profile</a>
            </li>
            <!-- Settings link -->
            <li class="<?php echo ($currentPage === 'settings') ? 'active' : ''; ?>">
                <a href="teacher_settings.php"><i class="fas fa-cog"></i> Settings</a>
            </li>
            <!-- Logout link -->
            <li><a href="logout.php"><i class="fas fa-sign-out-alt"></i> Logout</a></li>
        </ul>
    </nav>
</aside>
