Completed
Push — master ( 58f2f2...86fc5a )
by Jesus
02:20
created
locallib.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 global $CFG;
29 29
 
30
-require_once(dirname(__FILE__).'/lib.php');
30
+require_once(dirname(__FILE__) . '/lib.php');
31 31
 
32 32
 const BIGBLUEBUTTONBN_FORCED = true;
33 33
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     if (isset($meta)) {
77 77
         $log->meta = $meta;
78 78
     } else if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) {
79
-        $log->meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
79
+        $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
80 80
     }
81 81
 
82 82
     $DB->insert_record('bigbluebuttonbn_logs', $log);
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 
122 122
     if (!is_null($pname) && !is_null($purl)) {
123 123
         $method = BIGBLUEBUTTONBN_METHOD_POST;
124
-        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='" . $pname . "'><document url='".
125
-            $purl."' /></module></modules>";
124
+        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='" . $pname . "'><document url='" .
125
+            $purl . "' /></module></modules>";
126 126
     }
127 127
 
128 128
     $xml = bigbluebuttonbn_wrap_xml_load_file($createmeetingurl, $method, $data);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                                 'moderatorPW' => $meeting->moderatorPW,
168 168
                                 'attendeePW' => $meeting->attendeePW,
169 169
                                 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded,
170
-                                'running' => $meeting->running, );
170
+                                'running' => $meeting->running,);
171 171
         }
172 172
 
173 173
         return $meetings;
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
 function bigbluebuttonbn_get_recordings_imported_array($courseid, $bigbluebuttonbnid = null, $subset = true) {
309 309
     global $DB;
310 310
 
311
-    $select = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '".
312
-        BIGBLUEBUTTONBN_LOG_EVENT_IMPORT."'";
311
+    $select = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '" .
312
+        BIGBLUEBUTTONBN_LOG_EVENT_IMPORT . "'";
313 313
     if ($bigbluebuttonbnid === null) {
314
-        $select = "courseid = '{$courseid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_IMPORT."'";
314
+        $select = "courseid = '{$courseid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_IMPORT . "'";
315 315
     } else if ($subset) {
316
-        $select = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_IMPORT."'";
316
+        $select = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_IMPORT . "'";
317 317
     }
318 318
     $recordsimported = $DB->get_records_select('bigbluebuttonbn_logs', $select);
319 319
 
@@ -340,37 +340,37 @@  discard block
 block discarded – undo
340 340
 function bigbluebuttonbn_get_default_config_xml_array() {
341 341
     $defaultconfigxml = bigbluebuttonbn_getDefaultConfigXML();
342 342
 
343
-    return (array) $defaultconfigxml;
343
+    return (array)$defaultconfigxml;
344 344
 }
345 345
 
346 346
 function bigbluebuttonbn_get_recording_array_value($recording) {
347 347
     // Add formats.
348 348
     $playbackarray = array();
349 349
     foreach ($recording->playback->format as $format) {
350
-        $playbackarray[(string) $format->type] = array('type' => (string) $format->type,
351
-            'url' => (string) $format->url, 'length' => (string) $format->length);
350
+        $playbackarray[(string)$format->type] = array('type' => (string)$format->type,
351
+            'url' => (string)$format->url, 'length' => (string)$format->length);
352 352
         // Add preview per format when existing.
353 353
         if ($format->preview) {
354 354
             $imagesarray = array();
355 355
             foreach ($format->preview->images->image as $image) {
356
-                $imagearray = array('url' => (string) $image);
356
+                $imagearray = array('url' => (string)$image);
357 357
                 foreach ($image->attributes() as $attkey => $attvalue) {
358
-                    $imagearray[$attkey] = (string) $attvalue;
358
+                    $imagearray[$attkey] = (string)$attvalue;
359 359
                 }
360 360
                 array_push($imagesarray, $imagearray);
361 361
             }
362
-            $playbackarray[(string) $format->type]['preview'] = $imagesarray;
362
+            $playbackarray[(string)$format->type]['preview'] = $imagesarray;
363 363
         }
364 364
     }
365 365
 
366 366
     // Add the metadata to the recordings array.
367 367
     $metadataarray = bigbluebuttonbn_get_recording_array_meta(get_object_vars($recording->metadata));
368
-    $recordingarray = array('recordID' => (string) $recording->recordID,
369
-        'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name,
370
-        'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime,
371
-        'endTime' => (string) $recording->endTime, 'playbacks' => $playbackarray);
368
+    $recordingarray = array('recordID' => (string)$recording->recordID,
369
+        'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name,
370
+        'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime,
371
+        'endTime' => (string)$recording->endTime, 'playbacks' => $playbackarray);
372 372
     if (isset($recording->protected)) {
373
-        $recordingarray['protected'] = (string) $recording->protected;
373
+        $recordingarray['protected'] = (string)$recording->protected;
374 374
     }
375 375
     // Force protected.
376 376
     $recordingarray['protected'] = 'false';
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         if (is_object($value)) {
384 384
             $value = '';
385 385
         }
386
-        $metadataarray['meta_'.$key] = $value;
386
+        $metadataarray['meta_' . $key] = $value;
387 387
     }
388 388
     return $metadataarray;
389 389
 }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     $ids = explode(',', $recordids);
