Completed
Push — master ( 845ee1...5650b5 )
by Jesus
02:02
created
locallib.php 2 patches
Spacing   +98 added lines, -98 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
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     if (isset($meta)) {
83 83
         $log->meta = $meta;
84 84
     } else if ($event == BIGBLUEBUTTONBN_LOG_EVENT_CREATE) {
85
-        $log->meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
85
+        $log->meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
86 86
     }
87 87
 
88 88
     $DB->insert_record('bigbluebuttonbn_logs', $log);
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 
135 135
     if (!is_null($pname) && !is_null($purl)) {
136 136
         $method = BIGBLUEBUTTONBN_METHOD_POST;
137
-        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='" . $pname . "'><document url='".
138
-            $purl."' /></module></modules>";
137
+        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='" . $pname . "'><document url='" .
138
+            $purl . "' /></module></modules>";
139 139
     }
140 140
 
141 141
     $xml = bigbluebuttonbn_wrap_xml_load_file($createmeetingurl, $method, $data);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                                 'moderatorPW' => $meeting->moderatorPW,
181 181
                                 'attendeePW' => $meeting->attendeePW,
182 182
                                 'hasBeenForciblyEnded' => $meeting->hasBeenForciblyEnded,
183
-                                'running' => $meeting->running, );
183
+                                'running' => $meeting->running,);
184 184
         }
185 185
 
186 186
         return $meetings;
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         // Override imported flag with actual ID.
338 338
         $recording['imported'] = $recordimported->id;
339 339
         if (isset($recordimported->protected)) {
340
-            $recording['protected'] = (string) $recordimported->protected;
340
+            $recording['protected'] = (string)$recordimported->protected;
341 341
         }
342 342
         $recordsimportedarray[$recording['recordID']] = $recording;
343 343
     }
@@ -356,37 +356,37 @@  discard block
 block discarded – undo
356 356
 function bigbluebuttonbn_get_default_config_xml_array() {
357 357
     $defaultconfigxml = bigbluebuttonbn_getDefaultConfigXML();
358 358
 
359
-    return (array) $defaultconfigxml;
359
+    return (array)$defaultconfigxml;
360 360
 }
361 361
 
362 362
 function bigbluebuttonbn_get_recording_array_value($recording) {
363 363
     // Add formats.
364 364
     $playbackarray = array();
365 365
     foreach ($recording->playback->format as $format) {
366
-        $playbackarray[(string) $format->type] = array('type' => (string) $format->type,
367
-            'url' => (string) $format->url, 'length' => (string) $format->length);
366
+        $playbackarray[(string)$format->type] = array('type' => (string)$format->type,
367
+            'url' => (string)$format->url, 'length' => (string)$format->length);
368 368
         // Add preview per format when existing.
369 369
         if ($format->preview) {
370 370
             $imagesarray = array();
371 371
             foreach ($format->preview->images->image as $image) {
372
-                $imagearray = array('url' => (string) $image);
372
+                $imagearray = array('url' => (string)$image);
373 373
                 foreach ($image->attributes() as $attkey => $attvalue) {
374
-                    $imagearray[$attkey] = (string) $attvalue;
374
+                    $imagearray[$attkey] = (string)$attvalue;
375 375
                 }
376 376
                 array_push($imagesarray, $imagearray);
377 377
             }
378
-            $playbackarray[(string) $format->type]['preview'] = $imagesarray;
378
+            $playbackarray[(string)$format->type]['preview'] = $imagesarray;
379 379
         }
380 380
     }
381 381
 
382 382
     // Add the metadata to the recordings array.
383 383
     $metadataarray = bigbluebuttonbn_get_recording_array_meta(get_object_vars($recording->metadata));
384
-    $recordingarray = array('recordID' => (string) $recording->recordID,
385
-        'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name,
386
-        'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime,
387
-        'endTime' => (string) $recording->endTime, 'playbacks' => $playbackarray);
384
+    $recordingarray = array('recordID' => (string)$recording->recordID,
385
+        'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name,
386
+        'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime,
387
+        'endTime' => (string)$recording->endTime, 'playbacks' => $playbackarray);
388 388
     if (isset($recording->protected)) {
389
-        $recordingarray['protected'] = (string) $recording->protected;
389
+        $recordingarray['protected'] = (string)$recording->protected;
390 390
     }
391 391
     return $recordingarray + $metadataarray;
392 392
 }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         if (is_object($value)) {
398 398
             $value = '';
399 399
         }
