Completed
Push — master ( 63aa89...ef28c1 )
by Jesus
02:13
created
locallib.php 1 patch
Braces   +64 added lines, -39 removed lines patch added patch discarded remove patch
@@ -69,19 +69,23 @@  discard block
 block discarded – undo
69 69
     $params = 'name='.urlencode($name).'&meetingID='.urlencode($meetingID).'&attendeePW='.urlencode($attendeePW).'&moderatorPW='.urlencode($moderatorPW).'&logoutURL='.urlencode($logoutURL).'&record='.$record;
70 70
 
71 71
     $voiceBridge = intval($voiceBridge);
72
-    if ( $voiceBridge > 0 && $voiceBridge < 79999)
73
-        $params .= '&voiceBridge='.$voiceBridge;
72
+    if ( $voiceBridge > 0 && $voiceBridge < 79999) {
73
+            $params .= '&voiceBridge='.$voiceBridge;
74
+    }
74 75
 
75 76
     $duration = intval($duration);
76
-    if( $duration > 0 )
77
-        $params .= '&duration='.$duration;
77
+    if( $duration > 0 ) {
78
+            $params .= '&duration='.$duration;
79
+    }
78 80
 
79 81
     $maxParticipants = intval($maxParticipants);
80
-    if( $maxParticipants > 0 )
81
-        $params .= '&maxParticipants='.$maxParticipants;
82
+    if( $maxParticipants > 0 ) {
83
+            $params .= '&maxParticipants='.$maxParticipants;
84
+    }
82 85
 
83
-    if( trim( $welcome ) )
84
-        $params .= '&welcome='.urlencode($welcome);
86
+    if( trim( $welcome ) ) {
87
+            $params .= '&welcome='.urlencode($welcome);
88
+    }
85 89
 
86 90
     foreach ($metadata as $key => $value) {
87 91
         $params .= '&'.$key.'='.urlencode($value);
@@ -155,10 +159,11 @@  discard block
 block discarded – undo
155 159
     }
156 160
 
157 161
     if ( $xml ) {
158
-        if ($xml->meetingID)
159
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
160
-        else
161
-            return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
162
+        if ($xml->meetingID) {
163
+                    return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey, 'meetingID' => $xml->meetingID, 'attendeePW' => $xml->attendeePW, 'moderatorPW' => $xml->moderatorPW, 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded );
164
+        } else {
165
+                    return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey );
166
+        }
162 167
     } else {
163 168
         return null;
164 169
     }
@@ -267,7 +272,9 @@  discard block
 block discarded – undo
267 272
     $metadataArray = array();
268 273
     $metadata = get_object_vars($recording->metadata);
269 274
     foreach ( $metadata as $key => $value ) {
270
-        if ( is_object($value) ) $value = '';
275
+        if ( is_object($value) ) {
276
+            $value = '';
277
+        }
271 278
         $metadataArray['meta_'.$key] = $value;
272 279
     }
273 280
 
@@ -277,17 +284,22 @@  discard block
 block discarded – undo
277 284
 }
278 285
 
279 286
 function bigbluebuttonbn_recordingBuildSorter($a, $b){
280
-    if( $a['startTime'] < $b['startTime']) return -1;
281
-    else if( $a['startTime'] == $b['startTime']) return 0;
282
-    else return 1;
283
-}
287
+    if( $a['startTime'] < $b['startTime']) {
288
+        return -1;
289
+    } else if( $a['startTime'] == $b['startTime']) {
290
+        return 0;
291
+    } else {
292
+        return 1;
293
+    }
294
+    }
284 295
 
285 296
 function bigbluebuttonbn_doDeleteRecordings( $recordIDs, $URL, $SALT ) {
286 297
     $ids = 	explode(",", $recordIDs);
287 298
     foreach( $ids as $id){
288 299
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getDeleteRecordingsURL($id, $URL, $SALT) );
289
-        if( $xml && $xml->returncode != 'SUCCESS' )
290
-            return false;
300
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
301
+                    return false;
302
+        }
291 303
     }
