Completed
Push — master ( a4199d...5f856c )
by Jesus
01:51
created
locallib.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 global $CFG;
30 30
 
31
-require_once(dirname(__FILE__).'/lib.php');
31
+require_once(dirname(__FILE__) . '/lib.php');
32 32
 
33 33
 /** @var BIGBLUEBUTTONBN_UPDATE_CACHE boolean set to true indicates that cache has to be updated */
34 34
 const BIGBLUEBUTTONBN_UPDATE_CACHE = true;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
               'logoutURL' => $logouturl,
101 101
             ];
102 102
     // Choose between Adobe Flash or HTML5 Client.
103
-    if ( $clienttype == BIGBLUEBUTTON_CLIENTTYPE_HTML5 ) {
103
+    if ($clienttype == BIGBLUEBUTTON_CLIENTTYPE_HTML5) {
104 104
         $data['joinViaHtml5'] = 'true';
105 105
     }
106 106
     if (!is_null($configtoken)) {
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
     $data = null;
129 129
     if (!is_null($pname) && !is_null($purl)) {
130 130
         $method = 'POST';
131
-        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='".
132
-            $purl."' /></module></modules>";
131
+        $data = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='" .
132
+            $purl . "' /></module></modules>";
133 133
     }
134 134
     $xml = bigbluebuttonbn_wrap_xml_load_file($createmeetingurl, $method, $data);
135 135
     if ($xml) {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         // Override imported flag with actual ID.
291 291
         $recording['imported'] = $recordimported->id;
292 292
         if (isset($recordimported->protected)) {
293
-            $recording['protected'] = (string) $recordimported->protected;
293
+            $recording['protected'] = (string)$recordimported->protected;
294 294
         }
295 295
         $recordsimportedarray[$recording['recordID']] = $recording;
296 296
     }
@@ -320,21 +320,21 @@  discard block
 block discarded – undo
320 320
     // Add formats.
321 321
     $playbackarray = array();
322 322
     foreach ($recording->playback->format as $format) {
323
-        $playbackarray[(string) $format->type] = array('type' => (string) $format->type,
324
-            'url' => trim((string) $format->url), 'length' => (string) $format->length);
323
+        $playbackarray[(string)$format->type] = array('type' => (string)$format->type,
324
+            'url' => trim((string)$format->url), 'length' => (string)$format->length);
325 325
         // Add preview per format when existing.
326 326
         if ($format->preview) {
327
-            $playbackarray[(string) $format->type]['preview'] = bigbluebuttonbn_get_recording_preview_images($format->preview);
327
+            $playbackarray[(string)$format->type]['preview'] = bigbluebuttonbn_get_recording_preview_images($format->preview);
328 328
         }
329 329
     }
330 330
     // Add the metadata to the recordings array.
331 331
     $metadataarray = bigbluebuttonbn_get_recording_array_meta(get_object_vars($recording->metadata));
332
-    $recordingarray = array('recordID' => (string) $recording->recordID,
333
-        'meetingID' => (string) $recording->meetingID, 'meetingName' => (string) $recording->name,
334
-        'published' => (string) $recording->published, 'startTime' => (string) $recording->startTime,
335
-        'endTime' => (string) $recording->endTime, 'playbacks' => $playbackarray);
332
+    $recordingarray = array('recordID' => (string)$recording->recordID,
333
+        'meetingID' => (string)$recording->meetingID, 'meetingName' => (string)$recording->name,
334
+        'published' => (string)$recording->published, 'startTime' => (string)$recording->startTime,
335
+        'endTime' => (string)$recording->endTime, 'playbacks' => $playbackarray);
336 336
     if (isset($recording->protected)) {
337
-        $recordingarray['protected'] = (string) $recording->protected;
337
+        $recordingarray['protected'] = (string)$recording->protected;
338 338
     }
339 339
     return $recordingarray + $metadataarray;
340 340
 }
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
 function bigbluebuttonbn_get_recording_preview_images($preview) {
350 350
     $imagesarray = array();
351 351
     foreach ($preview->images->image as $image) {
352
-        $imagearray = array('url' => trim((string) $image));
352
+        $imagearray = array('url' => trim((string)$image));
353 353
         foreach ($image->attributes() as $attkey => $attvalue) {
354
-            $imagearray[$attkey] = (string) $attvalue;
354
+            $imagearray[$attkey] = (string)$attvalue;
355 355
         }
356 356
         array_push($imagesarray, $imagearray);
357 357
     }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         if (is_object($value)) {
372 372
             $value = '';
373 373
         }
374
-        $metadataarray['meta_'.$key] = $value;
374
+        $metadataarray['meta_' . $key] = $value;
375 375
     }
376 376
     return $metadataarray;
377 377
 }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     $ids = explode(',', $recordids);
