Skip to content

Commit 55d2cc7

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents 6aa7346 + e871e55 commit 55d2cc7

5 files changed

Lines changed: 65 additions & 11 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 %}

src/CoreBundle/Entity/AccessUrl.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#[ApiResource(
2727
normalizationContext: [
2828
'groups' => ['access_url:read'],
29-
'swagger_definition_name' => 'Read',
3029
],
3130
denormalizationContext: [
3231
'groups' => ['access_url:write', 'course_category:write'],

src/CoreBundle/Entity/CourseCategory.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
1111
use ApiPlatform\Metadata\ApiFilter;
1212
use ApiPlatform\Metadata\ApiResource;
13+
use ApiPlatform\Metadata\Delete;
14+
use ApiPlatform\Metadata\Get;
1315
use ApiPlatform\Metadata\GetCollection;
1416
use ApiPlatform\Metadata\Link;
17+
use ApiPlatform\Metadata\Patch;
18+
use ApiPlatform\Metadata\Post;
1519
use ApiPlatform\Serializer\Filter\PropertyFilter;
1620
use Chamilo\CoreBundle\Repository\CourseCategoryRepository;
1721
use Doctrine\Common\Collections\ArrayCollection;
@@ -23,14 +27,19 @@
2327
use Symfony\Component\Validator\Constraints as Assert;
2428

2529
#[ApiResource(
30+
operations: [
31+
new Get(),
32+
new GetCollection(),
33+
new Post(security: "is_granted('ROLE_ADMIN')"),
34+
new Delete(security: "is_granted('ROLE_ADMIN')"),
35+
new Patch(security: "is_granted('ROLE_ADMIN')"),
36+
],
2637
normalizationContext: [
2738
'groups' => ['course_category:read', 'course:read'],
28-
'swagger_definition_name' => 'Read',
2939
],
3040
denormalizationContext: [
3141
'groups' => ['course_category:write', 'course:write'],
3242
],
33-
security: "is_granted('ROLE_ADMIN')"
3443
)]
3544
#[ORM\Table(name: 'course_category')]
3645
#[ORM\Index(columns: ['parent_id'], name: 'parent_id')]

0 commit comments

Comments
 (0)