From de0320eb73f4bd8e5331b94d881b1df3ab5dc29d Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 6 Oct 2016 11:13:17 -0500 Subject: [PATCH] merge --- plugin/bbb/admin.php | 49 +++++++++++++++++++++++++++++++++++--- plugin/bbb/admin.tpl | 8 ++----- plugin/bbb/lib/bbb.lib.php | 3 ++- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/plugin/bbb/admin.php b/plugin/bbb/admin.php index 501e44b33c..3f510af2b9 100644 --- a/plugin/bbb/admin.php +++ b/plugin/bbb/admin.php @@ -15,13 +15,43 @@ $plugin = BBBPlugin::create(); $tool_name = $plugin->get_lang('Videoconference'); $tpl = new Template($tool_name); -$isGlobal = isset($_GET['global']) ? true : false; - -$bbb = new bbb('', '', $isGlobal); +$bbb = new bbb('', ''); $action = isset($_GET['action']) ? $_GET['action'] : null; $meetings = $bbb->getMeetings(); +if ($action) { + switch ($action) { + case 'export': + $dataToExport = [ + [$tool_name, get_lang('RecordList')], + [], + [ + get_lang('CreatedAt'), + get_lang('Status'), + get_lang('Records'), + get_lang('Course'), + get_lang('Session'), + get_lang('Participants'), + ] + ]; + + foreach ($meetings as $meeting) { + $dataToExport[] = [ + $meeting['created_at'], + $meeting['status'] == 1 ? get_lang('MeetingOpened') : 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); } @@ -35,7 +65,20 @@ if (!$bbb->isServerRunning()) { $tpl->assign('meetings', $meetings); $content = $tpl->fetch('bbb/admin.tpl'); +$actions = []; + +if ($meetings) { + $actions[] = Display::toolbarButton( + get_lang('ExportInExcel'), + api_get_self() . '?action=export', + 'file-excel-o', + 'success', + [], + false + ); +} $tpl->assign('header', get_lang('RecordList')); +$tpl->assign('actions', implode('', $actions)); $tpl->assign('content', $content); $tpl->display_one_col_template(); diff --git a/plugin/bbb/admin.tpl b/plugin/bbb/admin.tpl index e20c983227..9ace9e696a 100644 --- a/plugin/bbb/admin.tpl +++ b/plugin/bbb/admin.tpl @@ -6,7 +6,7 @@ {{ 'Records'|get_lang }} {{ 'Course'|get_lang }} {{ 'Session'|get_lang }} - {{ 'Actions'|get_lang }} + {{ 'Participants'|get_lang }} @@ -33,11 +33,7 @@ {{ meeting.course ? meeting.course.title : '-' }} {{ meeting.session ? meeting.session.name : '-' }} - {% if meeting.status == 1 %} - {{ 'CloseMeeting'|get_lang }} - {% else %} - {{ meeting.action_links }} - {% endif %} + {{ meeting.participants|join('
') }} {% endfor %} diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php index cfcf1a95fc..9ca55ca6de 100755 --- a/plugin/bbb/lib/bbb.lib.php +++ b/plugin/bbb/lib/bbb.lib.php @@ -1204,8 +1204,9 @@ class bbb public function unPublishUrl($meeting) { if (!isset($meeting['id'])) { - return ''; + return null; } + return api_get_path(WEB_PLUGIN_PATH).'bbb/listing.php?'.$this->getUrlParams().'&action=unpublish&id='.$meeting['id']; }