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

@ -21,119 +21,125 @@ document.addEventListener("DOMContentLoaded", function () {
}
var calendarEl = document.getElementById("calendar");
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
eventDidMount: function (info) {
var tooltip = tippy(info.el, {
content: `<strong>${info.event.title}</strong><br/><strong>${info.event.extendedProps.speaker.nombre}</strong><br/>${info.event.extendedProps.description}`,
allowHTML: true,
});
},
eventSources: [
{
url: "/api/eventos/cursos",
color: "#755baf",
/*NO ESTÁ FUNCANDO EL RECUR
eventDidMount: function (info) {
var tooltip = tippy(info.el, {
content: `<strong>${info.event.title}</strong><br/><strong>${info.event.extendedProps.speaker.nombre}</strong><br/>${info.event.extendedProps.description}`,
allowHTML: true,
});
},
eventSources: [
{
url: "/api/eventos/cursos",
color: "#755baf",
/*NO ESTÁ FUNCANDO EL RECUR
startTime:"13:00",
endTime:"14:00",
startRecur:"2021-09-14",
endRecur:"2021-09-16",*/
},
{
url: "/api/eventos/plenarias",
color: "#578e44",
},
{
url: "/api/eventos/semiplenarias",
color: "#3383cb",
},
{
url: "/api/eventos/publicas",
color: "#a57b00",
},
{
url: "/api/eventos/premiados",
color: "darkred",
},
{ url:"/api/eventos/sesiones/",
color: "gray",
},
{
events: function(info,success,fail){
let comisiones = [];
for(let i=0;i<3;i++){
comisiones.push({
title: "Comisión de Género",
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",
},
{
url: "/api/eventos/plenarias",
color: "#578e44",
eventTimeFormat: {
hour: "numeric",
minute: "2-digit",
meridiem: false,
},
{
url: "/api/eventos/semiplenarias",
color: "#3383cb",
timeZone: "America/Montevideo",
locale: "es",
initialView: "timeGridAll",
initialDate: "2021-09-13",
validRange: {
start: "2021-09-13",
end: "2021-09-18",
},
{
url: "/api/eventos/publicas",
color: "#a57b00",
nowIndicator: true,
now: "2021-09-12",
slotMinTime: "11:00:00",
slotMaxTime: "21:00:00",
//slotMinTime:"11:00:00",
//slotMaxTime:"21:00:00",
slotDuration: "00:15",
allDaySlot: false,
slotLabelFormat: {
hour: "numeric",
minute: "2-digit",
omitZeroMinute: false,
meridiem: "short",
},
{
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" },
color: "gray",
//duration:{days:5}
},
{
title: "Comisión de Género",
startTime: "18:30-0300",
endTime: "19:30-0300",
startRecur: "2021-09-14",
endRecur: "2021-09-17",
speaker: { nombre: "organizadores" },
color: "#812c64",
},
{
title: "Asamblea UMALCA",
start: "2021-09-13T19:00-0300",
end: "2019-09-13T20:00-0300",
speaker: { nombre: "organizadores" },
color: "black",
},
],
headerToolbar: {
center: "timeGridAll,timeGridThree,timeGridOne",
},
eventTimeFormat: {
hour: "numeric",
minute: "2-digit",
meridiem: false,
},
timeZone:"America/Montevideo",
locale: "es",
initialView: "timeGridAll",
initialDate: "2021-09-13",
validRange: {
start: "2021-09-13",
end: "2021-09-19",
},
nowIndicator: true,
now: "2021-09-12",
slotMinTime: "11:00:00",
slotMaxTime: "21:00:00",
//slotMinTime:"11:00:00",
//slotMaxTime:"21:00:00",
slotDuration: "00:15",
allDaySlot: false,
slotLabelFormat: {
hour: "numeric",
minute: "2-digit",
omitZeroMinute: false,
meridiem: "short",
},
eventDisplay: "block",
views: {
timeGridAll: {
type: "timeGrid",
duration: { days: 5 },
buttonText: "Todos los dias",
},
timeGridThree: {
type: "timeGrid",
duration: { days: 2 },
buttonText: "2 dias",
},
timeGridOne: {
type: "timeGrid",
eventDisplay: "block",
views: {
timeGridAll: {
type: "timeGrid",
duration: { days: 5 },
buttonText: "Todos los dias",
},
timeGridThree: {
type: "timeGrid",
duration: { days: 2 },
buttonText: "2 dias",
},
timeGridOne: {
type: "timeGrid",
duration: { days: 1 },
buttonText: "1 dia",
},
duration: { days: 1 },
buttonText: "1 dia",
},
duration: { days: 1 },
},
});
});
calendar.render();
timeZoneSelectorEl.addEventListener("change", function () {
calendar.setOption("timeZone", this.value);

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']);
$newres = $response->withJson(getEventos($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);