<?php
require_once 'class/c_login.php';

$user = Login::get_user();


if (!$user->admin)
    header('Location: main.php?error=1');
?>
<!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">
    <title>Editar Horarios | <?php echo $_SESSION['facultad'] ?? "Administrador"; ?></title>
    <link rel="icon" type="image/png" href="imagenes/favicon.png" />
    <link rel="stylesheet" href="css/bootstrap-ulsa.min.css" type="text/css">
    <link rel="stylesheet" href="css/indivisa.css" type="text/css">
    <link rel="stylesheet" href="css/sgi.css?rand=<?php echo rand(); ?>" type="text/css">
</head>

<body>
    <?php
    include "import/html_header.php";
    html_header("Editar Horarios", "Gestión de Checador");
    ?>

    <!-- Create a schedule design -->
    <main class="content marco">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <!-- Nivel select option -->
                    <div class="form-group">
                        <label for="nivel">Nivel</label>
                        <select class="form-control" id="nivel">
                            <option value="0">Selecciona un nivel</option>
                            <option value="1">Nivel 1</option>
                            <option value="2">Nivel 2</option>
                            <option value="3">Nivel 3</option>
                            <option value="4">Nivel 4</option>
                            <option value="5">Nivel 5</option>
                            <option value="6">Nivel 6</option>
                            <option value="7">Nivel 7</option>
                            <option value="8">Nivel 8</option>
                            <option value="9">Nivel 9</option>
                            <option value="10">Nivel 10</option>
                        </select>

                    </div>

                </div>
            </div>

            <!-- Table Schedule -->
            <div class="row">
                <div class="col-sm-12">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr>
                                <th scope="col">Hora</th>
                                <th scope="col">Lunes</th>
                                <th scope="col">Martes</th>
                                <th scope="col">Miércoles</th>
                                <th scope="col">Jueves</th>
                                <th scope="col">Viernes</th>
                                <th scope="col">Sábado</th>
                                <th scope="col">Domingo</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th scope="row">7:00 - 8:00</th>
                                <!-- Matemáticas Martes id horario: 3 edit -->
                                <td>
                                </td>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </main>
    <?php
    include "import/html_footer.php";
    ?>
</body>

</html>
<?php

function get_horarios($facultad_id): array
{
    $dias = array("lun", "mar", "mié", "jue", "vie", "sáb",);
    foreach ($dias as $dia) {
        $horarios = query(
            "SELECT * FROM HORARIO_VIEW
            WHERE FACULTAD_ID = :facultad_id AND DIA = :dia
            ORDER BY HORA",
            array(":facultad_id" => $facultad_id, ":dia" => $dia)
        );
        foreach ($horarios as $h)
            $horario[$dia][] = $h;
    }
    return $horario;
}
?>