Initial Commit
This commit is contained in:
40
action/action_profesor_faltas.php
Normal file
40
action/action_profesor_faltas.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
$ruta = "../";
|
||||
require_once "../include/bd_pdo.php";
|
||||
|
||||
// die(print_r($_POST, true));
|
||||
|
||||
extract($_POST);
|
||||
// if hora fin is null, then subtract half an hour from hora inicio and set hora fin to hora inicio + half an hour
|
||||
$hora_fin = empty($hora_fin) ? $hora_inicio : $hora_fin;
|
||||
|
||||
$hora_inicio = date('H:i:s', strtotime($hora_inicio < '07:00' ? '07:00' : $hora_inicio) - 1800);
|
||||
$hora_fin = date('H:i:s', strtotime($hora_fin > '22:00' ? '22:00' : $hora_fin) + 1800);
|
||||
|
||||
die(json_encode(
|
||||
array_map(fn ($row) => array_merge(
|
||||
$db->where('id', $row['profesor_id'])->getOne('fs_profesor'),
|
||||
$db->where('id', $row['materia_id'])->getOne('fs_materia'),
|
||||
$row
|
||||
),
|
||||
queryAll(
|
||||
"SELECT REPORTE.*
|
||||
FROM fs_asistencia_profesorreporte(null, :periodo, null, :fecha, :fecha) AS REPORTE
|
||||
JOIN PROFESOR P ON P.PROFESOR_ID = REPORTE.PROFESOR_ID
|
||||
WHERE HORA_CHECADO IS NULL
|
||||
AND HORA BETWEEN :inicio AND :fin
|
||||
AND P.PROFESOR_CLAVE ILIKE COALESCE(:clave, P.PROFESOR_CLAVE) and UNACCENT(P.PROFESOR_NOMBRE) ILIKE UNACCENT(COALESCE(:nombre, P.PROFESOR_NOMBRE))
|
||||
AND FECHA = :fecha
|
||||
ORDER BY HORA, MATERIA",
|
||||
[
|
||||
'periodo' => $periodo,
|
||||
'fecha' => $fecha,
|
||||
'inicio' => $hora_inicio,
|
||||
'fin' => $hora_fin,
|
||||
'clave' => empty($clave) ? null : "%$clave%",
|
||||
'nombre' => empty($nombre) ? null : "%$nombre%"
|
||||
]
|
||||
))));
|
||||
|
||||
|
||||
#ECHO "$hora_inicio - $hora_fin";
|
||||
Reference in New Issue
Block a user