@@ -207,7 +207,7 @@ discard block  | 
                                                    ||
| 207 | 207 | * $return->time = the time they did it  | 
                                                        
| 208 | 208 | * $return->info = a short text description.  | 
                                                        
| 209 | 209 | *  | 
                                                        
| 210 | - * @return bool  | 
                                                        |
| 210 | + * @return string  | 
                                                        |
| 211 | 211 | */  | 
                                                        
| 212 | 212 |  function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { | 
                                                        
| 213 | 213 | global $DB;  | 
                                                        
@@ -488,6 +488,8 @@ discard block  | 
                                                    ||
| 488 | 488 | |
| 489 | 489 | /**  | 
                                                        
| 490 | 490 | * Helper for validating pluginfile.  | 
                                                        
| 491 | + * @param stdClass $context  | 
                                                        |
| 492 | + * @param string $filearea  | 
                                                        |
| 491 | 493 | */  | 
                                                        
| 492 | 494 |  function bigbluebuttonbn_pluginfile_valid($context, $filearea) { | 
                                                        
| 493 | 495 |      if ($context->contextlevel != CONTEXT_MODULE) { | 
                                                        
@@ -504,6 +506,10 @@ discard block  | 
                                                    ||
| 504 | 506 | |
| 505 | 507 | /**  | 
                                                        
| 506 | 508 | * Helper for getting pluginfile.  | 
                                                        
| 509 | + * @param stdClass $course  | 
                                                        |
| 510 | + * @param stdClass $cm  | 
                                                        |
| 511 | + * @param stdClass $context  | 
                                                        |
| 512 | + * @param string $filearea  | 
                                                        |
| 507 | 513 | */  | 
                                                        
| 508 | 514 |  function bigbluebuttonbn_pluginfile_file($course, $cm, $context, $filearea, $args) { | 
                                                        
| 509 | 515 | $filename = bigbluebuttonbn_pluginfile_filename($course, $cm, $context, $args);  | 
                                                        
@@ -24,8 +24,8 @@ discard block  | 
                                                    ||
| 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 |  $a = optional_param('a', 0, PARAM_INT); | 
                                                        
@@ -88,12 +88,12 @@ discard block  | 
                                                    ||
| 88 | 88 |      if ($moderator || $administrator) { | 
                                                        
| 89 | 89 | bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $cm);  | 
                                                        
| 90 | 90 |          echo get_string('index_ending', 'bigbluebuttonbn'); | 
                                                        
| 91 | - $meetingid = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id;  | 
                                                        |
| 91 | + $meetingid = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;  | 
                                                        |
| 92 | 92 |          if ($g != '0') { | 
                                                        
| 93 | - $meetingid .= '['.$g.']';  | 
                                                        |
| 93 | + $meetingid .= '[' . $g . ']';  | 
                                                        |
| 94 | 94 | }  | 
                                                        
| 95 | 95 | bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingid));  | 
                                                        
| 96 | -        redirect('index.php?id='.$id); | 
                                                        |
| 96 | +        redirect('index.php?id=' . $id); | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | 99 | |
@@ -107,7 +107,7 @@ discard block  | 
                                                    ||
| 107 | 107 | // Add a the data for the bigbluebuttonbn instance.  | 
                                                        
| 108 | 108 | $groupobj = null;  | 
                                                        
| 109 | 109 |          if (groups_get_activity_groupmode($cm) > 0) { | 
                                                        
| 110 | -            $groupobj = (object) array('id' => 0, 'name' => get_string('allparticipants')); | 
                                                        |
| 110 | +            $groupobj = (object)array('id' => 0, 'name' => get_string('allparticipants')); | 
                                                        |
| 111 | 111 | }  | 
                                                        
| 112 | 112 | $table->data[] = bigbluebuttonbn_index_display_room($canmoderate, $course, $bigbluebuttonbn, $groupobj);  | 
                                                        
| 113 | 113 | // Add a the data for the groups belonging to the bigbluebuttonbn instance, if any.  | 
                                                        
@@ -124,12 +124,12 @@ discard block  | 
                                                    ||
| 124 | 124 | echo $OUTPUT->footer();  | 
                                                        
| 125 | 125 | |
| 126 | 126 |  function bigbluebuttonbn_index_display_room($moderator, $course, $bigbluebuttonbn, $groupobj = null) { | 
                                                        
| 127 | - $meetingid = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id;  | 
                                                        |
| 127 | + $meetingid = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id;  | 
                                                        |
| 128 | 128 | $paramgroup = '';  | 
                                                        
| 129 | 129 | $groupname = '';  | 
                                                        
| 130 | 130 |      if ($groupobj) { | 
                                                        
| 131 | - $meetingid .= '['.$groupobj->id.']';  | 
                                                        |
| 132 | - $paramgroup = '&group='.$groupobj->id;  | 
                                                        |
| 131 | + $meetingid .= '[' . $groupobj->id . ']';  | 
                                                        |
| 132 | + $paramgroup = '&group=' . $groupobj->id;  | 
                                                        |
| 133 | 133 | $groupname = $groupobj->name;  | 
                                                        
| 134 | 134 | }  | 
                                                        
| 135 | 135 | $meetinginfo = bigbluebuttonbn_get_meeting_info_array($meetingid);  | 
                                                        
@@ -144,7 +144,7 @@ discard block  | 
                                                    ||
| 144 | 144 | return;  | 
                                                        
| 145 | 145 | }  | 
                                                        
| 146 | 146 | // Output Users in the meeting.  | 
                                                        
| 147 | - $joinurl = '<a href="view.php?id='.$bigbluebuttonbn->coursemodule.$paramgroup.'">'.format_string($bigbluebuttonbn->name).'</a>';  | 
                                                        |
| 147 | + $joinurl = '<a href="view.php?id=' . $bigbluebuttonbn->coursemodule . $paramgroup . '">' . format_string($bigbluebuttonbn->name) . '</a>';  | 
                                                        |
| 148 | 148 | $group = $groupname;  | 
                                                        
| 149 | 149 | $users = '';  | 
                                                        
| 150 | 150 | $viewerlist = '';  | 
                                                        
@@ -176,7 +176,7 @@ discard block  | 
                                                    ||
| 176 | 176 | $attendeecount = 0;  | 
                                                        
| 177 | 177 |          foreach ($meetinginfo['attendees']->attendee as $attendee) { | 
                                                        
| 178 | 178 |              if ($attendee->role == $role) { | 
                                                        
| 179 | - $attendeelist .= ($attendeecount++ > 0 ? ', ' : '').$attendee->fullName;  | 
                                                        |
| 179 | + $attendeelist .= ($attendeecount++ > 0 ? ', ' : '') . $attendee->fullName;  | 
                                                        |
| 180 | 180 | }  | 
                                                        
| 181 | 181 | }  | 
                                                        
| 182 | 182 | }  | 
                                                        
@@ -195,15 +195,15 @@ discard block  | 
                                                    ||
| 195 | 195 |  function bigbluebuttonbn_index_display_room_actions($moderator, $course, $bigbluebuttonbn, $groupobj = null) { | 
                                                        
| 196 | 196 | $actions = '';  | 
                                                        
| 197 | 197 |      if ($moderator) { | 
                                                        
| 198 | - $actions .= '<form name="form1" method="post" action="">'.'/n';  | 
                                                        |
| 199 | - $actions .= ' <INPUT type="hidden" name="id" value="'.$course->id.'">'.'/n';  | 
                                                        |
| 200 | - $actions .= ' <INPUT type="hidden" name="a" value="'.$bigbluebuttonbn->id.'">'.'/n';  | 
                                                        |
| 198 | + $actions .= '<form name="form1" method="post" action="">' . '/n';  | 
                                                        |
| 199 | + $actions .= ' <INPUT type="hidden" name="id" value="' . $course->id . '">' . '/n';  | 
                                                        |
| 200 | + $actions .= ' <INPUT type="hidden" name="a" value="' . $bigbluebuttonbn->id . '">' . '/n';  | 
                                                        |
| 201 | 201 |          if ($groupobj != null) { | 
                                                        
| 202 | - $actions .= ' <INPUT type="hidden" name="g" value="'.$groupobj->id.'">'.'/n';  | 
                                                        |
| 202 | + $actions .= ' <INPUT type="hidden" name="g" value="' . $groupobj->id . '">' . '/n';  | 
                                                        |
| 203 | 203 | }  | 
                                                        
| 204 | - $actions .= ' <INPUT type="submit" name="submit" value="end" onclick="return confirm(\''.  | 
                                                        |
| 205 | -            get_string('index_confirm_end', 'bigbluebuttonbn').'\')">'.'/n'; | 
                                                        |
| 206 | - $actions .= '</form>'.'/n';  | 
                                                        |
| 204 | + $actions .= ' <INPUT type="submit" name="submit" value="end" onclick="return confirm(\'' .  | 
                                                        |
| 205 | +            get_string('index_confirm_end', 'bigbluebuttonbn') . '\')">' . '/n'; | 
                                                        |
| 206 | + $actions .= '</form>' . '/n';  | 
                                                        |
| 207 | 207 | }  | 
                                                        
| 208 | 208 | return $actions;  | 
                                                        
| 209 | 209 | }  | 
                                                        
@@ -23,8 +23,8 @@ discard block  | 
                                                    ||
| 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 |  $bn = required_param('bn', PARAM_INT); | 
                                                        
| 30 | 30 |  $tc = optional_param('tc', 0, PARAM_INT); | 
                                                        
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 |      $output .= html_writer::tag('input', '', | 
                                                        
| 100 | 100 |          array('type' => 'button', 'class' => 'btn btn-secondary', | 
                                                        
| 101 | 101 |                'value' => get_string('view_recording_button_return', 'bigbluebuttonbn'), | 
                                                        
| 102 | - 'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$cm->id.'\''));  | 
                                                        |
| 102 | + 'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $cm->id . '\''));  | 
                                                        |
