You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.2 KiB
66 lines
2.2 KiB
<?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();
|
|
}
|
|
|