All
This commit is contained in:
@@ -29,6 +29,7 @@ try {
|
||||
"WITH horarios AS (
|
||||
SELECT
|
||||
horario_id,
|
||||
facultad.facultad_id,
|
||||
horario_fecha_inicio,
|
||||
horario_fecha_fin,
|
||||
horario_grupo,
|
||||
@@ -55,31 +56,35 @@ try {
|
||||
fechas AS (
|
||||
SELECT fechas_clase(h.horario_id, true) as registro_fecha_ideal, h.horario_id
|
||||
FROM horarios h
|
||||
),
|
||||
sin_registro AS (
|
||||
SELECT * FROM ESTADO_SUPERVISOR WHERE (estado_color, estado_icon) = ('dark', 'ing-cancelar')
|
||||
)
|
||||
SELECT
|
||||
usuario.usuario_nombre,
|
||||
registro.registro_id, registro.registro_fecha, registro.registro_retardo, registro.registro_justificada, comentario, registro_fecha_supervisor justificacion, registro_fecha_justificacion,
|
||||
registro.registro_id,
|
||||
registro.registro_fecha,
|
||||
registro.registro_retardo,
|
||||
registro.registro_justificada,
|
||||
registro_fecha_supervisor,
|
||||
justificacion,
|
||||
comentario,
|
||||
registro_fecha_justificacion,
|
||||
profesor.profesor_id, profesor_nombre, profesor_clave, profesor_correo,
|
||||
horarios.*,
|
||||
registro_fecha_ideal,
|
||||
COALESCE(estado_supervisor.estado_supervisor_id, sin_registro.estado_supervisor_id) as estado_supervisor_id,
|
||||
COALESCE(estado_supervisor.nombre, sin_registro.nombre) as nombre,
|
||||
COALESCE(estado_supervisor.estado_color, sin_registro.estado_color) as estado_color,
|
||||
COALESCE(estado_supervisor.estado_icon, sin_registro.estado_icon) as estado_icon,
|
||||
materia, carrera, horarios.facultad_id, facultad, nivel, horario_hora, horario_fin, horario_grupo, salon,
|
||||
fechas.registro_fecha_ideal,
|
||||
estado_supervisor.estado_supervisor_id as estado_supervisor_id,
|
||||
estado_supervisor.nombre as nombre,
|
||||
estado_supervisor.estado_color as estado_color,
|
||||
estado_supervisor.estado_icon as estado_icon,
|
||||
justificador.usuario_nombre as justificador_nombre,
|
||||
justificador.usuario_clave as justificador_clave,
|
||||
facultad.facultad_nombre as justificador_facultad,
|
||||
rol.rol_titulo as justificador_rol
|
||||
rol.rol_titulo as justificador_rol,
|
||||
CASE WHEN registro_retardo THEN 'warning' ELSE 'primary' END as color
|
||||
FROM horarios
|
||||
JOIN fechas using (horario_id)
|
||||
JOIN horario_profesor using (horario_id)
|
||||
JOIN profesor using (profesor_id)
|
||||
LEFT JOIN registro USING (horario_id, registro_fecha_ideal, profesor_id)
|
||||
LEFT join estado_supervisor using (estado_supervisor_id)
|
||||
CROSS JOIN sin_registro
|
||||
join estado_supervisor ON estado_supervisor.estado_supervisor_id = COALESCE(registro.estado_supervisor_id, 0)
|
||||
LEFT JOIN USUARIO ON USUARIO.usuario_id = REGISTRO.supervisor_id
|
||||
LEFT JOIN USUARIO JUSTIFICADOR ON JUSTIFICADOR.usuario_id = REGISTRO.justificador_id
|
||||
LEFT JOIN ROL on ROL.rol_id = justificador.rol_id
|
||||
|
||||
44
action/reposicion_profesor_materias.php
Normal file
44
action/reposicion_profesor_materias.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Obtiene datos de reposición
|
||||
*/
|
||||
$ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
|
||||
// check if the session is started
|
||||
if (!isset($_SESSION['user']))
|
||||
die('No se ha iniciado sesión');
|
||||
|
||||
$user = unserialize($_SESSION['user']);
|
||||
|
||||
|
||||
//--- Objeto para validar usuario. El id de usuario lo lee desde sesión
|
||||
/*if(!$objSesion->tieneAcceso()){
|
||||
$return["error"] = "Error! No tienes permisos para realizar esta acción.";
|
||||
}else*/ if(!isset($_POST["id"])){
|
||||
$return["error"] = "Error! No se recibió la información del profesor.";
|
||||
}else{
|
||||
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
|
||||
|
||||
try{
|
||||
$rs = $db->query('SELECT * FROM fs_materiasprofesor(:id)', [':id' => $id] );
|
||||
|
||||
}catch(Exception $e){
|
||||
$return["error"] = "Ocurrió un error al leer los datos de las materias.";
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
$mat_arr = array();
|
||||
foreach($rs as $m){
|
||||
$mat_arr[] = array("horario_id"=>$m["horario_id"], "horario_dia"=>$m["horario_dia"],
|
||||
"horario_hora"=>substr($m["horario_hora"], 0, 2), "horario_min"=>substr($m["horario_hora"], 3, 2),
|
||||
"materia_nombre"=>$m["materia_nombre"].' - '.$m["horario_dia_nombre"]." ".substr($m["horario_hora"], 0, -3)
|
||||
);
|
||||
}
|
||||
|
||||
$return["materias"] = $mat_arr;
|
||||
|
||||
}
|
||||
echo json_encode($return);
|
||||
?>
|
||||
@@ -12,6 +12,7 @@ $ruta = "../";
|
||||
require_once "../class/c_login.php";
|
||||
// check method
|
||||
try {
|
||||
global $db;
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// check parameters
|
||||
array_walk($information['GET'], function ($value) {
|
||||
@@ -25,32 +26,69 @@ try {
|
||||
$data = $db
|
||||
->where('tiene_salones')
|
||||
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
||||
->get('salon_view');
|
||||
->get('salon_view', columns: 'id_espacio_sgu, salon, salon_id, salon_array');
|
||||
|
||||
// step 3: get horarios
|
||||
// step 3: get horario
|
||||
$columns = [
|
||||
// horario
|
||||
'horario_view.horario_id',
|
||||
'horario_hora',
|
||||
'horario_grupo',
|
||||
'horario_fin',
|
||||
'materia',
|
||||
'carrera',
|
||||
'nivel',
|
||||
'horario_view.salon',
|
||||
'facultad',
|
||||
// profesor
|
||||
'profesor.profesor_id',
|
||||
'profesor_clave',
|
||||
'profesor_nombre',
|
||||
'profesor_correo',
|
||||
// registro
|
||||
'registro_fecha',
|
||||
'registro_retardo',
|
||||
'registro.reposicion_id',
|
||||
'estado_supervisor_id',
|
||||
'comentario',
|
||||
// reposicion
|
||||
'reposicion_fecha',
|
||||
'reposicion_hora',
|
||||
'salon_reposicion.salon as reposicion_salon',
|
||||
];
|
||||
$fecha = "'2023-09-01'::DATE";
|
||||
$data = array_map(
|
||||
fn($ruta) => array_merge(
|
||||
[
|
||||
'horarios' => array_merge(
|
||||
$db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)')
|
||||
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
||||
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
||||
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_id')
|
||||
->join('registro', '(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, CURRENT_DATE)', 'LEFT')
|
||||
->where('CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin')
|
||||
->where('horario_dia = EXTRACT(DOW FROM CURRENT_DATE)')
|
||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||
->where('id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', null, '*, horario_view.horario_id, profesor.profesor_id'),
|
||||
),
|
||||
'horarios' => $db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (horario_view.horario_hora, horario_view.horario_hora + horario_view.duracion)')
|
||||
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
||||
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
||||
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_id')
|
||||
->join('registro', "(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, $fecha)", 'LEFT')
|
||||
->join('reposicion', 'reposicion.reposicion_id = registro.reposicion_id', 'LEFT')
|
||||
->join('salon as salon_reposicion', 'salon_reposicion.salon_id = reposicion.salon_id', 'LEFT')
|
||||
->where("$fecha BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin")
|
||||
->where("horario_dia = EXTRACT(DOW FROM $fecha)")
|
||||
->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
||||
->where('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
||||
->get('horario_view', columns: $columns),
|
||||
'reposiciones' => $db
|
||||
->join('periodo', 'periodo.periodo_id = horario_view.periodo_id')
|
||||
->join('registro', 'registro.horario_id = horario_view.horario_id')
|
||||
->join('reposicion', 'registro.reposicion_id = reposicion.reposicion_id')
|
||||
->join('bloque_horario', '(bloque_horario.hora_inicio, bloque_horario.hora_fin) OVERLAPS (reposicion_hora, reposicion_hora + horario_view.duracion)')
|
||||
->join('profesor', 'profesor.profesor_id = registro.profesor_id')
|
||||
->join('salon as salon_reposicion', 'salon_reposicion.salon_id = reposicion.salon_id', 'LEFT')
|
||||
->where("$fecha BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin")
|
||||
->where("reposicion_fecha = $fecha")
|
||||
->get('horario_view', columns: $columns),
|
||||
],
|
||||
$ruta,
|
||||
),
|
||||
$data
|
||||
);
|
||||
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
http_response_code(405);
|
||||
|
||||
Reference in New Issue
Block a user