<?php session_start();

// Cek Active Link
function ActiveClass($requestUri)
{
    $current_file_name = basename($_SERVER['REQUEST_URI'], ".php");

    if ($current_file_name == $requestUri)
        echo 'class="active"';
}
        
        //check already index
        if (!isset($_SESSION['user_email'])) {
            header ('Location:../index.php');
            exit;
        }

        // Logout
        if (isset($_GET['action'])) {
            $action = $_GET['action'];
            if ($action == 'logout') {
                session_destroy();
                header('Location:../login_2.php');
            }
        }

     if (isset($_GET['page']) && $_GET['page'] == 'dashboad') {
            $page = 'dashboad';
        }  else if (isset($_GET['page']) && $_GET['page'] == 'student') {
            $page = "student";
        }else if (isset($_GET['page']) && $_GET['page'] == 'student_action') {
            $page = "student_action";
        }else if (isset($_GET['page']) && $_GET['page'] == 'view_student_result') {
            $page = "view_student_result";
        }else if (isset($_GET['page']) && $_GET['page'] == 'view_A_student_result') {
            $page = "view_A_student_result";
        } else if (isset($_GET['page']) && $_GET['page'] == 'update_student') {
            $page = "update_student";
        }else if (isset($_GET['page']) && $_GET['page'] == 'update_teacher') {
            $page = "update_teacher";
        }else if (isset($_GET['page']) && $_GET['page'] == 'view_profile') {
            $page = "view_profile";
        }  else if (isset($_GET['page']) && $_GET['page'] == 'update_program') {
            $page = "update_program";
        } else if (isset($_GET['page']) && $_GET['page'] == 'exam_time') {
            $page = "exam_time";
        } else if (isset($_GET['page']) && $_GET['page'] == 'update_class') {
            $page = "update_class";
        } else if (isset($_GET['page']) && $_GET['page'] == 'profile') {
            $page = "profile";
        }else if (isset($_GET['page']) && $_GET['page'] == 'update_exam') {
            $page = "update_exam";
        }else if (isset($_GET['page']) && $_GET['page'] == 'view_course') {
            $page = "view_course";
        }else if (isset($_GET['page']) && $_GET['page'] == 'course') {
            $page = "course";
        }else if (isset($_GET['page']) && $_GET['page'] == 'teacher') {
            $page = "teacher";
        }else if (isset($_GET['page']) && $_GET['page'] == 'non_teacher') {
            $page = "non_teacher";
        }else if (isset($_GET['page']) && $_GET['page'] == 'teacher_action') {
            $page = "teacher_action";
        }else if (isset($_GET['page']) && $_GET['page'] == 't_allocation') {
            $page = "t_allocation";
        }else if (isset($_GET['page']) && $_GET['page'] == 'class') {
            $page = "class";
        }else if (isset($_GET['page']) && $_GET['page'] == 'program') {
            $page = "program";
        }else if (isset($_GET['page']) && $_GET['page'] == 'exam') {
            $page = "exam";
        } else if (isset($_GET['page']) && $_GET['page'] == 'edit_february') {
            $page = "edit_february";
        } else if (isset($_GET['page']) && $_GET['page'] == 'timetable_list') {
            $page = "timetable_list";
        } else if (isset($_GET['page']) && $_GET['page'] == 'timetable') {
            $page = "timetable";
        }else if (isset($_GET['page']) && $_GET['page'] == 'five_1') {
            $page = "five_1";
        }else if (isset($_GET['page']) && $_GET['page'] == 'view_all_report') {
            $page = "view_all_report";
        }else if (isset($_GET['page']) && $_GET['page'] == 'view_all_ad_report') {
            $page = "view_all_ad_report";
        }else if (isset($_GET['page']) && $_GET['page'] == 'student_list') {
            $page = "student_list";
        }else if (isset($_GET['page']) && $_GET['page'] == 'certificate') {
            $page = "certificate";
        }else if (isset($_GET['page']) && $_GET['page'] == 'fgtutrs345gj789km231ExamTeachUIYTR7ttdeewz34') {
            $page = "fgtutrs345gj789km231ExamTeachUIYTR7ttdeewz34";
        }else if (isset($_GET['page']) && $_GET['page'] == 'fgtutrs345gj789km231ExamUIYTR7ttdeewz34') {
            $page = "fgtutrs345gj789km231ExamUIYTR7ttdeewz34";
        } else {
            $page = 'dashboad';
        }

 

//Get Header
include('includes/head.php');  
//set global message notification
$msgBox ="";

if (file_exists('views/'.$page.'.php')) {
            // Load the Page
            include('views/'.$page.'.php');
        } else {
            // Else Display an Error
          
            echo '
                    <div class="wrapper">
                        <h3>Err</h3>
                        <div class="alertMsg default">
                            <i class="icon-warning-sign"></i> The page "'.$page.'" could not be found.
                        </div>
                    </div>
                ';
        }
    ?>
      </div>
    <?php include('includes/footer.php');?>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
 