Initial state

This commit is contained in:
2023-05-16 10:16:21 -06:00
commit c3c0108143
167 changed files with 20135 additions and 0 deletions

35
action/action_horario.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
header('Content-Type: application/json');
$ruta = "../";
require_once("../include/bd_pdo.php");
extract($_POST);
$dias = array("domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado");
$horarios = $db
->get("fs_horario($periodo, $carrera, '$grupo', true)");
// get each id from $horarios (might be duplicate)
try {
$horarios = array_map(function ($horario) use ($dias, $db) {
$horario['profesores'] = array_map(
fn ($profesor) =>
$db->where("id", $profesor)->getOne("fs_profesor"),
explode(",", substr($horario['profesores'], 1, -1))
);
$horario['dia'] = $dias[$horario['dia']];
return $horario;
}, $horarios);
} catch (Exception $e) {
die(json_encode([
"status" => "error",
"message" => $e->getMessage(),
]));
}
?>
<?= json_encode([
"status" => "success",
"horario" => $horarios,
]) ?>