diff --git a/plugin/bbb/admin.php b/plugin/bbb/admin.php
index 614e25ada5..34a04a8774 100644
--- a/plugin/bbb/admin.php
+++ b/plugin/bbb/admin.php
@@ -22,7 +22,7 @@ $isGlobal = isset($_GET['global']) ? true : false;
$bbb = new bbb('', '', $isGlobal);
$action = isset($_GET['action']) ? $_GET['action'] : null;
-$meetings = $bbb->getMeetings();
+$meetings = $bbb->getMeetings(0, 0, 0, true);
foreach ($meetings as &$meeting) {
$participants = $bbb->findMeetingParticipants($meeting['id']);
@@ -85,9 +85,7 @@ if ($meetings) {
get_lang('ExportInExcel'),
api_get_self() . '?action=export',
'file-excel-o',
- 'success',
- [],
- false
+ 'success'
);
}
diff --git a/plugin/bbb/admin.tpl b/plugin/bbb/admin.tpl
index c0c528be13..8b70645c3c 100644
--- a/plugin/bbb/admin.tpl
+++ b/plugin/bbb/admin.tpl
@@ -36,6 +36,9 @@
{{ meeting.participants ? meeting.participants|join(' ') : '-' }}
|
+
+ {{ meeting.action_links }}
+ |
{% endfor %}
diff --git a/plugin/bbb/lang/english.php b/plugin/bbb/lang/english.php
index 53b9809cfd..ff53bcf3a4 100755
--- a/plugin/bbb/lang/english.php
+++ b/plugin/bbb/lang/english.php
@@ -56,4 +56,6 @@ $strings['plugin_tool_bbb'] = 'Video';
$strings['ThereAreNotRecordingsForTheMeetings'] = 'There are not recording for the meeting sessions';
$strings['NoRecording'] = 'No recording';
$strings['ClickToContinue'] = 'Click to continue';
-$strings['UrlMeetingToShare'] = 'URL to share';
\ No newline at end of file
+$strings['UrlMeetingToShare'] = 'URL to share';
+
+$strings['AdminView'] = 'View for administrators';
diff --git a/plugin/bbb/lang/french.php b/plugin/bbb/lang/french.php
index 502900a7fc..d33967f736 100755
--- a/plugin/bbb/lang/french.php
+++ b/plugin/bbb/lang/french.php
@@ -38,4 +38,6 @@ $strings['plugin_tool_bbb'] = 'Vidéo';
$strings['ThereAreNotRecordingsForTheMeetings'] = 'Aucun enregistrement disponible';
$strings['NoRecording'] = "Pas d'enregistrement";
$strings['ClickToContinue'] = 'Cliquez pour continuer';
-$strings['UrlMeetingToShare'] = 'URL à partager';
\ No newline at end of file
+$strings['UrlMeetingToShare'] = 'URL à partager';
+
+$strings['AdminView'] = 'View for administrators';
diff --git a/plugin/bbb/lang/spanish.php b/plugin/bbb/lang/spanish.php
index edb9b3a127..a9b5a03e72 100755
--- a/plugin/bbb/lang/spanish.php
+++ b/plugin/bbb/lang/spanish.php
@@ -48,4 +48,6 @@ $strings['plugin_tool_bbb'] = 'Video';
$strings['ThereAreNotRecordingsForTheMeetings'] = 'No hay grabaciones de sesiones de videoconferencia';
$strings['NoRecording'] = 'No hay grabación';
$strings['ClickToContinue'] = 'Hacer click para continuar';
-$strings['UrlMeetingToShare'] = 'URL a compartir';
\ No newline at end of file
+$strings['UrlMeetingToShare'] = 'URL a compartir';
+
+$strings['AdminView'] = 'Vista para administradores';
diff --git a/plugin/bbb/lib/bbb.lib.php b/plugin/bbb/lib/bbb.lib.php
index ab2166cf16..960856030d 100755
--- a/plugin/bbb/lib/bbb.lib.php
+++ b/plugin/bbb/lib/bbb.lib.php
@@ -33,6 +33,9 @@ class bbb
public $accessUrl = 1;
public $userId = 0;
public $plugin;
+ private $courseCode;
+ private $sessionId;
+ private $groupId;
/**
* Constructor (generates a connection to the API and the Chamilo settings
@@ -44,6 +47,10 @@ class bbb
*/
public function __construct($host = '', $salt = '', $isGlobalConference = false, $isGlobalPerUser = 0)
{
+ $this->courseCode = api_get_course_id();
+ $this->sessionId = api_get_session_id();
+ $this->groupId = api_get_group_id();
+
// Initialize video server settings from global settings
$this->plugin = BBBPlugin::create();
@@ -108,6 +115,19 @@ class bbb
}
}
+ /**
+ * Set forced the course, session or group IDs
+ * @param string $courseCode
+ * @param int $sessionId
+ * @param int $groupId
+ */
+ public function forceCIdReq($courseCode, $sessionId = 0, $groupId = 0)
+ {
+ $this->courseCode = $courseCode;
+ $this->sessionId = intval($sessionId);
+ $this->groupId = intval($groupId);
+ }
+
/**
* @return bool
*/
@@ -551,7 +571,7 @@ class bbb
* Gets all the course meetings saved in the plugin_bbb_meeting table
* @return array Array of current open meeting rooms
*/
- public function getMeetings($courseId = 0, $sessionId = 0, $groupId = 0)
+ public function getMeetings($courseId = 0, $sessionId = 0, $groupId = 0, $isAdminReport = false)
{
$em = Database::getManager();
$pass = $this->getUserMeetingPassword();
@@ -608,9 +628,6 @@ class bbb
$meetingBBB['add_to_calendar_url'] = $this->addToCalendarUrl($meetingDB);
}
- $recordArray = array();
- $actionLinksArray = array();
-
if ($meetingDB['record'] == 1) {
// backwards compatibility (when there was no remote ID)
$mId = $meetingDB['remote_id'];
@@ -628,149 +645,40 @@ class bbb
//To see the recording list in your BBB server do: bbb-record --list
$records = $this->api->getRecordingsWithXmlResponseArray($recordingParams);
+
+ if ($isAdminReport) {
+ $courseInfo = api_get_course_info_by_id($meetingDB['c_id']);
+ $this->forceCIdReq($courseInfo['code'], $meetingDB['session_id'], $meetingDB['group_id']);
+ }
+
+ $record = [];
+ $recordLink = get_lang('NoRecording');
+
if (!empty($records)) {
- $count = 1;
- if (isset($records['message']) && !empty($records['message'])) {
- if ($records['messageKey'] == 'noRecordings') {
- $recordArray[] = $this->plugin->get_lang('NoRecording');
- if ($meetingDB['visibility'] == 0) {
- $actionLinksArray[] = Display::url(
- Display::return_icon(
- 'invisible.png',
- $this->plugin->get_lang('MakeVisible'),
- array(),
- ICON_SIZE_MEDIUM
- ),
- $this->publishUrl($meetingDB)
- );
- } else {
- $actionLinksArray[] = Display::url(
- Display::return_icon(
- 'visible.png',
- $this->plugin->get_lang('MakeInvisible'),
- array(),
- ICON_SIZE_MEDIUM
- ),
- $this->unPublishUrl($meetingDB)
- );
- }
- }
- } else {
- foreach ($records as $record) {
- //if you get several recordings here and you used a
- // previous version of Chamilo, you might want to
- // only keep the last result for each chamilo conf
- // (see show_links after the end of this loop)
- if (is_array($record) && isset($record['recordId'])) {
- $url = Display::url(
- $this->plugin->get_lang('ViewRecord')." [~".$record['playbackFormatLength']."']",
- $record['playbackFormatUrl'],
- array('target' => '_blank')
- );
- $actionLinks = '';
- if ($this->isConferenceManager()) {
- if ($isGlobal === false) {
- $actionLinks .= Display::url(
- Display::return_icon(
- 'link.gif',
- $this->plugin->get_lang('CopyToLinkTool')
- ),
- $this->copyToRecordToLinkTool($meetingDB)
- );
- $actionLinks .= Display::url(
- Display::return_icon(
- 'agenda.png',
- $this->plugin->get_lang('AddToCalendar')
- ),
- $this->addToCalendarUrl($meetingDB, $record)
- );
- }
- $actionLinks .= Display::url(
- Display::return_icon(
- 'delete.png',
- $this->plugin->get_lang('Delete')
- ),
- $this->deleteRecordUrl($meetingDB)
- );
-
- if ($meetingDB['visibility'] == 0) {
- $actionLinks .= Display::url(
- Display::return_icon(
- 'invisible.png',
- $this->plugin->get_lang('MakeVisible'),
- array(),
- ICON_SIZE_MEDIUM
- ),
- $this->publishUrl($meetingDB)
- );
- } else {
- $actionLinks .= Display::url(
- Display::return_icon(
- 'visible.png',
- $this->plugin->get_lang('MakeInvisible'),
- array(),
- ICON_SIZE_MEDIUM
- ),
- $this->unPublishUrl($meetingDB)
- );
- }
- }
- $count++;
- $recordArray[] = $url;
- $actionLinksArray[] = $actionLinks;
- } else {
- /*if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) {
-
- //Fix the bbb timestamp
- //$record['startTime'] = substr($record['startTime'], 0, strlen($record['startTime']) -3);
- //$record['endTime'] = substr($record['endTime'], 0, strlen($record['endTime']) -3);
- //.' - '.api_convert_and_format_date($record['startTime']).' - '.api_convert_and_format_date($record['endTime'])
- foreach($record['playbacks'] as $item) {
- $url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank'));
- //$url .= Display::url(get_lang('DeleteRecord'), api_get_self().'?action=delete_record&'.$record['recordID']);
- if ($this->isConferenceManager()) {
- $url .= Display::url(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meetingDB['id'].'&record_id='.$record['recordID']);
- $url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meetingDB['id'].'&start='.api_strtotime($meetingDB['created_at']).'&url='.$item['url']);
- $url .= Display::url(Display::return_icon('delete.png',get_lang('Delete')), api_get_self().'?action=delete_record&id='.$record['recordID']);
- }
- //$url .= api_get_self().'?action=publish&id='.$record['recordID'];
- $count++;
- $recordArray[] = $url;
- }
- }*/
- }
+ if (!isset($records['messageKey']) || $records['messageKey'] != 'noRecordings') {
+ //if you get several recordings here and you used a
+ // previous version of Chamilo, you might want to
+ // only keep the last result for each chamilo conf
+ $record = end($records);
+ if (!is_array($record) || !isset($record['recordId'])) {
+ continue;
}
- }
- } else {
- $actionLinks = '';
- if ($this->isConferenceManager()) {
- if ($meetingDB['visibility'] == 0) {
- $actionLinks .= Display::url(
- Display::return_icon(
- 'invisible.png',
- $this->plugin->get_lang('MakeVisible'),
- array(),
- ICON_SIZE_MEDIUM
- ),
- $this->publishUrl($meetingDB)
- );
- } else {
- $actionLinks .= Display::url(
- Display::return_icon(
- 'visible.png',
- $this->plugin->get_lang('MakeInvisible'),
- array(),
- ICON_SIZE_MEDIUM
- ),
- $this->unPublishUrl($meetingDB)
- );
+
+ $recordLink = Display::url(
+ get_lang('ViewRecord')." [~".$record['playbackFormatLength']."']",
+ $record['playbackFormatUrl'],
+ array('target' => '_blank')
+ );
+
+ if (!$this->isConferenceManager()) {
+ $record = [];
}
}
- $actionLinksArray[] = $actionLinks;
- $item['action_links'] = implode('
', $actionLinksArray);
}
- $item['show_links'] = implode('
', $recordArray);
- $item['action_links'] = implode('
', $actionLinksArray);
+
+ $actionLinks = $this->getActionLinks($meetingDB, $record, $isGlobal, $isAdminReport);
+ $item['show_links'] = $recordLink;
+ $item['action_links'] = implode(PHP_EOL, $actionLinks);
}
$item['created_at'] = api_convert_and_format_date($meetingDB['created_at']);
@@ -1121,7 +1029,7 @@ class bbb
{
$courseInfo = api_get_course_info();
- if (empty($courseInfo)) {
+ if (empty($this->courseCode)) {
if ($this->isGlobalConferencePerUserEnabled()) {
@@ -1137,7 +1045,11 @@ class bbb
return '';
}
- return api_get_cidreq();
+ return http_build_query([
+ 'cidReq' => $this->courseCode,
+ 'id_session' => $this->sessionId,
+ 'gidReq' => $this->groupId
+ ]);
}
/**
@@ -1299,4 +1211,54 @@ class bbb
return $return;
}
+
+ private function getActionLinks($meetingInfo, $recordInfo, $isGlobal = false, $isAdminReport = false)
+ {
+ $isVisible = $meetingInfo['visibility'] != 0;
+ $linkVisibility = $isVisible
+ ? Display::url(
+ Display::return_icon('visible.png', get_lang('MakeInvisible')),
+ $this->unPublishUrl($meetingInfo)
+ )
+ : Display::url(
+ Display::return_icon('invisible.png', get_lang('MakeVisible')),
+ $this->publishUrl($meetingInfo)
+ );
+
+ $links = [];
+
+ if (empty($recordInfo)) {
+ $links[] = $linkVisibility;
+
+ return $links;
+ }
+
+ if (!$isGlobal) {
+ $links[] = Display::url(
+ Display::return_icon('link.gif', get_lang('CopyToLinkTool')),
+ $this->copyToRecordToLinkTool($meetingInfo)
+ );
+ $links[] = Display::url(
+ Display::return_icon('agenda.png', get_lang('AddToCalendar')),
+ $this->addToCalendarUrl($meetingInfo, $recordInfo)
+ );
+ }
+
+ $links[] = Display::url(
+ Display::return_icon('down.png', get_lang('DownloadFile')),
+ $recordInfo['playbackFormatUrl'] . '/capture.m4v',
+ ['target' => '_blank']
+ );
+
+ if (!$isAdminReport) {
+ $links[] = Display::url(
+ Display::return_icon('delete.png', get_lang('Delete')),
+ $this->deleteRecordUrl($meetingInfo)
+ );
+ }
+
+ $links[] = $linkVisibility;
+
+ return $links;
+ }
}
diff --git a/plugin/bbb/listing.php b/plugin/bbb/listing.php
index 55f0611fbe..440159fc55 100755
--- a/plugin/bbb/listing.php
+++ b/plugin/bbb/listing.php
@@ -186,5 +186,19 @@ $tpl->assign('form', $formToString);
$listing_tpl = 'bbb/listing.tpl';
$content = $tpl->fetch($listing_tpl);
+
+if (api_is_platform_admin()) {
+ $actionLinks = [
+ Display::toolbarButton(
+ $plugin->get_lang('AdminView'),
+ api_get_path(WEB_PLUGIN_PATH) . 'bbb/admin.php',
+ 'list',
+ 'primary'
+ )
+ ];
+
+ $tpl->assign('actions', implode(PHP_EOL, $actionLinks));
+}
+
$tpl->assign('content', $content);
$tpl->display_one_col_template();