292 304
     return true;
293 305
 }
@@ -296,8 +308,9 @@  discard block
 block discarded – undo
296 308
     $ids = 	explode(",", $recordIDs);
297 309
     foreach( $ids as $id){
298 310
         $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getPublishRecordingsURL($id, $set, $URL, $SALT) );
299
-        if( $xml && $xml->returncode != 'SUCCESS' )
300
-            return false;
311
+        if( $xml && $xml->returncode != 'SUCCESS' ) {
312
+                    return false;
313
+        }
301 314
     }
302 315
     return true;
303 316
 }
@@ -307,8 +320,7 @@  discard block
 block discarded – undo
307 320
 
308 321
     if( $xml ) { //If the xml packet returned failure it displays the message to the user
309 322
         return array('returncode' => $xml->returncode, 'message' => $xml->message, 'messageKey' => $xml->messageKey);
310
-    }
311
-    else { //If the server is unreachable, then prompts the user of the necessary action
323
+    } else { //If the server is unreachable, then prompts the user of the necessary action
312 324
         return null;
313 325
     }
314 326
 }
@@ -342,7 +354,9 @@  discard block
 block discarded – undo
342 354
 }
343 355
 
344 356
 function bigbluebuttonbn_wrap_xml_load_file($url, $method=BIGBLUEBUTTONBN_METHOD_GET, $data=null) {
345
-    if ( bigbluebuttonbn_debugdisplay() ) error_log("Request to: ".$url);
357
+    if ( bigbluebuttonbn_debugdisplay() ) {
358
+        error_log("Request to: ".$url);
359
+    }
346 360
 
347 361
     if (extension_loaded('curl')) {
348 362
         $c = new curl();
@@ -530,8 +544,9 @@  discard block
 block discarded – undo
530 544
         // Iterate looking for all configuration
531 545
         foreach($participant_list as $participant){
532 546
             if( $participant->selectiontype == 'all' ) {
533
-                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
534
-                    return true;
547
+                if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
548
+                                    return true;
549
+                }
535 550
             }
536 551
         }
537 552
 
@@ -542,8 +557,9 @@  discard block
 block discarded – undo
542 557
                 foreach( $roles as $role ) {
543 558
                     $db_moodle_role = bigbluebuttonbn_moodle_db_role_lookup($db_moodle_roles, $role->roleid);
544 559
                     if( $participant->selectionid == $db_moodle_role->shortname ) {
545
-                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
546
-                            return true;
560
+                        if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
561
+                                                    return true;
562
+                        }
547 563
                     }
548 564
                 }
549 565
             }
@@ -553,8 +569,9 @@  discard block
 block discarded – undo
553 569
         foreach($participant_list as $participant){
554 570
             if( $participant->selectiontype == 'user' ) {
555 571
                 if( $participant->selectionid == $user ) {
556
-                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR )
557
-                        return true;
572
+                    if ( $participant->role == BIGBLUEBUTTONBN_ROLE_MODERATOR ) {
573
+                                            return true;
574
+                    }
558 575
                 }
559 576
             }
560 577
         }
@@ -588,7 +605,9 @@  discard block
 block discarded – undo
588 605
     if( $voicebridge != 0 ) {
589 606
         $table = "bigbluebuttonbn";
590 607
         $select = "voicebridge = ".$voicebridge;
591
-        if( $id ) $select .= " AND id <> ".$id;
608
+        if( $id ) {
609
+            $select .= " AND id <> ".$id;
610
+        }
592 611
         if ( $rooms = $DB->get_records_select($table, $select)  ) {
593 612
             $is_unique = false;
594 613
         }
@@ -924,7 +943,9 @@  discard block
 block discarded – undo
924 943
     $error = $org_msg;
925 944
 
926 945
     if( !empty($new_msg) ) {
927
-        if( !empty($error) ) $error .= ' ';
946
+        if( !empty($error) ) {
947
+            $error .= ' ';
948
+        }
928 949
         $error .= $new_msg;
929 950
     }
930 951
 
@@ -1205,8 +1226,9 @@  discard block
 block discarded – undo
1205 1226
         $capabilities = bigbluebuttonbn_getCapabilitiesArray( $endpoint, $shared_secret );
1206 1227
         if( $capabilities ) {
1207 1228
             foreach ($capabilities as $capability) {
1208
-                if( $capability["name"] == $capability_name)
1209
-                    $capability_offered = $capability;
1229
+                if( $capability["name"] == $capability_name) {
1230
+                                    $capability_offered = $capability;
1231
+                }
1210 1232
             }
1211 1233
         }
1212 1234
     }