442 442
     foreach ($ids as $id) {
443 443
         $xml = bigbluebuttonbn_wrap_xml_load_file(
444
-            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
444
+            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array)$params)
445 445
           );
446 446
         if ($xml && $xml->returncode != 'SUCCESS') {
447 447
             return false;
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
             return $xml;
562 562
         } catch (Exception $e) {
563 563
             libxml_use_internal_errors($previous);
564
-            $error = 'Caught exception: '.$e->getMessage();
564
+            $error = 'Caught exception: ' . $e->getMessage();
565 565
             debugging($error, DEBUG_DEVELOPER);
566 566
             return null;
567 567
         }
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
         $response = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
574 574
         return $response;
575 575
     } catch (Exception $e) {
576
-        $error = 'Caught exception: '.$e->getMessage();
576
+        $error = 'Caught exception: ' . $e->getMessage();
577 577
         debugging($error, DEBUG_DEVELOPER);
578 578
         libxml_use_internal_errors($previous);
579 579
         return null;
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 
592 592
         $options = array();
593 593
         $options['CURLOPT_HTTPHEADER'] = array(
594
-                 'Content-Type: '.$contenttype,
595
-                 'Content-Length: '.strlen($data),
594
+                 'Content-Type: ' . $contenttype,
595
+                 'Content-Length: ' . strlen($data),
596 596
                  'Content-Language: en-US',
597 597
                );
598 598
 
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
     if ($userroles) {
610 610
         $where = '';
611 611
         foreach ($userroles as $value) {
612
-            $where .= (empty($where) ? ' WHERE' : ' AND').' id='.$value->roleid;
612
+            $where .= (empty($where) ? ' WHERE' : ' AND') . ' id=' . $value->roleid;
613 613
         }
614
-        $userroles = $DB->get_records_sql('SELECT * FROM {role}'.$where);
614
+        $userroles = $DB->get_records_sql('SELECT * FROM {role}' . $where);
615 615
     }
616 616
 
617 617
     return $userroles;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 }
625 625
 
626 626
 function bigbluebuttonbn_get_users(context $context = null) {
627
-    $users = (array) get_enrolled_users($context,'',0,'u.*',null,0,0,true);
627
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
628 628
     foreach ($users as $key => $value) {
629 629
         $users[$key] = fullname($value);
630 630
     }
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 }
633 633
 
634 634
 function bigbluebuttonbn_get_users_select(context $context = null) {
635
-    $users = (array) get_enrolled_users($context,'',0,'u.*',null,0,0,true);
635
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
636 636
     foreach ($users as $key => $value) {
637 637
         $users[$key] = array('id' => $value->id, 'name' => fullname($value));
638 638
     }
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 }
641 641
 
642 642
 function bigbluebuttonbn_get_roles(context $context = null) {
643
-    $roles = (array) role_get_names($context);
643
+    $roles = (array)role_get_names($context);
644 644
     foreach ($roles as $key => $value) {
645 645
         $roles[$key] = $value->localname;
646 646
     }
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 }
649 649
 
650 650
 function bigbluebuttonbn_get_roles_select(context $context = null) {
651
-    $roles = (array) role_get_names($context);
651
+    $roles = (array)role_get_names($context);
652 652
     foreach ($roles as $key => $value) {
653 653
         $roles[$key] = array('id' => $value->id, 'name' => $value->localname);
654 654
     }
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 }
657 657
 