| 103 | 103 | |
| 104 | 104 | // JavaScript for locales.  | 
                                                        
| 105 | 105 | $PAGE->requires->strings_for_js(array_keys(bigbluebuttonbn_get_strings_for_js()), 'bigbluebuttonbn');  | 
                                                        
@@ -93,7 +93,7 @@ discard block  | 
                                                    ||
| 93 | 93 | 'alt' => $contents,  | 
                                                        
| 94 | 94 | 'title' => $contents,  | 
                                                        
| 95 | 95 | 'src' => $jsvars['pix_icon_delete']  | 
                                                        
| 96 | - );  | 
                                                        |
| 96 | + );  | 
                                                        |
| 97 | 97 |              $jsvars['pix_icon_delete'] = html_writer::tag('img', '', $options); | 
                                                        
| 98 | 98 | }  | 
                                                        
| 99 | 99 |          $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-modform', | 
                                                        
@@ -189,8 +189,8 @@ discard block  | 
                                                    ||
| 189 | 189 | $this->bigbluebuttonbn_mform_add_element($mform, $field['type'], $field['name'], $field['data_type'],  | 
                                                        
| 190 | 190 | $field['description_key'], 0, ['maxlength' => 4, 'size' => 6],  | 
                                                        
| 191 | 191 |                  ['message' => get_string('mod_form_field_voicebridge_format_error', 'bigbluebuttonbn'), | 
                                                        
| 192 | - 'type' => 'numeric', 'rule' => '####', 'validator' => 'server']  | 
                                                        |
| 193 | - );  | 
                                                        |
| 192 | + 'type' => 'numeric', 'rule' => '####', 'validator' => 'server']  | 
                                                        |
| 193 | + );  | 
                                                        |
| 194 | 194 |          } else { | 
                                                        
| 195 | 195 | $this->bigbluebuttonbn_mform_add_element($mform, $field['type'], $field['name'], $field['data_type'],  | 
                                                        
| 196 | 196 | $field['description_key'], 0, ['maxlength' => 4, 'size' => 6]);  | 
                                                        
@@ -224,7 +224,7 @@ discard block  | 
                                                    ||
| 224 | 224 | */  | 
                                                        
| 225 | 225 |      private function bigbluebuttonbn_mform_add_block_room_recordings($mform, $cfg) { | 
                                                        
| 226 | 226 | $field = ['type' => 'hidden', 'name' => 'recordings_html', 'data_type' => PARAM_INT,  | 
                                                        
| 227 | - 'description_key' => null];  | 
                                                        |
| 227 | + 'description_key' => null];  | 
                                                        |
| 228 | 228 |          if ($cfg['recordings_html_editable']) { | 
                                                        
| 229 | 229 | $field['type'] = 'checkbox';  | 
                                                        
| 230 | 230 | $field['description_key'] = 'mod_form_field_recordings_html';  | 
                                                        
@@ -233,7 +233,7 @@ discard block  | 
                                                    ||
| 233 | 233 | $field['description_key'], $cfg['recordings_html_default']);  | 
                                                        
| 234 | 234 | |
| 235 | 235 | $field = ['type' => 'hidden', 'name' => 'recordings_deleted', 'data_type' => PARAM_INT,  | 
                                                        
| 236 | - 'description_key' => null];  | 
                                                        |
| 236 | + 'description_key' => null];  | 
                                                        |
| 237 | 237 |          if ($cfg['recordings_deleted_editable']) { | 
                                                        
| 238 | 238 | $field['type'] = 'checkbox';  | 
                                                        
| 239 | 239 | $field['description_key'] = 'mod_form_field_recordings_deleted';  | 
                                                        
@@ -242,7 +242,7 @@ discard block  | 
                                                    ||
| 242 | 242 | $field['description_key'], $cfg['recordings_deleted_default']);  | 
                                                        
| 243 | 243 | |
| 244 | 244 | $field = ['type' => 'hidden', 'name' => 'recordings_imported', 'data_type' => PARAM_INT,  | 
                                                        
| 245 | - 'description_key' => null];  | 
                                                        |
| 245 | + 'description_key' => null];  | 
                                                        |
| 246 | 246 |          if ($cfg['recordings_imported_editable']) { | 
                                                        
| 247 | 247 | $field['type'] = 'checkbox';  | 
                                                        
| 248 | 248 | $field['description_key'] = 'mod_form_field_recordings_imported';  | 
                                                        
@@ -299,7 +299,7 @@ discard block  | 
                                                    ||
| 299 | 299 | $htmlselectiontype = html_writer::select($participantselection['type_options'],  | 
                                                        
| 300 | 300 | 'bigbluebuttonbn_participant_selection_type', $participantselection['type_selected'], array(),  | 
                                                        
| 301 | 301 |              array('id' => 'bigbluebuttonbn_participant_selection_type', | 
                                                        
| 302 | - 'onchange' => 'M.mod_bigbluebuttonbn.modform.participantSelectionSet(); return 0;'));  | 
                                                        |
| 302 | + 'onchange' => 'M.mod_bigbluebuttonbn.modform.participantSelectionSet(); return 0;'));  | 
                                                        |
| 303 | 303 | $htmlselectionoptions = html_writer::select($participantselection['options'], 'bigbluebuttonbn_participant_selection',  | 
                                                        
| 304 | 304 | $participantselection['selected'], array(),  | 
                                                        
| 305 | 305 |              array('id' => 'bigbluebuttonbn_participant_selection', 'disabled' => 'disabled')); | 
                                                        
@@ -307,7 +307,7 @@ discard block  | 
                                                    ||
| 307 | 307 | 'type' => 'button', 'class' => 'btn btn-secondary',  | 
                                                        
| 308 | 308 |              'value' => get_string('mod_form_field_participant_list_action_add', 'bigbluebuttonbn'), | 
                                                        
| 309 | 309 | 'onclick' => 'M.mod_bigbluebuttonbn.modform.participantAdd(); return 0;'  | 
                                                        
| 310 | - ));  | 
                                                        |
| 310 | + ));  | 
                                                        |
| 311 | 311 |          $htmladdparticipant = html_writer::tag('div', | 
                                                        
| 312 | 312 | $htmlselectiontype . '  ' . $htmlselectionoptions . '  ' . $htmlselectioninput, null);  | 
                                                        
| 313 | 313 |          $mform->addElement('html', "\n\n"); | 
                                                        
@@ -198,10 +198,10 @@ discard block  | 
                                                    ||
| 198 | 198 | */  | 
                                                        
| 199 | 199 |  function bigbluebutton_bbb_view_create_meeting_data(&$bbbsession) { | 
                                                        
| 200 | 200 | $data = ['meetingID' => $bbbsession['meetingid'],  | 
                                                        
| 201 | - 'name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),  | 
                                                        |
| 202 | - 'attendeePW' => $bbbsession['viewerPW'],  | 
                                                        |
| 203 | - 'moderatorPW' => $bbbsession['modPW'],  | 
                                                        |
| 204 | - 'logoutURL' => $bbbsession['logoutURL'],  | 
                                                        |
| 201 | + 'name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),  | 
                                                        |
| 202 | + 'attendeePW' => $bbbsession['viewerPW'],  | 
                                                        |
| 203 | + 'moderatorPW' => $bbbsession['modPW'],  | 
                                                        |
| 204 | + 'logoutURL' => $bbbsession['logoutURL'],  | 
                                                        |
| 205 | 205 | ];  | 
                                                        
| 206 | 206 | $data['record'] = bigbluebutton_bbb_view_create_meeting_data_record($bbbsession['record']);  | 
                                                        
| 207 | 207 | $data['welcome'] = trim($bbbsession['welcome']);  | 
                                                        
@@ -214,7 +214,7 @@ discard block  | 
                                                    ||
| 214 | 214 | '%duration%',  | 
                                                        
| 215 | 215 | (string) $durationtime,  | 
                                                        
| 216 | 216 |              get_string('bbbdurationwarning', 'bigbluebuttonbn') | 
                                                        
| 217 | - );  | 
                                                        |
| 217 | + );  | 
                                                        |
| 218 | 218 | }  | 
                                                        
| 219 | 219 | $voicebridge = intval($bbbsession['voicebridge']);  | 
                                                        
