<?php
$s_script = "";

if (session_status() == PHP_SESSION_NONE) {
    session_start();
}

if (!class_exists('User')) {
    include($_main_root . 'config/enum.php');
}

if (!isset($_login_page) || !$_login_page) {

    if (!User::Login()) {
        header("Location: " . $_main_root . "index.php");
        exit();
    }
}

if (!class_exists("Config")) {
    include($_main_root . 'config/config.php');
}

?>

<!DOCTYPE html>
<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.0">
    <link rel="icon" sizes="32x32" type="image/png" href="<?php echo ($_main_root . 'img/favicon.png'); ?>">
    <link rel="stylesheet" href="<?php echo ($_main_root . 'vendor/select2-4.0.13/css/select2.min.css'); ?>">
    <link rel="stylesheet" href="<?php echo ($_main_root . 'vendor/bootstrap-5.3.0/css/bootstrap.min.css'); ?>">
    <link rel="stylesheet"
        href="<?php echo ($_main_root . 'vendor/bootstrap-icons-1.10.5/font/bootstrap-icons.css'); ?>">
    <link rel="stylesheet" href="<?php echo ($_main_root . 'vendor/DataTables/datatables.min.css'); ?>">
    <link rel="stylesheet"
        href="<?php echo ($_main_root . 'vendor/dateandtimepicker/jquery.datetimepicker.min.css'); ?>">
    <link rel="stylesheet" href="<?php echo ($_main_root . 'style/custom.css'); ?>">
    <title>
        <?php echo ($_page_title); ?>
    </title>
</head>

<body>
    <?php

    if (User::Login()) {
        $_userProfileImage = $_main_root . "img/user/" . User::UserName() . '.jpg';
        if (!file_exists($_userProfileImage)) {
            $_userProfileImage = $_main_root . "img/user/default_user.png";
        }
    }
    ?>
    <nav class="navbar sticky-top navbar-expand-xl navbar-dark bg-dark">
        <div class="container">
            <?php
            if (User::Login()) {
                include 'menu_main.php';
            } else {
                if ($_public_form) {
                    include 'menu_public.php';
                }
            }
            ?>
        </div>
    </nav>