658 658
 function bigbluebuttonbn_get_role($id) {
659
-    $roles = (array) role_get_names();
659
+    $roles = (array)role_get_names();
660 660
     if (is_numeric($id)) {
661 661
         return (object)$roles[$id];
662 662
     }
@@ -704,12 +704,12 @@  discard block
 block discarded – undo
704 704
 function bigbluebuttonbn_get_participant_rules_encoded($bigbluebuttonbn) {
705 705
     $rules = json_decode($bigbluebuttonbn->participants, true);
706 706
     foreach ($rules as $key => $rule) {
707
-        if ( $rule['selectiontype'] !== 'role' || is_numeric($rule['selectionid']) ) {
707
+        if ($rule['selectiontype'] !== 'role' || is_numeric($rule['selectionid'])) {
708 708
             continue;
709 709
         }
710 710
 
711 711
         $role = bigbluebuttonbn_get_role($rule['selectionid']);
712
-        if ( $role == null ) {
712
+        if ($role == null) {
713 713
             unset($rules[$key]);
714 714
             continue;
715 715
         }
@@ -831,9 +831,9 @@  discard block
 block discarded – undo
831 831
     $isunique = true;
832 832
     if ($voicebridge != 0) {
833 833
         $table = 'bigbluebuttonbn';
834
-        $select = 'voicebridge = '.$voicebridge;
834
+        $select = 'voicebridge = ' . $voicebridge;
835 835
         if ($id) {
836
-            $select .= ' AND id <> '.$id;
836
+            $select .= ' AND id <> ' . $id;
837 837
         }
838 838
         if ($DB->get_records_select($table, $select)) {
839 839
             $isunique = false;
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
     $mt = microtime();
902 902
     $rand = mt_rand();
903 903
 
904
-    return md5($mt.$rand);
904
+    return md5($mt . $rand);
905 905
 }
906 906
 
907 907
 function bigbluebuttonbn_random_password($length = 8) {
@@ -913,41 +913,41 @@  discard block
 block discarded – undo
913 913
 
914 914
 function bigbluebuttonbn_events() {
915 915
     return array(
916
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
917
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
918
-        (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
919
-        (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
920
-        (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
921
-        (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
922
-        (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
923
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
924
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
925
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
926
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
927
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
928
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
929
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
930
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
916
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
917
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
918
+        (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
919
+        (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
920
+        (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
921
+        (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
922
+        (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
923
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
924
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
925
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
926
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
927
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
928
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
929
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
930
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
931 931
     );
932 932
 }
933 933
 
934 934
 function bigbluebuttonbn_events_action() {
935 935
     return array(
936
-        'view' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
937
-        'view_management' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
938
-        'live_action' => (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
939
-        'meeting_create' => (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
940
-        'meeting_end' => (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
941
-        'meeting_join' => (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
942
-        'meeting_left' => (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
943
-        'recording_delete' => (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
944
-        'recording_import' => (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
945
-        'recording_protect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
946
-        'recording_publish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
947
-        'recording_unprotect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
948
-        'recording_unpublish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
949
-        'recording_edit' => (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
950
-        'recording_play' => (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
936
+        'view' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
937
+        'view_management' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
938
+        'live_action' => (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
939
+        'meeting_create' => (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
940
+        'meeting_end' => (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
941
+        'meeting_join' => (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
942
+        'meeting_left' => (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
943
+        'recording_delete' => (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
944
+        'recording_import' => (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
945
+        'recording_protect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
946
+        'recording_publish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
947
+        'recording_unprotect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
948
+        'recording_unpublish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
949
+        'recording_edit' => (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
950
+        'recording_play' => (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
951 951
     );
952 952
 }
953 953
 
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
         $eventproperties['other'] = $options['other'];
972 972
     }
973 973
 
974
-    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_'.$eventtype.'::create',
974
+    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_' . $eventtype . '::create',
975 975
       array($eventproperties));
976 976
     $event->trigger();
977 977
 }
@@ -1014,11 +1014,11 @@  discard block
 block discarded – undo
1014 1014
     $now = time();
1015 1015
     if (!$forced && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
1016 1016
         // Use the value in the cache.
1017
-        return (array) json_decode($result['meeting_info']);
1017
+        return (array)json_decode($result['meeting_info']);
1018 1018
     }
1019 1019
 
1020 1020
     // Ping again and refresh the cache.
1021
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1021
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
1022 1022
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1023 1023
       );
1024 1024
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1076,8 +1076,8 @@  discard block
 block discarded – undo
1076 1076
  * @param string $configxml
1077 1077
  */
1078 1078
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml) {
1079
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1080
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1079
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1080
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . \mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1081 1081
 
1082 1082
     return $configxmlparams;
1083 1083
 }
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
  * @param string $configxml
1088 1088
  */
1089 1089
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1090
-    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
1090
+    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url') . 'api/setConfigXML?';
1091 1091
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1092 1092
     $xml = bigbluebuttonbn_wrap_xml_load_file($urldefaultconfig, BIGBLUEBUTTONBN_METHOD_POST,
1093 1093
         $configxmlparams, 'application/x-www-form-urlencoded');
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
  */
1102 1102
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml) {
1103 1103
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1104
-    $configxmlarray = (array) $configxml;
1104
+    $configxmlarray = (array)$configxml;
1105 1105
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1106 1106
         debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1107 1107
         return '';
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
         $starttime = $starttime - ($starttime % 1000);
1139 1139
 
1140 1140
         // Set formatted date.
1141
-        $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1141
+        $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1142 1142
         $row->date_formatted = userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1143 1143
 
1144 1144
         // Set formatted duration.
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
     }
1210 1210
 
1211 1211
     $recordingpreview = html_writer::start_tag('div',
1212
-        array('id' => 'preview-'.$recording['recordID'], $visibility => $visibility));
1212
+        array('id' => 'preview-' . $recording['recordID'], $visibility => $visibility));
1213 1213
     foreach ($recording['playbacks'] as $playback) {
1214 1214
         if (isset($playback['preview'])) {
1215 1215
             foreach ($playback['preview'] as $image) {
@@ -1242,19 +1242,19 @@  discard block
 block discarded – undo
1242 1242
         $visibility = 'hidden ';
1243 1243
     }
1244 1244
 
1245
-    $id = 'playbacks-'.$recording['recordID'];
1245
+    $id = 'playbacks-' . $recording['recordID'];
1246 1246
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1247 1247
           'data-recordingid' => $recording['recordID'], 'data-meetingid' => $recording['meetingID'],
1248 1248
           'title' => $title, $visibility => $visibility));
1249 1249
     foreach ($recording['playbacks'] as $playback) {
1250 1250
         $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_play(this);';
1251
-        $href = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn='.$bigbluebuttonbnid.
1252
-            '&href='.urlencode($playback['url']).'&rid='.$recording['recordID'];
1253
-        $linkattributes = array('title' => get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn'),
1251
+        $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn=' . $bigbluebuttonbnid .
1252
+            '&href=' . urlencode($playback['url']) . '&rid=' . $recording['recordID'];
1253
+        $linkattributes = array('title' => get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'),
1254 1254
             'class' => 'btn btn-sm btn-default', 'onclick' => $onclick,
1255 1255
             'data-action' => 'play', 'data-href' => $href);
1256
-        $recordingtypes .= $OUTPUT->action_link('#', get_string('view_recording_format_'.$playback['type'],
1257
-            'bigbluebuttonbn'), null, $linkattributes).'&#32;';
1256
+        $recordingtypes .= $OUTPUT->action_link('#', get_string('view_recording_format_' . $playback['type'],
1257
+            'bigbluebuttonbn'), null, $linkattributes) . '&#32;';
1258 1258
     }
1259 1259
     $recordingtypes .= html_writer::end_tag('div');
1260 1260
 
@@ -1339,11 +1339,11 @@  discard block
 block discarded – undo
1339 1339
         $target .= '-' . $data['target'];
1340 1340
     }
1341 1341
     $id = 'recording-' . $target . '-' . $recording['recordID'];
1342
-    $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_'.$data['action'].'(this);';
1342
+    $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_' . $data['action'] . '(this);';
1343 1343
     if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('recording_icons_enabled')) {
1344 1344
         // With icon for $manageaction.
1345 1345
         $iconattributes = array('id' => $id, 'class' => 'iconsmall');
1346
-        $icon = new pix_icon('i/'.$data['tag'],
1346
+        $icon = new pix_icon('i/' . $data['tag'],
1347 1347
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1348 1348
             'moodle', $iconattributes);
1349 1349
         $linkattributes = array(
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
     if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {
1434 1434
         // There are recordings for this meeting.
1435 1435
         foreach ($recordings as $recording) {
1436
-            if ( !bigbluebuttonbn_include_recording_table_row($bbbsession, $recording) ) {
1436
+            if (!bigbluebuttonbn_include_recording_table_row($bbbsession, $recording)) {
1437 1437
                 continue;
1438 1438
             }
1439 1439
             bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $tools, $table);
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 
1446 1446
 function bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $tools, &$table) {
1447 1447
     $row = new html_table_row();
1448
-    $row->id = 'recording-td-'.$recording['recordID'];
1448
+    $row->id = 'recording-td-' . $recording['recordID'];
1449 1449
     $row->attributes['data-imported'] = 'false';
1450 1450
     $texthead = '';
1451 1451
     $texttail = '';
@@ -1459,9 +1459,9 @@  discard block
 block discarded – undo
1459 1459
     $rowdata = bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools);
1460 1460
     if ($rowdata != null) {
1461 1461
         $rowdata->date_formatted = str_replace(' ', '&nbsp;', $rowdata->date_formatted);
1462
-        $row->cells = array($texthead.$rowdata->recording.$texttail,
1463
-            $texthead.$rowdata->activity.$texttail, $texthead.$rowdata->description.$texttail,
1464
-            $rowdata->preview, $texthead.$rowdata->date_formatted.$texttail,
1462
+        $row->cells = array($texthead . $rowdata->recording . $texttail,
1463
+            $texthead . $rowdata->activity . $texttail, $texthead . $rowdata->description . $texttail,
1464
+            $rowdata->preview, $texthead . $rowdata->date_formatted . $texttail,
1465 1465
             $rowdata->duration_formatted);
1466 1466
         if ($bbbsession['managerecordings']) {
1467 1467
             $row->cells[] = $rowdata->actionbar;
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 }
1472 1472
 
1473 1473
 function bigbluebuttonbn_include_recording_table_row($bbbsession, $recording) {
1474
-    return !( !isset($recording['imported']) && isset($bbbsession['group']) && $recording['meetingID'] != $bbbsession['meetingid'] );
1474
+    return !(!isset($recording['imported']) && isset($bbbsession['group']) && $recording['meetingID'] != $bbbsession['meetingid']);
1475 1475
 }
1476 1476
 
1477 1477
 function bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn) {
@@ -1483,9 +1483,9 @@  discard block
 block discarded – undo
1483 1483
     // Build the message_body.
1484 1484
     $msg->activity_type = '';
1485 1485
     $msg->activity_title = $bigbluebuttonbn->name;
1486
-    $messagetext = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.
1487
-        $msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.
1488
-        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1486
+    $messagetext = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' .
1487
+        $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' .
1488
+        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1489 1489
 
1490 1490
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $messagetext);
1491 1491
 }
@@ -1578,15 +1578,15 @@  discard block
 block discarded – undo
1578 1578
 
1579 1579
     // Gather the bigbluebuttonbnids whose meetingids should be included in the getRecordings request'.
1580 1580
     $select = "id <> '{$bigbluebuttonbnid}' AND course = '{$courseid}'";
1581
-    $selectdeleted = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '".
1582
-        BIGBLUEBUTTONBN_LOG_EVENT_DELETE."' AND meta like '%has_recordings%' AND meta like '%true%'";
1581
+    $selectdeleted = "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '" .
1582
+        BIGBLUEBUTTONBN_LOG_EVENT_DELETE . "' AND meta like '%has_recordings%' AND meta like '%true%'";
1583 1583
     if ($bigbluebuttonbnid === null) {
1584 1584
         $select = "course = '{$courseid}'";
1585
-        $selectdeleted = "courseid = '{$courseid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_DELETE.
1585
+        $selectdeleted = "courseid = '{$courseid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_DELETE .
1586 1586
             "' AND meta like '%has_recordings%' AND meta like '%true%'";
1587 1587
     } else if ($subset) {
1588 1588
         $select = "id = '{$bigbluebuttonbnid}'";
1589
-        $selectdeleted = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_DELETE.
1589
+        $selectdeleted = "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_DELETE .
1590 1590
             "' AND meta like '%has_recordings%' AND meta like '%true%'";
1591 1591
     }
1592 1592
     $bigbluebuttonbns = $DB->get_records_select_menu('bigbluebuttonbn', $select, null, 'id', 'id, meetingid');
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
     if (!empty($bigbluebuttonbns)) {
1609 1609
         // Prepare select for loading records based on existent bigbluebuttonbns.
1610 1610
         $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
1611
-        $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
1611
+        $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
1612 1612
         // Include only Create events and exclude those with record not true.
1613 1613
         $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
1614 1614
         // Execute select for loading records based on existent bigbluebuttonbns.
@@ -1700,8 +1700,8 @@  discard block
 block discarded – undo
1700 1700
 function bigbluebuttonbn_format_activity_time($time) {
1701 1701
     $activitytime = '';
1702 1702
     if ($time) {
1703
-        $activitytime = calendar_day_representation($time).' '.
1704
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
1703
+        $activitytime = calendar_day_representation($time) . ' ' .
1704
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
1705 1705
           calendar_time_representation($time);
1706 1706
     }
1707 1707
 
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
 function bigbluebuttonbn_get_moderator_email($context) {
1729 1729
     $moderatoremails = array();
1730
-    $users = (array) get_enrolled_users($context,'',0,'u.*',null,0,0,true);
1730
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
1731 1731
     $counter = 0;
1732 1732
     foreach ($users as $key => $user) {
1733 1733
         if ($counter == 5) {
Please login to merge, or discard this patch.