function bigbluebuttonbn_view_joining($bbbsession, $context, $streamline) { global $CFG, $DB; $joining = false; // If user is administrator, moderator or if is viewer and no waiting is required if ($bbbsession['flag']['administrator'] || $bbbsession['flag']['moderator'] || !$bbbsession['flag']['wait']) { // // Join directly // $metadata = array("meta_origin" => $bbbsession['origin'], "meta_originVersion" => $bbbsession['originVersion'], "meta_originServerName" => $bbbsession['originServerName'], "meta_originServerCommonName" => $bbbsession['originServerCommonName'], "meta_originTag" => $bbbsession['originTag'], "meta_context" => $bbbsession['context'], "meta_contextActivity" => $bbbsession['contextActivity'], "meta_contextActivityDescription" => $bbbsession['contextActivityDescription'], "meta_recording" => $bbbsession['textflag']['record']); $response = bigbluebuttonbn_getCreateMeetingArray($bbbsession['meetingname'], $bbbsession['meetingid'], $bbbsession['welcome'], $bbbsession['modPW'], $bbbsession['viewerPW'], $bbbsession['salt'], $bbbsession['url'], $bbbsession['logoutURL'], $bbbsession['textflag']['record'], $bbbsession['timeduration'], $bbbsession['voicebridge'], $metadata); if (!$response) { // If the server is unreachable, then prompts the user of the necessary action if ($bbbsession['flag']['administrator']) { print_error('view_error_unable_join', 'streamline', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); } else { if ($bbbsession['flag']['moderator']) { print_error('view_error_unable_join_teacher', 'streamline', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); } else { print_error('view_error_unable_join_student', 'streamline', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); } } } else { if ($response['returncode'] == "FAILED") { // The meeting was not created $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); if (!$error_key) { print_error($response['message'], 'streamline'); } else { print_error($error_key, 'streamline'); } } else { if ($response['hasBeenForciblyEnded'] == "true") { print_error(get_string('index_error_forciblyended', 'streamline')); } else { ///////////////Everything is ok ///////////////////// /// Moodle event logger: Create an event for meeting created if ($CFG->version < '2014051200') { //This is valid before v2.7 add_to_log($bbbsession['courseid'], 'streamline', 'meeting created', '', $streamline->name, $bbbsession['cm']->id); } else { //This is valid after v2.7 $event = \mod_streamline\event\bigbluebuttonbn_meeting_created::create(array('context' => $context, 'objectid' => $streamline->id)); $event->trigger(); } /// Internal logger: Instert a record with the meeting created bigbluebuttonbn_log($bbbsession, 'Create'); if (groups_get_activity_groupmode($bbbsession['cm']) > 0 && count(groups_get_activity_allowed_groups($bbbsession['cm'])) > 1) { print "<br>" . get_string('view_groups_selection', 'streamline') . " <input type='button' onClick='M.mod_streamline.joinURL()' value='" . get_string('view_groups_selection_join', 'streamline') . "'>"; } else { $joining = true; if ($bbbsession['flag']['administrator'] || $bbbsession['flag']['moderator']) { print "<br />" . get_string('view_login_moderator', 'streamline') . "<br /><br />"; } else { print "<br />" . get_string('view_login_viewer', 'streamline') . "<br /><br />"; } print "<center><img src='pix/loading.gif' /></center>"; } /// Moodle event logger: Create an event for meeting joined if ($CFG->version < '2014051200') { //This is valid before v2.7 add_to_log($bbbsession['courseid'], 'streamline', 'meeting joined', '', $streamline->name, $bbbsession['cm']->id); } else { //This is valid after v2.7 $event = \mod_streamline\event\bigbluebuttonbn_meeting_joined::create(array('context' => $context, 'objectid' => $streamline->id)); $event->trigger(); } } } } } else { // // "Viewer" && Waiting for moderator is required; // $joining = true; print "<div align='center'>"; if (bigbluebuttonbn_wrap_simplexml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($bbbsession['meetingid'], $bbbsession['url'], $bbbsession['salt'])) == "true") { /// Since the meeting is already running, we just join the session print "<br />" . get_string('view_login_viewer', 'streamline') . "<br /><br />"; print "<center><img src='pix/loading.gif' /></center>"; /// Moodle event logger: Create an event for meeting joined if ($CFG->version < '2014051200') { //This is valid before v2.7 add_to_log($bbbsession['courseid'], 'streamline', 'meeting joined', '', $streamline->name, $bbbsession['cm']->id); } else { //This is valid after v2.7 $event = \mod_streamline\event\bigbluebuttonbn_meeting_joined::create(array('context' => $context, 'objectid' => $streamline->id)); $event->trigger(); } } else { /// Since the meeting is not running, the spining wheel is shown print "<br />" . get_string('view_wait', 'streamline') . "<br /><br />"; print '<center><img src="pix/polling.gif"></center>'; } print "</div>"; } return $joining; }
function bigbluebuttonbn_getMeetingXML($meetingID, $URL, $SALT) { $xml = bigbluebuttonbn_wrap_simplexml_load_file(bigbluebuttonbn_getIsMeetingRunningURL($meetingID, $URL, $SALT)); if ($xml && $xml->returncode == 'SUCCESS') { return str_replace('</response>', '', str_replace("<?xml version=\"1.0\"?>\n<response>", '', $xml->asXML())); } else { return 'false'; } }
$cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST); if ($CFG->version < '2014051200') { //This is valid before v2.7 add_to_log($course->id, 'bigbluebuttonbn', 'meeting ended', "index.php?id={$course->id}", ''); } else { //This is valid before v2.7 $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_meeting_ended::create(array('context' => $context, 'objectid' => $bigbluebuttonbn->id)); $event->trigger(); } echo get_string('index_ending', 'bigbluebuttonbn'); $meetingID = $bigbluebuttonbn->meetingid . '-' . $course->id . '-' . $bigbluebuttonbn->id; $modPW = $bigbluebuttonbn->moderatorpass; if ($g != '0') { $getArray = bigbluebuttonbn_wrap_simplexml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID . '[' . $g . ']', $modPW, $url, $salt)); } else { $getArray = bigbluebuttonbn_wrap_simplexml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $url, $salt)); } redirect('index.php?id=' . $id); } else { if ($CFG->version < '2014051200') { //This is valid before v2.7 add_to_log($course->id, 'bigbluebuttonbn', 'activity management viewed', "index.php?id={$course->id}", ''); } else { //This is valid after v2.7 $event = \mod_bigbluebuttonbn\event\bigbluebuttonbn_activity_management_viewed::create(array('context' => $context)); $event->trigger(); } } foreach ($bigbluebuttonbns as $bigbluebuttonbn) { $cm = get_coursemodule_from_id('bigbluebuttonbn', $bigbluebuttonbn->coursemodule, 0, false, MUST_EXIST); if (groups_get_activity_groupmode($cm) > 0) {