123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?php
- /**
- * This script initiates a video conference session, calling the BigBlueButton API
- * @package chamilo.plugin.bigbluebutton
- */
- use Chamilo\UserBundle\Entity\User;
- $course_plugin = 'bbb'; //needed in order to load the plugin lang variables
- $cidReset = true;
- require_once __DIR__ . '/../../main/inc/global.inc.php';
- api_protect_admin_script();
- $plugin = BBBPlugin::create();
- $tool_name = $plugin->get_lang('Videoconference');
- $bbb = new bbb('', '');
- $action = isset($_GET['action']) ? $_GET['action'] : null;
- $form = new FormValidator(get_lang('Search'));
- $form->addDatePicker('search_meeting', get_lang('Date'));
- $form->addButtonSearch(get_lang('Search'));
- $actions = [];
- if ($form->validate()) {
- $date = $form->getSubmitValue('search_meeting');
- $meetings = $bbb->getMeetings(0, 0, 0, true, $date);
- $actions[] = Display::toolbarButton(
- $plugin->get_lang('ReturnToFullList'),
- api_get_self(),
- 'list',
- 'primary'
- );
- } else {
- $meetings = $bbb->getMeetings(0, 0, 0, true);
- }
- foreach ($meetings as &$meeting) {
- $participants = $bbb->findMeetingParticipants($meeting['id']);
- foreach ($participants as $meetingParticipant) {
- /** @var User $participant */
- $participant = $meetingParticipant['participant'];
- $meeting['participants'][] = $participant->getCompleteName()
- . ' (' . $participant->getEmail() . ')';
- }
- }
- if ($action) {
- switch ($action) {
- case 'export':
- $dataToExport = [
- [$tool_name, $plugin->get_lang('RecordList')],
- [],
- [
- get_lang('CreatedAt'),
- get_lang('Status'),
- $plugin->get_lang('Records'),
- get_lang('Course'),
- get_lang('Session'),
- get_lang('Participants'),
- ]
- ];
- foreach ($meetings as $meeting) {
- $dataToExport[] = [
- $meeting['created_at'],
- $meeting['status'] == 1 ? $plugin->get_lang('MeetingOpened') : $plugin->get_lang('MeetingClosed'),
- $meeting['record'] == 1 ? get_lang('Yes') : get_lang('No'),
- $meeting['course'] ? $meeting['course']->getTitle() : '-',
- $meeting['session'] ? $meeting['session']->getName() : '-',
- isset($meeting['participants']) ? implode(PHP_EOL, $meeting['participants']) : null
- ];
- }
- Export::arrayToXls($dataToExport);
- break;
- }
- }
- if (!empty($meetings)) {
- $meetings = array_reverse($meetings);
- }
- if (!$bbb->isServerRunning()) {
- Display::addFlash(
- Display::return_message(get_lang('ServerIsNotRunning'), 'error')
- );
- }
- $htmlHeadXtra[] = api_get_js_simple(
- api_get_path(WEB_PLUGIN_PATH) . 'bbb/resources/utils.js'
- );
- $htmlHeadXtra[] = "<script>var _p = {web_plugin: '" . api_get_path(WEB_PLUGIN_PATH). "'}</script>";
- $tpl = new Template($tool_name);
- $tpl->assign('meetings', $meetings);
- $tpl->assign('search_form', $form->returnForm());
- $content = $tpl->fetch('bbb/admin.tpl');
- if ($meetings) {
- $actions[] = Display::toolbarButton(
- get_lang('ExportInExcel'),
- api_get_self() . '?action=export',
- 'file-excel-o',
- 'success'
- );
- }
- $tpl->assign('header', $plugin->get_lang('RecordList'));
- $tpl->assign('actions', implode('', $actions));
- $tpl->assign('content', $content);
- $tpl->display_one_col_template();
|