User restore session

This commit is contained in:
2023-09-04 16:15:44 +00:00
parent a761df59a7
commit 8eec1a97ba
37 changed files with 130 additions and 195 deletions

View File

@@ -3,18 +3,16 @@
require_once 'class/c_login.php';
if (!isset($_SESSION['user']))
die(header('Location: index.php'));
$user = Login::get_user();
$user = unserialize($_SESSION['user']);
$user->access('reporte_de_asistencias');
if ( $user->acceso == null )
if ($user->acceso == null)
die(header('Location: main.php?error=1'));
$user->print_to_log('Consultar: Reporte de asistencias de profesor');
#$required_post = ['id', 'fecha_inicial', 'fecha_final', 'periodo'];
#if (array_diff($required_post, array_keys($_POST)))
#header('Location: s.php');
@@ -46,7 +44,7 @@ $reporte = queryAll("SELECT * FROM fs_asistencia_profesorreporte(:carrera, :peri
":id" => $id,
":initial_date" => $fecha_inicial->format("Y-m-d"),
":final_date" => $fecha_final->format("Y-m-d"),
":materia" => empty($materia) ? null : $materia
":materia" => empty($materia) ? null : $materia
)
);
@@ -55,7 +53,8 @@ $profesor = query(
array(":id" => $id)
);
$asistencias = query("SELECT total, asistencias, retardos, justificaciones FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date)",
$asistencias = query(
"SELECT total, asistencias, retardos, justificaciones FROM fs_asistencia_reporte(:carrera, :periodo, :clave, :nombre, :facultad, :initial_date, :final_date)",
array(
":carrera" => empty($carrera) ? null : $carrera,
":periodo" => $user->periodo_id,
@@ -92,15 +91,20 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
<div class="container ml-4">
<div class="row my-3">
<h3 class="ml-4 text-left"><?= $profesor['profesor'] ?></h3>
<h3 class="ml-4 text-left">
<?= $profesor['profesor'] ?>
</h3>
</div>
<div class="row my-3">
<h4 class="ml-4 text-left text-danger"><b>Clave:</b> <?= $profesor['clave'] ?></h4>
<h4 class="ml-4 text-left text-danger"><b>Clave:</b>
<?= $profesor['clave'] ?>
</h4>
</div>
</div>
<div class="row">
<div class="col-12 text-right">
<button type="button" class="btn btn-outline-secondary" onclick="submit('reporte_de_asistencias.php', {clave: <?= $profesor['clave'] ?>, periodo: <?= $user->periodo_id ?>, nombre: '<?= $profesor['profesor'] ?>', fecha_inicial: '<?= $fecha_inicial->format('Y-m-d') ?>', fecha_final: '<?= $fecha_final->format('Y-m-d') ?>'})">
<button type="button" class="btn btn-outline-secondary"
onclick="submit('reporte_de_asistencias.php', {clave: <?= $profesor['clave'] ?>, periodo: <?= $user->periodo_id ?>, nombre: '<?= $profesor['profesor'] ?>', fecha_inicial: '<?= $fecha_inicial->format('Y-m-d') ?>', fecha_final: '<?= $fecha_final->format('Y-m-d') ?>'})">
<span class="ing-regresar ing-fw"></span>
Regresar
</button>
@@ -128,7 +132,7 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
<div class="col-12">
<?php
if (!empty($reporte)) {
?>
?>
<!-- legend check (Asistencia) x | (sin registro) | * (Justificada) -->
<div class="row text-right">
<div class="col-12">
@@ -136,7 +140,8 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
<?php if ($retardos) { ?>
<i class='ing-retardo' style='color:orange'></i><span style="color:orange"> Retardo</span> |
<?php } ?>
<i class='ing-cancelar text-danger'></i><span class="text-danger"> Sin registro</span> | <i class='ing-justificar azul'></i><span class="azul"> Justificada</span>
<i class='ing-cancelar text-danger'></i><span class="text-danger"> Sin registro</span> | <i
class='ing-justificar azul'></i><span class="azul"> Justificada</span>
</div>
</div>
@@ -181,34 +186,47 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
$hora = date("H:i", strtotime($row['hora']));
$hora_checado = is_null($row["hora_checado"]) ? '-' : date("H:i:s", strtotime($row["hora_checado"]));
$horario = $db->getOne("fget_horario({$row['id']})");
?>
?>
<tr class="text-nowrap" id="<?= $row["id"] ?>">
<!-- <td class="complete"><pre><?= print_r($row, true) ?></pre></td> -->
<td class="text-center"><?= $row["grupo"] ?></td>
<td class="text-center"><?= $horario["salon"] ?></td>
<td class="text-center">
<?= $row["grupo"] ?>
</td>
<td class="text-center">
<?= $horario["salon"] ?>
</td>
<td id="<?= $row["materia_id"] ?>"><?= $row["materia"] ?></td>
<td class="text-center text-nowrap"><?= $fecha ?> | <?= $días[date("w", strtotime($row["fecha"]))] ?></td>
<td class="text-center text-nowrap">
<?= $fecha ?> |
<?= $días[date("w", strtotime($row["fecha"]))] ?>
</td>
<!-- "hh:mm:ss" -> "hh:mm" -->
<td class="text-center text-nowrap"><?= $hora ?> - <?= join(":", array_slice(explode(":", $horario["hora_final"]), 0, 2)) ?></td>
<td class="text-center"><?= $checado ?></td>
<td class="text-center text-nowrap">
<?= $hora ?> -
<?= join(":", array_slice(explode(":", $horario["hora_final"]), 0, 2)) ?>
</td>
<td class="text-center">
<?= $checado ?>
</td>
<td class="text-center">
<?php if ($justificable) { ?>
<button class='btn btn-sm btn-outline-primary' onclick="justificar(<?= $row['id'] ?>, '<?= $fecha ?>', ' <?= $hora ?>')">Justificar</button>
<button class='btn btn-sm btn-outline-primary'
onclick="justificar(<?= $row['id'] ?>, '<?= $fecha ?>', ' <?= $hora ?>')">Justificar</button>
<?php } else { ?>
<?= !$row["justificada"] ? $hora_checado : "<b>Justificada</b>" ?>
<?php } ?>
</td>
</tr>
<?php
<?php
}
?>
</tbody>
</table>
<?php
<?php
} else { ?>
<div class='alert alert-warning'>No hay registros para mostrar</div>
<?php
<?php
}
?>
</div>
@@ -252,8 +270,10 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
<div class="modal-footer">
<input type="hidden" id="id_borrar" value="">
<input type="hidden" id="facultad_borrar" value="">
<button type="button" class="btn btn-outline-primary btn-aceptar"><span class="ing-aceptar ing-fw"></span> Justificar</button>
<button type="button" class="btn btn-outline-danger" data-dismiss="modal" aria-label="Close"><span class="ing-cancelar ing-fw"></span> Cancelar</button>
<button type="button" class="btn btn-outline-primary btn-aceptar"><span
class="ing-aceptar ing-fw"></span> Justificar</button>
<button type="button" class="btn btn-outline-danger" data-dismiss="modal" aria-label="Close"><span
class="ing-cancelar ing-fw"></span> Cancelar</button>
</div>
</div>
</div>
@@ -296,24 +316,24 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
clone.appendTo("#message");
// remove after 4 seconds
setTimeout(function() {
setTimeout(function () {
clone.alert("close");
}, 4000);
}
$(document).ready(function() {
$(document).ready(function () {
$("#reporte").hide();
$("#reporte").click(function(e) {
$("#reporte").click(function (e) {
$("#form_reporte").submit();
});
var periodo_inicio = '<?= $periodo["inicio"] ?>';
var periodo_fin = '<?= $periodo["fin"] ?>';
var previous_date;
$('#initial_date_src').focus(function() {
$('#initial_date_src').focus(function () {
previous_date = $(this).val();
}).change(function() {
}).change(function () {
// console.log("Periodo inicio: ", periodo_inicio);
// console.log("this < Periodo inicio: ", $(this).val() < periodo_inicio);
if ($(this).val() > $('#final_date_src').val()) {
@@ -330,9 +350,9 @@ $retardos = query("SELECT FS_HAS_RETARDO(:facultad) AS retardo", array(":faculta
}
});
$('#final_date_src').focus(function() {
$('#final_date_src').focus(function () {
previous_date = $(this).val();
}).change(function() {
}).change(function () {
console.log("Periodo fin: ", periodo_fin);
console.log("this > Periodo fin: ", $(this).val() > periodo_fin);
if ($(this).val() < $('#initial_date_src').val()) {