| 220 | 220 |      if ($voicebridge > 0 && $voicebridge < 79999) { | 
                                                        
@@ -253,22 +253,22 @@ discard block  | 
                                                    ||
| 253 | 253 |  function bigbluebutton_bbb_view_create_meeting_metadata(&$bbbsession) { | 
                                                        
| 254 | 254 | global $USER;  | 
                                                        
| 255 | 255 | $metadata = ['bbb-origin' => $bbbsession['origin'],  | 
                                                        
| 256 | - 'bbb-origin-version' => $bbbsession['originVersion'],  | 
                                                        |
| 257 | - 'bbb-origin-server-name' => $bbbsession['originServerName'],  | 
                                                        |
| 258 | - 'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'],  | 
                                                        |
| 259 | - 'bbb-origin-tag' => $bbbsession['originTag'],  | 
                                                        |
| 260 | - 'bbb-context' => $bbbsession['course']->fullname,  | 
                                                        |
| 261 | - 'bbb-recording-name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),  | 
                                                        |
| 262 | - 'bbb-recording-description' => bigbluebuttonbn_html2text($bbbsession['meetingdescription'], 64),  | 
                                                        |
| 263 | - 'bbb-recording-tags' => bigbluebuttonbn_get_tags($bbbsession['cm']->id), // Same as $id.  | 
                                                        |
| 256 | + 'bbb-origin-version' => $bbbsession['originVersion'],  | 
                                                        |
| 257 | + 'bbb-origin-server-name' => $bbbsession['originServerName'],  | 
                                                        |
| 258 | + 'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'],  | 
                                                        |
| 259 | + 'bbb-origin-tag' => $bbbsession['originTag'],  | 
                                                        |
| 260 | + 'bbb-context' => $bbbsession['course']->fullname,  | 
                                                        |
| 261 | + 'bbb-recording-name' => bigbluebuttonbn_html2text($bbbsession['meetingname'], 64),  | 
                                                        |
| 262 | + 'bbb-recording-description' => bigbluebuttonbn_html2text($bbbsession['meetingdescription'], 64),  | 
                                                        |
| 263 | + 'bbb-recording-tags' => bigbluebuttonbn_get_tags($bbbsession['cm']->id), // Same as $id.  | 
                                                        |
| 264 | 264 | ];  | 
                                                        
| 265 | 265 |      if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('recordingstatus_enabled')) { | 
                                                        
| 266 | 266 | $metadata["bn-recording-status"] = json_encode(  | 
                                                        
| 267 | 267 | array(  | 
                                                        
| 268 | 268 |                  'email' => array('"' . fullname($USER) . '" <' . $USER->email . '>'), | 
                                                        
| 269 | 269 | 'context' => $bbbsession['bigbluebuttonbnURL']  | 
                                                        
| 270 | - )  | 
                                                        |
| 271 | - );  | 
                                                        |
| 270 | + )  | 
                                                        |
| 271 | + );  | 
                                                        |
| 272 | 272 | }  | 
                                                        
| 273 | 273 |      if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('recordingready_enabled')) { | 
                                                        
| 274 | 274 | $metadata['bn-recording-ready-url'] = $bbbsession['recordingReadyURL'];  | 
                                                        
@@ -62,91 +62,91 @@  | 
                                                    ||
| 62 | 62 | }  | 
                                                        
| 63 | 63 | |
| 64 | 64 |  switch (strtolower($action)) { | 
                                                        
| 65 | - case 'logout':  | 
                                                        |
| 66 | -        if (isset($errors) && $errors != '') { | 
                                                        |
| 67 | - bigbluebutton_bbb_view_errors($errors, $id);  | 
                                                        |
| 68 | - break;  | 
                                                        |
| 69 | - }  | 
                                                        |
| 70 | -        if (is_null($bbbsession)) { | 
                                                        |
| 71 | - bigbluebutton_bbb_view_close_window_manually();  | 
                                                        |
| 72 | - break;  | 
                                                        |
| 73 | - }  | 
                                                        |
| 74 | - // Moodle event logger: Create an event for meeting left.  | 
                                                        |
| 75 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm);  | 
                                                        |
| 76 | - // Update the cache.  | 
                                                        |
| 77 | - $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED);  | 
                                                        |
| 78 | - // Close the tab or window where BBB was opened.  | 
                                                        |
| 79 | - bigbluebutton_bbb_view_close_window();  | 
                                                        |
| 80 | - break;  | 
                                                        |
| 81 | - case 'join':  | 
                                                        |
| 82 | -        if (is_null($bbbsession)) { | 
                                                        |
| 83 | -            print_error('view_error_unable_join', 'bigbluebuttonbn'); | 
                                                        |
| 84 | - break;  | 
                                                        |
| 85 | - }  | 
                                                        |
| 86 | - // See if the session is in progress.  | 
                                                        |
| 87 | -        if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) { | 
                                                        |
| 88 | - // Since the meeting is already running, we just join the session.  | 
                                                        |
| 89 | - bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);  | 
                                                        |
| 90 | - break;  | 
                                                        |
| 91 | - }  | 
                                                        |
| 92 | - // If user is not administrator nor moderator (user is steudent) and waiting is required.  | 
                                                        |
| 93 | -        if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) { | 
                                                        |
| 94 | -            header('Location: '.$bbbsession['logoutURL']); | 
                                                        |
| 65 | + case 'logout':  | 
                                                        |
| 66 | +            if (isset($errors) && $errors != '') { | 
                                                        |
| 67 | + bigbluebutton_bbb_view_errors($errors, $id);  | 
                                                        |
| 68 | + break;  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | +            if (is_null($bbbsession)) { | 
                                                        |
| 71 | + bigbluebutton_bbb_view_close_window_manually();  | 
                                                        |
| 72 | + break;  | 
                                                        |
| 73 | + }  | 
                                                        |
| 74 | + // Moodle event logger: Create an event for meeting left.  | 
                                                        |
| 75 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm);  | 
                                                        |
| 76 | + // Update the cache.  | 
                                                        |
| 77 | + $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED);  | 
                                                        |
| 78 | + // Close the tab or window where BBB was opened.  | 
                                                        |
| 79 | + bigbluebutton_bbb_view_close_window();  | 
                                                        |
| 95 | 80 | break;  | 
                                                        
| 96 | - }  | 
                                                        |
| 97 | - // As the meeting doesn't exist, try to create it.  | 
                                                        |
| 98 | - $response = bigbluebuttonbn_get_create_meeting_array(  | 
                                                        |
| 99 | - bigbluebutton_bbb_view_create_meeting_data($bbbsession),  | 
                                                        |
| 100 | - bigbluebutton_bbb_view_create_meeting_metadata($bbbsession),  | 
                                                        |
| 101 | - $bbbsession['presentation']['name'],  | 
                                                        |
| 102 | - $bbbsession['presentation']['url']  | 
                                                        |
| 103 | - );  | 
                                                        |
| 104 | -        if (empty($response)) { | 
                                                        |
| 105 | - // The server is unreachable.  | 
                                                        |
| 106 | -            if ($bbbsession['administrator']) { | 
                                                        |
| 107 | -                print_error('view_error_unable_join', 'bigbluebuttonbn', | 
                                                        |
| 108 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 81 | + case 'join':  | 
                                                        |
| 82 | +            if (is_null($bbbsession)) { | 
                                                        |
| 83 | +                print_error('view_error_unable_join', 'bigbluebuttonbn'); | 
                                                        |
| 84 | + break;  | 
                                                        |
| 85 | + }  | 
                                                        |
| 86 | + // See if the session is in progress.  | 
                                                        |
| 87 | +            if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) { | 
                                                        |
| 88 | + // Since the meeting is already running, we just join the session.  | 
                                                        |
| 89 | + bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);  | 
                                                        |
| 109 | 90 | break;  | 
                                                        
| 110 | 91 | }  | 
                                                        
| 111 | -            if ($bbbsession['moderator']) { | 
                                                        |
| 112 | -                print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', | 
                                                        |
| 92 | + // If user is not administrator nor moderator (user is steudent) and waiting is required.  | 
                                                        |
| 93 | +            if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) { | 
                                                        |
| 94 | +                header('Location: '.$bbbsession['logoutURL']); | 
                                                        |
| 95 | + break;  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | + // As the meeting doesn't exist, try to create it.  | 
                                                        |
| 98 | + $response = bigbluebuttonbn_get_create_meeting_array(  | 
                                                        |
| 99 | + bigbluebutton_bbb_view_create_meeting_data($bbbsession),  | 
                                                        |
| 100 | + bigbluebutton_bbb_view_create_meeting_metadata($bbbsession),  | 
                                                        |
| 101 | + $bbbsession['presentation']['name'],  | 
                                                        |
| 102 | + $bbbsession['presentation']['url']  | 
                                                        |
| 103 | + );  | 
                                                        |
| 104 | +            if (empty($response)) { | 
                                                        |
| 105 | + // The server is unreachable.  | 
                                                        |
| 106 | +                if ($bbbsession['administrator']) { | 
                                                        |
| 107 | +                    print_error('view_error_unable_join', 'bigbluebuttonbn', | 
                                                        |
| 108 | + $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 109 | + break;  | 
                                                        |
| 110 | + }  | 
                                                        |
| 111 | +                if ($bbbsession['moderator']) { | 
                                                        |
| 112 | +                    print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', | 
                                                        |
| 113 | + $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 114 | + break;  | 
                                                        |
| 115 | + }  | 
                                                        |
| 116 | +                print_error('view_error_unable_join_student', 'bigbluebuttonbn', | 
                                                        |
| 113 | 117 | $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        
| 114 | 118 | break;  | 
                                                        
| 115 | 119 | }  | 
                                                        
| 116 | -            print_error('view_error_unable_join_student', 'bigbluebuttonbn', | 
                                                        |
| 117 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 118 | - break;  | 
                                                        |
| 119 | - }  | 
                                                        |
| 120 | -        if ($response['returncode'] == 'FAILED') { | 
                                                        |
| 121 | - // The meeting was not created.  | 
                                                        |
| 122 | -            if (!$printerrorkey) { | 
                                                        |
| 123 | - print_error($response['message'], 'bigbluebuttonbn');  | 
                                                        |
| 120 | +            if ($response['returncode'] == 'FAILED') { | 
                                                        |
| 121 | + // The meeting was not created.  | 
                                                        |
| 122 | +                if (!$printerrorkey) { | 
                                                        |
| 123 | + print_error($response['message'], 'bigbluebuttonbn');  | 
                                                        |
| 124 | + break;  | 
                                                        |
| 125 | + }  | 
                                                        |
| 126 | + $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');  | 
                                                        |
| 127 | + print_error($printerrorkey, 'bigbluebuttonbn');  | 
                                                        |
| 128 | + break;  | 
                                                        |
| 129 | + }  | 
                                                        |
| 130 | +            if ($response['hasBeenForciblyEnded'] == 'true') { | 
                                                        |
| 131 | +                print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); | 
                                                        |
| 124 | 132 | break;  | 
                                                        
| 125 | 133 | }  | 
                                                        
| 126 | - $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create');  | 
                                                        |
| 127 | - print_error($printerrorkey, 'bigbluebuttonbn');  | 
                                                        |
| 134 | + // Moodle event logger: Create an event for meeting created.  | 
                                                        |
| 135 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm);  | 
                                                        |
| 136 | + // Internal logger: Insert a record with the meeting created.  | 
                                                        |
| 137 | + bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE);  | 
                                                        |
| 138 | + // Since the meeting is already running, we just join the session.  | 
                                                        |
| 139 | + bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);  | 
                                                        |
| 128 | 140 | break;  | 
                                                        
| 129 | - }  | 
                                                        |
| 130 | -        if ($response['hasBeenForciblyEnded'] == 'true') { | 
                                                        |
| 131 | -            print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); | 
                                                        |
| 141 | + case 'play':  | 
                                                        |
| 142 | + $href = bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype);  | 
                                                        |
