@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | |
183 | 183 | function bigbluebutton_bbb_view_create_meeting_data(&$bbbsession, $bigbluebuttonbn) { |
184 | 184 | $data = ['meetingID' => $bbbsession['meetingid'], |
185 | - 'name' => $bbbsession['meetingname'], |
|
186 | - 'attendeePW' => $bbbsession['viewerPW'], |
|
187 | - 'moderatorPW' => $bbbsession['modPW'], |
|
188 | - 'logoutURL' => $bbbsession['logoutURL'], |
|
185 | + 'name' => $bbbsession['meetingname'], |
|
186 | + 'attendeePW' => $bbbsession['viewerPW'], |
|
187 | + 'moderatorPW' => $bbbsession['modPW'], |
|
188 | + 'logoutURL' => $bbbsession['logoutURL'], |
|
189 | 189 | ]; |
190 | 190 | $data['record'] = bigbluebutton_bbb_view_create_meeting_data_record($bbbsession['record']); |
191 | 191 | $data['welcome'] = trim($bbbsession['welcome']); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | '%duration%', |
199 | 199 | (string) $durationtime, |
200 | 200 | get_string('bbbdurationwarning', 'bigbluebuttonbn') |
201 | - ); |
|
201 | + ); |
|
202 | 202 | } |
203 | 203 | $voicebridge = intval($bbbsession['voicebridge']); |
204 | 204 | if ($voicebridge > 0 && $voicebridge < 79999) { |
@@ -228,22 +228,22 @@ discard block |
||
228 | 228 | function bigbluebutton_bbb_view_create_meeting_metadata(&$bbbsession) { |
229 | 229 | global $USER; |
230 | 230 | $metadata = ['bbb-origin' => $bbbsession['origin'], |
231 | - 'bbb-origin-version' => $bbbsession['originVersion'], |
|
232 | - 'bbb-origin-server-name' => $bbbsession['originServerName'], |
|
233 | - 'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'], |
|
234 | - 'bbb-origin-tag' => $bbbsession['originTag'], |
|
235 | - 'bbb-context' => $bbbsession['course']->fullname, |
|
236 | - 'bbb-recording-name' => $bbbsession['meetingname'], |
|
237 | - 'bbb-recording-description' => bigbluebuttonbn_html2text($bbbsession['meetingdescription'], 64), |
|
238 | - 'bbb-recording-tags' => bigbluebuttonbn_get_tags($bbbsession['cm']->id), // Same as $id. |
|
231 | + 'bbb-origin-version' => $bbbsession['originVersion'], |
|
232 | + 'bbb-origin-server-name' => $bbbsession['originServerName'], |
|
233 | + 'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'], |
|
234 | + 'bbb-origin-tag' => $bbbsession['originTag'], |
|
235 | + 'bbb-context' => $bbbsession['course']->fullname, |
|
236 | + 'bbb-recording-name' => $bbbsession['meetingname'], |
|
237 | + 'bbb-recording-description' => bigbluebuttonbn_html2text($bbbsession['meetingdescription'], 64), |
|
238 | + 'bbb-recording-tags' => bigbluebuttonbn_get_tags($bbbsession['cm']->id), // Same as $id. |
|
239 | 239 | ]; |
240 | 240 | if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('recordingstatus_enabled')) { |
241 | 241 | $metadata["bn-recording-status"] = json_encode( |
242 | 242 | array( |
243 | 243 | 'email' => array('"' . fullname($USER) . '" <' . $USER->email . '>'), |
244 | 244 | 'context' => $bbbsession['bigbluebuttonbnURL'] |
245 | - ) |
|
246 | - ); |
|
245 | + ) |
|
246 | + ); |
|
247 | 247 | } |
248 | 248 | if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('recordingready_enabled')) { |
249 | 249 | $metadata['bn-recording-ready-url'] = $bbbsession['recordingReadyURL']; |
@@ -61,91 +61,91 @@ |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | switch (strtolower($action)) { |
64 | - case 'logout': |
|
65 | - if (isset($errors) && $errors != '') { |
|
66 | - bigbluebutton_bbb_view_errors($errors, $id); |
|
67 | - break; |
|
68 | - } |
|
69 | - if (is_null($bbbsession)) { |
|
70 | - bigbluebutton_bbb_view_close_window_manually(); |
|
71 | - break; |
|
72 | - } |
|
73 | - // Moodle event logger: Create an event for meeting left. |
|
74 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm); |
|
75 | - // Update the cache. |
|
76 | - $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED); |
|
77 | - // Close the tab or window where BBB was opened. |
|
78 | - bigbluebutton_bbb_view_close_window(); |
|
79 | - break; |
|
80 | - case 'join': |
|
81 | - if (is_null($bbbsession)) { |
|
82 | - print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
83 | - break; |
|
84 | - } |
|
85 | - // See if the session is in progress. |
|
86 | - if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) { |
|
87 | - // Since the meeting is already running, we just join the session. |
|
88 | - bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn); |
|
89 | - break; |
|
90 | - } |
|
91 | - // If user is not administrator nor moderator (user is steudent) and waiting is required. |
|
92 | - if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) { |
|
93 | - header('Location: '.$bbbsession['logoutURL']); |
|
64 | + case 'logout': |
|
65 | + if (isset($errors) && $errors != '') { |
|
66 | + bigbluebutton_bbb_view_errors($errors, $id); |
|
67 | + break; |
|
68 | + } |
|
69 | + if (is_null($bbbsession)) { |
|
70 | + bigbluebutton_bbb_view_close_window_manually(); |
|
71 | + break; |
|
72 | + } |
|
73 | + // Moodle event logger: Create an event for meeting left. |
|
74 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm); |
|
75 | + // Update the cache. |
|
76 | + $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED); |
|
77 | + // Close the tab or window where BBB was opened. |
|
78 | + bigbluebutton_bbb_view_close_window(); |
|
94 | 79 | break; |
95 | - } |
|
96 | - // As the meeting doesn't exist, try to create it. |
|
97 | - $response = bigbluebuttonbn_get_create_meeting_array( |
|
98 | - bigbluebutton_bbb_view_create_meeting_data($bbbsession, $bigbluebuttonbn), |
|
99 | - bigbluebutton_bbb_view_create_meeting_metadata($bbbsession), |
|
100 | - $bbbsession['presentation']['name'], |
|
101 | - $bbbsession['presentation']['url'] |
|
102 | - ); |
|
103 | - if (empty($response)) { |
|
104 | - // The server is unreachable. |
|
105 | - if ($bbbsession['administrator']) { |
|
106 | - print_error('view_error_unable_join', 'bigbluebuttonbn', |
|
107 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
80 | + case 'join': |
|
81 | + if (is_null($bbbsession)) { |
|
82 | + print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
83 | + break; |
|
84 | + } |
|
85 | + // See if the session is in progress. |
|
86 | + if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) { |
|
87 | + // Since the meeting is already running, we just join the session. |
|
88 | + bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn); |
|
108 | 89 | break; |
109 | 90 | } |
110 | - if ($bbbsession['moderator']) { |
|
111 | - print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', |
|
91 | + // If user is not administrator nor moderator (user is steudent) and waiting is required. |
|
92 | + if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) { |
|
93 | + header('Location: '.$bbbsession['logoutURL']); |
|
94 | + break; |
|
95 | + } |
|
96 | + // As the meeting doesn't exist, try to create it. |
|
97 | + $response = bigbluebuttonbn_get_create_meeting_array( |
|
98 | + bigbluebutton_bbb_view_create_meeting_data($bbbsession, $bigbluebuttonbn), |
|
99 | + bigbluebutton_bbb_view_create_meeting_metadata($bbbsession), |
|
100 | + $bbbsession['presentation']['name'], |
|
101 | + $bbbsession['presentation']['url'] |
|
102 | + ); |
|
103 | + if (empty($response)) { |
|
104 | + // The server is unreachable. |
|
105 | + if ($bbbsession['administrator']) { |
|
106 | + print_error('view_error_unable_join', 'bigbluebuttonbn', |
|
107 | + $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
108 | + break; |
|
109 | + } |
|
110 | + if ($bbbsession['moderator']) { |
|
111 | + print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', |
|
112 | + $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
113 | + break; |
|
114 | + } |
|
115 | + print_error('view_error_unable_join_student', 'bigbluebuttonbn', |
|
112 | 116 | $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
113 | 117 | break; |
114 | 118 | } |
115 | - print_error('view_error_unable_join_student', 'bigbluebuttonbn', |
|
116 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
117 | - break; |
|
118 | - } |
|
119 | - if ($response['returncode'] == 'FAILED') { |
|
120 | - // The meeting was not created. |
|
121 | - if (!$printerrorkey) { |
|
122 | - print_error($response['message'], 'bigbluebuttonbn'); |
|
119 | + if ($response['returncode'] == 'FAILED') { |
|
120 | + // The meeting was not created. |
|
121 | + if (!$printerrorkey) { |
|
122 | + print_error($response['message'], 'bigbluebuttonbn'); |
|
123 | + break; |
|
124 | + } |
|
125 | + $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
126 | + print_error($printerrorkey, 'bigbluebuttonbn'); |
|
127 | + break; |
|
128 | + } |
|
129 | + if ($response['hasBeenForciblyEnded'] == 'true') { |
|
130 | + print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
123 | 131 | break; |
124 | 132 | } |
125 | - $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
126 | - print_error($printerrorkey, 'bigbluebuttonbn'); |
|
133 | + // Moodle event logger: Create an event for meeting created. |
|
134 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm); |
|
135 | + // Internal logger: Insert a record with the meeting created. |
|
136 | + bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
137 | + // Since the meeting is already running, we just join the session. |
|
138 | + bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn); |
|
127 | 139 | break; |
128 | - } |
|
129 | - if ($response['hasBeenForciblyEnded'] == 'true') { |
|
130 | - print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
140 | + case 'play': |
|
141 | + $href = bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype); |
|
142 | + // Moodle event logger: Create an event for meeting left. |
|
143 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]); |
|
144 | + // Execute the redirect. |
|
145 | + header('Location: '.urldecode($href)); |
|
131 | 146 | break; |
132 | - } |
|
133 | - // Moodle event logger: Create an event for meeting created. |
|
134 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm); |
|
135 | - // Internal logger: Insert a record with the meeting created. |
|
136 | - bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
137 | - // Since the meeting is already running, we just join the session. |
|
138 | - bigbluebutton_bbb_view_join_meeting($bbbsession, $cm, $bigbluebuttonbn); |
|
139 | - break; |
|
140 | - case 'play': |
|
141 | - $href = bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype); |
|
142 | - // Moodle event logger: Create an event for meeting left. |
|
143 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]); |
|
144 | - // Execute the redirect. |
|
145 | - header('Location: '.urldecode($href)); |
|
146 | - break; |
|
147 | - default: |
|
148 | - bigbluebutton_bbb_view_close_window(); |
|
147 | + default: |
|
148 | + bigbluebutton_bbb_view_close_window(); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | function bigbluebutton_bbb_view_playback_href($href, $mid, $rid, $rtype) { |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later |
23 | 23 | */ |
24 | 24 | |
25 | -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); |
|
26 | -require_once(dirname(__FILE__).'/locallib.php'); |
|
25 | +require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); |
|
26 | +require_once(dirname(__FILE__) . '/locallib.php'); |
|
27 | 27 | |
28 | 28 | $action = required_param('action', PARAM_TEXT); |
29 | 29 | $id = optional_param('id', 0, PARAM_INT); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | // If user is not administrator nor moderator (user is steudent) and waiting is required. |
92 | 92 | if (!$bbbsession['administrator'] && !$bbbsession['moderator'] && $bbbsession['wait']) { |
93 | - header('Location: '.$bbbsession['logoutURL']); |
|
93 | + header('Location: ' . $bbbsession['logoutURL']); |
|
94 | 94 | break; |
95 | 95 | } |
96 | 96 | // As the meeting doesn't exist, try to create it. |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | // The server is unreachable. |
105 | 105 | if ($bbbsession['administrator']) { |
106 | 106 | print_error('view_error_unable_join', 'bigbluebuttonbn', |
107 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
107 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
108 | 108 | break; |
109 | 109 | } |
110 | 110 | if ($bbbsession['moderator']) { |
111 | 111 | print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', |
112 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
112 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | print_error('view_error_unable_join_student', 'bigbluebuttonbn', |
116 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
116 | + $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
117 | 117 | break; |
118 | 118 | } |
119 | 119 | if ($response['returncode'] == 'FAILED') { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // Moodle event logger: Create an event for meeting left. |
143 | 143 | bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_VIEWED, $bigbluebuttonbn, $cm, ['other' => $rid]); |
144 | 144 | // Execute the redirect. |
145 | - header('Location: '.urldecode($href)); |
|
145 | + header('Location: ' . urldecode($href)); |
|
146 | 146 | break; |
147 | 147 | default: |
148 | 148 | bigbluebutton_bbb_view_close_window(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $data['welcome'] .= '<br><br>'; |
197 | 197 | $data['welcome'] .= str_replace( |
198 | 198 | '%duration%', |
199 | - (string) $durationtime, |
|
199 | + (string)$durationtime, |
|
200 | 200 | get_string('bbbdurationwarning', 'bigbluebuttonbn') |
201 | 201 | ); |
202 | 202 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $meetinginfo = bigbluebuttonbn_get_meeting_info($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED); |
260 | 260 | if ($bbbsession['userlimit'] > 0 && intval($meetinginfo['participantCount']) >= $bbbsession['userlimit']) { |
261 | 261 | // No more users allowed to join. |
262 | - header('Location: '.$bbbsession['logoutURL']); |
|
262 | + header('Location: ' . $bbbsession['logoutURL']); |
|
263 | 263 | return; |
264 | 264 | } |
265 | 265 | // Build the URL. |
@@ -277,18 +277,18 @@ discard block |
||
277 | 277 | bigbluebuttonbn_participant_joined($bbbsession['meetingid'], |
278 | 278 | ($bbbsession['administrator'] || $bbbsession['moderator'])); |
279 | 279 | // Execute the redirect. |
280 | - header('Location: '.$joinurl); |
|
280 | + header('Location: ' . $joinurl); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | function bigbluebutton_bbb_view_errors($serrors, $id) { |
284 | 284 | global $CFG, $OUTPUT; |
285 | - $errors = (array) json_decode(urldecode($serrors)); |
|
285 | + $errors = (array)json_decode(urldecode($serrors)); |
|
286 | 286 | $msgerrors = ''; |
287 | 287 | foreach ($errors as $error) { |
288 | - $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger'))."\n"; |
|
288 | + $msgerrors .= html_writer::tag('p', $error->{'message'}, array('class' => 'alert alert-danger')) . "\n"; |
|
289 | 289 | } |
290 | 290 | echo $OUTPUT->header(); |
291 | 291 | print_error('view_error_bigbluebutton', 'bigbluebuttonbn', |
292 | - $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$id, $msgerrors, $serrors); |
|
292 | + $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $id, $msgerrors, $serrors); |
|
293 | 293 | echo $OUTPUT->footer(); |
294 | 294 | } |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { |
225 | 225 | global $DB; |
226 | 226 | $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id, |
227 | - 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
|
228 | - 'userid' => $user->id, |
|
229 | - 'log' => 'Join', ), '*'); |
|
227 | + 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
|
228 | + 'userid' => $user->id, |
|
229 | + 'log' => 'Join', ), '*'); |
|
230 | 230 | if ($completed > 0) { |
231 | 231 | return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '. |
232 | 232 | get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '. |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | function bigbluebuttonbn_user_complete($course, $user, $mod, $bigbluebuttonbn) { |
245 | 245 | global $DB; |
246 | 246 | $completed = $DB->count_recorda('bigbluebuttonbn_logs', array('courseid' => $course->id, |
247 | - 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
|
248 | - 'userid' => $user->id, |
|
249 | - 'log' => 'Join', ), '*', IGNORE_MULTIPLE); |
|
247 | + 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
|
248 | + 'userid' => $user->id, |
|
249 | + 'log' => 'Join', ), '*', IGNORE_MULTIPLE); |
|
250 | 250 | return $completed > 0; |
251 | 251 | } |
252 | 252 | |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | $str = '<div class="bigbluebuttonbn overview">'."\n"; |
318 | 318 | $str .= ' <div class="name">'.get_string('modulename', 'bigbluebuttonbn').': '."\n"; |
319 | 319 | $str .= ' <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule. |
320 | - '">'.$bigbluebuttonbn->name.'</a>'."\n"; |
|
320 | + '">'.$bigbluebuttonbn->name.'</a>'."\n"; |
|
321 | 321 | $str .= ' </div>'."\n"; |
322 | 322 | $str .= ' <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime). |
323 | 323 | '</div>'."\n"; |
324 | 324 | $str .= ' <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime) |
325 | - .'</div>'."\n"; |
|
325 | + .'</div>'."\n"; |
|
326 | 326 | $str .= '</div>'."\n"; |
327 | 327 | return $str; |
328 | 328 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * $return->time = the time they did it |
219 | 219 | * $return->info = a short text description. |
220 | 220 | * |
221 | - * @return bool |
|
221 | + * @return string |
|
222 | 222 | */ |
223 | 223 | function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { |
224 | 224 | global $DB; |
@@ -513,6 +513,10 @@ discard block |
||
513 | 513 | send_stored_file($file, 0, 0, $forcedownload, $options); // download MUST be forced - security! |
514 | 514 | } |
515 | 515 | |
516 | +/** |
|
517 | + * @param stdClass $context |
|
518 | + * @param string $filearea |
|
519 | + */ |
|
516 | 520 | function bigbluebuttonbn_pluginfile_valid($context, $filearea) { |
517 | 521 | if ($context->contextlevel != CONTEXT_MODULE) { |
518 | 522 | return false; |
@@ -529,6 +533,12 @@ discard block |
||
529 | 533 | return true; |
530 | 534 | } |
531 | 535 | |
536 | +/** |
|
537 | + * @param stdClass $course |
|
538 | + * @param stdClass $cm |
|
539 | + * @param stdClass $context |
|
540 | + * @param string $filearea |
|
541 | + */ |
|
532 | 542 | function bigbluebuttonbn_pluginfile_file($course, $cm, $context, $filearea, $args) { |
533 | 543 | $filename = bigbluebuttonbn_pluginfile_filename($course, $cm, $context, $args); |
534 | 544 | if (!$filename) { |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | |
28 | 28 | global $CFG; |
29 | 29 | |
30 | -require_once($CFG->dirroot.'/calendar/lib.php'); |
|
31 | -require_once($CFG->dirroot.'/message/lib.php'); |
|
32 | -require_once($CFG->dirroot.'/mod/lti/OAuth.php'); |
|
33 | -require_once($CFG->libdir.'/accesslib.php'); |
|
34 | -require_once($CFG->libdir.'/completionlib.php'); |
|
35 | -require_once($CFG->libdir.'/datalib.php'); |
|
36 | -require_once($CFG->libdir.'/coursecatlib.php'); |
|
37 | -require_once($CFG->libdir.'/enrollib.php'); |
|
38 | -require_once($CFG->libdir.'/filelib.php'); |
|
39 | -require_once($CFG->libdir.'/formslib.php'); |
|
40 | - |
|
41 | -if (file_exists(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php')) { |
|
42 | - require_once(dirname(__FILE__).'/vendor/firebase/php-jwt/src/JWT.php'); |
|
30 | +require_once($CFG->dirroot . '/calendar/lib.php'); |
|
31 | +require_once($CFG->dirroot . '/message/lib.php'); |
|
32 | +require_once($CFG->dirroot . '/mod/lti/OAuth.php'); |
|
33 | +require_once($CFG->libdir . '/accesslib.php'); |
|
34 | +require_once($CFG->libdir . '/completionlib.php'); |
|
35 | +require_once($CFG->libdir . '/datalib.php'); |
|
36 | +require_once($CFG->libdir . '/coursecatlib.php'); |
|
37 | +require_once($CFG->libdir . '/enrollib.php'); |
|
38 | +require_once($CFG->libdir . '/filelib.php'); |
|
39 | +require_once($CFG->libdir . '/formslib.php'); |
|
40 | + |
|
41 | +if (file_exists(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php')) { |
|
42 | + require_once(dirname(__FILE__) . '/vendor/firebase/php-jwt/src/JWT.php'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (!isset($CFG->bigbluebuttonbn)) { |
46 | 46 | $CFG->bigbluebuttonbn = array(); |
47 | 47 | } |
48 | 48 | |
49 | -if (file_exists(dirname(__FILE__).'/config.php')) { |
|
50 | - require_once(dirname(__FILE__).'/config.php'); |
|
49 | +if (file_exists(dirname(__FILE__) . '/config.php')) { |
|
50 | + require_once(dirname(__FILE__) . '/config.php'); |
|
51 | 51 | // Old BigBlueButtonBN cfg schema. For backward compatibility. |
52 | 52 | global $BIGBLUEBUTTONBN_CFG; |
53 | 53 | |
54 | 54 | if (isset($BIGBLUEBUTTONBN_CFG)) { |
55 | - foreach ((array) $BIGBLUEBUTTONBN_CFG as $key => $value) { |
|
55 | + foreach ((array)$BIGBLUEBUTTONBN_CFG as $key => $value) { |
|
56 | 56 | $cfgkey = str_replace("bigbluebuttonbn_", "", $key); |
57 | 57 | $CFG->bigbluebuttonbn[$cfgkey] = $value; |
58 | 58 | } |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $features = array( |
86 | - (string) FEATURE_IDNUMBER => true, |
|
87 | - (string) FEATURE_GROUPS => true, |
|
88 | - (string) FEATURE_GROUPINGS => true, |
|
89 | - (string) FEATURE_GROUPMEMBERSONLY => true, |
|
90 | - (string) FEATURE_MOD_INTRO => true, |
|
91 | - (string) FEATURE_BACKUP_MOODLE2 => true, |
|
92 | - (string) FEATURE_COMPLETION_TRACKS_VIEWS => true, |
|
93 | - (string) FEATURE_GRADE_HAS_GRADE => false, |
|
94 | - (string) FEATURE_GRADE_OUTCOMES => false, |
|
95 | - (string) FEATURE_SHOW_DESCRIPTION => true, |
|
86 | + (string)FEATURE_IDNUMBER => true, |
|
87 | + (string)FEATURE_GROUPS => true, |
|
88 | + (string)FEATURE_GROUPINGS => true, |
|
89 | + (string)FEATURE_GROUPMEMBERSONLY => true, |
|
90 | + (string)FEATURE_MOD_INTRO => true, |
|
91 | + (string)FEATURE_BACKUP_MOODLE2 => true, |
|
92 | + (string)FEATURE_COMPLETION_TRACKS_VIEWS => true, |
|
93 | + (string)FEATURE_GRADE_HAS_GRADE => false, |
|
94 | + (string)FEATURE_GRADE_OUTCOMES => false, |
|
95 | + (string)FEATURE_SHOW_DESCRIPTION => true, |
|
96 | 96 | ); |
97 | 97 | |
98 | - if (isset($features[(string) $feature])) { |
|
98 | + if (isset($features[(string)$feature])) { |
|
99 | 99 | return $features[$feature]; |
100 | 100 | } |
101 | 101 | |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id, |
213 | 213 | 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
214 | 214 | 'userid' => $user->id, |
215 | - 'log' => 'Join', ), '*'); |
|
215 | + 'log' => 'Join',), '*'); |
|
216 | 216 | if ($completed > 0) { |
217 | - return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '. |
|
218 | - get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '. |
|
217 | + return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' . |
|
218 | + get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' . |
|
219 | 219 | get_string('view_message_times', 'bigbluebuttonbn'); |
220 | 220 | } |
221 | 221 | return ''; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $completed = $DB->count_recorda('bigbluebuttonbn_logs', array('courseid' => $course->id, |
233 | 233 | 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
234 | 234 | 'userid' => $user->id, |
235 | - 'log' => 'Join', ), '*', IGNORE_MULTIPLE); |
|
235 | + 'log' => 'Join',), '*', IGNORE_MULTIPLE); |
|
236 | 236 | return $completed > 0; |
237 | 237 | } |
238 | 238 | |
@@ -300,16 +300,16 @@ discard block |
||
300 | 300 | if ($bigbluebuttonbn->visible) { |
301 | 301 | $classes = 'class="dimmed" '; |
302 | 302 | } |
303 | - $str = '<div class="bigbluebuttonbn overview">'."\n"; |
|
304 | - $str .= ' <div class="name">'.get_string('modulename', 'bigbluebuttonbn').': '."\n"; |
|
305 | - $str .= ' <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule. |
|
306 | - '">'.$bigbluebuttonbn->name.'</a>'."\n"; |
|
307 | - $str .= ' </div>'."\n"; |
|
308 | - $str .= ' <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime). |
|
309 | - '</div>'."\n"; |
|
310 | - $str .= ' <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime) |
|
311 | - .'</div>'."\n"; |
|
312 | - $str .= '</div>'."\n"; |
|
303 | + $str = '<div class="bigbluebuttonbn overview">' . "\n"; |
|
304 | + $str .= ' <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ': ' . "\n"; |
|
305 | + $str .= ' <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . |
|
306 | + '">' . $bigbluebuttonbn->name . '</a>' . "\n"; |
|
307 | + $str .= ' </div>' . "\n"; |
|
308 | + $str .= ' <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . |
|
309 | + '</div>' . "\n"; |
|
310 | + $str .= ' <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime) |
|
311 | + .'</div>' . "\n"; |
|
312 | + $str .= '</div>' . "\n"; |
|
313 | 313 | return $str; |
314 | 314 | } |
315 | 315 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | if (count($files) == 1) { |
465 | 465 | // Get the first (and only) file. |
466 | 466 | $file = reset($files); |
467 | - $filesrc = '/'.$file->get_filename(); |
|
467 | + $filesrc = '/' . $file->get_filename(); |
|
468 | 468 | } |
469 | 469 | return $filesrc; |
470 | 470 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | if (!$filename) { |
515 | 515 | return false; |
516 | 516 | } |
517 | - $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename; |
|
517 | + $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename; |
|
518 | 518 | $fs = get_file_storage(); |
519 | 519 | $file = $fs->get_file_by_hash(sha1($fullpath)); |
520 | 520 | if (!$file || $file->is_directory()) { |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later |
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 | $id = required_param('id', PARAM_INT); |
30 | 30 | $a = optional_param('a', 0, PARAM_INT); |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | if ($moderator || $administrator) { |
88 | 88 | bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $cm); |
89 | 89 | echo get_string('index_ending', 'bigbluebuttonbn'); |
90 | - $meetingid = $bigbluebuttonbn->meetingid.'-'.$course->id.'-'.$bigbluebuttonbn->id; |
|
90 | + $meetingid = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id; |
|
91 | 91 | if ($g != '0') { |
92 | - $meetingid .= '['.$g.']'; |
|
92 | + $meetingid .= '[' . $g . ']'; |
|
93 | 93 | } |
94 | 94 | bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingid)); |
95 | - redirect('index.php?id='.$id); |
|
95 | + redirect('index.php?id=' . $id); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // Add a the data for the bigbluebuttonbn instance. |
107 | 107 | $groupobj = null; |
108 | 108 | if (groups_get_activity_groupmode($cm) > 0) { |
109 | - $groupobj = (object) array('id' => 0, 'name' => get_string('allparticipants')); |
|
109 | + $groupobj = (object)array('id' => 0, 'name' => get_string('allparticipants')); |
|
110 | 110 | } |
111 | 111 | $table->data[] = bigbluebuttonbn_index_display_room($canmoderate, $course, $bigbluebuttonbn, $groupobj); |
112 | 112 | // Add a the data for the groups belonging to the bigbluebuttonbn instance, if any. |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | |
125 | 125 | // Functions. |
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 | } |