Completed
Push — master ( 43b232...a6a187 )
by Jesus
02:48
created
view.php 2 patches
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 83
 $bbbsession['userlimit'] = intval($bigbluebuttonbn->userlimit);
84
-$bbbsession['voicebridge'] = ($bigbluebuttonbn->voicebridge > 0)? 70000 + $bigbluebuttonbn->voicebridge: $bigbluebuttonbn->voicebridge;
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,10 +164,10 @@  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
 $bigbluebuttonbn_view = '';
173 173
 
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
 
177 177
 /// find out current groups mode
178 178
 $groupmode = groups_get_activity_groupmode($bbbsession['cm']);
179
-if ($groupmode == NOGROUPS ) {  //No groups mode
180
-    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbn']->id;
179
+if ($groupmode == NOGROUPS) {  //No groups mode
180
+    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' . $bbbsession['bigbluebuttonbn']->id;
181 181
     $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name;
182 182
 
183 183
 } else {                                        // Separate or visible groups mode
184 184
     echo $OUTPUT->box_start('generalbox boxaligncenter');
185
-    echo '<br><div class="alert alert-warning">'.get_string('view_groups_selection_warning', 'bigbluebuttonbn').'</div>';
185
+    echo '<br><div class="alert alert-warning">' . get_string('view_groups_selection_warning', 'bigbluebuttonbn') . '</div>';
186 186
     echo $OUTPUT->box_end();
187 187
 
188 188
     $bbbsession['group'] = groups_get_activity_group($bbbsession['cm'], true);
189
-    if ($groupmode == SEPARATEGROUPS ) {
190
-        groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id, false, true);
191
-        if( $bbbsession['group'] == 0 ) {
192
-            if ( $bbbsession['administrator'] ) {
189
+    if ($groupmode == SEPARATEGROUPS) {
190
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id, false, true);
191
+        if ($bbbsession['group'] == 0) {
192
+            if ($bbbsession['administrator']) {
193 193
                 $my_groups = groups_get_all_groups($bbbsession['course']->id);
194 194
             } else {
195 195
                 $my_groups = groups_get_activity_allowed_groups($bbbsession['cm']);
@@ -199,15 +199,15 @@  discard block
 block discarded – undo
199 199
         }
200 200
 
201 201
     } else {
202
-        groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id);
202
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id);
203 203
     }
204 204
 
205
-    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
206
-    if( $bbbsession['group'] > 0 )
205
+    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' . $bbbsession['bigbluebuttonbn']->id . '[' . $bbbsession['group'] . ']';
206
+    if ($bbbsession['group'] > 0)
207 207
         $group_name = groups_get_group_name($bbbsession['group']);
208 208
     else
209 209
         $group_name = get_string('allparticipants');
210
-    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$group_name.')';
210
+    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name . ' (' . $group_name . ')';
211 211
 }
212 212
 // Metadata (context)
213 213
 $bbbsession['contextActivityName'] = $bbbsession['meetingname'];
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 $bbbsession['contextActivityTags'] = "";
216 216
 
217 217
 $now = time();
218
-if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime ) {
218
+if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime) {
219 219
     //CALLING BEFORE
220 220
     $bigbluebuttonbn_view = 'before';
221 221
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         'action' => $bigbluebuttonbn_view,
248 248
         'meetingid' => $bbbsession['meetingid'],
249 249
         'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbn']->id,
250
-        'ping_interval' => ($waitformoderator_ping_interval > 0? $waitformoderator_ping_interval * 1000: 15000),
250
+        'ping_interval' => ($waitformoderator_ping_interval > 0 ? $waitformoderator_ping_interval * 1000 : 15000),
251 251
         'userlimit' => $bbbsession['userlimit'],
252 252
         'locales' => bigbluebuttonbn_get_locales_for_ui()
253 253
     );
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 // Finish the page
265 265
 echo $OUTPUT->footer();
266 266
 