400
-        $metadataarray['meta_'.$key] = $value;
400
+        $metadataarray['meta_' . $key] = $value;
401 401
     }
402 402
     return $metadataarray;
403 403
 }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     $ids = explode(',', $recordids);
456 456
     foreach ($ids as $id) {
457 457
         $xml = bigbluebuttonbn_wrap_xml_load_file(
458
-            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
458
+            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array)$params)
459 459
           );
460 460
         if ($xml && $xml->returncode != 'SUCCESS') {
461 461
             return false;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             return $xml;
533 533
         } catch (Exception $e) {
534 534
             libxml_use_internal_errors($previous);
535
-            $error = 'Caught exception: '.$e->getMessage();
535
+            $error = 'Caught exception: ' . $e->getMessage();
536 536
             debugging($error, DEBUG_DEVELOPER);
537 537
             return null;
538 538
         }
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
         $response = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
545 545
         return $response;
546 546
     } catch (Exception $e) {
547
-        $error = 'Caught exception: '.$e->getMessage();
547
+        $error = 'Caught exception: ' . $e->getMessage();
548 548
         debugging($error, DEBUG_DEVELOPER);
549 549
         libxml_use_internal_errors($previous);
550 550
         return null;
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 
563 563
         $options = array();
564 564
         $options['CURLOPT_HTTPHEADER'] = array(
565
-                 'Content-Type: '.$contenttype,
566
-                 'Content-Length: '.strlen($data),
565
+                 'Content-Type: ' . $contenttype,
566
+                 'Content-Length: ' . strlen($data),
567 567
                  'Content-Language: en-US',
568 568
                );
569 569
 
@@ -580,9 +580,9 @@  discard block
 block discarded – undo
580 580
     if ($userroles) {
581 581
         $where = '';
582 582
         foreach ($userroles as $value) {
583
-            $where .= (empty($where) ? ' WHERE' : ' AND').' id='.$value->roleid;
583
+            $where .= (empty($where) ? ' WHERE' : ' AND') . ' id=' . $value->roleid;
584 584
         }
585
-        $userroles = $DB->get_records_sql('SELECT * FROM {role}'.$where);
585
+        $userroles = $DB->get_records_sql('SELECT * FROM {role}' . $where);
586 586
     }
587 587
 
588 588
     return $userroles;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 }
596 596
 
597 597
 function bigbluebuttonbn_get_users(context $context = null) {
598
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
598
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
599 599
     foreach ($users as $key => $value) {
600 600
         $users[$key] = fullname($value);
601 601
     }
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 }
604 604
 
605 605
 function bigbluebuttonbn_get_users_select(context $context = null) {
606
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
606
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
607 607
     foreach ($users as $key => $value) {
608 608
         $users[$key] = array('id' => $value->id, 'name' => fullname($value));
609 609
     }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 }
612 612
 
613 613
 function bigbluebuttonbn_get_roles(context $context = null) {
614
-    $roles = (array) role_get_names($context);
614
+    $roles = (array)role_get_names($context);
615 615
     foreach ($roles as $key => $value) {
616 616
         $roles[$key] = $value->localname;
617 617
     }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 }
620 620
 
621 621
 function bigbluebuttonbn_get_roles_select(context $context = null) {
622
-    $roles = (array) role_get_names($context);
622
+    $roles = (array)role_get_names($context);
623 623
     foreach ($roles as $key => $value) {
624 624
         $roles[$key] = array('id' => $value->id, 'name' => $value->localname);
625 625
     }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 }
628 628
 
629 629
 function bigbluebuttonbn_get_role($id) {
630
-    $roles = (array) role_get_names();
630
+    $roles = (array)role_get_names();
631 631
     if (is_numeric($id)) {
632 632
         return (object)$roles[$id];
633 633
     }
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
         return array();
682 682
     }