| 143 | + // Moodle event logger: Create an event for meeting left.  | 
                                                        |
| 144 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]);  | 
                                                        |
| 145 | + // Execute the redirect.  | 
                                                        |
| 146 | +            header('Location: '.urldecode($href)); | 
                                                        |
| 132 | 147 | break;  | 
                                                        
| 133 | - }  | 
                                                        |
| 134 | - // Moodle event logger: Create an event for meeting created.  | 
                                                        |
| 135 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm);  | 
                                                        |
| 136 | - // Internal logger: Insert a record with the meeting created.  | 
                                                        |
| 137 | - bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE);  | 
                                                        |
| 138 | - // Since the meeting is already running, we just join the session.  | 
                                                        |
| 139 | - bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn);  | 
                                                        |
| 140 | - break;  | 
                                                        |
| 141 | - case 'play':  | 
                                                        |
| 142 | - $href = bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype);  | 
                                                        |
| 143 | - // Moodle event logger: Create an event for meeting left.  | 
                                                        |
| 144 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]);  | 
                                                        |
| 145 | - // Execute the redirect.  | 
                                                        |
| 146 | -        header('Location: '.urldecode($href)); | 
                                                        |
| 147 | - break;  | 
                                                        |
| 148 | - default:  | 
                                                        |
| 149 | - bigbluebutton_bbb_view_close_window();  | 
                                                        |
| 148 | + default:  | 
                                                        |
| 149 | + bigbluebutton_bbb_view_close_window();  | 
                                                        |
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | 152 | /**  | 
                                                        
@@ -23,8 +23,8 @@ discard block  | 
                                                    ||
| 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 |  $action = required_param('action', PARAM_TEXT); | 
                                                        
| 30 | 30 |  $id = optional_param('id', 0, PARAM_INT); | 
                                                        
@@ -91,7 +91,7 @@ discard block  | 
                                                    ||
| 91 | 91 | }  | 
                                                        
| 92 | 92 | // If user is not administrator nor moderator (user is steudent) and waiting is required.  | 
                                                        
| 93 | 93 |          if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) { | 
                                                        
| 94 | -            header('Location: '.$bbbsession['logoutURL']); | 
                                                        |
| 94 | +            header('Location: ' . $bbbsession['logoutURL']); | 
                                                        |
| 95 | 95 | break;  | 
                                                        
| 96 | 96 | }  | 
                                                        
| 97 | 97 | // As the meeting doesn't exist, try to create it.  | 
                                                        
@@ -105,16 +105,16 @@ discard block  | 
                                                    ||
| 105 | 105 | // The server is unreachable.  | 
                                                        
| 106 | 106 |              if ($bbbsession['administrator']) { | 
                                                        
| 107 | 107 |                  print_error('view_error_unable_join', 'bigbluebuttonbn', | 
                                                        
| 108 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 108 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 109 | 109 | break;  | 
                                                        
| 110 | 110 | }  | 
                                                        
| 111 | 111 |              if ($bbbsession['moderator']) { | 
                                                        
| 112 | 112 |                  print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', | 
                                                        
| 113 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 113 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 114 | 114 | break;  | 
                                                        
| 115 | 115 | }  | 
                                                        
| 116 | 116 |              print_error('view_error_unable_join_student', 'bigbluebuttonbn', | 
                                                        
| 117 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 117 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 118 | 118 | break;  | 
                                                        
| 119 | 119 | }  | 
                                                        
| 120 | 120 |          if ($response['returncode'] == 'FAILED') { | 
                                                        
@@ -143,7 +143,7 @@ discard block  | 
                                                    ||
| 143 | 143 | // Moodle event logger: Create an event for meeting left.  | 
                                                        
| 144 | 144 | bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]);  | 
                                                        
| 145 | 145 | // Execute the redirect.  | 
                                                        
| 146 | -        header('Location: '.urldecode($href)); | 
                                                        |
| 146 | +        header('Location: ' . urldecode($href)); | 
                                                        |
| 147 | 147 | break;  | 
                                                        
| 148 | 148 | default:  | 
                                                        
| 149 | 149 | bigbluebutton_bbb_view_close_window();  | 
                                                        
@@ -212,7 +212,7 @@ discard block  | 
                                                    ||
| 212 | 212 | $data['welcome'] .= '<br><br>';  | 
                                                        
| 213 | 213 | $data['welcome'] .= str_replace(  | 
                                                        
| 214 | 214 | '%duration%',  | 
                                                        
| 215 | - (string) $durationtime,  | 
                                                        |
| 215 | + (string)$durationtime,  | 
                                                        |
| 216 | 216 |              get_string('bbbdurationwarning', 'bigbluebuttonbn') | 
                                                        
| 217 | 217 | );  | 
                                                        
| 218 | 218 | }  | 
                                                        
@@ -287,7 +287,7 @@ discard block  | 
                                                    ||
| 287 | 287 | $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED);  | 
                                                        
| 288 | 288 |      if ($bbbsession['userlimit'] > 0 && intval($meetinginfo['participantCount']) >= $bbbsession['userlimit']) { | 
                                                        
| 289 | 289 | // No more users allowed to join.  | 
                                                        
| 290 | -        header('Location: '.$bbbsession['logoutURL']); | 
                                                        |
| 290 | +        header('Location: ' . $bbbsession['logoutURL']); | 
                                                        |
| 291 | 291 | return;  | 
                                                        
| 292 | 292 | }  | 
                                                        
| 293 | 293 | // Build the URL.  | 
                                                        
@@ -305,7 +305,7 @@ discard block  | 
                                                    ||
| 305 | 305 | bigbluebuttonbn_participant_joined($bbbsession['meetingid'],  | 
                                                        
| 306 | 306 | ($bbbsession['administrator'] || $bbbsession['moderator']));  | 
                                                        
| 307 | 307 | // Execute the redirect.  | 
                                                        
| 308 | -    header('Location: '.$joinurl); | 
                                                        |
| 308 | +    header('Location: ' . $joinurl); | 
                                                        |
| 309 | 309 | }  | 
                                                        
| 310 | 310 | |
| 311 | 311 | /**  | 
                                                        
@@ -313,13 +313,13 @@ discard block  | 
                                                    ||
| 313 | 313 | */  | 
                                                        
| 314 | 314 |  function bigbluebutton_bbb_view_errors($serrors, $id) { | 
                                                        
| 315 | 315 | global $CFG, $OUTPUT;  | 
                                                        
| 316 | - $errors = (array) json_decode(urldecode($serrors));  | 
                                                        |
| 316 | + $errors = (array)json_decode(urldecode($serrors));  | 
                                                        |
| 317 | 317 | $msgerrors = '';  | 
                                                        
| 318 | 318 |      foreach ($errors as $error) { | 
                                                        
| 319 | -        $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger'))."\n"; | 
                                                        |
| 319 | +        $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger')) . "\n"; | 
                                                        |
| 320 | 320 | }  | 
                                                        
| 321 | 321 | echo $OUTPUT->header();  | 
                                                        
| 322 | 322 |      print_error('view_error_bigbluebutton', 'bigbluebuttonbn', | 
                                                        
| 323 | - $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$id, $msgerrors, $serrors);  | 
                                                        |
| 323 | + $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $id, $msgerrors, $serrors);  | 
                                                        |
| 324 | 324 | echo $OUTPUT->footer();  | 
                                                        
| 325 | 325 | }  | 
                                                        
@@ -366,26 +366,26 @@ discard block  | 
                                                    ||