267
-function bigbluebuttonbn_view_joining($bbbsession){
267
+function bigbluebuttonbn_view_joining($bbbsession) {
268 268
     global $CFG, $DB, $OUTPUT;
269 269
 
270 270
     echo $OUTPUT->heading($bbbsession['meetingname'], 3);
@@ -273,29 +273,29 @@  discard block
 block discarded – undo
273 273
     echo '<br><span id="status_bar"></span><br>';
274 274
     echo '<span id="control_panel"></span>';
275 275
     echo $OUTPUT->box_end();
276
-    if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ){
277
-        echo ''.
278
-          '<div id="panelContent" class="hidden">'.
279
-          '  <div class="yui3-widget-bd">'.
280
-          '    <form>'.
281
-          '      <fieldset>'.
282
-          '        <input type="hidden" name="join" id="meeting_join_url" value="">'.
283
-          '        <input type="hidden" name="message" id="meeting_message" value="">'.
284
-          '        <div>'.
285
-          '          <label for="name">'.get_string('view_recording_name', 'bigbluebuttonbn').'</label><br/>'.
286
-          '          <input type="text" name="name" id="recording_name" placeholder="">'.
287
-          '        </div><br>'.
288
-          '        <div>'.
289
-          '          <label for="description">'.get_string('view_recording_description', 'bigbluebuttonbn').'</label><br/>'.
290
-          '          <input type="text" name="description" id="recording_description" value="" placeholder="">'.
291
-          '        </div><br>'.
292
-          '        <div>'.
293
-          '          <label for="tags">'.get_string('view_recording_tags', 'bigbluebuttonbn').'</label><br/>'.
294
-          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">'.
295
-          '        </div>'.
296
-          '      </fieldset>'.
297
-          '    </form>'.
298
-          '  </div>'.
276
+    if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) {
277
+        echo '' .
278
+          '<div id="panelContent" class="hidden">' .
279
+          '  <div class="yui3-widget-bd">' .
280
+          '    <form>' .
281
+          '      <fieldset>' .
282
+          '        <input type="hidden" name="join" id="meeting_join_url" value="">' .
283
+          '        <input type="hidden" name="message" id="meeting_message" value="">' .
284
+          '        <div>' .
285
+          '          <label for="name">' . get_string('view_recording_name', 'bigbluebuttonbn') . '</label><br/>' .
286
+          '          <input type="text" name="name" id="recording_name" placeholder="">' .
287
+          '        </div><br>' .
288
+          '        <div>' .
289
+          '          <label for="description">' . get_string('view_recording_description', 'bigbluebuttonbn') . '</label><br/>' .
290
+          '          <input type="text" name="description" id="recording_description" value="" placeholder="">' .
291
+          '        </div><br>' .
292
+          '        <div>' .
293
+          '          <label for="tags">' . get_string('view_recording_tags', 'bigbluebuttonbn') . '</label><br/>' .
294
+          '          <input type="text" name="tags" id="recording_tags" value="" placeholder="">' .
295
+          '        </div>' .
296
+          '      </fieldset>' .
297
+          '    </form>' .
298
+          '  </div>' .
299 299
           '</div>';
300 300
     }
301 301
 
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
     bigbluebuttonbn_view_recordings($bbbsession);
307 307
 }
308 308
 
