Files
paad/horario_profesor.php
2023-08-28 15:26:15 +00:00

135 lines
6.0 KiB
PHP

<?php
require_once 'class/c_login.php';
if (!isset($_SESSION['user']))
die(header('Location: index.php'));
$user = unserialize($_SESSION['user']);
$user->access();
if (in_array($user->acceso, ['n']))
die(header('Location: main.php?error=1'));
$user->print_to_log('Consultar horario');
$write = $user->admin || in_array($user->acceso, ['w']);
// var_dump($user);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Consultar horario | <?= $user->facultad['facultad'] ?? 'General' ?></title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/plain; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php include_once "import/html_css_files.php"; ?>
<script src="js/scrollables.js" defer></script>
<script src="js/jquery.min.js" defer></script>
<script src="js/bootstrap/bootstrap.min.js" defer></script>
<script src="js/messages.js" defer></script>
<script>
const write = <?= $write ? 'true' : 'false' ?>;
</script>
<script src="js/moment.js" defer></script>
<script src="js/horario_profesor.js" defer></script>
</head>
<!-- -->
<body style="display: block;">
<?php
include('include/constantes.php');
include("import/html_header.php");
html_header("Consultar horario", "Sistema de gestión de checador");
?>
<?= "<!-- $user -->" ?>
<main class="container content marco content-margin" id="local-app">
<section id="message"></section>
<?php require('import/periodo.php') ?>
<form id="form" class="form-horizontal">
<div class="form-group">
<div class="form-box">
<input type="hidden" name="periodo" value="<?= $user->periodo_id ?>" />
<div class="form-group row">
<label for="clave_profesor" class="col-4 col-form-label">Profesor</label>
<div class="col-6">
<input list="lista_profesores" name="clave_profesor" id="clave_profesor" class="form-control" placeholder="Profesor" required="required">
<div class="valid-feedback">
Profesor encontrado
</div>
<div class="invalid-feedback">
Profesor no encontrado
</div>
<datalist id="lista_profesores">
<?php
$profesores = $db->where('facultad_id', $user->facultad['facultad_id'])->get("fs_profesor");
foreach ($profesores as $profesor) {
extract($profesor);
?>
<option data-grado="<?= $grado ?>" data-clave="<?= $clave ?>" data-profesor="<?= $profesor ?>" data-id="<?= $id; ?>" value="<?= "$clave | $grado $profesor" ?>"></option>
<?php
}
?>
</datalist>
<ul class="list-group" id="profesores"></ul>
<input type="hidden" id="periodo_id" name="periodo_id" value="<?= $user->periodo_id ?>">
<input type="hidden" id="profesor_id" name="profesor_id" value="">
</div>
</div>
<!-- ICO-BUSCAR FILTRAR & ICO-BORRAR LIMPIAR -->
<div class="form-group row justify-content-center">
<button class="btn btn-outline-primary mr-2">
<span class="ing-buscar icono"></span>
Buscar horario
</button>
<button type="button" class="btn btn-outline-danger" onclick="location.reload()">
<span class="ing-borrar icono"></span>
Limpiar
</button>
</div>
</div>
</div>
</form>
<div class="form-group mt-4 row justify-content-center">
<?php if ($write) { ?>
<button type="button" id="nuevo" class="btn btn-outline-primary ml-4 d-none" title="Nuevo horario" data-toggle="modal" data-target="#modal-editar">
<span class="ing-mas ing-fw"></span> Nuevo
</button>
<?php } ?>
</div>
</div>
</div>
</form>
<!-- Horario is a (table with one a cell) within a table
7:15 - 8:45, 8:45 - 10:15, 10:30 - 12:00, 12:00 - 13:30
de lunes a viernes, a excepción de que tenga sábado
-->
<div id="btn-excel-horario" class="mb-2 float-right hidden">
<button class="btn btn-outline-secondary " title="Exportar a Excel">
<span class="ing-descarga ing-fw"></span> Exportar a Excel
</button>
</div>
<!-- Table responsive -->
<div class="table-responsive">
<table class="table table-bordered table-sm table-responsive-md" id="table-horario">
<thead class="thead-dark">
<tr id="headers">
<th scope="col" class="text-center">Hora</th>
<th scope="col" class="text-center">Lunes</th>
<th scope="col" class="text-center">Martes</th>
<th scope="col" class="text-center">Miércoles</th>
<th scope="col" class="text-center">Jueves</th>
<th scope="col" class="text-center">Viernes</th>
<th scope="col" class="text-center">Sábado</th>
</tr>
</thead>
<tbody id="horario"></tbody>
</table>
</div>
</main>
</body>
</html>