@@ -1512,7 +1534,9 @@  discard block
 block discarded – undo
1512 1534
             }
1513 1535
             //Generates the meetingID string
1514 1536
             foreach ($mIDs as $mID) {
1515
-                if (strlen($meetingID) > 0) $meetingID .= ',';
1537
+                if (strlen($meetingID) > 0) {
1538
+                    $meetingID .= ',';
1539
+                }
1516 1540
                 $meetingID .= $mID;
1517 1541
             }
1518 1542
         }
@@ -1610,9 +1634,10 @@  discard block
 block discarded – undo
1610 1634
 function bigbluebuttonbn_html2text($html, $len) {
1611 1635
     $text = strip_tags($html);
1612 1636
     $text = str_replace("&nbsp;", ' ', $text);
1613
-    if( strlen($text) > $len )
1614
-        $text = substr($text, 0, $len)."...";
1615
-    else
1616
-        $text = substr($text, 0, $len);
1637
+    if( strlen($text) > $len ) {
1638
+            $text = substr($text, 0, $len)."...";
1639
+    } else {
1640
+            $text = substr($text, 0, $len);
1641
+    }
1617 1642
     return $text;
1618 1643
 }
Please login to merge, or discard this patch.
view.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -289,28 +289,28 @@  discard block
 block discarded – undo
289 289
 
290 290
     if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ){
291 291
         echo ''.
292
-          '<div id="panelContent" class="hidden">'."\n".
293
-          '  <div class="yui3-widget-bd">'."\n".
294
-          '    <form>'."\n".
295
-          '      <fieldset>'."\n".
296
-          '        <input type="hidden" name="join" id="meeting_join_url" value="">'."\n".
297
-          '        <input type="hidden" name="message" id="meeting_message" value="">'."\n".
298
-          '        <div>'."\n".
299
-          '          <label for="name">'.get_string('view_recording_name', 'bigbluebuttonbn').'</label><br/>'."\n".
300
-          '          <input type="text" name="name" id="recording_name" placeholder="">'."\n".
301
-          '        </div><br>'."\n".
302
-          '        <div>'."\n".
303
-          '          <label for="description">'.get_string('view_recording_description', 'bigbluebuttonbn').'</label><br/>'."\n".
304
-          '          <input type="text" name="description" id="recording_description" value="" placeholder="">'."\n".
305
-          '        </div><br>'."\n".
306
-          '        <div>'."\n".
307
-          '          <label for="tags">'.get_string('view_recording_tags', 'bigbluebuttonbn').'</label><br/>'."\n".
308
-          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">'."\n".
309
-          '        </div>'."\n".
310
-          '      </fieldset>'."\n".
311
-          '    </form>'."\n".
312
-          '  </div>'."\n".
313
-          '</div>';
292
+            '<div id="panelContent" class="hidden">'."\n".
293
+            '  <div class="yui3-widget-bd">'."\n".
294
+            '    <form>'."\n".
295
+            '      <fieldset>'."\n".
296
+            '        <input type="hidden" name="join" id="meeting_join_url" value="">'."\n".
297
+            '        <input type="hidden" name="message" id="meeting_message" value="">'."\n".
298
+            '        <div>'."\n".
299
+            '          <label for="name">'.get_string('view_recording_name', 'bigbluebuttonbn').'</label><br/>'."\n".
300
+            '          <input type="text" name="name" id="recording_name" placeholder="">'."\n".
301
+            '        </div><br>'."\n".
302
+            '        <div>'."\n".
303
+            '          <label for="description">'.get_string('view_recording_description', 'bigbluebuttonbn').'</label><br/>'."\n".
304
+            '          <input type="text" name="description" id="recording_description" value="" placeholder="">'."\n".
305
+            '        </div><br>'."\n".
306
+            '        <div>'."\n".
307
+            '          <label for="tags">'.get_string('view_recording_tags', 'bigbluebuttonbn').'</label><br/>'."\n".
308
+            '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">'."\n".
309
+            '        </div>'."\n".
310
+            '      </fieldset>'."\n".
311
+            '    </form>'."\n".
312
+            '  </div>'."\n".
313
+            '</div>';
314 314
     }