309
-function bigbluebuttonbn_view_before( $bbbsession ){
309
+function bigbluebuttonbn_view_before($bbbsession) {
310 310
     global $CFG, $DB, $OUTPUT;
311 311
 
312 312
     echo $OUTPUT->heading(get_string('view_message_conference_not_started', 'bigbluebuttonbn'), 3);
313 313
 
314 314
     echo '<table>';
315 315
     if ($bbbsession['openingtime']) {
316
-        echo '<tr><td class="c0">'.get_string('mod_form_field_openingtime','bigbluebuttonbn').':</td>';
317
-        echo '    <td class="c1">'.userdate($bbbsession['openingtime']).'</td></tr>';
316
+        echo '<tr><td class="c0">' . get_string('mod_form_field_openingtime', 'bigbluebuttonbn') . ':</td>';
317
+        echo '    <td class="c1">' . userdate($bbbsession['openingtime']) . '</td></tr>';
318 318
     }
319 319
     if ($bbbsession['closingtime']) {
320
-        echo '<tr><td class="c0">'.get_string('mod_form_field_closingtime','bigbluebuttonbn').':</td>';
321
-        echo '    <td class="c1">'.userdate($bbbsession['closingtime']).'</td></tr>';
320
+        echo '<tr><td class="c0">' . get_string('mod_form_field_closingtime', 'bigbluebuttonbn') . ':</td>';
321
+        echo '    <td class="c1">' . userdate($bbbsession['closingtime']) . '</td></tr>';
322 322
     }
323 323
     echo '</table>';
324 324
 }
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
 
329 329
     echo $OUTPUT->heading(get_string('view_message_conference_has_ended', 'bigbluebuttonbn'), 3);
330 330
 
331
-    if( !is_null($bbbsession['presentation']['url']) ) {
331
+    if (!is_null($bbbsession['presentation']['url'])) {
332 332
         $attributes = array('title' => $bbbsession['presentation']['name']);
333 333
         $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
334 334
 
335
-        echo '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
336
-             ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
337
-             ''.$OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
335
+        echo '<h4>' . get_string('view_section_title_presentation', 'bigbluebuttonbn') . '</h4>' .
336
+             '' . $OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false) . '' .
337
+             '' . $OUTPUT->action_link($bbbsession['presentation']['url'], $bbbsession['presentation']['name'], null, $attributes) . '<br><br>';
338 338
     }
339 339
 
340 340
     bigbluebuttonbn_view_recordings($bbbsession);
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 function bigbluebuttonbn_view_recordings($bbbsession) {
344 344
     global $CFG;
345 345
 
346
-    if( isset($bbbsession['record']) && $bbbsession['record'] ) {
347
-        $output = html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn') );
346
+    if (isset($bbbsession['record']) && $bbbsession['record']) {
347
+        $output = html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn'));
348 348
 
349
-        $meetingID='';
349
+        $meetingID = '';
350 350
         $results = bigbluebuttonbn_getRecordedMeetings($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
351 351
 
352 352
         //if( $recordingsbn->include_deleted_activities ) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         //    $results = array_merge($results, $results_deleted);
355 355
         //}
356 356
 
357
-        if( $results ){
357
+        if ($results) {
358 358
             //Eliminates duplicates
359 359
             $mIDs = array();
360 360
             foreach ($results as $result) {
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
         // Get actual recordings
371 371
         //$recordings = bigbluebuttonbn_getRecordingsArray($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret']);
372
-        if ( $meetingID != '' ) {
372
+        if ($meetingID != '') {
373 373
             $recordings = bigbluebuttonbn_getRecordingsArray($meetingID, $bbbsession['endpoint'], $bbbsession['shared_secret']);
374 374
         } else {
375 375
             $recordings = Array();
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
         // Get recording links
378 378
         $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
379 379
         // Merge the recordings
380
-        $recordings = array_merge( $recordings, $recordings_imported );
380
+        $recordings = array_merge($recordings, $recordings_imported);
381 381
         // Render the table
382
-        $output .= bigbluebutton_output_recording_table($bbbsession, $recordings)."\n";
382
+        $output .= bigbluebutton_output_recording_table($bbbsession, $recordings) . "\n";
383 383
 
384
-        if ( $bbbsession['managerecordings'] && bigbluebuttonbn_get_cfg_importrecordings_enabled() ) {
385
-            $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.'\'') );
384
+        if ($bbbsession['managerecordings'] && bigbluebuttonbn_get_cfg_importrecordings_enabled()) {
385
+            $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 . '\''));
386 386
             $output .= html_writer::start_tag('br');
387 387
             $output .= html_writer::tag('span', $button_import_recordings, ['id'=>"import_recording_links_button"]);
388 388
             $output .= html_writer::tag('span', '', ['id'=>"import_recording_links_table"]);
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 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 )
87
+if( $bigbluebuttonbn->record ) {
88 88
     $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
89
+}
89 90
 $bbbsession['tagging'] = $bigbluebuttonbn->tagging;
90 91
 
91 92
 $bbbsession['openingtime'] = $bigbluebuttonbn->openingtime;
@@ -112,22 +113,24 @@  discard block
 block discarded – undo
112 113
 // Validates if the BigBlueButton server is running
113 114
 $serverVersion = bigbluebuttonbn_getServerVersion($bbbsession['endpoint']);
114 115
 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
-    else
120
-        print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
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'] )
116
+    if ( $bbbsession['administrator'] ) {
125 117
             print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
126
-        else if ( $bbbsession['moderator'] )
118
+    } else if ( $bbbsession['moderator'] ) {
127 119
             print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
128
-        else
120
+    } else {
129 121
             print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
130 122
     }
123
+    } else {
124
+    $xml = bigbluebuttonbn_wrap_xml_load_file( bigbluebuttonbn_getMeetingsURL( $bbbsession['endpoint'], $bbbsession['shared_secret'] ) );
125
+    if ( !isset($xml) || !isset($xml->returncode) || $xml->returncode == 'FAILED' ){ // The shared secret is wrong
126
+        if ( $bbbsession['administrator'] ) {
127
+                    print_error( 'view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn' );
128
+        } else if ( $bbbsession['moderator'] ) {
129
+                    print_error( 'view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
130
+        } else {
131
+                    print_error( 'view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course );
132
+        }
133
+    }
131 134
 }
132 135
 
133 136
 // Mark viewed by user (if required)
@@ -203,10 +206,11 @@  discard block
 block discarded – undo
203 206
     }
204 207
 
205 208
     $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.$bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
206
-    if( $bbbsession['group'] > 0 )
207
-        $group_name = groups_get_group_name($bbbsession['group']);
208
-    else
209
-        $group_name = get_string('allparticipants');
209
+    if( $bbbsession['group'] > 0 ) {
210
+            $group_name = groups_get_group_name($bbbsession['group']);
211
+    } else {
212
+            $group_name = get_string('allparticipants');
213
+    }
210 214
     $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$group_name.')';
211 215
 }
212 216
 // Metadata (context)
@@ -362,7 +366,9 @@  discard block
 block discarded – undo
362 366
             }
363 367
             //Generates the meetingID string
364 368
             foreach ($mIDs as $mID) {
365
-                if (strlen($meetingID) > 0) $meetingID .= ',';
369
+                if (strlen($meetingID) > 0) {
370
+                    $meetingID .= ',';
371
+                }
366 372
                 $meetingID .= $mID;
367 373
             }
368 374
         }
Please login to merge, or discard this patch.