Completed
Pull Request — v2.2-stable (#330)
by Jesus
02:19
created
locallib.php 2 patches
Doc Comments   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
  * Helper function to retrieve imported recordings from the Moodle database.
277 277
  * The references are stored as events in bigbluebuttonbn_logs.
278 278
  *
279
- * @param string $courseid
279
+ * @param integer $courseid
280 280
  * @param string $bigbluebuttonbnid
281 281
  * @param bool   $subset
282 282
  *
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 /**
305 305
  * Helper function to retrive the default config.xml file.
306 306
  *
307
- * @return string
307
+ * @return null|SimpleXMLElement
308 308
  */
309 309
 function bigbluebuttonbn_get_default_config_xml() {
310 310
     $xml = bigbluebuttonbn_wrap_xml_load_file(
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
  * @param object $a
387 387
  * @param object $b
388 388
  *
389
- * @return array
389
+ * @return integer
390 390
  */
391 391
 function bigbluebuttonbn_recording_build_sorter($a, $b) {
392 392
     if ($a['startTime'] < $b['startTime']) {
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
  * @param string $data
498 498
  * @param string $contenttype
499 499
  *
500
- * @return object
500
+ * @return null|SimpleXMLElement
501 501
  */
502 502
 function bigbluebuttonbn_wrap_xml_load_file($url, $method = 'GET', $data = null, $contenttype = 'text/xml') {
503 503
     if (extension_loaded('curl')) {
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
  * @param string $data
539 539
  * @param string $contenttype
540 540
  *
541
- * @return object
541
+ * @return string
542 542
  */
543 543
 function bigbluebuttonbn_wrap_xml_load_file_curl_request($url, $method = 'GET', $data = null, $contenttype = 'text/xml') {
544 544
     $c = new curl();
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
  * @param integer $instance
912 912
  * @param integer $voicebridge
913 913
  *
914
- * @return string
914
+ * @return boolean
915 915
  */
916 916
 function bigbluebuttonbn_voicebridge_unique($instance, $voicebridge) {
917 917
     global $DB;
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 /**
1015 1015
  * Helper returns an array with all possible bigbluebuttonbn events.
1016 1016
  *
1017
- * @return array
1017
+ * @return string[]
1018 1018
  */
1019 1019
 function bigbluebuttonbn_events() {
1020 1020
     return array(
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
  * @param string $meetingid
1121 1121
  * @param boolean $updatecache
1122 1122
  *
1123
- * @return array
1123
+ * @return string
1124 1124
  */
1125 1125
 function bigbluebuttonbn_get_meeting_info($meetingid, $updatecache = false) {
1126 1126
     $cachettl = (int)\mod_bigbluebuttonbn\locallib\config::get('waitformoderator_cache_ttl');
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
  * @param string $meetingid
1241 1241
  * @param string $configxml
1242 1242
  *
1243
- * @return object
1243
+ * @return null|SimpleXMLElement
1244 1244
  */
1245 1245
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1246 1246
     $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
  * @param array $recording
1290 1290
  * @param array $tools
1291 1291
  *
1292
- * @return array
1292
+ * @return null|stdClass
1293 1293
  */
1294 1294
 function bigbluebuttonbn_get_recording_data_row($bbbsession, $recording, $tools = ['protect', 'publish', 'delete']) {
1295 1295
     if (!bigbluebuttonbn_include_recording_table_row($bbbsession, $recording)) {
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
  *
1854 1854
  * @param array $bbbsession
1855 1855
  * @param array $recording
1856
- * @param object $rowdata
1856
+ * @param stdClass $rowdata
1857 1857
  *
1858 1858
  * @return object
1859 1859
  */
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
  * Helper function to define the sql used for gattering the bigbluebuttonbnids whose meetingids should be included
2049 2049
  * in the getRecordings request considering only those that belong to deleted activities.
2050 2050
  *
2051
- * @param string $courseid
2051
+ * @param integer $courseid
2052 2052
  * @param string $bigbluebuttonbnid
2053 2053
  * @param bool   $subset
2054 2054
  *
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
  * Helper function to define the sql used for gattering the bigbluebuttonbnids whose meetingids should be included
2073 2073
  * in the getRecordings request considering only those that belong to imported recordings.
2074 2074
  *
2075
- * @param string $courseid
2075
+ * @param integer $courseid
2076 2076
  * @param string $bigbluebuttonbnid
2077 2077
  * @param bool   $subset
2078 2078
  *
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 /**
2096 2096
  * Helper function to get recordings  and imported recordings together.
2097 2097
  *
2098
- * @param string $courseid
2098
+ * @param integer $courseid
2099 2099
  * @param string $bigbluebuttonbnid
2100 2100
  * @param bool   $subset
2101 2101
  * @param bool   $includedeleted
@@ -2113,7 +2113,7 @@  discard block
 block discarded – undo
2113 2113
  * Helper function to retrieve recordings from the BigBlueButton. The references are stored as events
2114 2114
  * in bigbluebuttonbn_logs.
2115 2115
  *
2116
- * @param string $courseid
2116
+ * @param integer $courseid
2117 2117
  * @param string $bigbluebuttonbnid
2118 2118
  * @param bool   $subset
2119 2119
  * @param bool   $includedeleted
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 function bigbluebuttonbn_get_join_url($meetingid, $username, $pw, $logouturl, $configtoken = null,
96 96
             $userid = null, $clienttype = BIGBLUEBUTTON_CLIENTTYPE_FLASH, $createtime = null) {
97 97
     $data = ['meetingID' => $meetingid,
98
-              'fullName' => $username,
99
-              'password' => $pw,
100
-              'logoutURL' => $logouturl,
98
+                'fullName' => $username,
99
+                'password' => $pw,
100
+                'logoutURL' => $logouturl,
101 101
             ];
102 102
     // Choose between Adobe Flash or HTML5 Client.
103 103
     if ( $clienttype == BIGBLUEBUTTON_CLIENTTYPE_HTML5 ) {
@@ -157,23 +157,23 @@  discard block
 block discarded – undo
157 157
 function bigbluebuttonbn_get_meeting_info_array($meetingid) {
158 158
     $xml = bigbluebuttonbn_wrap_xml_load_file(
159 159
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
160
-      );
160
+        );
161 161
     if ($xml && $xml->returncode == 'SUCCESS' && empty($xml->messageKey)) {
162 162
         // Meeting info was returned.
163 163
         return array('returncode' => $xml->returncode,
164
-                     'meetingID' => $xml->meetingID,
165
-                     'moderatorPW' => $xml->moderatorPW,
166
-                     'attendeePW' => $xml->attendeePW,
167
-                     'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
168
-                     'running' => $xml->running,
169
-                     'recording' => $xml->recording,
170
-                     'startTime' => $xml->startTime,
171
-                     'endTime' => $xml->endTime,
172
-                     'participantCount' => $xml->participantCount,
173
-                     'moderatorCount' => $xml->moderatorCount,
174
-                     'attendees' => $xml->attendees,
175
-                     'metadata' => $xml->metadata,
176
-                   );
164
+                        'meetingID' => $xml->meetingID,
165
+                        'moderatorPW' => $xml->moderatorPW,
166
+                        'attendeePW' => $xml->attendeePW,
167
+                        'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded,
168
+                        'running' => $xml->running,
169
+                        'recording' => $xml->recording,
170
+                        'startTime' => $xml->startTime,
171
+                        'endTime' => $xml->endTime,
172
+                        'participantCount' => $xml->participantCount,
173
+                        'moderatorCount' => $xml->moderatorCount,
174
+                        'attendees' => $xml->attendees,
175
+                        'metadata' => $xml->metadata,
176
+                    );
177 177
     }
178 178
     if ($xml) {
179 179
         // Either failure or success without meeting info.
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 function bigbluebuttonbn_get_default_config_xml() {
310 310
     $xml = bigbluebuttonbn_wrap_xml_load_file(
311 311
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getDefaultConfigXML')
312
-      );
312
+        );
313 313
     return $xml;
314 314
 }
315 315
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
     foreach ($ids as $id) {
411 411
         $xml = bigbluebuttonbn_wrap_xml_load_file(
412 412
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('deleteRecordings', ['recordID' => $id])
413
-          );
413
+            );
414 414
         if ($xml && $xml->returncode != 'SUCCESS') {
415 415
             return false;
416 416
         }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
     foreach ($ids as $id) {
430 430
         $xml = bigbluebuttonbn_wrap_xml_load_file(
431 431
             \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('publishRecordings', ['recordID' => $id, 'publish' => $publish])
432
-          );
432
+            );
433 433
         if ($xml && $xml->returncode != 'SUCCESS') {
434 434
             return false;
435 435
         }
@@ -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
         }
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 function bigbluebuttonbn_end_meeting($meetingid, $modpw) {
466 466
     $xml = bigbluebuttonbn_wrap_xml_load_file(
467 467
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('end', ['meetingID' => $meetingid, 'password' => $modpw])
468
-      );
468
+        );
469 469
     if ($xml) {
470 470
         // If the xml packet returned failure it displays the message to the user.
471 471
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 function bigbluebuttonbn_get_server_version() {
483 483
     $xml = bigbluebuttonbn_wrap_xml_load_file(
484 484
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url()
485
-      );
485
+        );
486 486
     if ($xml && $xml->returncode == 'SUCCESS') {
487 487
         return $xml->version;
488 488
     }
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
         }
550 550
         $options = array();
551 551
         $options['CURLOPT_HTTPHEADER'] = array(
552
-                 'Content-Type: '.$contenttype,
553
-                 'Content-Length: '.strlen($data),
554
-                 'Content-Language: en-US',
555
-               );
552
+                    'Content-Type: '.$contenttype,
553
+                    'Content-Length: '.strlen($data),
554
+                    'Content-Language: en-US',
555
+                );
556 556
 
557 557
         return $c->post($url, $data, $options);
558 558
     }
@@ -699,16 +699,16 @@  discard block
 block discarded – undo
699 699
         'all' => array(
700 700
             'name' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
701 701
             'children' => []
702
-          )
703
-      );
702
+            )
703
+        );
704 704
     $data['role'] = array(
705 705
         'name' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
706 706
         'children' => bigbluebuttonbn_get_roles_select($context)
707
-      );
707
+        );
708 708
     $data['user'] = array(
709 709
         'name' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
710 710
         'children' => bigbluebuttonbn_get_users_select($context)
711
-      );
711
+        );
712 712
     return $data;
713 713
 }
714 714
 
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
         'selectiontype' => 'all',
752 752
         'selectionid' => 'all',
753 753
         'role' => BIGBLUEBUTTONBN_ROLE_VIEWER
754
-      );
754
+        );
755 755
     $defaultrules = explode(',', \mod_bigbluebuttonbn\locallib\config::get('participant_moderator_default'));
756 756
     foreach ($defaultrules as $defaultrule) {
757 757
         if ($defaultrule == '0') {
@@ -764,9 +764,9 @@  discard block
 block discarded – undo
764 764
             continue;
765 765
         }
766 766
         $participantlist[] = array(
767
-              'selectiontype' => 'role',
768
-              'selectionid' => $defaultrule,
769
-              'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR);
767
+                'selectiontype' => 'role',
768
+                'selectionid' => $defaultrule,
769
+                'role' => BIGBLUEBUTTONBN_ROLE_MODERATOR);
770 770
     }
771 771
     return $participantlist;
772 772
 }
@@ -805,11 +805,11 @@  discard block
 block discarded – undo
805 805
             'all' => get_string('mod_form_field_participant_list_type_all', 'bigbluebuttonbn'),
806 806
             'role' => get_string('mod_form_field_participant_list_type_role', 'bigbluebuttonbn'),
807 807
             'user' => get_string('mod_form_field_participant_list_type_user', 'bigbluebuttonbn'),
808
-          ],
808
+            ],
809 809
         'type_selected' => 'all',
810 810
         'options' => ['all' => '---------------'],
811 811
         'selected' => 'all',
812
-      ];
812
+        ];
813 813
 }
814 814
 
815 815
 /**
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
         $eventproperties['other'] = $options['other'];
1091 1091
     }
1092 1092
     $event = call_user_func_array('\mod_bigbluebuttonbn\event\bigbluebuttonbn_'.$eventtype.'::create',
1093
-      array($eventproperties));
1093
+        array($eventproperties));
1094 1094
     $event->trigger();
1095 1095
 }
1096 1096
 
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
     // Ping again and refresh the cache.
1135 1135
     $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1136 1136
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1137
-      );
1137
+        );
1138 1138
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
1139 1139
     return $meetinginfo;
1140 1140
 }
@@ -1546,8 +1546,8 @@  discard block
 block discarded – undo
1546 1546
     }
1547 1547
     $id = 'playbacks-'.$recording['recordID'];
1548 1548
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1549
-          'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1550
-          'title' => $title, $visibility => $visibility));
1549
+            'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1550
+            'title' => $title, $visibility => $visibility));
1551 1551
     foreach ($recording['playbacks'] as $playback) {
1552 1552
         $recordingtypes .= bigbluebuttonbn_get_recording_data_row_type($recording, $bbbsession, $playback);
1553 1553
     }
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
     }
1572 1572
     $text = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1573 1573
     $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=play&bn=' . $bbbsession['bigbluebuttonbn']->id .
1574
-      '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1574
+        '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1575 1575
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1576 1576
         $href .= '&href='.urlencode(trim($playback['url']));
1577 1577
     }
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
         'data-action' => 'play',
1583 1583
         'data-target' => $playback['type'],
1584 1584
         'data-href' => $href,
1585
-      );
1585
+        );
1586 1586
     if (!bigbluebuttonbn_is_bn_server() && !bigbluebuttonbn_is_valid_resource(trim($playback['url']))) {
1587 1587
         $linkattributes['class'] = 'btn btn-sm btn-warning';
1588 1588
         $linkattributes['title'] = get_string('view_recording_format_errror_unreachable', 'bigbluebuttonbn');
@@ -1732,10 +1732,10 @@  discard block
 block discarded – undo
1732 1732
             'id' => $id,
1733 1733
             'onclick' => $onclick,
1734 1734
             'data-action' => $data['action']
1735
-          );
1735
+            );
1736 1736
         if (!isset($recording['imported'])) {
1737 1737
             $linkattributes['data-links'] = bigbluebuttonbn_count_recording_imported_instances(
1738
-              $recording['recordID']);
1738
+                $recording['recordID']);
1739 1739
         }
1740 1740
         if (isset($data['disabled'])) {
1741 1741
             $iconattributes['class'] .= ' fa-' . $data['disabled'];
@@ -2294,8 +2294,8 @@  discard block
 block discarded – undo
2294 2294
     $activitytime = '';
2295 2295
     if ($time) {
2296 2296
         $activitytime = calendar_day_representation($time).' '.
2297
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2298
-          calendar_time_representation($time);
2297
+            get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2298
+            calendar_time_representation($time);
2299 2299
     }
2300 2300
     return $activitytime;
2301 2301
 }
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
     global $BIGBLUEBUTTONBN_CFG;
2392 2392
     if (isset($BIGBLUEBUTTONBN_CFG)) {
2393 2393
         $renderer->render_warning_message('general_warning',
2394
-             get_string('config_warning_bigbluebuttonbn_cfg_deprecated', 'bigbluebuttonbn'));
2394
+                get_string('config_warning_bigbluebuttonbn_cfg_deprecated', 'bigbluebuttonbn'));
2395 2395
     }
2396 2396
 }
2397 2397
 
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
         $renderer->render_group_element('participant_moderator_default',
2600 2600
             $renderer->render_group_element_configmultiselect('participant_moderator_default',
2601 2601
                 array_keys($owner), array_merge($owner, $roles))
2602
-          );
2602
+            );
2603 2603
     }
2604 2604
 }
2605 2605
 
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
         $default = intval((int)\mod_bigbluebuttonbn\locallib\config::get('clienttype_default'));
2638 2638
 
2639 2639
         $choices = array(BIGBLUEBUTTON_CLIENTTYPE_FLASH => get_string('mod_form_block_clienttype_flash', 'bigbluebuttonbn'),
2640
-                         BIGBLUEBUTTON_CLIENTTYPE_HTML5 => get_string('mod_form_block_clienttype_html5', 'bigbluebuttonbn'));
2640
+                            BIGBLUEBUTTON_CLIENTTYPE_HTML5 => get_string('mod_form_block_clienttype_html5', 'bigbluebuttonbn'));
2641 2641
         $renderer->render_group_element('clienttype_default',
2642 2642
             $renderer->render_group_element_configselect('clienttype_default',
2643 2643
                 $default, $choices));
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
         return $output;
2731 2731
     }
2732 2732
     $output .= $OUTPUT->box_start('box boxalignleft adminerror alert alert-' . $type . ' alert-block fade in',
2733
-      'bigbluebuttonbn_view_general_warning') . "\n";
2733
+        'bigbluebuttonbn_view_general_warning') . "\n";
2734 2734
     $output .= '    ' . $message . "\n";
2735 2735
     $output .= '  <div class="singlebutton pull-right">' . "\n";
2736 2736
     if (!empty($href)) {
Please login to merge, or discard this patch.