315 315
 }
316 316
 
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
         $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
323 323
 
324 324
         echo '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
325
-             ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
326
-             ''.$OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
325
+                ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
326
+                ''.$OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
327 327
     }
328 328
 }
329 329
 
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later
10 10
  */
11 11
 
12
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
13
-require_once(dirname(__FILE__).'/locallib.php');
12
+require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
13
+require_once(dirname(__FILE__) . '/locallib.php');
14 14
 
15
-$id = required_param('id', PARAM_INT);              // Course Module ID, or
16
-$b  = optional_param('n', 0, PARAM_INT);            // bigbluebuttonbn instance ID
17
-$group  = optional_param('group', 0, PARAM_INT);    // group instance ID
15
+$id = required_param('id', PARAM_INT); // Course Module ID, or
16
+$b  = optional_param('n', 0, PARAM_INT); // bigbluebuttonbn instance ID
17
+$group  = optional_param('group', 0, PARAM_INT); // group instance ID
18 18
 
19 19
 if ($id) {
20 20
     $cm = get_coursemodule_from_id('bigbluebuttonbn', $id, 0, false, MUST_EXIST);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 require_login($course, true, $cm);
32 32
 
33 33
 $version_major = bigbluebuttonbn_get_moodle_version_major();
34
-if ( $version_major < '2013111800' ) {
34
+if ($version_major < '2013111800') {
35 35
     //This is valid before v2.6
36 36
     $module = $DB->get_record('modules', array('name' => 'bigbluebuttonbn'));
37 37
     $module_version = $module->version;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 $bbbsession['roles'] = get_user_roles($context, $USER->id, true);
57 57
 
58 58
 // User roles
59
-if( $bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]" ){
59
+if ($bigbluebuttonbn->participants == null || $bigbluebuttonbn->participants == "" || $bigbluebuttonbn->participants == "[]") {
60 60
     //The room that is being used comes from a previous version
61 61
     $bbbsession['moderator'] = has_capability('mod/bigbluebuttonbn:moderate', $context);
62 62
 } else {
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
 // Database info related to the activity
77 77
 $bbbsession['meetingdescription'] = $bigbluebuttonbn->intro;
78 78
 $bbbsession['welcome'] = $bigbluebuttonbn->welcome;
79
-if( !isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') {
79
+if (!isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') {
80 80
     $bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn');
81 81
 }
82 82
 
83
-$bbbsession['userlimit'] = bigbluebuttonbn_get_cfg_userlimit_editable()? intval($bigbluebuttonbn->userlimit): intval(bigbluebuttonbn_get_cfg_userlimit_default());
84
-$bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0)? 70000 + $bigbluebuttonbn->voicebridge: $bigbluebuttonbn->voicebridge;
83
+$bbbsession['userlimit'] = bigbluebuttonbn_get_cfg_userlimit_editable() ? intval($bigbluebuttonbn->userlimit) : intval(bigbluebuttonbn_get_cfg_userlimit_default());
84
+$bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0) ? 70000 + $bigbluebuttonbn->voicebridge : $bigbluebuttonbn->voicebridge;
85 85
 $bbbsession['wait'] = $bigbluebuttonbn->wait;
86 86
 $bbbsession['record'] = $bigbluebuttonbn->record;
87
-if( $bigbluebuttonbn->record )
88
-    $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
87
+if ($bigbluebuttonbn->record)
88
+    $bbbsession['welcome'] .= '<br><br>' . get_string('bbbrecordwarning', 'bigbluebuttonbn');
89 89
 $bbbsession['tagging'] = $bigbluebuttonbn->tagging;
90 90
 
91 91
 $bbbsession['openingtime'] = $bigbluebuttonbn->openingtime;
@@ -104,29 +104,29 @@  discard block
 block discarded – undo
104 104
 $bbbsession['originServerName'] = $parsedUrl['host'];
105 105
 $bbbsession['originServerUrl'] = $CFG->wwwroot;
106 106
 $bbbsession['originServerCommonName'] = '';
107
-$bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.$module_version.')';
107
+$bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn (' . $module_version . ')';
108 108
 ////////////////////////////////////////////////
109 109
 /////   BigBlueButton Session Setup Ends   /////
110 110
 ////////////////////////////////////////////////
111 111
 
112 112
 // Validates if the BigBlueButton server is running
113 113
 $serverVersion = bigbluebuttonbn_getServerVersion($bbbsession['endpoint']);
114
-if ( !isset($serverVersion) ) { //Server is not working
115
-    if ( $bbbsession['administrator'] )
116
-        print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
117
-    else if ( $bbbsession['moderator'] )
118
-        print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
114
+if (!isset($serverVersion)) { //Server is not working
115
+    if ($bbbsession['administrator'])
116
+        print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
117
+    else if ($bbbsession['moderator'])
118
+        print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
119 119
     else
120
-        print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
120
+        print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
121 121
 } else {
122
-    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) );
123
-    if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong
124
-        if ( $bbbsession['administrator'] )
125
-            print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
126
-        else if ( $bbbsession['moderator'] )
127
-            print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
122
+    $xml = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getMeetingsURL($bbbsession['endpoint'], $bbbsession['shared_secret']));
123
+    if (!isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED') { // The shared secret is wrong
124
+        if ($bbbsession['administrator'])
125
+            print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');
126
+        else if ($bbbsession['moderator'])
127
+            print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
128 128
         else
129
-            print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
129
+            print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);
130 130
     }
131 131
 }
