diff --git a/public/js/program.js b/public/js/program.js index b54ae93..e50ae3f 100644 --- a/public/js/program.js +++ b/public/js/program.js @@ -21,119 +21,125 @@ document.addEventListener("DOMContentLoaded", function () { } var calendarEl = document.getElementById("calendar"); var calendar = new FullCalendar.Calendar(calendarEl, { - schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives", - - eventDidMount: function (info) { - var tooltip = tippy(info.el, { - content: `${info.event.title}
${info.event.extendedProps.speaker.nombre}
${info.event.extendedProps.description}`, - allowHTML: true, - }); - }, - eventSources: [ - { - url: "/api/eventos/cursos", - color: "#755baf", - /*NO ESTÁ FUNCANDO EL RECUR + schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives", + + eventDidMount: function (info) { + var tooltip = tippy(info.el, { + content: `${info.event.title}
${info.event.extendedProps.speaker.nombre}
${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); diff --git a/src/routes.php b/src/routes.php index 6c4ccf2..e881acf 100644 --- a/src/routes.php +++ b/src/routes.php @@ -253,15 +253,58 @@ $mw = function ($request, $response, $next) { // API ROUTES $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)); + $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);