444 444
     foreach ($ids as $id) {
445 445
         $xml = bigbluebuttonbn_wrap_xml_load_file(
446
-            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array) $params)
446
+            \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('updateRecordings', ['recordID' => $id] + (array)$params)
447 447
           );
448 448
         if ($xml && $xml->returncode != 'SUCCESS') {
449 449
             return false;
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             return $xml;
509 509
         } catch (Exception $e) {
510 510
             libxml_use_internal_errors($previous);
511
-            $error = 'Caught exception: '.$e->getMessage();
511
+            $error = 'Caught exception: ' . $e->getMessage();
512 512
             debugging($error, DEBUG_DEVELOPER);
513 513
             return null;
514 514
         }
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
         $response = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NOBLANKS);
520 520
         return $response;
521 521
     } catch (Exception $e) {
522
-        $error = 'Caught exception: '.$e->getMessage();
522
+        $error = 'Caught exception: ' . $e->getMessage();
523 523
         debugging($error, DEBUG_DEVELOPER);
524 524
         libxml_use_internal_errors($previous);
525 525
         return null;
@@ -545,8 +545,8 @@  discard block
 block discarded – undo
545 545
         }
546 546
         $options = array();
547 547
         $options['CURLOPT_HTTPHEADER'] = array(
548
-                 'Content-Type: '.$contenttype,
549
-                 'Content-Length: '.strlen($data),
548
+                 'Content-Type: ' . $contenttype,
549
+                 'Content-Length: ' . strlen($data),
550 550
                  'Content-Language: en-US',
551 551
                );
552 552
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
  * @return void
568 568
  */
569 569
 function bigbluebuttonbn_end_meeting_if_running($bigbluebuttonbn) {
570
-    $meetingid = $bigbluebuttonbn->meetingid.'-'.$bigbluebuttonbn->course.'-'.$bigbluebuttonbn->id;
570
+    $meetingid = $bigbluebuttonbn->meetingid . '-' . $bigbluebuttonbn->course . '-' . $bigbluebuttonbn->id;
571 571
     if (bigbluebuttonbn_is_meeting_running($meetingid)) {
572 572
         bigbluebuttonbn_end_meeting($meetingid, $bigbluebuttonbn->moderatorpass);
573 573
     }
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
     if ($userroles) {
588 588
         $where = '';
589 589
         foreach ($userroles as $userrole) {
590
-            $where .= (empty($where) ? ' WHERE' : ' OR').' id=' . $userrole->roleid;
590
+            $where .= (empty($where) ? ' WHERE' : ' OR') . ' id=' . $userrole->roleid;
591 591
         }
592
-        $userroles = $DB->get_records_sql('SELECT * FROM {role}'.$where);
592
+        $userroles = $DB->get_records_sql('SELECT * FROM {role}' . $where);
593 593
     }
594 594
     return $userroles;
595 595
 }
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
  * @return array $users
613 613
  */
