<?php
  $change_style = "  font-size: 13px;
                            color: #17a2b8;
                            padding: 4px;";
?>

<aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->

    <a href="<?php echo $conn->teacher_url().'index'; ?>" class="brand-link">
        <img src="<?php echo $conn->base_url(); ?>upload/<?php echo $logo; ?> " alt="<?php echo $logo; ?> Logo" class="img-circles elevation-4" style="opacity: .8">
        <span class="brand-text font-weight-light" style="visibility: hidden;"><?php echo "APP"; ?> </span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
        <!-- Sidebar user panel (optional) -->
        <!-- Sidebar Menu -->
        <nav class="mt-2">
            <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
                <!-- Add icons to the links using the .nav-icon class
                     with font-awesome or any other icon font library -->
                <li class="nav-item" style="margin-top: 20px;">
                    <a href="<?php echo $conn->teacher_url().'index'; ?>" <?php
                    if(basename($_SERVER['SCRIPT_NAME']) == 'index.php'){
                        echo 'class = "nav-link active"';
                    }else{
                        echo 'class = "nav-link"';
                    }
                    ?>>
                        <i class="nav-icon fas fa-tachometer-alt"></i>
                        <p>
                            Dashboard
                        </p>
                    </a>
                </li>

                  <li class="nav-item">
                    <a href="<?php echo $conn->teacher_url().'student'; ?>" <?php
                    if(basename($_SERVER['SCRIPT_NAME']) == 'student.php'
                        || basename($_SERVER['SCRIPT_NAME']) == 'add-student.php'
                        || basename($_SERVER['SCRIPT_NAME']) == 'view-student.php'
                        || basename($_SERVER['SCRIPT_NAME']) == 'edit-student.php'){
                        echo 'class = "nav-link active"';
                    }else{
                        echo 'class = "nav-link"';
                    }
                    ?>>
                        <i class="nav-icon fas fa-graduation-cap"></i>
                        <p>
                            Student
                        </p>
                    </a>
                </li>

                  <li class="nav-item">
                    <a href="<?php echo $conn->teacher_url().'teacher'; ?>" <?php
                    if(basename($_SERVER['SCRIPT_NAME']) == 'teacher.php' ||
                        basename($_SERVER['SCRIPT_NAME']) == 'add-teacher.php'
                       || basename($_SERVER['SCRIPT_NAME']) == 'view-teacher.php'
                       || basename($_SERVER['SCRIPT_NAME']) == 'edit-teacher.php'){
                        echo 'class = "nav-link active"';
                    }else{
                        echo 'class = "nav-link"';
                    }
                    ?>>
                        <i class="nav-icon fas fa-user-circle"></i>
                        <p>
                            Teacher
                        </p>
                    </a>
                </li>

                <li <?php
                    if(basename($_SERVER['SCRIPT_NAME']) == 'class.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'section.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'subject.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'add-class.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'edit-class.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'add-section.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'edit-section.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'add-subject.php'
                         || basename($_SERVER['SCRIPT_NAME']) == 'edit-subject.php') {
                            echo 'class = "nav-item menu-open"';
                    }else{
                        echo 'class = "nav-item"';
                    }
                ?>>
                    <a href="#page3" class="nav-link">
                        <i class="nav-icon fas fa-university"></i>
                        <p>
                           Academic
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'class'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'class.php'
                               || basename($_SERVER['SCRIPT_NAME']) == 'add-class.php'
                               || basename($_SERVER['SCRIPT_NAME']) == 'edit-class.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-sitemap nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Class</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'section'; ?>"<?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'section.php'
                               || basename($_SERVER['SCRIPT_NAME']) == 'add-section.php'
                               || basename($_SERVER['SCRIPT_NAME']) == 'edit-section.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-star nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Section</p>
                            </a>
                        </li>
                         <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'subject'; ?>"<?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'subject.php'
                              || basename($_SERVER['SCRIPT_NAME']) == 'add-subject.php'
                              || basename($_SERVER['SCRIPT_NAME']) == 'edit-subject.php'
                              ){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-book nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Subject</p>
                            </a>
                        </li>
                    </ul>
                </li>

<!--                Mark start -->

                <li <?php
                if(basename($_SERVER['SCRIPT_NAME']) == 'mark.php'
                   || basename($_SERVER['SCRIPT_NAME']) == 'mark.php'
                   || basename($_SERVER['SCRIPT_NAME']) == 'view-mark.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'add-mark.php') {
                    echo 'class = "nav-item menu-open"';
                }else{
                    echo 'class = "nav-item"';
                }
                ?>>
                    <a href="#page" class="nav-link">
                        <i class="nav-icon fa fa-bookmark"></i>
                        <p>
                           Mark
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'mark'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'mark.php'
                              || basename($_SERVER['SCRIPT_NAME']) == 'view-mark.php'
                              || basename($_SERVER['SCRIPT_NAME']) == 'mark.php'
                                || basename($_SERVER['SCRIPT_NAME']) == 'add-mark.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-flask nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Mark</p>
                            </a>
                        </li>

                    </ul>
                </li>

<!--                Mark end -->



                <!--  CBT start -->

                <li <?php
                if(basename($_SERVER['SCRIPT_NAME']) == 'exam_form.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'exam_list.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'add_question.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'manage_questions.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'edit_question.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'view_exam_results.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'student_exam_result.php'

                ) {

                    echo 'class = "nav-item menu-open"';
                }else{
                    echo 'class = "nav-item"';
                }
                ?>>
                    <a href="#page" class="nav-link">
                        <i class="nav-icon fa fa-laptop"></i>
                        <p>
                            CBT
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'exam_form'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'exam_form.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-qrcode nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Create Exam</p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'exam_list'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'exam_list.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-globe nav-icon" style="<?php echo $change_style;?>"></i>
                                <p> Manage Online Exam </p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'add_question'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'add_question.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-plus-circle nav-icon" style="<?php echo $change_style;?>"></i>
                                <p> Add Question </p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'manage_questions'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'manage_questions.php'
                                || basename($_SERVER['SCRIPT_NAME']) == 'edit_question.php'

                            ){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-question-circle nav-icon" style="<?php echo $change_style;?>"></i>
                                <p> Manage Questions </p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'view_exam_results'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'view_exam_results.php'
                                || basename($_SERVER['SCRIPT_NAME']) == 'student_exam_result.php'
                            ){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-eye nav-icon" style="<?php echo $change_style;?> background:none !important;"></i>
                                <p> View Exam Results </p>
                            </a>
                        </li>

                    </ul>
                </li>

                <!-- CBT end -->

                <!-- start homepage settings -->
                <li <?php
                if(basename($_SERVER['SCRIPT_NAME']) == 'settings.php') {
                    echo 'class = "nav-item menu-open"';
                }else{
                    echo 'class = "nav-item"';
                }
                ?>>
                    <a href="#page" class="nav-link">
                        <i class="nav-icon fa fa-cog"></i>
                        <p>
                            Settings
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'settings'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'settings.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-hammer nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>General Setting</p>
                            </a>
                        </li>
                    </ul>
                </li>

                <li class="nav-item">
                    <a href="<?php echo $conn->teacher_url().'attendance'; ?>" <?php
                    if(basename($_SERVER['SCRIPT_NAME']) == 'attendance.php'
                        || basename($_SERVER['SCRIPT_NAME']) == 'add-attendance.php'){
                        echo 'class = "nav-link active"';
                    }else{
                        echo 'class = "nav-link"';
                    }
                    ?>>
                        <i class="nav-icon fas fa-calendar"></i>
                        <p>Manage Attendance</p>
                    </a>
                </li>

                <!--                Psychomotor -->
                <li <?php
                if(basename($_SERVER['SCRIPT_NAME']) == 'manage-psychomotor.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'student-psychomotor.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'add-psychomotor.php') {
                    echo 'class = "nav-item menu-open"';
                }else{
                    echo 'class = "nav-item"';
                }
                ?>>
                    <a href="#page" class="nav-link">
                        <i class="nav-icon fa fa-car"></i>
                        <p>
                            Psychomotor
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'manage-psychomotor'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'manage-psychomotor.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-motorcycle nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Manage Psychomotor</p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'add-psychomotor'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'add-psychomotor.php'
                                || basename($_SERVER['SCRIPT_NAME']) == 'add-psychomotor.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-user nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Students' Psychomotor</p>
                            </a>
                        </li>
                    </ul>
                </li>

                <!--                End Psychomotor-->

                <!--                Cognitive Area -->
                <li <?php
                if(basename($_SERVER['SCRIPT_NAME']) == 'manage-cognitive.php'
                    || basename($_SERVER['SCRIPT_NAME']) == 'add-cognitive.php') {
                    echo 'class = "nav-item menu-open"';
                }else{
                    echo 'class = "nav-item"';
                }
                ?>>
                    <a href="#page" class="nav-link">
                        <i class="nav-icon fa fa-brain"></i>
                        <p>
                            Cognitive Area
                            <i class="fas fa-angle-left right"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'manage-cognitive'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'manage-cognitive.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa-code-branch nav-icon" style="<?php echo $change_style;?>"></i>
                                <p>Manage Cognitive Area</p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?php echo $conn->teacher_url().'add-cognitive'; ?>"  <?php
                            if(basename($_SERVER['SCRIPT_NAME']) == 'add-cognitive.php'){
                                echo 'class = "nav-link active"';
                            }else{
                                echo 'class = "nav-link"';
                            }
                            ?>>
                                <i class="fas fa fa-brain nav-icon" style="<?php echo $change_style;?>"></i>
                                <p> Students' Cognitive Area </p>
                            </a>
                        </li>
                    </ul>
                </li>

                <!--                End Cognitive area  -->

                <li class="nav-item">
                    <a href="<?php echo $conn->teacher_url().'logout'; ?>" <?php
                    if(basename($_SERVER['SCRIPT_NAME']) == 'logout.php'){
                        echo 'class = "nav-link active"';
                    }else{
                        echo 'class = "nav-link"';
                    }
                    ?>>
                        <i class="nav-icon fas fa-lock"></i>
                        <p>Logout</p>
                    </a>
                </li>


            </ul>
        </nav>
        <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
</aside>