| 366 | 366 | return array(  | 
                                                        
| 367 | 367 | 'status' => false,  | 
                                                        
| 368 | 368 |                  'message' => get_string('view_recording_publish_link_deleted', 'bigbluebuttonbn') | 
                                                        
| 369 | - );  | 
                                                        |
| 369 | + );  | 
                                                        |
| 370 | 370 | }  | 
                                                        
| 371 | 371 |          if ($realrecordings[$params['id']]['published'] !== 'true') { | 
                                                        
| 372 | 372 | return array(  | 
                                                        
| 373 | 373 | 'status' => false,  | 
                                                        
| 374 | 374 |                  'message' => get_string('view_recording_publish_link_not_published', 'bigbluebuttonbn') | 
                                                        
| 375 | - );  | 
                                                        |
| 375 | + );  | 
                                                        |
| 376 | 376 | }  | 
                                                        
| 377 | 377 | return array(  | 
                                                        
| 378 | 378 | 'status' => bigbluebuttonbn_publish_recording_imported(  | 
                                                        
| 379 | 379 | $recordings[$params['id']]['imported'], true  | 
                                                        
| 380 | 380 | )  | 
                                                        
| 381 | - );  | 
                                                        |
| 381 | + );  | 
                                                        |
| 382 | 382 | }  | 
                                                        
| 383 | 383 | // As the recordingid was not identified as imported recording link, execute actual publish.  | 
                                                        
| 384 | 384 | return array(  | 
                                                        
| 385 | 385 | 'status' => bigbluebuttonbn_publish_recordings(  | 
                                                        
| 386 | 386 | $params['id'], 'true'  | 
                                                        
| 387 | 387 | )  | 
                                                        
| 388 | - );  | 
                                                        |
| 388 | + );  | 
                                                        |
| 389 | 389 | }  | 
                                                        
