@@ -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 {
0 commit comments