Initial Commit
This commit is contained in:
28
action/action_grupo_horario.php
Normal file
28
action/action_grupo_horario.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$ruta = "../";
|
||||
require_once("../include/bd_pdo.php");
|
||||
|
||||
$grupo = isset($_GET['grupo']) ? $_GET['grupo'] : 1;
|
||||
$grupo_horarios = $db->querySingle(
|
||||
"WITH bloques AS (
|
||||
SELECT id, hora_inicio, hora_fin
|
||||
FROM public.bloque_horario
|
||||
WHERE grupo = ?
|
||||
ORDER BY hora_inicio ASC
|
||||
)
|
||||
|
||||
SELECT json_agg(json_build_object(
|
||||
'id', id,
|
||||
'hora_inicio', hora_inicio,
|
||||
'hora_fin', hora_fin,
|
||||
'selected', current_time between hora_inicio and hora_fin
|
||||
)) AS bloque_horario
|
||||
FROM bloques
|
||||
",
|
||||
[$grupo]
|
||||
)['bloque_horario'];
|
||||
|
||||
|
||||
echo $grupo_horarios;
|
||||
Reference in New Issue
Block a user