683 683
     foreach ($rules as $key => $rule) {
684
-        if ( $rule['selectiontype'] !== 'role' || is_numeric($rule['selectionid']) ) {
684
+        if ($rule['selectiontype'] !== 'role' || is_numeric($rule['selectionid'])) {
685 685
             continue;
686 686
         }
687 687
         $role = bigbluebuttonbn_get_role($rule['selectionid']);
688
-        if ( $role == null ) {
688
+        if ($role == null) {
689 689
             unset($rules[$key]);
690 690
             continue;
691 691
         }
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
     if (empty($userroles)) {
751 751
         $userroles = get_user_roles($context, $userid, true);
752 752
     }
753
-    return bigbluebuttonbn_is_moderator_validator($participantlist, $userid , $userroles);
753
+    return bigbluebuttonbn_is_moderator_validator($participantlist, $userid, $userroles);
754 754
 }
755 755
 
756
-function bigbluebuttonbn_is_moderator_validator($participantlist, $userid , $userroles) {
756
+function bigbluebuttonbn_is_moderator_validator($participantlist, $userid, $userroles) {
757 757
     // Iterate participant rules.
758 758
     foreach ($participantlist as $participant) {
759 759
         if (bigbluebuttonbn_is_moderator_validate_rule($participant, $userid, $userroles)) {
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
     $isunique = true;
799 799
     if ($voicebridge != 0) {
800 800
         $table = 'bigbluebuttonbn';
801
-        $select = 'voicebridge = '.$voicebridge;
801
+        $select = 'voicebridge = ' . $voicebridge;
802 802
         if ($id) {
803
-            $select .= ' AND id <> '.$id;
803
+            $select .= ' AND id <> ' . $id;
804 804
         }
805 805
         if ($DB->get_records_select($table, $select)) {
806 806
             $isunique = false;
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 function bigbluebuttonbn_generate_nonce() {
862 862
     $mt = microtime();
863 863
     $rand = mt_rand();
864
-    return md5($mt.$rand);
864
+    return md5($mt . $rand);
865 865
 }
866 866
 
867 867
 function bigbluebuttonbn_random_password($length = 8) {
@@ -872,41 +872,41 @@  discard block
 block discarded – undo
872 872
 
873 873
 function bigbluebuttonbn_events() {
874 874
     return array(
875
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
876
-        (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
877
-        (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
878
-        (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
879
-        (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
880
-        (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
881
-        (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
882
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
883
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
884
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
885
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
886
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
887
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
888
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
889
-        (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
875
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
876
+        (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
877
+        (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
878
+        (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
879
+        (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
880
+        (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
881
+        (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
882
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
883
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
884
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
885
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
886
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
887
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
888
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
889
+        (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
890 890
     );
891 891
 }
892 892
 
893 893
 function bigbluebuttonbn_events_action() {
894 894
     return array(
895
-        'view' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
896
-        'view_management' => (string) BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
897
-        'live_action' => (string) BIGBLUEBUTTON_EVENT_LIVE_SESSION,
898
-        'meeting_create' => (string) BIGBLUEBUTTON_EVENT_MEETING_CREATED,
899
-        'meeting_end' => (string) BIGBLUEBUTTON_EVENT_MEETING_ENDED,
900
-        'meeting_join' => (string) BIGBLUEBUTTON_EVENT_MEETING_JOINED,
901
-        'meeting_left' => (string) BIGBLUEBUTTON_EVENT_MEETING_LEFT,
902
-        'recording_delete' => (string) BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
903
-        'recording_import' => (string) BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
904
-        'recording_protect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
905
-        'recording_publish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
906
-        'recording_unprotect' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
907
-        'recording_unpublish' => (string) BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
908
-        'recording_edit' => (string) BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
909
-        'recording_play' => (string) BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
895
+        'view' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED,
896
+        'view_management' => (string)BIGBLUEBUTTON_EVENT_ACTIVITY_MANAGEMENT_VIEWED,
897
+        'live_action' => (string)BIGBLUEBUTTON_EVENT_LIVE_SESSION,
898
+        'meeting_create' => (string)BIGBLUEBUTTON_EVENT_MEETING_CREATED,
899
+        'meeting_end' => (string)BIGBLUEBUTTON_EVENT_MEETING_ENDED,
900
+        'meeting_join' => (string)BIGBLUEBUTTON_EVENT_MEETING_JOINED,
901
+        'meeting_left' => (string)BIGBLUEBUTTON_EVENT_MEETING_LEFT,
902
+        'recording_delete' => (string)BIGBLUEBUTTON_EVENT_RECORDING_DELETED,
903
+        'recording_import' => (string)BIGBLUEBUTTON_EVENT_RECORDING_IMPORTED,
904
+        'recording_protect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PROTECTED,
905
+        'recording_publish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_PUBLISHED,
906
+        'recording_unprotect' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPROTECTED,
907
+        'recording_unpublish' => (string)BIGBLUEBUTTON_EVENT_RECORDING_UNPUBLISHED,
908
+        'recording_edit' => (string)BIGBLUEBUTTON_EVENT_RECORDING_EDITED,
909
+        'recording_play' => (string)BIGBLUEBUTTON_EVENT_RECORDING_VIEWED
910 910
     );
911 911
 }
912 912
 
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
     if (array_key_exists('other', $options)) {
928 928
         $eventproperties['other'] = $options['other'];
929 929
     }
930
-    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_'.$eventtype.'::create',
930
+    $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_' . $eventtype . '::create',
931 931
       array($eventproperties));
932 932
     $event->trigger();
933 933
 }
@@ -968,10 +968,10 @@  discard block
 block discarded – undo
968 968
     $now = time();
969 969
     if (!$forced && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
970 970
         // Use the value in the cache.
971
-        return (array) json_decode($result['meeting_info']);
971
+        return (array)json_decode($result['meeting_info']);
972 972
     }
973 973
     // Ping again and refresh the cache.
974
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
974
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
975 975
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
976 976
       );
977 977
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1046,8 +1046,8 @@  discard block
 block discarded – undo
1046 1046
  * @param string $configxml
1047 1047
  */
1048 1048
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml) {
1049
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1050
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1049
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1050
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . \mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1051 1051
     return $configxmlparams;
1052 1052
 }
1053 1053
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
  * @param string $configxml
1057 1057
  */
1058 1058
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1059
-    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
1059
+    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url') . 'api/setConfigXML?';
1060 1060
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1061 1061
     $xml = bigbluebuttonbn_wrap_xml_load_file($urldefaultconfig, BIGBLUEBUTTONBN_METHOD_POST,
1062 1062
         $configxmlparams, 'application/x-www-form-urlencoded');
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
  */
1070 1070
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml) {
1071 1071
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1072
-    $configxmlarray = (array) $configxml;
1072
+    $configxmlarray = (array)$configxml;
1073 1073
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1074 1074
         debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1075 1075
         return '';
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
     global $USER;
1120 1120
     $starttime = $starttime - ($starttime % 1000);
1121 1121
     // Set formatted date.
1122
-    $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1122
+    $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1123 1123
     return userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1124 1124
 }
1125 1125
 
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 function bigbluebuttonbn_get_recording_data_row_actionbar($recording, $tools) {
1136 1136
     $actionbar = '';
1137 1137
     foreach ($tools as $tool) {
1138
-        if ( $tool == 'protect' && !isset($recording['protected']) ) {
1138
+        if ($tool == 'protect' && !isset($recording['protected'])) {
1139 1139
             continue;
1140 1140
         }
1141 1141
         $buttonpayload = bigbluebuttonbn_get_recording_data_row_actionbar_payload($recording, $tool);
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
         $visibility = 'hidden ';
1180 1180
     }
1181 1181
     $recordingpreview = html_writer::start_tag('div',
1182
-        array('id' => 'preview-'.$recording['recordID'], $visibility => $visibility));
1182
+        array('id' => 'preview-' . $recording['recordID'], $visibility => $visibility));
1183 1183
     foreach ($recording['playbacks'] as $playback) {
1184 1184
         if (isset($playback['preview'])) {
1185 1185
             foreach ($playback['preview'] as $image) {
@@ -1207,13 +1207,13 @@  discard block
 block discarded – undo
1207 1207
     if ($recording['published'] === 'false') {
1208 1208
         $visibility = 'hidden ';
1209 1209
     }
1210
-    $id = 'playbacks-'.$recording['recordID'];
1210
+    $id = 'playbacks-' . $recording['recordID'];
1211 1211
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1212 1212
           'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1213 1213
           'title' => $title, $visibility => $visibility));
1214 1214
     foreach ($recording['playbacks'] as $playback) {
1215 1215
         $recordingtypes .= bigbluebuttonbn_get_recording_data_row_type($recording, $bigbluebuttonbnid,
1216
-            $playback).'&#32;';
1216
+            $playback) . '&#32;';
1217 1217
     }
1218 1218
     $recordingtypes .= html_writer::end_tag('div');
1219 1219
     return $recordingtypes;
@@ -1221,12 +1221,12 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
 function bigbluebuttonbn_get_recording_data_row_type($recording, $bigbluebuttonbnid, $playback) {
1223 1223
     global $CFG, $OUTPUT;
1224
-    $title = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1224
+    $title = get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn');
1225 1225
     $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_play(this);';
1226
-    $href = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn='.$bigbluebuttonbnid.
1227
-      '&mid='.$recording['meetingID'].'&rid='.$recording['recordID'].'&rtype='.$playback['type'];
1226
+    $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn=' . $bigbluebuttonbnid .
1227
+      '&mid=' . $recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1228 1228
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1229
-        $href .= '&href='.urlencode($playback['url']);
1229
+        $href .= '&href=' . urlencode($playback['url']);
1230 1230
     }
1231 1231
     $linkattributes = array('title' => $title,
1232 1232
         'class' => 'btn btn-sm btn-default', 'onclick' => $onclick,
@@ -1314,11 +1314,11 @@  discard block
 block discarded – undo
1314 1314
         $target .= '-' . $data['target'];
1315 1315
     }
1316 1316
     $id = 'recording-' . $target . '-' . $recording['recordID'];
1317
-    $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_'.$data['action'].'(this);';
1317
+    $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_' . $data['action'] . '(this);';
1318 1318
     if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('recording_icons_enabled')) {
1319 1319
         // With icon for $manageaction.
1320 1320
         $iconattributes = array('id' => $id, 'class' => 'iconsmall');
1321
-        $icon = new pix_icon('i/'.$data['tag'],
1321
+        $icon = new pix_icon('i/' . $data['tag'],
1322 1322
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1323 1323
             'moodle', $iconattributes);
1324 1324
         $linkattributes = array(
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
     if (isset($recordings) && !array_key_exists('messageKey', $recordings)) {
1410 1410
         // There are recordings for this meeting.
1411 1411
         foreach ($recordings as $recording) {
1412
-            if ( !bigbluebuttonbn_include_recording_table_row($bbbsession, $recording) ) {
1412
+            if (!bigbluebuttonbn_include_recording_table_row($bbbsession, $recording)) {
1413 1413
                 continue;
1414 1414
             }
1415 1415
             bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $tools, $table);
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
     }
1428 1428
 
1429 1429
     $row = new html_table_row();
1430
-    $row->id = 'recording-td-'.$recording['recordID'];
1430
+    $row->id = 'recording-td-' . $recording['recordID'];
1431 1431
     $row->attributes['data-imported'] = 'false';
1432 1432
     $texthead = '';
1433 1433
     $texttail = '';
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 }
1452 1452
 
1453 1453
 function bigbluebuttonbn_include_recording_table_row($bbbsession, $recording) {
1454
-    if ( isset($recording['imported']) || !isset($bbbsession['group']) || $recording['meetingID'] == $bbbsession['meetingid'] ) {
1454
+    if (isset($recording['imported']) || !isset($bbbsession['group']) || $recording['meetingID'] == $bbbsession['meetingid']) {
1455 1455
         return true;
1456 1456
     }
1457 1457
     return false;
@@ -1466,9 +1466,9 @@  discard block
 block discarded – undo
1466 1466
     // Build the message_body.
1467 1467
     $msg->activity_type = '';
1468 1468
     $msg->activity_title = $bigbluebuttonbn->name;
1469
-    $messagetext = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').' '.
1470
-        $msg->activity_type.' &quot;'.$msg->activity_title.'&quot; '.
1471
-        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1469
+    $messagetext = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') . ' ' .
1470
+        $msg->activity_type . ' &quot;' . $msg->activity_title . '&quot; ' .
1471
+        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1472 1472
 
1473 1473
     bigbluebuttonbn_send_notification($sender, $bigbluebuttonbn, $messagetext);
1474 1474
 }
@@ -1566,15 +1566,15 @@  discard block
 block discarded – undo
1566 1566
 
1567 1567
 function bigbluebuttonbn_get_recordings_sql_selectdeleted($courseid, $bigbluebuttonbnid = null, $subset = true) {
1568 1568
     if ($bigbluebuttonbnid === null) {
1569
-        return "courseid = '{$courseid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_DELETE.
1569
+        return "courseid = '{$courseid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_DELETE .
1570 1570
             "' AND meta like '%has_recordings%' AND meta like '%true%'";
1571 1571
     }
1572 1572
     if ($subset) {
1573
-        return "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '".BIGBLUEBUTTONBN_LOG_EVENT_DELETE.
1573
+        return "bigbluebuttonbnid = '{$bigbluebuttonbnid}' AND log = '" . BIGBLUEBUTTONBN_LOG_EVENT_DELETE .
1574 1574
             "' AND meta like '%has_recordings%' AND meta like '%true%'";
1575 1575
     }
1576
-    return "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '".
1577
-        BIGBLUEBUTTONBN_LOG_EVENT_DELETE."' AND meta like '%has_recordings%' AND meta like '%true%'";
1576
+    return "courseid = '{$courseid}' AND bigbluebuttonbnid <> '{$bigbluebuttonbnid}' AND log = '" .
1577
+        BIGBLUEBUTTONBN_LOG_EVENT_DELETE . "' AND meta like '%has_recordings%' AND meta like '%true%'";
1578 1578
 }
1579 1579
 
1580 1580
 function bigbluebuttonbn_get_allrecordings($courseid, $bigbluebuttonbnid = null, $subset = true,
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
 
1624 1624
     // Prepare select for loading records based on existent bigbluebuttonbns.
1625 1625
     $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
1626
-    $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
1626
+    $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
1627 1627
     // Include only Create events and exclude those with record not true.
1628 1628
     $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
1629 1629
     // Execute select for loading records based on existent bigbluebuttonbns.
@@ -1707,8 +1707,8 @@  discard block
 block discarded – undo
1707 1707
 function bigbluebuttonbn_format_activity_time($time) {
1708 1708
     $activitytime = '';
1709 1709
     if ($time) {
1710
-        $activitytime = calendar_day_representation($time).' '.
1711
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
1710
+        $activitytime = calendar_day_representation($time) . ' ' .
1711
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
1712 1712
           calendar_time_representation($time);
1713 1713
     }
1714 1714
 
Please login to merge, or discard this patch.
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
  */
99 99
 function bigbluebuttonbn_get_join_url($meetingid, $username, $pw, $logouturl, $configtoken = null, $userid = null) {
100 100
     $data = ['meetingID' => $meetingid,
101
-              'fullName' => $username,
102
-              'password' => $pw,
103
-              'logoutURL' => $logouturl,
101
+                'fullName' => $username,
102
+                'password' => $pw,
103
+                'logoutURL' => $logouturl,
104 104
             ];
105 105
 
106 106
     if (!is_null($configtoken)) {
@@ -193,24 +193,24 @@  discard block
 block discarded – undo
193 193
 function bigbluebuttonbn_get_meeting_info_array($meetingid) {
194 194
     $xml = bigbluebuttonbn_wrap_xml_load_file(
195 195
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
196
-      );
196
+        );
197 197
 
198 198
     if ($xml && $xml->returncode == 'SUCCESS' && empty($xml->messageKey)) {
199 199
         // Meeting info was returned.
200 200
         return array('returncode' => $xml->returncode,
201
-                     'meetingID' => $xml->meetingID,
202
-                     'moderatorPW' => $xml->moderatorPW,
203
-                     'attendeePW' => $xml->attendeePW,
204
-                     'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
205
-                     'running' => $xml->running,
206
-                     'recording' => $xml->recording,
207
-                     'startTime' => $xml->startTime,
208
-                     'endTime' => $xml->endTime,
209
-                     'participantCount' => $xml->participantCount,
210
-                     'moderatorCount' => $xml->moderatorCount,
211
-                     'attendees' => $xml->attendees,
212
-                     'metadata' => $xml->metadata,
213
-                   );
201
+                        'meetingID' => $xml->meetingID,
202
+                        'moderatorPW' => $xml->moderatorPW,
203
+                        'attendeePW' => $xml->attendeePW,
204
+                        'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
205
+                        'running' => $xml->running,
206
+                        'recording' => $xml->recording,
207
+                        'startTime' => $xml->startTime,
208
+                        'endTime' => $xml->endTime,
209
+                        'participantCount' => $xml->participantCount,
210
+                        'moderatorCount' => $xml->moderatorCount,
211
+                        'attendees' => $xml->attendees,
212
+                        'metadata' => $xml->metadata,
213
+                    );
214 214
     }
215 215
 
216 216
     if ($xml) {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         // Do getRecordings is executed using a method GET (supported by all versions of BBB).
275 275
         $xml = bigbluebuttonbn_wrap_xml_load_file(
276 276
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getRecordings', ['meetingID' => implode(',', $mids)])
277
-          );
277
+            );
278 278
         if ($xml && $xml->returncode == 'SUCCESS' && isset($xml->recordings)) {
279 279
             // If there were meetings already created.
280 280
             foreach ($xml->recordings->recording as $recording) {
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 function bigbluebuttonbn_get_default_config_xml() {
341 341
     $xml = bigbluebuttonbn_wrap_xml_load_file(
342 342
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getDefaultConfigXML')
343
-      );
343
+        );
344 344
 
345 345
     return $xml;
346 346
 }
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     foreach ($ids as $id) {
413 413
         $xml = bigbluebuttonbn_wrap_xml_load_file(
414 414
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('deleteRecordings', ['recordID' => $id])
415
-          );
415
+            );
416 416
         if ($xml && $xml->returncode != 'SUCCESS') {
417 417
             return false;
418 418
         }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     foreach ($ids as $id) {
431 431
         $xml = bigbluebuttonbn_wrap_xml_load_file(
432 432
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('publishRecordings', ['recordID' => $id, 'publish' => $publish])
433
-          );
433
+            );
434 434
         if ($xml && $xml->returncode != 'SUCCESS') {
435 435
             return false;
436 436
         }
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     foreach ($ids as $id) {
449 449
         $xml = bigbluebuttonbn_wrap_xml_load_file(
450 450
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
451
-          );
451
+            );
452 452
         if ($xml && $xml->returncode != 'SUCCESS') {
453 453
             return false;
454 454
         }
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 function bigbluebuttonbn_end_meeting($meetingid, $modpw) {
465 465
     $xml = bigbluebuttonbn_wrap_xml_load_file(
466 466
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('end', ['meetingID' => $meetingid, 'password' => $modpw])
467
-      );
467
+        );
468 468
 
469 469
     if ($xml) {
470 470
         // If the xml packet returned failure it displays the message to the user.
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 function bigbluebuttonbn_is_meeting_running($meetingid) {
482 482
     $xml = bigbluebuttonbn_wrap_xml_load_file(
483 483
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('isMeetingRunning', ['meetingID' => $meetingid])
484
-      );
484
+        );
485 485
 
486 486
     if ($xml && $xml->returncode == 'SUCCESS') {
487 487
         return ($xml->running == 'true');
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 function bigbluebuttonbn_get_server_version() {
494 494
     $xml = bigbluebuttonbn_wrap_xml_load_file(
495 495
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url()
496
-      );
496
+        );
497 497
 
498 498
     if ($xml && $xml->returncode == 'SUCCESS') {
499 499
         return $xml->version;
@@ -554,10 +554,10 @@  discard block
 block discarded – undo
554 554
 
555 555
         $options = array();
556 556
         $options['CURLOPT_HTTPHEADER'] = array(
557
-                 'Content-Type: '.$contenttype,
558
-                 'Content-Length: '.strlen($data),
559
-                 'Content-Language: en-US',
560
-               );
557
+                    'Content-Type: '.$contenttype,
558
+                    'Content-Length: '.strlen($data),
559
+                    'Content-Language: en-US',
560
+                );
561 561
 
562 562
         return $c->post($url, $data, $options);
563 563
     }
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
 
633 633
 function bigbluebuttonbn_role_unknown() {
634 634
     return array(
635
-              "id" => "0",
636
-              "name" => "",
637
-              "shortname" => "unknown",
638
-              "description" => "",
639
-              "sortorder" => "0",
640
-              "archetype" => "guest",
641
-              "localname" => "Unknown"
635
+                "id" => "0",
636
+                "name" => "",
637
+                "shortname" => "unknown",
638
+                "description" => "",
639
+                "sortorder" => "0",
640
+                "archetype" => "guest",
641
+                "localname" => "Unknown"
642 642
             );
643 643
 }
644 644
 
@@ -647,16 +647,16 @@  discard block
 block discarded – undo
647 647
         'all' => array(
648 648
             'name' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
649 649
             'children' => []
650
-          )
651
-      );
650
+            )
651
+        );
652 652
     $data['role'] = array(
653 653
         'name' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
654 654
         'children' => bigbluebuttonbn_get_roles_select($context)
655
-      );
655
+        );
656 656
     $data['user'] = array(
657 657
         'name' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
658 658
         'children' => bigbluebuttonbn_get_users_select($context)
659
-      );
659
+        );
660 660
     return $data;
661 661
 }
662 662
 
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
             continue;
707 707
         }
708 708
         $participantlistarray[] = array(
709
-              'selectiontype' => 'role',
710
-              'selectionid' => $moderatordefault,
711
-              'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR);
709
+                'selectiontype' => 'role',
710
+                'selectionid' => $moderatordefault,
711
+                'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR);
712 712
     }
713 713
     return $participantlistarray;
714 714
 }
@@ -719,11 +719,11 @@  discard block
 block discarded – undo
719 719
             'all' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
720 720
             'role' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
721 721
             'user' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
722
-          ],
722
+            ],
723 723
         'type_selected' => 'all',
724 724
         'options' => ['all' => '---------------'],
725 725
         'selected' => 'all',
726
-      ];
726
+        ];
727 727
 }
728 728
 
729 729
 function bigbluebuttonbn_is_moderator($context, $participants, $userid = null, $userroles = null) {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
         $eventproperties['other'] = $options['other'];
917 917
     }
918 918
     $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_'.$eventtype.'::create',
919
-      array($eventproperties));
919
+        array($eventproperties));
920 920
     $event->trigger();
921 921
 }
922 922
 
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
     // Ping again and refresh the cache.
962 962
     $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
963 963
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
964
-      );
964
+        );
965 965
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
966 966
     return $meetinginfo;
967 967
 }
@@ -1197,8 +1197,8 @@  discard block
 block discarded – undo
1197 1197
     }
1198 1198
     $id = 'playbacks-'.$recording['recordID'];
1199 1199
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1200
-          'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1201
-          'title' => $title, $visibility => $visibility));
1200
+            'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1201
+            'title' => $title, $visibility => $visibility));
1202 1202
     foreach ($recording['playbacks'] as $playback) {
1203 1203
         $recordingtypes .= bigbluebuttonbn_get_recording_data_row_type($recording, $bigbluebuttonbnid,
1204 1204
             $playback).'&#32;';
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
     $title = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1213 1213
     $onclick = 'M.mod_bigbluebuttonbn.recordings.recording_play(this);';
1214 1214
     $href = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=playback&bn='.$bigbluebuttonbnid.
1215
-      '&mid='.$recording['meetingID'].'&rid='.$recording['recordID'].'&rtype='.$playback['type'];
1215
+        '&mid='.$recording['meetingID'].'&rid='.$recording['recordID'].'&rtype='.$playback['type'];
1216 1216
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1217 1217
         $href .= '&href='.urlencode($playback['url']);
1218 1218
     }
@@ -1314,7 +1314,7 @@  discard block
 block discarded – undo
1314 1314
             'onclick' => $onclick,
1315 1315
             'data-action' => $data['action'],
1316 1316
             'data-links' => bigbluebuttonbn_get_count_recording_imported_instances($recording['recordID'])
1317
-          );
1317
+            );
1318 1318
         return $OUTPUT->action_icon('#', $icon, null, $linkattributes, false);
1319 1319
     }
1320 1320
 
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
         $texthead . $rowdata->activity . $texttail, $texthead . $rowdata->description . $texttail,
1432 1432
         $rowdata->preview, $texthead . $rowdata->date_formatted . $texttail,
1433 1433
         $rowdata->duration_formatted
1434
-      );
1434
+        );
1435 1435
     if ($bbbsession['managerecordings']) {
1436 1436
         $row->cells[] = $rowdata->actionbar;
1437 1437
     }
@@ -1696,8 +1696,8 @@  discard block
 block discarded – undo
1696 1696
     $activitytime = '';
1697 1697
     if ($time) {
1698 1698
         $activitytime = calendar_day_representation($time).' '.
1699
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
1700
-          calendar_time_representation($time);
1699
+            get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
1700
+            calendar_time_representation($time);
1701 1701
     }
1702 1702
 
1703 1703
     return $activitytime;
Please login to merge, or discard this patch.