|
@@ -1,4 +1,8 @@
|
|
|
<?
|
|
<?
|
|
|
|
|
+ini_set('display_errors', 1);
|
|
|
|
|
+ini_set('display_startup_errors', 1);
|
|
|
|
|
+error_reporting(E_ALL);
|
|
|
|
|
+
|
|
|
#input $_GET['id_espacio_sgu']
|
|
#input $_GET['id_espacio_sgu']
|
|
|
$information = [
|
|
$information = [
|
|
|
'GET' => [
|
|
'GET' => [
|
|
@@ -6,6 +10,7 @@ $information = [
|
|
|
'bloque_horario_id',
|
|
'bloque_horario_id',
|
|
|
],
|
|
],
|
|
|
];
|
|
];
|
|
|
|
|
+
|
|
|
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
|
#output rutas: [ ...ruta, salones: [{...salon}] ]
|
|
|
header('Content-Type: application/json charset=utf-8');
|
|
header('Content-Type: application/json charset=utf-8');
|
|
|
$ruta = "../";
|
|
$ruta = "../";
|
|
@@ -28,7 +33,6 @@ try {
|
|
|
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
|
->where("{$_GET['id_espacio_sgu']} = ANY(id_espacio_sgu_array)")
|
|
|
->get('salon_view', columns: 'id_espacio_sgu, salon, salon_id, salon_array');
|
|
->get('salon_view', columns: 'id_espacio_sgu, salon, salon_id, salon_array');
|
|
|
|
|
|
|
|
- // step 3: get horario
|
|
|
|
|
$columns = [
|
|
$columns = [
|
|
|
// horario
|
|
// horario
|
|
|
'horario_view.horario_id',
|
|
'horario_view.horario_id',
|
|
@@ -56,7 +60,7 @@ try {
|
|
|
'reposicion_hora',
|
|
'reposicion_hora',
|
|
|
'salon_reposicion.salon as reposicion_salon',
|
|
'salon_reposicion.salon as reposicion_salon',
|
|
|
];
|
|
];
|
|
|
- $fecha = "'2023-09-01'::DATE";
|
|
|
|
|
|
|
+
|
|
|
$data = array_map(
|
|
$data = array_map(
|
|
|
fn($ruta) => array_merge(
|
|
fn($ruta) => array_merge(
|
|
|
[
|
|
[
|
|
@@ -66,24 +70,34 @@ try {
|
|
|
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
|
->join('salon_view', 'salon_view.salon_id = horario_view.salon_id')
|
|
|
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
|
->join('horario_profesor', 'horario_profesor.horario_id = horario_view.horario_id')
|
|
|
->join('profesor', 'profesor.profesor_id = horario_profesor.profesor_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('registro', '(registro.profesor_id, registro.horario_id, registro.registro_fecha_ideal) = (profesor.profesor_id, horario_view.horario_id, CURRENT_DATE)', 'LEFT')
|
|
|
->join('reposicion', 'reposicion.reposicion_id = registro.reposicion_id', 'LEFT')
|
|
->join('reposicion', 'reposicion.reposicion_id = registro.reposicion_id', 'LEFT')
|
|
|
->join('salon as salon_reposicion', 'salon_reposicion.salon_id = reposicion.salon_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('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('bloque_horario.id', $_GET['bloque_horario_id'])
|
|
|
->where('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
|
->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),
|
|
|
|
|
|
|
+ ->get(
|
|
|
|
|
+ 'horario_view',
|
|
|
|
|
+ columns: $columns
|
|
|
|
|
+ ),
|
|
|
|
|
+ 'query' => $db->getLastQuery(),
|
|
|
|
|
+ '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_view', 'salon_view.salon_id = reposicion.salon_id', 'LEFT')
|
|
|
|
|
+ ->join('salon as salon_reposicion', 'salon_reposicion.salon_id = horario_view.salon_id', 'LEFT')
|
|
|
|
|
+ ->where("CURRENT_DATE BETWEEN periodo.periodo_fecha_inicio AND periodo.periodo_fecha_fin")
|
|
|
|
|
+ ->where("reposicion_fecha = CURRENT_DATE")
|
|
|
|
|
+ ->where('bloque_horario.id', $_GET['bloque_horario_id'])
|
|
|
|
|
+ ->where('salon_view.id_espacio_padre', $ruta['id_espacio_sgu'])
|
|
|
|
|
+ ->get(
|
|
|
|
|
+ 'horario_view',
|
|
|
|
|
+ columns: $columns
|
|
|
|
|
+ ),
|
|
|
],
|
|
],
|
|
|
$ruta,
|
|
$ruta,
|
|
|
),
|
|
),
|