fix recursion en cursos, comision de género y asamblea con event source as function

This commit is contained in:
Germán Correa 2021-09-02 18:27:42 +02:00
parent 210d25f3e6
commit 7e617171f3
2 changed files with 155 additions and 106 deletions

View File

@ -55,35 +55,41 @@ document.addEventListener("DOMContentLoaded", function () {
url: "/api/eventos/premiados",
color: "darkred",
},
],
events: [
{
title: "Sesiones",
startTime: "15:00-0300",
endTime: "18:15-0300",
startRecur: "2021-09-13",
endRecur: "2021-09-18",
speaker: { nombre: "organizadores" },
{ url:"/api/eventos/sesiones/",
color: "gray",
//duration:{days:5}
},
{
events: function(info,success,fail){
let comisiones = [];
for(let i=0;i<3;i++){
comisiones.push({
title: "Comisión de Género",
startTime: "18:30-0300",
endTime: "19:30-0300",
startRecur: "2021-09-14",
endRecur: "2021-09-17",
start: `2021-09-${14 + i}T18:30-0300`,
end: `2021-09-${14 + i}T19:30-0300`,
speaker: { nombre: "organizadores" },
description: "Reuniones de Comisión de Género de UMALCA",
color: "#812c64",
});
}
success(comisiones);
}
},
{
events: function(info,success,fail){
let asamblea = {
title: "Asamblea UMALCA",
start: "2021-09-13T19:00-0300",
end: "2019-09-13T20:00-0300",
speaker: { nombre: "organizadores" },
color: "black",
},
}
success([asamblea])
}
}
],
headerToolbar: {
center: "timeGridAll,timeGridThree,timeGridOne",
},
@ -98,7 +104,7 @@ document.addEventListener("DOMContentLoaded", function () {
initialDate: "2021-09-13",
validRange: {
start: "2021-09-13",
end: "2021-09-19",
end: "2021-09-18",
},
nowIndicator: true,
now: "2021-09-12",

View File

@ -254,14 +254,57 @@ $mw = function ($request, $response, $next) {
$app->group('/api', function($app){
$app->get("/eventos/{tipo:cursos|plenarias|semiplenarias|publicas|premiados}",function(Request $request, Response $response, array $args) {
$tipo=$args['tipo']=="publicas"?"Públicas":ucfirst($args['tipo']);
if($tipo==="Cursos"){
$cursos = [];
foreach(getEventos($tipo) as $event){
for($i=0;$i<3;$i++){
$eventStart = new DateTime($event['start']);
$eventEnd = new DateTime($event['end']);
$eventStart->add(new DateInterval("P{$i}D"));
$eventEnd->add(new DateInterval("P{$i}D"));
$cursos[] = array(
'title'=>$event['title'],
'start'=>$eventStart->format("c"),
'end'=>$eventEnd->format("c"),
'description'=>$event['description'],
'speaker'=>$event['speaker'],
);
}
}
$newres = $response->withJson($cursos);
}
else
$newres = $response->withJson(getEventos($tipo));
return $newres;
});
$app->get("/eventos/sesiones[/{sesionId}]",function(Request $request, Response $response, array $args) {
$app->group("/eventos/sesiones/", function($app){
$app->get("",function(Request $request, Response $response, array $args){
$sesiones = getSesiones();
$sesionesEventos = [];
for($i=0;$i<5;$i++){
$dia=13+$i;
$evento = array(
'title'=>"Sesiones",
'start'=>'2021-09-'.$dia.'T15:00-0300',
'end'=>'2021-09-'.$dia.'T18:15-0300',
'description'=>"",
'speaker'=>"",
);
$sesionesEventos[]=$evento;
}
foreach ($sesiones as $ses){
}
return $response->withJson($sesionesEventos);
});
$app->get("/{sesionId}",function(Request $request, Response $response, array $args) {
$newres = $response->withJson(getSesiones($args['sesionId']));
return $newres;
});
});
$app->get("/test", function(Request $request, Response $response, array $args) {
$this->logger->info("GDDWorkshop '/api/test' route");
return var_dump($request);