| 390 | 390 | |
| 391 | 391 | /**  | 
                                                        
@@ -401,26 +401,26 @@ discard block  | 
                                                    ||
| 401 | 401 | return array(  | 
                                                        
| 402 | 402 | 'status' => false,  | 
                                                        
| 403 | 403 |                  'message' => get_string('view_recording_unprotect_link_deleted', 'bigbluebuttonbn') | 
                                                        
| 404 | - );  | 
                                                        |
| 404 | + );  | 
                                                        |
| 405 | 405 | }  | 
                                                        
| 406 | 406 |          if ($realrecordings[$params['id']]['protected'] === 'true') { | 
                                                        
| 407 | 407 | return array(  | 
                                                        
| 408 | 408 | 'status' => false,  | 
                                                        
| 409 | 409 |                  'message' => get_string('view_recording_unprotect_link_not_unprotected', 'bigbluebuttonbn') | 
                                                        
| 410 | - );  | 
                                                        |
| 410 | + );  | 
                                                        |
| 411 | 411 | }  | 
                                                        
| 412 | 412 | return array(  | 
                                                        
| 413 | 413 | 'status' => bigbluebuttonbn_protect_recording_imported(  | 
                                                        
| 414 | 414 | $recordings[$params['id']]['imported'], false  | 
                                                        
| 415 | 415 | )  | 
                                                        
| 416 | - );  | 
                                                        |
| 416 | + );  | 
                                                        |
| 417 | 417 | }  | 
                                                        
| 418 | 418 | // As the recordingid was not identified as imported recording link, execute actual uprotect.  | 
                                                        
| 419 | 419 | return array(  | 
                                                        
| 420 | 420 | 'status' => bigbluebuttonbn_update_recordings(  | 
                                                        
| 421 | 421 |              $params['id'], array('protect' => 'false') | 
                                                        
| 422 | 422 | )  | 
                                                        
| 423 | - );  | 
                                                        |
| 423 | + );  | 
                                                        |
| 424 | 424 | }  | 
                                                        
| 425 | 425 | |
| 426 | 426 | /**  | 
                                                        
@@ -434,7 +434,7 @@ discard block  | 
                                                    ||
| 434 | 434 | 'status' => bigbluebuttonbn_publish_recording_imported(  | 
                                                        
| 435 | 435 | $recordings[$params['id']]['imported'], false  | 
                                                        
| 436 | 436 | )  | 
                                                        
| 437 | - );  | 
                                                        |
| 437 | + );  | 
                                                        |
| 438 | 438 | }  | 
                                                        
| 439 | 439 | // As the recordingid was not identified as imported recording link, execute unpublish on a real recording.  | 
                                                        
| 440 | 440 | // First: Unpublish imported links associated to the recording.  | 
                                                        
@@ -452,7 +452,7 @@ discard block  | 
                                                    ||
| 452 | 452 | 'status' => bigbluebuttonbn_publish_recordings(  | 
                                                        
| 453 | 453 | $params['id'], 'false'  | 
                                                        
| 454 | 454 | )  | 
                                                        
| 455 | - );  | 
                                                        |
| 455 | + );  | 
                                                        |
| 456 | 456 | }  | 
                                                        
| 457 | 457 | |
| 458 | 458 | /**  | 
                                                        
@@ -466,7 +466,7 @@ discard block  | 
                                                    ||
| 466 | 466 | 'status' => bigbluebuttonbn_protect_recording_imported(  | 
                                                        
| 467 | 467 | $recordings[$params['id']]['imported'], true  | 
                                                        
| 468 | 468 | )  | 
                                                        
| 469 | - );  | 
                                                        |
| 469 | + );  | 
                                                        |
| 470 | 470 | }  | 
                                                        
| 471 | 471 | // As the recordingid was not identified as imported recording link, execute protect on a real recording.  | 
                                                        
| 472 | 472 | // First: Protect imported links associated to the recording.  | 
                                                        
@@ -484,7 +484,7 @@ discard block  | 
                                                    ||
| 484 | 484 | 'status' => bigbluebuttonbn_update_recordings(  | 
                                                        
| 485 | 485 |              $params['id'], array('protect' => 'true') | 
                                                        
| 486 | 486 | )  | 
                                                        
| 487 | - );  | 
                                                        |
| 487 | + );  | 
                                                        |
| 488 | 488 | }  | 
                                                        
| 489 | 489 | |
| 490 | 490 | /**  | 
                                                        
@@ -498,7 +498,7 @@ discard block  | 
                                                    ||
| 498 | 498 | 'status' => bigbluebuttonbn_delete_recording_imported(  | 
                                                        
| 499 | 499 | $recordings[$params['id']]['imported']  | 
                                                        
| 500 | 500 | )  | 
                                                        
| 501 | - );  | 
                                                        |
| 501 | + );  | 
                                                        |
| 502 | 502 | }  | 
                                                        
| 503 | 503 | // As the recordingid was not identified as imported recording link, execute delete on a real recording.  | 
                                                        
| 504 | 504 | // First: Delete imported links associated to the recording.  | 
                                                        
@@ -514,7 +514,7 @@ discard block  | 
                                                    ||
| 514 | 514 | 'status' => bigbluebuttonbn_delete_recordings(  | 
                                                        
| 515 | 515 | $params['id']  | 
                                                        
| 516 | 516 | )  | 
                                                        
| 517 | - );  | 
                                                        |
| 517 | + );  | 
                                                        |
| 518 | 518 | }  | 
                                                        
| 519 | 519 | |
| 520 | 520 | /**  | 
                                                        
@@ -527,7 +527,7 @@ discard block  | 
                                                    ||
| 527 | 527 | 'status' => bigbluebuttonbn_update_recording_imported(  | 
                                                        
| 528 | 528 | $recordings[$params['id']]['imported'], json_decode($params['meta'], true)  | 
                                                        
| 529 | 529 | )  | 
                                                        
| 530 | - );  | 
                                                        |
| 530 | + );  | 
                                                        |
| 531 | 531 | }  | 
                                                        
| 532 | 532 | |
| 533 | 533 | // As the recordingid was not identified as imported recording link, execute update on a real recording.  | 
                                                        
@@ -537,7 +537,7 @@ discard block  | 
                                                    ||
| 537 | 537 | 'status' => bigbluebuttonbn_update_recordings(  | 
                                                        
| 538 | 538 | $params['id'], json_decode($params['meta'])  | 
                                                        
| 539 | 539 | )  | 
                                                        
| 540 | - );  | 
                                                        |
| 540 | + );  | 
                                                        |
| 541 | 541 | }  | 
                                                        
| 542 | 542 | |
| 543 | 543 | /**  | 
                                                        
@@ -682,10 +682,10 @@ discard block  | 
                                                    ||
| 682 | 682 | $params['recording_import'] = ['id' => 'The recordingID must be specified.'];  | 
                                                        
| 683 | 683 | $params['recording_ready'] = [  | 
                                                        
| 684 | 684 | 'signed_parameters' => 'A JWT encoded string must be included as [signed_parameters].'  | 
                                                        
| 685 | - ];  | 
                                                        |
| 685 | + ];  | 
                                                        |
| 686 | 686 | $params['live_session_events'] = [  | 
                                                        
| 687 | 687 | 'signed_parameters' => 'A JWT encoded string must be included as [signed_parameters].'  | 
                                                        
| 688 | - ];  | 
                                                        |
| 688 | + ];  | 
                                                        |
| 689 | 689 | return $params;  | 
                                                        
| 690 | 690 | }  | 
                                                        
| 691 | 691 | |
@@ -23,8 +23,8 @@ discard block  | 
                                                    ||
| 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 | use \Firebase\JWT\JWT;  | 
                                                        
| 30 | 30 | |
@@ -40,13 +40,13 @@ discard block  | 
                                                    ||
| 40 | 40 |  $params['meta'] = optional_param('meta', '', PARAM_TEXT); | 
                                                        
| 41 | 41 | |
| 42 | 42 |  if (empty($params['action'])) { | 
                                                        
| 43 | -    header('HTTP/1.0 400 Bad Request. Parameter ['.$params['action'].'] was not included'); | 
                                                        |
| 43 | +    header('HTTP/1.0 400 Bad Request. Parameter [' . $params['action'] . '] was not included'); | 
                                                        |
| 44 | 44 | return;  | 
                                                        
| 45 | 45 | }  | 
                                                        
| 46 | 46 | |
| 47 | 47 | $error = bigbluebuttonbn_broker_validate_parameters($params);  | 
                                                        
| 48 | 48 |  if (!empty($error)) { | 
                                                        
| 49 | -    header('HTTP/1.0 400 Bad Request. '.$error); | 
                                                        |
| 49 | +    header('HTTP/1.0 400 Bad Request. ' . $error); | 
                                                        |
| 50 | 50 | return;  | 
                                                        
| 51 | 51 | }  | 
                                                        
| 52 | 52 | |
@@ -130,11 +130,11 @@ discard block  | 
                                                    ||
| 130 | 130 | bigbluebuttonbn_broker_live_session_events($params, $bigbluebuttonbn, $cm);  | 
                                                        
| 131 | 131 | return;  | 
                                                        
| 132 | 132 | }  | 
                                                        
| 133 | -    header('HTTP/1.0 400 Bad request. The action '. $a . ' doesn\'t exist'); | 
                                                        |
| 133 | +    header('HTTP/1.0 400 Bad request. The action ' . $a . ' doesn\'t exist'); | 
                                                        |
| 134 | 134 | return;  | 
                                                        
| 135 | 135 | |
| 136 | 136 |  } catch (Exception $e) { | 
                                                        
| 137 | -    header('HTTP/1.0 500 Internal Server Error. '.$e->getMessage()); | 
                                                        |
| 137 | +    header('HTTP/1.0 500 Internal Server Error. ' . $e->getMessage()); | 
                                                        |
| 138 | 138 | return;  | 
                                                        
| 139 | 139 | }  | 
                                                        
| 140 | 140 | |
@@ -270,7 +270,7 @@ discard block  | 
                                                    ||
| 270 | 270 |  function bigbluebuttonbn_broker_recording_info_current($recording, $params) { | 
                                                        
| 271 | 271 | $callbackresponse['status'] = true;  | 
                                                        
| 272 | 272 | $callbackresponse['found'] = true;  | 
                                                        
| 273 | - $callbackresponse['published'] = (string) $recording['published'];  | 
                                                        |
| 273 | + $callbackresponse['published'] = (string)$recording['published'];  | 
                                                        |
| 274 | 274 |      if (!isset($params['meta']) || empty($params['meta'])) { | 
                                                        
| 275 | 275 | return $callbackresponse;  | 
                                                        
| 276 | 276 | }  | 
                                                        
@@ -549,8 +549,8 @@ discard block  | 
                                                    ||
| 549 | 549 | $decodedparameters = JWT::decode($params['signed_parameters'],  | 
                                                        
| 550 | 550 |              (string)\mod_bigbluebuttonbn\locallib\config::get('shared_secret'), array('HS256')); | 
                                                        
| 551 | 551 |      } catch (Exception $e) { | 
                                                        
| 552 | - $error = 'Caught exception: '.$e->getMessage();  | 
                                                        |
| 553 | -        header('HTTP/1.0 400 Bad Request. '.$error); | 
                                                        |
| 552 | + $error = 'Caught exception: ' . $e->getMessage();  | 
                                                        |
| 553 | +        header('HTTP/1.0 400 Bad Request. ' . $error); | 
                                                        |
| 554 | 554 | return;  | 
                                                        
| 555 | 555 | }  | 
                                                        
| 556 | 556 | // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.  | 
                                                        
@@ -566,8 +566,8 @@ discard block  | 
                                                    ||
| 566 | 566 | bigbluebuttonbn_send_notification_recording_ready($bigbluebuttonbn);  | 
                                                        
| 567 | 567 |          header('HTTP/1.0 202 Accepted'); | 
                                                        
| 568 | 568 |      } catch (Exception $e) { | 
                                                        
| 569 | - $error = 'Caught exception: '.$e->getMessage();  | 
                                                        |
| 570 | -        header('HTTP/1.0 503 Service Unavailable. '.$error); | 
                                                        |
| 569 | + $error = 'Caught exception: ' . $e->getMessage();  | 
                                                        |
| 570 | +        header('HTTP/1.0 503 Service Unavailable. ' . $error); | 
                                                        |
| 571 | 571 | }  | 
                                                        
| 572 | 572 | }  | 
                                                        
| 573 | 573 | |
@@ -583,13 +583,13 @@ discard block  | 
                                                    ||
| 583 | 583 | $importrecordings = $SESSION->bigbluebuttonbn_importrecordings;  | 
                                                        
| 584 | 584 |      if (!isset($importrecordings[$params['id']])) { | 
                                                        
| 585 | 585 |          $error = "Recording {$params['id']} could not be found. It can not be imported"; | 
                                                        
| 586 | -        header('HTTP/1.0 404 Not found. '.$error); | 
                                                        |
| 586 | +        header('HTTP/1.0 404 Not found. ' . $error); | 
                                                        |
| 587 | 587 | return;  | 
                                                        
| 588 | 588 | }  | 
                                                        
| 589 | 589 |      $callbackresponse = array('status' => true); | 
                                                        
| 590 | 590 | $importrecordings[$params['id']]['imported'] = true;  | 
                                                        
| 591 | 591 |      $overrides = array('meetingid' => $importrecordings[$params['id']]['meetingID']); | 
                                                        
| 592 | -    $meta = '{"recording":'.json_encode($importrecordings[$params['id']]).'}'; | 
                                                        |
| 592 | +    $meta = '{"recording":' . json_encode($importrecordings[$params['id']]) . '}'; | 
                                                        |
| 593 | 593 | bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_IMPORT, $overrides, $meta);  | 
                                                        
| 594 | 594 | // Moodle event logger: Create an event for recording imported.  | 
                                                        
| 595 | 595 |      if (isset($bbbsession['bigbluebutton']) && isset($bbbsession['cm'])) { | 
                                                        
@@ -609,8 +609,8 @@ discard block  | 
                                                    ||
| 609 | 609 | $decodedparameters = JWT::decode($params['signed_parameters'],  | 
                                                        
| 610 | 610 |              (string)\mod_bigbluebuttonbn\locallib\config::get('shared_secret'), array('HS256')); | 
                                                        
| 611 | 611 |      } catch (Exception $e) { | 
                                                        
| 612 | - $error = 'Caught exception: '.$e->getMessage();  | 
                                                        |
| 613 | -        header('HTTP/1.0 400 Bad Request. '.$error); | 
                                                        |
| 612 | + $error = 'Caught exception: ' . $e->getMessage();  | 
                                                        |
| 613 | +        header('HTTP/1.0 400 Bad Request. ' . $error); | 
                                                        |
| 614 | 614 | return;  | 
                                                        
| 615 | 615 | }  | 
                                                        
| 616 | 616 | // Validate that the bigbluebuttonbn activity corresponds to the meeting_id received.  | 
                                                        
@@ -646,7 +646,7 @@ discard block  | 
                                                    ||
| 646 | 646 | }  | 
                                                        
| 647 | 647 | $action = strtolower($params['action']);  | 
                                                        
| 648 | 648 |      if (!array_key_exists($action, $requiredparams)) { | 
                                                        
| 649 | - return 'Action '.$params['action'].' can not be performed.';  | 
                                                        |
| 649 | + return 'Action ' . $params['action'] . ' can not be performed.';  | 
                                                        |
| 650 | 650 | }  | 
                                                        
| 651 | 651 | return bigbluebuttonbn_broker_validate_parameters_message($params, $requiredparams[$action]);  | 
                                                        
| 652 | 652 | }  | 
                                                        
@@ -24,8 +24,8 @@ discard block  | 
                                                    ||
| 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('n', 0, PARAM_INT); | 
                                                        
@@ -58,21 +58,21 @@ discard block  | 
                                                    ||
| 58 | 58 |  if (is_null($serverversion)) { | 
                                                        
| 59 | 59 |      if ($bbbsession['administrator']) { | 
                                                        
| 60 | 60 |          print_error('view_error_unable_join', 'bigbluebuttonbn', | 
                                                        
| 61 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 61 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn');  | 
                                                        |
| 62 | 62 | exit;  | 
                                                        
| 63 | 63 | }  | 
                                                        
| 64 | 64 | |
| 65 | 65 |      if ($bbbsession['moderator']) { | 
                                                        
| 66 | 66 |          print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', | 
                                                        
| 67 | - $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);  | 
                                                        |
| 67 | + $CFG->wwwroot . '/course/view.php?id=' . $bigbluebuttonbn->course);  | 
                                                        |
| 68 | 68 | exit;  | 
                                                        
| 69 | 69 | }  | 
                                                        
| 70 | 70 | |
| 71 | 71 |      print_error('view_error_unable_join_student', '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 | -$bbbsession['serverversion'] = (string) $serverversion;  | 
                                                        |
| 75 | +$bbbsession['serverversion'] = (string)$serverversion;  | 
                                                        |
| 76 | 76 | |
| 77 | 77 | // Mark viewed by user (if required).  | 
                                                        
| 78 | 78 | $completion = new completion_info($course);  | 
                                                        
@@ -80,7 +80,7 @@ discard block  | 
                                                    ||
| 80 | 80 | |
| 81 | 81 | // Print the page header.  | 
                                                        
| 82 | 82 | $PAGE->set_context($context);  | 
                                                        
| 83 | -$PAGE->set_url($CFG->wwwroot.'/mod/bigbluebuttonbn/view.php', array('id' => $cm->id)); | 
                                                        |
| 83 | +$PAGE->set_url($CFG->wwwroot . '/mod/bigbluebuttonbn/view.php', array('id' => $cm->id)); | 
                                                        |
| 84 | 84 | $PAGE->set_title(format_string($bigbluebuttonbn->name));  | 
                                                        
| 85 | 85 | $PAGE->set_cacheable(false);  | 
                                                        
| 86 | 86 | $PAGE->set_heading($course->fullname);  | 
                                                        
@@ -90,11 +90,11 @@ discard block  | 
                                                    ||
| 90 | 90 |  if (!has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context)) { | 
                                                        
| 91 | 91 | echo $OUTPUT->header();  | 
                                                        
| 92 | 92 |      if (isguestuser()) { | 
                                                        
| 93 | -        echo $OUTPUT->confirm('<p>'.get_string('view_noguests', '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_noguests', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'), | 
                                                        |
| 94 | + get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);  | 
                                                        |
| 95 | 95 |      } else { | 
                                                        
| 96 | -        echo $OUTPUT->confirm('<p>'.get_string('view_nojoin', 'bigbluebuttonbn').'</p>'.get_string('liketologin'), | 
                                                        |
| 97 | - get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);  | 
                                                        |
| 96 | +        echo $OUTPUT->confirm('<p>' . get_string('view_nojoin', 'bigbluebuttonbn') . '</p>' . get_string('liketologin'), | 
                                                        |
| 97 | + get_login_url(), $CFG->wwwroot . '/course/view.php?id=' . $course->id);  | 
                                                        |
| 98 | 98 | }  | 
                                                        
| 99 | 99 | echo $OUTPUT->footer();  | 
                                                        
| 100 | 100 | exit;  | 
                                                        
@@ -102,7 +102,7 @@ discard block  | 
                                                    ||
| 102 | 102 | |
| 103 | 103 | // Operation URLs.  | 
                                                        
| 104 | 104 | $bbbsession['bigbluebuttonbnURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id;  | 
                                                        
| 105 | -$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id .  | 
                                                        |
| 105 | +$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id=' . $id .  | 
                                                        |
| 106 | 106 | '&bn=' . $bbbsession['bigbluebuttonbn']->id;  | 
                                                        
| 107 | 107 | $bbbsession['recordingReadyURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=recording_' .  | 
                                                        
| 108 | 108 | 'ready&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbn']->id;  | 
                                                        
@@ -122,7 +122,7 @@ discard block  | 
                                                    ||
| 122 | 122 | echo $OUTPUT->footer();  | 
                                                        
| 123 | 123 | |
| 124 | 124 | // Shows version as a comment.  | 
                                                        
| 125 | -echo '<!-- '.$bbbsession['originTag'].' -->'."\n";  | 
                                                        |
| 125 | +echo '<!-- ' . $bbbsession['originTag'] . ' -->' . "\n";  | 
                                                        |
| 126 | 126 | |
| 127 | 127 | // Initialize session variable used across views.  | 
                                                        
| 128 | 128 | $SESSION->bigbluebuttonbn_bbbsession = $bbbsession;  | 
                                                        
@@ -149,7 +149,7 @@ discard block  | 
                                                    ||
| 149 | 149 | $bbbsession['viewerPW'] = $bbbsession['bigbluebuttonbn']->viewerpass;  | 
                                                        
| 150 | 150 | |
| 151 | 151 | // Database info related to the activity.  | 
                                                        
| 152 | - $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.  | 
                                                        |
| 152 | + $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' .  | 
                                                        |
| 153 | 153 | $bbbsession['bigbluebuttonbn']->id;  | 
                                                        
| 154 | 154 | $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name;  | 
                                                        
| 155 | 155 | $bbbsession['meetingdescription'] = $bbbsession['bigbluebuttonbn']->intro;  | 
                                                        
@@ -170,7 +170,7 @@ discard block  | 
                                                    ||
| 170 | 170 |          $bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn'); | 
                                                        
| 171 | 171 | }  | 
                                                        
| 172 | 172 |      if ($bbbsession['bigbluebuttonbn']->record) { | 
                                                        
| 173 | -        $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn'); | 
                                                        |
| 173 | +        $bbbsession['welcome'] .= '<br><br>' . get_string('bbbrecordwarning', 'bigbluebuttonbn'); | 
                                                        |
| 174 | 174 | }  | 
                                                        
| 175 | 175 | |
| 176 | 176 | $bbbsession['openingtime'] = $bbbsession['bigbluebuttonbn']->openingtime;  | 
                                                        
@@ -186,7 +186,7 @@ discard block  | 
                                                    ||
| 186 | 186 | $bbbsession['originServerName'] = $parsedurl['host'];  | 
                                                        
| 187 | 187 | $bbbsession['originServerUrl'] = $CFG->wwwroot;  | 
                                                        
| 188 | 188 | $bbbsession['originServerCommonName'] = '';  | 
                                                        
| 189 | -    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')'; | 
                                                        |
| 189 | +    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn (' . get_config('mod_bigbluebuttonbn', 'version') . ')'; | 
                                                        |
| 190 | 190 | }  | 
                                                        
| 191 | 191 | |
| 192 | 192 |  function bigbluebuttonbn_view_bbbsession_roles($context, $userid) { | 
                                                        
@@ -248,9 +248,9 @@ discard block  | 
                                                    ||
| 248 | 248 | }  | 
                                                        
| 249 | 249 | |
| 250 | 250 | // Assign group default values.  | 
                                                        
| 251 | - $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.  | 
                                                        |
| 252 | - $bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';  | 
                                                        |
| 253 | -    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$groupname.')'; | 
                                                        |
| 251 | + $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid . '-' . $bbbsession['course']->id . '-' .  | 
                                                        |
| 252 | + $bbbsession['bigbluebuttonbn']->id . '[' . $bbbsession['group'] . ']';  | 
                                                        |
| 253 | +    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name . ' (' . $groupname . ')'; | 
                                                        |
| 254 | 254 | |
| 255 | 255 |      if (count($groups) == 0) { | 
                                                        
| 256 | 256 | // Only the All participants group exists.  | 
                                                        
@@ -265,12 +265,12 @@ discard block  | 
                                                    ||
| 265 | 265 | }  | 
                                                        
| 266 | 266 | |
| 267 | 267 |      bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_selection_warning', 'bigbluebuttonbn'), 'warning'); | 
                                                        
| 268 | - $urltoroot = $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id;  | 
                                                        |
| 268 | + $urltoroot = $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id;  | 
                                                        |
| 269 | 269 | groups_print_activity_menu($bbbsession['cm'], $urltoroot);  | 
                                                        
| 270 | 270 | echo '<br><br>';  | 
                                                        
| 271 | 271 | }  | 
                                                        
| 272 | 272 | |
| 273 | -function bigbluebuttonbn_view_message_box(&$bbbsession, $message, $type='warning', $onlymoderator=false) { | 
                                                        |
| 273 | +function bigbluebuttonbn_view_message_box(&$bbbsession, $message, $type = 'warning', $onlymoderator = false) { | 
                                                        |
| 274 | 274 | global $OUTPUT;  | 
                                                        
| 275 | 275 |      if ($onlymoderator && !$bbbsession['moderator'] && !$bbbsession['administrator']) { | 
                                                        
| 276 | 276 | return;  | 
                                                        
@@ -301,7 +301,7 @@ discard block  | 
                                                    ||
| 301 | 301 | |
| 302 | 302 | // Renders general warning when configured.  | 
                                                        
| 303 | 303 | $cfg = \mod_bigbluebuttonbn\locallib\config::get_options();  | 
                                                        
| 304 | - $output = bigbluebuttonbn_view_render_warning(  | 
                                                        |
| 304 | + $output = bigbluebuttonbn_view_render_warning(  | 
                                                        |
| 305 | 305 | (string)$cfg['general_warning_message'],  | 
                                                        
| 306 | 306 | (string)$cfg['general_warning_box_type'],  | 
                                                        
| 307 | 307 | (string)$cfg['general_warning_button_href'],  | 
                                                        
@@ -323,7 +323,7 @@ discard block  | 
                                                    ||
| 323 | 323 | 'M.mod_bigbluebuttonbn.recordings.init', array($jsvars));  | 
                                                        
| 324 | 324 | }  | 
                                                        
| 325 | 325 | |
| 326 | -    echo $output.html_writer::empty_tag('br').html_writer::empty_tag('br').html_writer::empty_tag('br'); | 
                                                        |
| 326 | +    echo $output . html_writer::empty_tag('br') . html_writer::empty_tag('br') . html_writer::empty_tag('br'); | 
                                                        |
| 327 | 327 |      $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-broker', 'M.mod_bigbluebuttonbn.broker.init', array($jsvars)); | 
                                                        
| 328 | 328 | }  | 
                                                        
| 329 | 329 | |
@@ -348,7 +348,7 @@ discard block  | 
                                                    ||
| 348 | 348 | return $output;  | 
                                                        
| 349 | 349 | }  | 
                                                        
| 350 | 350 | |
| 351 | -function bigbluebuttonbn_view_render_warning($message, $type='info', $href='', $text='', $class='') { | 
                                                        |
| 351 | +function bigbluebuttonbn_view_render_warning($message, $type = 'info', $href = '', $text = '', $class = '') { | 
                                                        |
| 352 | 352 | global $OUTPUT;  | 
                                                        
| 353 | 353 | $output = "\n";  | 
                                                        
| 354 | 354 | // Evaluates if config_warning is enabled.  | 
                                                        
@@ -356,14 +356,14 @@ discard block  | 
                                                    ||
| 356 | 356 | return $output;  | 
                                                        
| 357 | 357 | }  | 
                                                        
| 358 | 358 |      $output .= $OUTPUT->box_start('box boxalignleft adminerror alert alert-' . $type . ' alert-block fade in', | 
                                                        
| 359 | - 'bigbluebuttonbn_view_general_warning')."\n";  | 
                                                        |
| 360 | - $output .= ' <button type="button" class="close" data-dismiss="alert">×</button>'.$message."\n";  | 
                                                        |
| 361 | - $output .= ' <div class="singlebutton">'."\n";  | 
                                                        |
| 359 | + 'bigbluebuttonbn_view_general_warning') . "\n";  | 
                                                        |
| 360 | + $output .= ' <button type="button" class="close" data-dismiss="alert">×</button>' . $message . "\n";  | 
                                                        |
| 361 | + $output .= ' <div class="singlebutton">' . "\n";  | 
                                                        |
| 362 | 362 |      if (!empty($href)) { | 
                                                        
| 363 | 363 | $output .= bigbluebuttonbn_view_render_warning_button($href, $text, $class);  | 
                                                        
| 364 | 364 | }  | 
                                                        
| 365 | - $output .= ' </div>'."\n";  | 
                                                        |
| 366 | - $output .= $OUTPUT->box_end()."\n";  | 
                                                        |
| 365 | + $output .= ' </div>' . "\n";  | 
                                                        |
| 366 | + $output .= $OUTPUT->box_end() . "\n";  | 
                                                        |
| 367 | 367 | return $output;  | 
                                                        
| 368 | 368 | }  | 
                                                        
| 369 | 369 | |
@@ -374,11 +374,11 @@ discard block  | 
                                                    ||
| 374 | 374 |      if ($class == '') { | 
                                                        
| 375 | 375 | $class = 'btn btn-secondary';  | 
                                                        
| 376 | 376 | }  | 
                                                        
| 377 | - $output = ' <form method="post" action="' . $href . '" class="form-inline">'."\n";  | 
                                                        |
| 378 | - $output .= ' <button type="submit" class="' . $class . '"'."\n";  | 
                                                        |
| 379 | - $output .= ' title=""'."\n";  | 
                                                        |
| 380 | - $output .= ' >' . $text . '</button>'."\n";  | 
                                                        |
| 381 | - $output .= ' </form>'."\n";  | 
                                                        |
| 377 | + $output = ' <form method="post" action="' . $href . '" class="form-inline">' . "\n";  | 
                                                        |
| 378 | + $output .= ' <button type="submit" class="' . $class . '"' . "\n";  | 
                                                        |
| 379 | + $output .= ' title=""' . "\n";  | 
                                                        |
| 380 | + $output .= ' >' . $text . '</button>' . "\n";  | 
                                                        |
| 381 | + $output .= ' </form>' . "\n";  | 
                                                        |
| 382 | 382 | return $output;  | 
                                                        
| 383 | 383 | }  | 
                                                        
| 384 | 384 | |
@@ -388,12 +388,12 @@ discard block  | 
                                                    ||
| 388 | 388 | // JavaScript variables for room.  | 
                                                        
| 389 | 389 | $openingtime = '';  | 
                                                        
| 390 | 390 |      if ($bbbsession['openingtime']) { | 
                                                        
| 391 | -        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn').': '. | 
                                                        |
| 391 | +        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn') . ': ' . | 
                                                        |
| 392 | 392 | userdate($bbbsession['openingtime']);  | 
                                                        
| 393 | 393 | }  | 
                                                        
| 394 | 394 | $closingtime = '';  | 
                                                        
| 395 | 395 |      if ($bbbsession['closingtime']) { | 
                                                        
| 396 | -        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn').': '. | 
                                                        |
| 396 | +        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn') . ': ' . | 
                                                        |
| 397 | 397 | userdate($bbbsession['closingtime']);  | 
                                                        
| 398 | 398 | }  | 
                                                        
| 399 | 399 | $jsvars += array(  | 
                                                        
@@ -410,7 +410,7 @@ discard block  | 
                                                    ||
| 410 | 410 | $output .= $OUTPUT->box_end();  | 
                                                        
| 411 | 411 | |
| 412 | 412 |      $output .= $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box'); | 
                                                        
| 413 | - $output .= '<br><br><span id="join_button"></span> <span id="end_button"></span>'."\n";  | 
                                                        |
| 413 | + $output .= '<br><br><span id="join_button"></span> <span id="end_button"></span>' . "\n";  | 
                                                        |
| 414 | 414 | $output .= $OUTPUT->box_end();  | 
                                                        
| 415 | 415 | |
| 416 | 416 |      if ($activity == 'ended') { | 
                                                        
@@ -436,7 +436,7 @@ discard block  | 
                                                    ||
| 436 | 436 | |
| 437 | 437 | // Get recordings.  | 
                                                        
| 438 | 438 | $recordings = array();  | 
                                                        
| 439 | -    if ( bigbluebuttonbn_view_include_recordings($bbbsession) ) { | 
                                                        |
| 439 | +    if (bigbluebuttonbn_view_include_recordings($bbbsession)) { | 
                                                        |
| 440 | 440 | $recordings = bigbluebuttonbn_get_recordings(  | 
                                                        
| 441 | 441 | $bbbsession['course']->id, $bigbluebuttonbnid, $showroom,  | 
                                                        
| 442 | 442 | $bbbsession['bigbluebuttonbn']->recordings_deleted  | 
                                                        
@@ -467,7 +467,7 @@ discard block  | 
                                                    ||
| 467 | 467 | // If there are meetings with recordings load the data to the table.  | 
                                                        
| 468 | 468 |      if ($bbbsession['bigbluebuttonbn']->recordings_html) { | 
                                                        
| 469 | 469 | // Render a plain html table.  | 
                                                        
| 470 | - return bigbluebutton_output_recording_table($bbbsession, $recordings)."\n";  | 
                                                        |
| 470 | + return bigbluebutton_output_recording_table($bbbsession, $recordings) . "\n";  | 
                                                        |
| 471 | 471 | }  | 
                                                        
| 472 | 472 | |
| 473 | 473 | // JavaScript variables for recordings with YUI.  | 
                                                        
@@ -487,8 +487,8 @@ discard block  | 
                                                    ||
| 487 | 487 |          array('type' => 'button', | 
                                                        
| 488 | 488 |                'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'), | 
                                                        
| 489 | 489 | 'class' => 'btn btn-secondary',  | 
                                                        
| 490 | - 'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='.  | 
                                                        |
| 491 | - $bbbsession['bigbluebuttonbn']->id.'\''));  | 
                                                        |
| 490 | + 'onclick' => 'window.location=\'' . $CFG->wwwroot . '/mod/bigbluebuttonbn/import_view.php?bn=' .  | 
                                                        |
| 491 | + $bbbsession['bigbluebuttonbn']->id . '\''));  | 
                                                        |
| 492 | 492 |      $output = html_writer::start_tag('br'); | 
                                                        
| 493 | 493 |      $output .= html_writer::tag('span', $button, array('id' => 'import_recording_links_button')); | 
                                                        
| 494 | 494 |      $output .= html_writer::tag('span', '', array('id' => 'import_recording_links_table')); | 
                                                        
@@ -503,10 +503,10 @@ discard block  | 
                                                    ||
| 503 | 503 |          $attributes = array('title' => $bbbsession['presentation']['name']); | 
                                                        
| 504 | 504 | $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);  | 
                                                        
| 505 | 505 | |
| 506 | -        return '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'. | 
                                                        |
| 507 | - ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.  | 
                                                        |
| 508 | - ''.$OUTPUT->action_link($bbbsession['presentation']['url'],  | 
                                                        |
| 509 | - $bbbsession['presentation']['name'], null, $attributes).'<br><br>';  | 
                                                        |
| 506 | +        return '<h4>' . get_string('view_section_title_presentation', 'bigbluebuttonbn') . '</h4>' . | 
                                                        |
| 507 | + '' . $OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false) . '' .  | 
                                                        |
| 508 | + '' . $OUTPUT->action_link($bbbsession['presentation']['url'],  | 
                                                        |
| 509 | + $bbbsession['presentation']['name'], null, $attributes) . '<br><br>';  | 
                                                        |
| 510 | 510 | }  | 
                                                        
| 511 | 511 | |
| 512 | 512 | return '';  |