include_once 'service/CoursesService.php';
include_once 'model/constantss.php';
session_start();
if (validate_session_time_out() == 0) {
    header("Location:login.php");
    exit;
}
if ($_SESSION['change_password'] == 0) {
    header("Location:change_password.php");
    exit;
}
if (un_hash_val($_SESSION['current_user_type']) == constantss::$user_type_admin) {
    header("Location:manage_courses.php");
    exit;
}
$CoursesService = new CoursesService();
$courses = $CoursesService->get_all_courses_related_to_user($_SESSION['user_id']);
?>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>instructor</title>

        <!-- Bootstrap -->
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/custom.css?<?php 
echo time();
?>
" rel="stylesheet">
    header("Location:login.php");
    exit;
}
if ($_SESSION['change_password'] == 0) {
    header("Location:change_password.php");
    exit;
}
if (un_hash_val($_SESSION['current_user_type']) == constantss::$user_type_admin) {
    header("Location:manage_courses.php");
    exit;
}
$course_id = un_hash_val($_GET['course']);
$hashed_course_id = $_GET['course'];
$MaterialsService = new MaterialsService($course_id);
$SectionsService = new SectionsService();
$CourseService = new CoursesService();
$_SESSION['material_service'] = serialize($MaterialsService);
$_SESSION['section_service'] = serialize($SectionsService);
$sections = $SectionsService->get_all_sections();
?>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- Bootstrap -->
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/custom.css" rel="stylesheet">
    </head>
    <body >