@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * $return->time = the time they did it |
| 220 | 220 | * $return->info = a short text description. |
| 221 | 221 | * |
| 222 | - * @return bool |
|
| 222 | + * @return string |
|
| 223 | 223 | */ |
| 224 | 224 | function bigbluebuttonbn_user_outline($course, $user, $mod, $bigbluebuttonbn) { |
| 225 | 225 | global $DB; |
@@ -462,9 +462,7 @@ discard block |
||
| 462 | 462 | * that was uploaded, or if there is none, set the |
| 463 | 463 | * presentation field to blank. |
| 464 | 464 | * |
| 465 | - * @param int $bigbluebuttonbnid the bigbluebuttonbn id |
|
| 466 | - * @param stdClass $context the context |
|
| 467 | - * @param int $draftitemid the draft item |
|
| 465 | + * @param int $bigbluebuttonbn the bigbluebuttonbn id |
|
| 468 | 466 | */ |
| 469 | 467 | function bigbluebuttonbn_update_media_file(&$bigbluebuttonbn) { |
| 470 | 468 | global $DB; |
@@ -517,6 +515,10 @@ discard block |
||
| 517 | 515 | send_stored_file($file, 0, 0, $forcedownload, $options); // download MUST be forced - security! |
| 518 | 516 | } |
| 519 | 517 | |
| 518 | +/** |
|
| 519 | + * @param stdClass $context |
|
| 520 | + * @param string $filearea |
|
| 521 | + */ |
|
| 520 | 522 | function bigbluebuttonbn_pluginfile_valid($context, $filearea) { |
| 521 | 523 | if ($context->contextlevel != CONTEXT_MODULE) { |
| 522 | 524 | return false; |
@@ -533,6 +535,12 @@ discard block |
||
| 533 | 535 | return true; |
| 534 | 536 | } |
| 535 | 537 | |
| 538 | +/** |
|
| 539 | + * @param stdClass $course |
|
| 540 | + * @param stdClass $cm |
|
| 541 | + * @param stdClass $context |
|
| 542 | + * @param string $filearea |
|
| 543 | + */ |
|
| 536 | 544 | function bigbluebuttonbn_pluginfile_file($course, $cm, $context, $filearea, $args) { |
| 537 | 545 | $filename = bigbluebuttonbn_pluginfile_filename($course, $cm, $context, $args); |
| 538 | 546 | if (!$filename) { |
@@ -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 | } |
@@ -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 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $DB->set_field('bigbluebuttonbn', 'meetingid', $meetingid, array('id' => $data->id)); |
| 126 | 126 | // Assuming the inserts work, we get to the following line. |
| 127 | 127 | $transaction->allow_commit(); |
| 128 | - } catch(Exception $e) { |
|
| 128 | + } catch (Exception $e) { |
|
| 129 | 129 | $transaction->rollback($e); |
| 130 | 130 | } |
| 131 | 131 | if ($data->id) { |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | // Assuming the inserts work, we get to the following line. |
| 155 | 155 | $transaction->allow_commit(); |
| 156 | 156 | $updated = true; |
| 157 | - } catch(Exception $e) { |
|
| 157 | + } catch (Exception $e) { |
|
| 158 | 158 | $transaction->rollback($e); |
| 159 | 159 | $updated = false; |
| 160 | 160 | } |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | $completed = $DB->count_records('bigbluebuttonbn_logs', array('courseid' => $course->id, |
| 227 | 227 | 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
| 228 | 228 | 'userid' => $user->id, |
| 229 | - 'log' => 'Join', ), '*'); |
|
| 229 | + 'log' => 'Join',), '*'); |
|
| 230 | 230 | if ($completed > 0) { |
| 231 | - return fullname($user).' '.get_string('view_message_has_joined', 'bigbluebuttonbn').' '. |
|
| 232 | - get_string('view_message_session_for', 'bigbluebuttonbn').' '.(string) $completed.' '. |
|
| 231 | + return fullname($user) . ' ' . get_string('view_message_has_joined', 'bigbluebuttonbn') . ' ' . |
|
| 232 | + get_string('view_message_session_for', 'bigbluebuttonbn') . ' ' . (string)$completed . ' ' . |
|
| 233 | 233 | get_string('view_message_times', 'bigbluebuttonbn'); |
| 234 | 234 | } |
| 235 | 235 | return ''; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $completed = $DB->count_recorda('bigbluebuttonbn_logs', array('courseid' => $course->id, |
| 247 | 247 | 'bigbluebuttonbnid' => $bigbluebuttonbn->id, |
| 248 | 248 | 'userid' => $user->id, |
| 249 | - 'log' => 'Join', ), '*', IGNORE_MULTIPLE); |
|
| 249 | + 'log' => 'Join',), '*', IGNORE_MULTIPLE); |
|
| 250 | 250 | return $completed > 0; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -314,16 +314,16 @@ discard block |
||
| 314 | 314 | if ($bigbluebuttonbn->visible) { |
| 315 | 315 | $classes = 'class="dimmed" '; |
| 316 | 316 | } |
| 317 | - $str = '<div class="bigbluebuttonbn overview">'."\n"; |
|
| 318 | - $str .= ' <div class="name">'.get_string('modulename', 'bigbluebuttonbn').': '."\n"; |
|
| 319 | - $str .= ' <a '.$classes.'href="'.$CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bigbluebuttonbn->coursemodule. |
|
| 320 | - '">'.$bigbluebuttonbn->name.'</a>'."\n"; |
|
| 321 | - $str .= ' </div>'."\n"; |
|
| 322 | - $str .= ' <div class="info">'.get_string($start, 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->openingtime). |
|
| 323 | - '</div>'."\n"; |
|
| 324 | - $str .= ' <div class="info">'.get_string('ends_at', 'bigbluebuttonbn').': '.userdate($bigbluebuttonbn->closingtime) |
|
| 325 | - .'</div>'."\n"; |
|
| 326 | - $str .= '</div>'."\n"; |
|
| 317 | + $str = '<div class="bigbluebuttonbn overview">' . "\n"; |
|
| 318 | + $str .= ' <div class="name">' . get_string('modulename', 'bigbluebuttonbn') . ': ' . "\n"; |
|
| 319 | + $str .= ' <a ' . $classes . 'href="' . $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bigbluebuttonbn->coursemodule . |
|
| 320 | + '">' . $bigbluebuttonbn->name . '</a>' . "\n"; |
|
| 321 | + $str .= ' </div>' . "\n"; |
|
| 322 | + $str .= ' <div class="info">' . get_string($start, 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->openingtime) . |
|
| 323 | + '</div>' . "\n"; |
|
| 324 | + $str .= ' <div class="info">' . get_string('ends_at', 'bigbluebuttonbn') . ': ' . userdate($bigbluebuttonbn->closingtime) |
|
| 325 | + .'</div>' . "\n"; |
|
| 326 | + $str .= '</div>' . "\n"; |
|
| 327 | 327 | return $str; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | if (count($files) == 1) { |
| 483 | 483 | // Get the first (and only) file. |
| 484 | 484 | $file = reset($files); |
| 485 | - $filesrc = '/'.$file->get_filename(); |
|
| 485 | + $filesrc = '/' . $file->get_filename(); |
|
| 486 | 486 | } |
| 487 | 487 | // Set the presentation column in the bigbluebuttonbn table. |
| 488 | 488 | $DB->set_field('bigbluebuttonbn', 'presentation', $filesrc, array('id' => $bigbluebuttonbn->id)); |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | return false; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/".$filename; |
|
| 542 | + $fullpath = "/$context->id/mod_bigbluebuttonbn/$filearea/0/" . $filename; |
|
| 543 | 543 | $fs = get_file_storage(); |
| 544 | 544 | $file = $fs->get_file_by_hash(sha1($fullpath)); |
| 545 | 545 | if (!$file || $file->is_directory()) { |
@@ -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 | } |
@@ -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 | } |