614 614
 function bigbluebuttonbn_get_users(context $context = null) {
615
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
615
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
616 616
     foreach ($users as $key => $value) {
617 617
         $users[$key] = fullname($value);
618 618
     }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
  * @return array $users
628 628
  */
629 629
 function bigbluebuttonbn_get_users_select(context $context = null) {
630
-    $users = (array) get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
630
+    $users = (array)get_enrolled_users($context, '', 0, 'u.*', null, 0, 0, true);
631 631
     foreach ($users as $key => $value) {
632 632
         $users[$key] = array('id' => $value->id, 'name' => fullname($value));
633 633
     }
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
  * @return array $roles
643 643
  */
644 644
 function bigbluebuttonbn_get_roles(context $context = null) {
645
-    $roles = (array) role_get_names($context);
645
+    $roles = (array)role_get_names($context);
646 646
     foreach ($roles as $key => $value) {
647 647
         $roles[$key] = $value->localname;
648 648
     }
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
  * @return array $users
658 658
  */
659 659
 function bigbluebuttonbn_get_roles_select(context $context = null) {
660
-    $roles = (array) role_get_names($context);
660
+    $roles = (array)role_get_names($context);
661 661
     foreach ($roles as $key => $value) {
662 662
         $roles[$key] = array('id' => $value->id, 'name' => $value->localname);
663 663
     }
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
  * @return object $role
673 673
  */
674 674
 function bigbluebuttonbn_get_role($id) {
675
-    $roles = (array) role_get_names();
675
+    $roles = (array)role_get_names();
676 676
     if (is_numeric($id) && isset($roles[$id])) {
677 677
         return (object)$roles[$id];
678 678
     }
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
     if (!isguestuser()) {
830 830
         $userroles = bigbluebuttonbn_get_user_roles($context, $userid);
831 831
     }
832
-    return bigbluebuttonbn_is_moderator_validator($participantlist, $userid , $userroles);
832
+    return bigbluebuttonbn_is_moderator_validator($participantlist, $userid, $userroles);
833 833
 }
834 834
 
835 835
 /**
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 function bigbluebuttonbn_generate_nonce() {
986 986
     $mt = microtime();
987 987
     $rand = mt_rand();
988
-    return md5($mt.$rand);
988
+    return md5($mt . $rand);
989 989
 }
990 990
 
991 991
 /**
@@ -1075,10 +1075,10 @@  discard block
 block discarded – undo
1075 1075
     $now = time();
1076 1076
     if (!$updatecache && isset($result) && $now < ($result['creation_time'] + $cachettl)) {
1077 1077
         // Use the value in the cache.
1078
-        return (array) json_decode($result['meeting_info']);
1078
+        return (array)json_decode($result['meeting_info']);
1079 1079
     }
1080 1080
     // Ping again and refresh the cache.
1081
-    $meetinginfo = (array) bigbluebuttonbn_wrap_xml_load_file(
1081
+    $meetinginfo = (array)bigbluebuttonbn_wrap_xml_load_file(
1082 1082
         \mod_bigbluebuttonbn\locallib\bigbluebutton::action_url('getMeetingInfo', ['meetingID' => $meetingid])
1083 1083
       );
1084 1084
     $cache->set($meetingid, array('creation_time' => time(), 'meeting_info' => json_encode($meetinginfo)));
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
  * @return object
1190 1190
  */
1191 1191
 function bigbluebuttonbn_set_config_xml($meetingid, $configxml) {
1192
-    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url').'api/setConfigXML?';
1192
+    $urldefaultconfig = \mod_bigbluebuttonbn\locallib\config::get('server_url') . 'api/setConfigXML?';
1193 1193
     $configxmlparams = bigbluebuttonbn_set_config_xml_params($meetingid, $configxml);
1194 1194
     $xml = bigbluebuttonbn_wrap_xml_load_file($urldefaultconfig, 'POST',
1195 1195
         $configxmlparams, 'application/x-www-form-urlencoded');
@@ -1205,8 +1205,8 @@  discard block
 block discarded – undo
1205 1205
  * @return string
1206 1206
  */
1207 1207
 function bigbluebuttonbn_set_config_xml_params($meetingid, $configxml) {
1208
-    $params = 'configXML='.urlencode($configxml).'&meetingID='.urlencode($meetingid);
1209
-    $configxmlparams = $params.'&checksum='.sha1('setConfigXML'.$params.\mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1208
+    $params = 'configXML=' . urlencode($configxml) . '&meetingID=' . urlencode($meetingid);
1209
+    $configxmlparams = $params . '&checksum=' . sha1('setConfigXML' . $params . \mod_bigbluebuttonbn\locallib\config::get('shared_secret'));
1210 1210
     return $configxmlparams;
1211 1211
 }
1212 1212
 
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
  */
1221 1221
 function bigbluebuttonbn_set_config_xml_array($meetingid, $configxml) {
1222 1222
     $configxml = bigbluebuttonbn_setConfigXML($meetingid, $configxml);
1223
-    $configxmlarray = (array) $configxml;
1223
+    $configxmlarray = (array)$configxml;
1224 1224
     if ($configxmlarray['returncode'] != 'SUCCESS') {
1225 1225
         debugging('BigBlueButton was not able to set the custom config.xml file', DEBUG_DEVELOPER);
1226 1226
         return '';
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
     global $USER;
1313 1313
     $starttime = $starttime - ($starttime % 1000);
1314 1314
     // Set formatted date.
1315
-    $dateformat = get_string('strftimerecentfull', 'langconfig').' %Z';
1315
+    $dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
1316 1316
     return userdate($starttime / 1000, $dateformat, usertimezone($USER->timezone));
1317 1317
 }
1318 1318
 
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
  * @return string
1429 1429
  */
1430 1430
 function bigbluebuttonbn_get_recording_data_row_preview($recording) {
1431
-    $options = array('id' => 'preview-'.$recording['recordID']);
1431
+    $options = array('id' => 'preview-' . $recording['recordID']);
1432 1432
     if ($recording['published'] === 'false') {
1433 1433
         $options['hidden'] = 'hidden';
1434 1434
     }
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
     if ($recording['published'] === 'false') {
1491 1491
         $visibility = 'hidden ';
1492 1492
     }
1493
-    $id = 'playbacks-'.$recording['recordID'];
1493
+    $id = 'playbacks-' . $recording['recordID'];
1494 1494
     $recordingtypes = html_writer::start_tag('div', array('id' => $id, 'data-imported' => $dataimported,
1495 1495
           'data-meetingid' => $recording['meetingID'], 'data-recordingid' => $recording['recordID'],
1496 1496
           'title' => $title, $visibility => $visibility));
@@ -1515,11 +1515,11 @@  discard block
 block discarded – undo
1515 1515
     if (!bigbluebuttonbn_include_recording_data_row_type($recording, $bbbsession, $playback)) {
1516 1516
         return '';
1517 1517
     }
1518
-    $text = get_string('view_recording_format_'.$playback['type'], 'bigbluebuttonbn');
1518
+    $text = get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn');
1519 1519
     $href = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=play&bn=' . $bbbsession['bigbluebuttonbn']->id .
1520
-      '&mid='.$recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1520
+      '&mid=' . $recording['meetingID'] . '&rid=' . $recording['recordID'] . '&rtype=' . $playback['type'];
1521 1521
     if (!isset($recording['imported']) || !isset($recording['protected']) || $recording['protected'] === 'false') {
1522
-        $href .= '&href='.urlencode(trim($playback['url']));
1522
+        $href .= '&href=' . urlencode(trim($playback['url']));
1523 1523
     }
1524 1524
     $linkattributes = array(
1525 1525
         'id' => 'recording-play-' . $playback['type'] . '-' . $recording['recordID'],
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
             $linkattributes['class'] = 'disabled';
1689 1689
             unset($linkattributes['onclick']);
1690 1690
         }
1691
-        $icon = new pix_icon('i/'.$data['tag'],
1691
+        $icon = new pix_icon('i/' . $data['tag'],
1692 1692
             get_string('view_recording_list_actionbar_' . $data['action'], 'bigbluebuttonbn'),
1693 1693
             'moodle', $iconattributes);
1694 1694
         return $OUTPUT->action_icon('#', $icon, null, $linkattributes, false);
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
  */
1806 1806
 function bigbluebuttonbn_get_recording_table_row($bbbsession, $recording, $rowdata) {
1807 1807
     $row = new html_table_row();
1808
-    $row->id = 'recording-tr-'.$recording['recordID'];
1808
+    $row->id = 'recording-tr-' . $recording['recordID'];
1809 1809
     $row->attributes['data-imported'] = 'false';
1810 1810
     $texthead = '';
1811 1811
     $texttail = '';
@@ -1865,9 +1865,9 @@  discard block
 block discarded – undo
1865 1865
 function bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn) {
1866 1866
     $sender = get_admin();
1867 1867
     // Prepare message.
1868
-    $messagetext = '<p>'.get_string('email_body_recording_ready_for', 'bigbluebuttonbn').
1869
-        ' &quot;' . $bigbluebuttonbn->name . '&quot; '.
1870
-        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn').'.</p>';
1868
+    $messagetext = '<p>' . get_string('email_body_recording_ready_for', 'bigbluebuttonbn') .
1869
+        ' &quot;' . $bigbluebuttonbn->name . '&quot; ' .
1870
+        get_string('email_body_recording_ready_is_ready', 'bigbluebuttonbn') . '.</p>';
1871 1871
     $context = context_course::instance($bigbluebuttonbn->course);
1872 1872
     \mod_bigbluebuttonbn\locallib\notifier::notification_send($context, $sender, $bigbluebuttonbn, $messagetext);
1873 1873
 }
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
     }
2090 2090
     // Prepare select for loading records based on existent bigbluebuttonbns.
2091 2091
     $sql = 'SELECT DISTINCT meetingid, bigbluebuttonbnid FROM {bigbluebuttonbn_logs} WHERE ';
2092
-    $sql .= '(bigbluebuttonbnid='.implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)).')';
2092
+    $sql .= '(bigbluebuttonbnid=' . implode(' OR bigbluebuttonbnid=', array_keys($bigbluebuttonbns)) . ')';
2093 2093
     // Include only Create events and exclude those with record not true.
2094 2094
     $sql .= ' AND log = ? AND meta LIKE ? AND meta LIKE ?';
2095 2095
     // Execute select for loading records based on existent bigbluebuttonbns.
@@ -2239,8 +2239,8 @@  discard block
 block discarded – undo
2239 2239
 function bigbluebuttonbn_format_activity_time($time) {
2240 2240
     $activitytime = '';
2241 2241
     if ($time) {
2242
-        $activitytime = calendar_day_representation($time).' '.
2243
-          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn').' '.
2242
+        $activitytime = calendar_day_representation($time) . ' ' .
2243
+          get_string('mod_form_field_notification_msg_at', 'bigbluebuttonbn') . ' ' .
2244 2244
           calendar_time_representation($time);
2245 2245
     }
2246 2246
     return $activitytime;
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
  *
2663 2663
  * @return string
2664 2664
  */
2665
-function bigbluebuttonbn_render_warning($message, $type='info', $href='', $text='', $class='') {
2665
+function bigbluebuttonbn_render_warning($message, $type = 'info', $href = '', $text = '', $class = '') {
2666 2666
     global $OUTPUT;
2667 2667
     $output = "\n";
2668 2668
     // Evaluates if config_warning is enabled.
@@ -2701,11 +2701,11 @@  discard block
 block discarded – undo
2701 2701
     if ($class == '') {
2702 2702
         $class = 'btn btn-secondary';
2703 2703
     }
2704
-    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
2705
-    $output .= '      <button type="submit" class="' . $class . '"'."\n";
2706
-    $output .= '          title="' . $title . '"'."\n";
2707
-    $output .= '          >' . $text . '</button>'."\n";
2708
-    $output .= '  </form>'."\n";
2704
+    $output  = '  <form method="post" action="' . $href . '" class="form-inline">' . "\n";
2705
+    $output .= '      <button type="submit" class="' . $class . '"' . "\n";
2706
+    $output .= '          title="' . $title . '"' . "\n";
2707
+    $output .= '          >' . $text . '</button>' . "\n";
2708
+    $output .= '  </form>' . "\n";
2709 2709
     return $output;
2710 2710
 }
2711 2711
 
@@ -2870,7 +2870,7 @@  discard block
 block discarded – undo
2870 2870
     $bbbsession['modPW'] = $bbbsession['bigbluebuttonbn']->moderatorpass;
2871 2871
     $bbbsession['viewerPW'] = $bbbsession['bigbluebuttonbn']->viewerpass;
2872 2872
     // Database info related to the activity.
2873
-    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.
2873
+    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' .
2874 2874
         $bbbsession['bigbluebuttonbn']->id;
2875 2875
     $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name;
2876 2876
     $bbbsession['meetingdescription'] = $bbbsession['bigbluebuttonbn']->intro;
@@ -2890,7 +2890,7 @@  discard block
 block discarded – undo
2890 2890
         $bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn');
2891 2891
     }
2892 2892
     if ($bbbsession['bigbluebuttonbn']->record) {
2893
-        $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
2893
+        $bbbsession['welcome'] .= '<br><br>' . get_string('bbbrecordwarning', 'bigbluebuttonbn');
2894 2894
     }
2895 2895
     $bbbsession['openingtime'] = $bbbsession['bigbluebuttonbn']->openingtime;
2896 2896
     $bbbsession['closingtime'] = $bbbsession['bigbluebuttonbn']->closingtime;
@@ -2903,7 +2903,7 @@  discard block
 block discarded – undo
2903 2903
     $bbbsession['originServerName'] = $parsedurl['host'];
2904 2904
     $bbbsession['originServerUrl'] = $CFG->wwwroot;
2905 2905
     $bbbsession['originServerCommonName'] = '';
2906
-    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')';
2906
+    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn (' . get_config('mod_bigbluebuttonbn', 'version') . ')';
2907 2907
     $bbbsession['bnserver'] = bigbluebuttonbn_is_bn_server();
2908 2908
     // Setting for clienttype, assign flash if not enabled, or default if not editable.
2909 2909
     $bbbsession['clienttype'] = \mod_bigbluebuttonbn\locallib\config::get('clienttype_default');
Please login to merge, or discard this patch.
bbb_view.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  * @author    Jesus Federico  (jesus [at] blindsidenetworks [dt] com)
24 24
  */
25 25
 
26
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
27
-require_once(dirname(__FILE__).'/locallib.php');
26
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
27
+require_once(dirname(__FILE__) . '/locallib.php');
28 28
 
29 29
 global $SESSION;
30 30
 
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
     if (is_null($serverversion)) {
65 65
         if ($bbbsession['administrator']) {
66 66
             print_error('view_error_unable_join', 'bigbluebuttonbn',
67
-                $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
67
+                $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
68 68
             exit;
69 69
         }
70 70
         if ($bbbsession['moderator']) {
71 71
             print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
72
-                $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);
72
+                $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
73 73
             exit;
74 74
         }
75 75
         print_error('view_error_unable_join_student', 'bigbluebuttonbn',
76
-            $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);
76
+            $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
77 77
         exit;
78 78
     }
79 79
 
80
-    $bbbsession['serverversion'] = (string) $serverversion;
80
+    $bbbsession['serverversion'] = (string)$serverversion;
81 81
 
82 82
     // Operation URLs.
83 83
     $bbbsession['bigbluebuttonbnURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id;
84
-    $bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id .
84
+    $bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id=' . $id .
85 85
         '&bn=' . $bbbsession['bigbluebuttonbn']->id;
86 86
     $bbbsession['recordingReadyURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=recording_' .
87 87
         'ready&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbn']->id;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         }
142 142
         // If user is not administrator nor moderator (user is steudent) and waiting is required.
143 143
         if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) {
144
-            header('Location: '.$bbbsession['logoutURL']);
144
+            header('Location: ' . $bbbsession['logoutURL']);
145 145
             break;
146 146
         }
147 147
         // As the meeting doesn't exist, try to create it.
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
             // The server is unreachable.
156 156
             if ($bbbsession['administrator']) {
157 157
                 print_error('view_error_unable_join', 'bigbluebuttonbn',
158
-                    $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
158
+                    $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
159 159
                 break;
160 160
             }
161 161
             if ($bbbsession['moderator']) {
162 162
                 print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
163
-                    $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
163
+                    $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
164 164
                 break;
165 165
             }
166 166
             print_error('view_error_unable_join_student', 'bigbluebuttonbn',
167
-                $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
167
+                $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
168 168
             break;
169 169
         }
170 170
         if ($response['returncode'] == 'FAILED') {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_create'], $bigbluebuttonbn);
186 186
         // Internal logger: Insert a record with the meeting created.
187 187
         $overrides = array('meetingid' => $bbbsession['meetingid']);
188
-        $meta = '{"record":'.($bbbsession['record'] ? 'true' : 'false').'}';
188
+        $meta = '{"record":' . ($bbbsession['record'] ? 'true' : 'false') . '}';
189 189
         bigbluebuttonbn_log($bbbsession['bigbluebuttonbn'], BIGBLUEBUTTONBN_LOG_EVENT_CREATE, $overrides, $meta);
190 190
         // Since the meeting is already running, we just join the session.
191 191
         bigbluebutton_bbb_view_join_meeting($bbbsession, $bigbluebuttonbn);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['recording_play'], $bigbluebuttonbn,
197 197
             ['other' => $rid]);
198 198
         // Execute the redirect.
199
-        header('Location: '.urldecode($href));
199
+        header('Location: ' . urldecode($href));
200 200
         break;
201 201
     default:
202 202
         bigbluebutton_bbb_view_close_window();
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         $data['welcome'] .= '<br><br>';
282 282
         $data['welcome'] .= str_replace(
283 283
             '%duration%',
284
-            (string) $durationtime,
284
+            (string)$durationtime,
285 285
             get_string('bbbdurationwarning', 'bigbluebuttonbn')
286 286
           );
287 287
     }
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
     $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_UPDATE_CACHE);
369 369
     if ($bbbsession['userlimit'] > 0 && intval($meetinginfo['participantCount']) >= $bbbsession['userlimit']) {
370 370
         // No more users allowed to join.
371
-        header('Location: '.$bbbsession['logoutURL']);
371
+        header('Location: ' . $bbbsession['logoutURL']);
372 372
         return;
373 373
     }
374 374
     // Build the URL.
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     bigbluebuttonbn_participant_joined($bbbsession['meetingid'],
388 388
         ($bbbsession['administrator'] || $bbbsession['moderator']));
389 389
     // Execute the redirect.
390
-    header('Location: '.$joinurl);
390
+    header('Location: ' . $joinurl);
391 391
 }
392 392
 
393 393
 /**
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
  */
400 400
 function bigbluebutton_bbb_view_errors($serrors, $id) {
401 401
     global $CFG, $OUTPUT;
402
-    $errors = (array) json_decode(urldecode($serrors));
402
+    $errors = (array)json_decode(urldecode($serrors));
403 403
     $msgerrors = '';
404 404
     foreach ($errors as $error) {
405
-        $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger'))."\n";
405
+        $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger')) . "\n";
406 406
     }
407 407
     echo $OUTPUT->header();
408 408
     print_error('view_error_bigbluebutton', 'bigbluebuttonbn',
409
-        $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$id, $msgerrors, $serrors);
409
+        $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $id, $msgerrors, $serrors);
410 410
     echo $OUTPUT->footer();
411 411
 }
Please login to merge, or discard this patch.
view.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
  * @author    Fred Dixon  (ffdixon [at] blindsidenetworks [dt] com)
25 25
  */
26 26
 
27
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
28
-require_once(dirname(__FILE__).'/locallib.php');
27
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
28
+require_once(dirname(__FILE__) . '/locallib.php');
29 29
 
30 30
 $id = required_param('id', PARAM_INT);
31 31
 $bn = optional_param('bn', 0, PARAM_INT);
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 if (is_null($serverversion)) {
58 58
     if ($bbbsession['administrator']) {
59 59
         print_error('view_error_unable_join', 'bigbluebuttonbn',
60
-            $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
60
+            $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
61 61
         exit;
62 62
     }
63 63
     if ($bbbsession['moderator']) {
64 64
         print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
65
-            $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);
65
+            $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
66 66
         exit;
67 67
     }
68 68
     print_error('view_error_unable_join_student', 'bigbluebuttonbn',
69
-        $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);
69
+        $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
70 70
     exit;
71 71
 }
72
-$bbbsession['serverversion'] = (string) $serverversion;
72
+$bbbsession['serverversion'] = (string)$serverversion;
73 73
 
74 74
 // Mark viewed by user (if required).
75 75
 $completion = new completion_info($course);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 // Print the page header.
79 79
 $PAGE->set_context($context);
80
-$PAGE->set_url($CFG->wwwroot.'/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
80
+$PAGE->set_url($CFG->wwwroot . '/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
81 81
 $PAGE->set_title(format_string($bigbluebuttonbn->name));
82 82
 $PAGE->set_cacheable(false);
83 83
 $PAGE->set_heading($course->fullname);
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 if (!has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context)) {
88 88
     echo $OUTPUT->header();
89 89
     if (isguestuser()) {
90
-        echo $OUTPUT->confirm('<p>'.get_string('view_noguests', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
91
-            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
90
+        echo $OUTPUT->confirm('<p>' . get_string('view_noguests', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'),
91
+            get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);
92 92
     } else {
93
-        echo $OUTPUT->confirm('<p>'.get_string('view_nojoin', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
94
-            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
93
+        echo $OUTPUT->confirm('<p>' . get_string('view_nojoin', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'),
94
+            get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);
95 95
     }
96 96
     echo $OUTPUT->footer();
97 97
     exit;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
 // Operation URLs.
101 101
 $bbbsession['bigbluebuttonbnURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id;
102
-$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id .
102
+$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id=' . $id .
103 103
     '&bn=' . $bbbsession['bigbluebuttonbn']->id;
104 104
 $bbbsession['recordingReadyURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=recording_' .
105 105
     'ready&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbn']->id;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 echo $OUTPUT->footer();
133 133
 
134 134
 // Shows version as a comment.
135
-echo '<!-- '.$bbbsession['originTag'].' -->'."\n";
135
+echo '<!-- ' . $bbbsession['originTag'] . ' -->' . "\n";
136 136
 
137 137
 /**
138 138
  * Displays the view for groups.
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
         $groupname = groups_get_group_name($bbbsession['group']);
162 162
     }
163 163
     // Assign group default values.
164
-    $bbbsession['meetingid'] .= '['.$bbbsession['group'].']';
165
-    $bbbsession['meetingname'] .= ' ('.$groupname.')';
164
+    $bbbsession['meetingid'] .= '[' . $bbbsession['group'] . ']';
165
+    $bbbsession['meetingname'] .= ' (' . $groupname . ')';
166 166
     if (count($groups) == 0) {
167 167
         // Only the All participants group exists.
168 168
         bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_notenrolled_warning', 'bigbluebuttonbn'), 'info');
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     if (has_capability('moodle/site:accessallgroups', $context)) {
173 173
         bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_selection_warning', 'bigbluebuttonbn'));
174 174
     }
175
-    $urltoroot = $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id;
175
+    $urltoroot = $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id;
176 176
     groups_print_activity_menu($bbbsession['cm'], $urltoroot);
177 177
     echo '<br><br>';
178 178
 }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $recordingsdisabled = get_string('view_message_recordings_disabled', 'bigbluebuttonbn');
245 245
         $output .= bigbluebuttonbn_render_warning($recordingsdisabled, 'danger');
246 246
     }
247
-    echo $output.html_writer::empty_tag('br').html_writer::empty_tag('br').html_writer::empty_tag('br');
247
+    echo $output . html_writer::empty_tag('br') . html_writer::empty_tag('br') . html_writer::empty_tag('br');
248 248
     $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-broker', 'M.mod_bigbluebuttonbn.broker.init', array($jsvars));
249 249
 }
250 250
 
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
     // JavaScript variables for room.
314 314
     $openingtime = '';
315 315
     if ($bbbsession['openingtime']) {
316
-        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn').': '.
316
+        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn') . ': ' .
317 317
             userdate($bbbsession['openingtime']);
318 318
     }
319 319
     $closingtime = '';
320 320
     if ($bbbsession['closingtime']) {
321
-        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn').': '.
321
+        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn') . ': ' .
322 322
             userdate($bbbsession['closingtime']);
323 323
     }
324 324
     $jsvars += array(
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     $output .= $OUTPUT->box_end();
336 336
     // Action button box.
337 337
     $output .= $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box');
338
-    $output .= '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>'."\n";
338
+    $output .= '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>' . "\n";
339 339
     $output .= $OUTPUT->box_end();
340 340
     if ($activity == 'ended') {
341 341
         $output .= bigbluebuttonbn_view_ended($bbbsession);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     // If there are meetings with recordings load the data to the table.
389 389
     if ($bbbsession['bigbluebuttonbn']->recordings_html) {
390 390
         // Render a plain html table.
391
-        return bigbluebuttonbn_output_recording_table($bbbsession, $recordings)."\n";
391
+        return bigbluebuttonbn_output_recording_table($bbbsession, $recordings) . "\n";
392 392
     }
393 393
     // JavaScript variables for recordings with YUI.
394 394
     $jsvars += array(
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
         array('type' => 'button',
417 417
               'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'),
418 418
               'class' => 'btn btn-secondary',
419
-              'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='.
420
-                  $bbbsession['bigbluebuttonbn']->id.'\''));
419
+              'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/import_view.php?bn=' .
420
+                  $bbbsession['bigbluebuttonbn']->id . '\''));
421 421
     $output  = html_writer::empty_tag('br');
422 422
     $output .= html_writer::tag('span', $button, array('id' => 'import_recording_links_button'));
423 423
     $output .= html_writer::tag('span', '', array('id' => 'import_recording_links_table'));
@@ -436,10 +436,10 @@  discard block
 block discarded – undo
436 436
     if (!is_null($bbbsession['presentation']['url'])) {
437 437
         $attributes = array('title' => $bbbsession['presentation']['name']);
438 438
         $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
439
-        return '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
440
-                $OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).
439
+        return '<h4>' . get_string('view_section_title_presentation', 'bigbluebuttonbn') . '</h4>' .
440
+                $OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false) .
441 441
                 $OUTPUT->action_link($bbbsession['presentation']['url'],
442
-                $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
442
+                $bbbsession['presentation']['name'], null, $attributes) . '<br><br>';
443 443
     }
444 444
     return '';
445 445
 }
Please login to merge, or discard this patch.