Skip to content

Commit a7f47b2

Browse files
committed
Plugins: BBB: reimplement showing multiple recordings format from C1 - refs BT#23194
1 parent c61e61f commit a7f47b2

3 files changed

Lines changed: 54 additions & 8 deletions

File tree

public/plugin/Bbb/lib/bbb.lib.php

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,12 +1248,17 @@ public function getMeetings(
12481248
$recordings = $this->api->getRecordingsWithXmlResponseArray(['meetingId' => $meeting->getRemoteId()]);
12491249
if (!empty($recordings) && (!isset($recordings['messageKey']) || $recordings['messageKey'] !== 'noRecordings')) {
12501250
$record = end($recordings);
1251-
if (isset($record['playbackFormatUrl'])) {
1252-
$recordLink = Display::url(
1253-
$this->plugin->get_lang('ViewRecord'),
1254-
$record['playbackFormatUrl'],
1255-
['target' => '_blank', 'class' => 'btn btn--plain']
1256-
);
1251+
if (isset($record['playbackFormat'])) {
1252+
$recordLink = array();
1253+
foreach ($record['playbackFormat'] as $format) {
1254+
$this->insertMeetingFormat(intval($meeting->getId()), $format->type->__toString(), $format->url->__toString());
1255+
$recordLink['record'][] = 1;
1256+
$recordLink[] = Display::url(
1257+
$this->plugin->get_lang($format->type->__toString()),
1258+
$format->url->__toString(),
1259+
['target' => '_blank', 'class' => 'btn btn--plain']
1260+
);
1261+
}
12571262
$this->updateMeetingVideoUrl($meeting->getId(), $record['playbackFormatUrl']);
12581263
}
12591264
}
@@ -1286,6 +1291,39 @@ public function getMeetings(
12861291

12871292
return $result;
12881293
}
1294+
1295+
/**
1296+
* @param int $meetingId
1297+
* @param string $formatType
1298+
* @param string $resourceUrl
1299+
*
1300+
* @return bool|int
1301+
*/
1302+
public function insertMeetingFormat(int $meetingId, string $formatType, string $resourceUrl)
1303+
{
1304+
$em = Database::getManager();
1305+
$sm = $em->getConnection()->getSchemaManager();
1306+
if ($sm->tablesExist('conference_recording')) {
1307+
$params = [
1308+
'format_type = ? and meeting_id = ? and resource_url = ?' => [$formatType, $meetingId, $resourceUrl],
1309+
];
1310+
$result = Database::select(
1311+
'id',
1312+
'conference_recording',
1313+
['where' => $params]
1314+
);
1315+
if (empty($result)) {
1316+
return Database::insert(
1317+
'conference_recording',
1318+
[
1319+
'format_type' => $formatType,
1320+
'resource_url' => $resourceUrl,
1321+
'meeting_id' => $meetingId
1322+
]
1323+
);
1324+
}
1325+
}
1326+
}
12891327

12901328
private function convertMeetingToArray(ConferenceMeeting $meeting): array
12911329
{

public/plugin/Bbb/lib/bbb_api.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,17 @@ public function getRecordingsWithXmlResponseArray(array $p): array
358358

359359
if (isset($xml->recordings->recording)) {
360360
foreach ($xml->recordings->recording as $rec) {
361+
foreach ($rec->playback->format as $format) {
362+
$formats[] = $format;
363+
}
361364
$out[] = [
362365
'recordId' => (string) $rec->recordID,
363366
'meetingId' => (string) $rec->meetingID,
364367
'name' => (string) $rec->name,
365368
'published' => (string) $rec->published,
366369
'startTime' => (string) $rec->startTime,
367370
'endTime' => (string) $rec->endTime,
371+
'playbackFormat' => $formats,
368372
'playbackFormatType' => (string) $rec->playback->format->type,
369373
'playbackFormatUrl' => (string) $rec->playback->format->url,
370374
'playbackFormatLength' => (string) $rec->playback->format->length,

public/plugin/Bbb/view/listing.tpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,12 @@
110110
{% endif %}
111111
</td>
112112
<td class="px-4 py-2">
113-
{% if meeting.record == 1 %}
114-
{{ meeting.show_links }}
113+
{% if meeting.show_links.record %}
114+
{% for link in meeting.show_links %}
115+
{% if link is not iterable %}
116+
{{ link }}
117+
{% endif %}
118+
{% endfor %}
115119
{% else %}
116120
<span class="text-gray-400">{{ 'NoRecording'|get_plugin_lang('BBBPlugin') }}</span>
117121
{% endif %}

0 commit comments

Comments
 (0)