132 132
 
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 
137 137
 // Print the page header
138 138
 $PAGE->set_context($context);
139
-$PAGE->set_url($CFG->wwwroot.'/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
139
+$PAGE->set_url($CFG->wwwroot . '/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
140 140
 $PAGE->set_title(format_string($bigbluebuttonbn->name));
141 141
 $PAGE->set_cacheable(false);
142 142
 $PAGE->set_heading($course->fullname);
143 143
 
144
-if( $bigbluebuttonbn->newwindow == 1 ) {
144
+if ($bigbluebuttonbn->newwindow == 1) {
145 145
     $PAGE->blocks->show_only_fake_blocks();
146 146
 
147 147
 } else {
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 }
150 150
 
151 151
 // Validate if the user is in a role allowed to join
152
-if ( !has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context) ) {
152
+if (!has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context)) {
153 153
     echo $OUTPUT->header();
154 154
     if (isguestuser()) {
155
-        echo $OUTPUT->confirm('<p>'.get_string('view_noguests', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
156
-            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
155
+        echo $OUTPUT->confirm('<p>' . get_string('view_noguests', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'),
156
+            get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);
157 157
     } else {
158
-        echo $OUTPUT->confirm('<p>'.get_string('view_nojoin', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
159
-            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
158
+        echo $OUTPUT->confirm('<p>' . get_string('view_nojoin', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'),
159
+            get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);
160 160
     }
161 161
 
162 162
     echo $OUTPUT->footer();
@@ -164,30 +164,30 @@  discard block
 block discarded – undo
164 164
 }
165 165
 
166 166
 // Operation URLs
167
-$bbbsession['courseURL'] = $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course;
168
-$bbbsession['logoutURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id.'&bn='.$bbbsession['bigbluebuttonbn']->id;
169
-$bbbsession['recordingReadyURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready';
170
-$bbbsession['joinURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=join&id='.$id.'&bigbluebuttonbn='.$bbbsession['bigbluebuttonbn']->id;
167
+$bbbsession['courseURL'] = $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course;
168
+$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id=' . $id . '&bn=' . $bbbsession['bigbluebuttonbn']->id;
169
+$bbbsession['recordingReadyURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready';
170
+$bbbsession['joinURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=join&id=' . $id . '&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbn']->id;
171 171
 
172 172
 // Output starts here
173 173
 echo $OUTPUT->header();
174 174
 
175 175
 /// find out current groups mode
176 176
 $groupmode = groups_get_activity_groupmode($bbbsession['cm']);
177
-if ($groupmode == NOGROUPS ) {  //No groups mode
178
-    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbn']->id;
177
+if ($groupmode == NOGROUPS) {  //No groups mode
178
+    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' . $bbbsession['bigbluebuttonbn']->id;
179 179
     $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name;
180 180
 
181 181
 } else {                                        // Separate or visible groups mode
182 182
     echo $OUTPUT->box_start('generalbox boxaligncenter');
183
-    echo '<br><div class="alert alert-warning">'.get_string('view_groups_selection_warning', 'bigbluebuttonbn').'</div>';
183
+    echo '<br><div class="alert alert-warning">' . get_string('view_groups_selection_warning', 'bigbluebuttonbn') . '</div>';
184 184
     echo $OUTPUT->box_end();
185 185
 
186 186
     $bbbsession['group'] = groups_get_activity_group($bbbsession['cm'], true);
187
-    if ($groupmode == SEPARATEGROUPS ) {
188
-        groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id, false, true);
189
-        if( $bbbsession['group'] == 0 ) {
190
-            if ( $bbbsession['administrator'] ) {
187
+    if ($groupmode == SEPARATEGROUPS) {
188
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id, false, true);
189
+        if ($bbbsession['group'] == 0) {
190
+            if ($bbbsession['administrator']) {
191 191
                 $my_groups = groups_get_all_groups($bbbsession['course']->id);
192 192
             } else {
193 193
                 $my_groups = groups_get_activity_allowed_groups($bbbsession['cm']);
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
         }
198 198
 
199 199
     } else {
200
-        groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id);
200
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id);
201 201
     }
202 202
 
203
-    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
204
-    if( $bbbsession['group'] > 0 )
203
+    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' . $bbbsession['bigbluebuttonbn']->id . '[' . $bbbsession['group'] . ']';
204
+    if ($bbbsession['group'] > 0)
205 205
         $group_name = groups_get_group_name($bbbsession['group']);
206 206
     else
207 207
         $group_name = get_string('allparticipants');
208
-    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$group_name.')';
208
+    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name . ' (' . $group_name . ')';
209 209
 }
210 210
 // Metadata (context)
211 211
 $bbbsession['contextActivityName'] = $bbbsession['meetingname'];
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 $bigbluebuttonbn_activity = 'open';
216 216
 $now = time();
217
-if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime ) {
217
+if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime) {
218 218
     //ACTIVITY HAS NOT BEEN OPENED
219 219
     $bigbluebuttonbn_activity = 'not_started';
220 220
 
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
     'activity' => $bigbluebuttonbn_activity,
239 239
     'meetingid' => $bbbsession['meetingid'],
240 240
     'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbn']->id,
241
-    'ping_interval' => ($waitformoderator_ping_interval > 0? $waitformoderator_ping_interval * 1000: 15000),
241
+    'ping_interval' => ($waitformoderator_ping_interval > 0 ? $waitformoderator_ping_interval * 1000 : 15000),
242 242
     'userlimit' => $bbbsession['userlimit'],
243 243
     'locales' => bigbluebuttonbn_get_locales_for_ui(),
244
-    'opening' => ($bbbsession['openingtime'])? get_string('mod_form_field_openingtime','bigbluebuttonbn').': '.userdate($bbbsession['openingtime']) : '',
245
-    'closing' => ($bbbsession['closingtime'])? get_string('mod_form_field_closingtime','bigbluebuttonbn').': '.userdate($bbbsession['closingtime']) : ''
244
+    'opening' => ($bbbsession['openingtime']) ? get_string('mod_form_field_openingtime', 'bigbluebuttonbn') . ': ' . userdate($bbbsession['openingtime']) : '',
245
+    'closing' => ($bbbsession['closingtime']) ? get_string('mod_form_field_closingtime', 'bigbluebuttonbn') . ': ' . userdate($bbbsession['closingtime']) : ''
246 246
 );
247 247
 
248 248
 $PAGE->requires->data_for_js('bigbluebuttonbn', $jsVars);
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
     echo $OUTPUT->box_end();
270 270
 
271 271
     echo $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box');
272
-    echo '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>'."\n";
272
+    echo '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>' . "\n";
273 273
     echo $OUTPUT->box_end();
274 274
 
275
-    if ( $activity == 'not_started' ) {
275
+    if ($activity == 'not_started') {
276 276
         // Do nothing
277 277
     } else {
278
-        if ( $activity == 'ended' ) {
278
+        if ($activity == 'ended') {
279 279
             bigbluebuttonbn_view_ended($bbbsession);
280 280
         } else {
281 281
             bigbluebuttonbn_view_joining($bbbsession);
@@ -287,29 +287,29 @@  discard block
 block discarded – undo
287 287
 
288 288
 function bigbluebuttonbn_view_joining($bbbsession) {
289 289
 
290
-    if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ){
291
-        echo ''.
292
-          '<div id="panelContent" class="hidden">'."\n".
293
-          '  <div class="yui3-widget-bd">'."\n".
294
-          '    <form>'."\n".
295
-          '      <fieldset>'."\n".
296
-          '        <input type="hidden" name="join" id="meeting_join_url" value="">'."\n".
297
-          '        <input type="hidden" name="message" id="meeting_message" value="">'."\n".
298
-          '        <div>'."\n".
299
-          '          <label for="name">'.get_string('view_recording_name', 'bigbluebuttonbn').'</label><br/>'."\n".
300
-          '          <input type="text" name="name" id="recording_name" placeholder="">'."\n".
301
-          '        </div><br>'."\n".
302
-          '        <div>'."\n".
303
-          '          <label for="description">'.get_string('view_recording_description', 'bigbluebuttonbn').'</label><br/>'."\n".
304
-          '          <input type="text" name="description" id="recording_description" value="" placeholder="">'."\n".
305
-          '        </div><br>'."\n".
306
-          '        <div>'."\n".
307
-          '          <label for="tags">'.get_string('view_recording_tags', 'bigbluebuttonbn').'</label><br/>'."\n".
308
-          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">'."\n".
309
-          '        </div>'."\n".
310
-          '      </fieldset>'."\n".
311
-          '    </form>'."\n".
312
-          '  </div>'."\n".
290
+    if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) {
291
+        echo '' .
292
+          '<div id="panelContent" class="hidden">' . "\n" .
293
+          '  <div class="yui3-widget-bd">' . "\n" .
294
+          '    <form>' . "\n" .
295
+          '      <fieldset>' . "\n" .
296
+          '        <input type="hidden" name="join" id="meeting_join_url" value="">' . "\n" .
297
+          '        <input type="hidden" name="message" id="meeting_message" value="">' . "\n" .
298
+          '        <div>' . "\n" .
299
+          '          <label for="name">' . get_string('view_recording_name', 'bigbluebuttonbn') . '</label><br/>' . "\n" .
300
+          '          <input type="text" name="name" id="recording_name" placeholder="">' . "\n" .
301
+          '        </div><br>' . "\n" .
302
+          '        <div>' . "\n" .
303
+          '          <label for="description">' . get_string('view_recording_description', 'bigbluebuttonbn') . '</label><br/>' . "\n" .
304
+          '          <input type="text" name="description" id="recording_description" value="" placeholder="">' . "\n" .
305
+          '        </div><br>' . "\n" .
306
+          '        <div>' . "\n" .
307
+          '          <label for="tags">' . get_string('view_recording_tags', 'bigbluebuttonbn') . '</label><br/>' . "\n" .
308
+          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">' . "\n" .
309
+          '        </div>' . "\n" .
310
+          '      </fieldset>' . "\n" .
311
+          '    </form>' . "\n" .
312
+          '  </div>' . "\n" .
313 313
           '</div>';
314 314
     }
315 315
 }
@@ -317,26 +317,26 @@  discard block
 block discarded – undo
317 317
 function bigbluebuttonbn_view_ended($bbbsession) {
318 318
     global $OUTPUT;
319 319
 
320
-    if( !is_null($bbbsession['presentation']['url']) ) {
320
+    if (!is_null($bbbsession['presentation']['url'])) {
321 321
         $attributes = array('title' => $bbbsession['presentation']['name']);
322 322
         $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
323 323
 
324
-        echo '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
325
-             ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
326
-             ''.$OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
324
+        echo '<h4>' . get_string('view_section_title_presentation', 'bigbluebuttonbn') . '</h4>' .
325
+             '' . $OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false) . '' .
326
+             '' . $OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes) . '<br><br>';
327 327
     }
328 328
 }
329 329
 
330 330
 function bigbluebuttonbn_view_recordings($bbbsession) {
331 331
     global $CFG;
332 332
 
333
-    if( isset($bbbsession['record']) && $bbbsession['record'] ) {
334
-        $output = html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn') );
333
+    if (isset($bbbsession['record']) && $bbbsession['record']) {
334
+        $output = html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn'));
335 335
 
336
-        $meetingID='';
336
+        $meetingID = '';
337 337
         $results = bigbluebuttonbn_getRecordedMeetings($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
338 338
 
339
-        if( $results ){
339
+        if ($results) {
340 340
             //Eliminates duplicates
341 341
             $mIDs = array();
342 342
             foreach ($results as $result) {
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         }
351 351
 
352 352
         // Get actual recordings
353
-        if ( $meetingID != '' ) {
353
+        if ($meetingID != '') {
354 354
             $recordings = bigbluebuttonbn_getRecordingsArray($meetingID, $bbbsession['endpoint'], $bbbsession['shared_secret']);
355 355
         } else {
356 356
             $recordings = Array();
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
         // Get recording links
359 359
         $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
360 360
         // Merge the recordings
361
-        $recordings = array_merge( $recordings, $recordings_imported );
361
+        $recordings = array_merge($recordings, $recordings_imported);
362 362
         // Render the table
363
-        $output .= bigbluebutton_output_recording_table($bbbsession, $recordings)."\n";
363
+        $output .= bigbluebutton_output_recording_table($bbbsession, $recordings) . "\n";
364 364
 
365
-        if ( $bbbsession['managerecordings'] && bigbluebuttonbn_get_cfg_importrecordings_enabled() ) {
366
-            $button_import_recordings = html_writer::tag( 'input', '', array('type' => 'button', 'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'), 'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='.$bbbsession['bigbluebuttonbn']->id.'\'') );
365
+        if ($bbbsession['managerecordings'] && bigbluebuttonbn_get_cfg_importrecordings_enabled()) {
366
+            $button_import_recordings = html_writer::tag('input', '', array('type' => 'button', 'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'), 'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/import_view.php?bn=' . $bbbsession['bigbluebuttonbn']->id . '\''));
367 367
             $output .= html_writer::start_tag('br');
368 368
             $output .= html_writer::tag('span', $button_import_recordings, ['id'=>"import_recording_links_button"]);
369 369
             $output .= html_writer::tag('span', '', ['id'=>"import_recording_links_table"]);
Please login to merge, or discard this patch.