Files
Chamilo/plugin/zoom/calendar.ajax.php
T
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

67 lines
2.2 KiB
PHP

<?php
/* For license terms, see /license.txt */
use Chamilo\PluginBundle\Zoom\API\BaseMeetingTrait;
use Chamilo\PluginBundle\Zoom\Meeting;
use Chamilo\PluginBundle\Zoom\Webinar;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request as HttpRequest;
$course_plugin = 'zoom'; // needed in order to load the plugin lang variables
$cidReset = true;
require_once __DIR__.'/config.php';
api_protect_admin_script();
$request = HttpRequest::createFromGlobals();
$plugin = ZoomPlugin::create();
$user = api_get_user_entity(api_get_user_id());
$action = $request->get('a');
if ($action == 'get_events') {
$startDate = $request->query->get('start');
$endDate = $request->query->get('end');
$startDate = api_get_utc_datetime($startDate, true, true);
$endDate = api_get_utc_datetime($endDate, true, true);
$meetings = $plugin
->getMeetingRepository()
->periodMeetings($startDate, $endDate);
$meetingsAsEvents = array_map(
function (Meeting $conference) {
$isWebinar = $conference instanceof Webinar;
/** @var BaseMeetingTrait $schema */
$schema = $isWebinar ? $conference->getWebinarSchema() : $conference->getMeetingInfoGet();
$endDate = new DateTime($conference->formattedStartTime);
$endDate->add($conference->durationInterval);
return [
'id' => 'meeting_'.$conference->getId(),
'title' => $schema->topic,
'typeName' => $conference->typeName,
'editable' => false,
'start' => $conference->formattedStartTime,
'start_date_localtime' => $conference->formattedStartTime,
'end' => $endDate->format('Y-m-d H:i'),
'end_date_localtime' => $endDate->format('Y-m-d H:i'),
'duration' => $conference->formattedDuration,
'description' => $schema->agenda,
'allDay' => false,
'accountEmail' => $conference->getAccountEmail(),
];
},
$meetings
);
$response = JsonResponse::create($meetingsAsEvents);
$response->send();
}