@@ -47,119 +47,119 @@ |
||
47 | 47 | $bbbsession = $SESSION->bigbluebuttonbn_bbbsession; |
48 | 48 | } |
49 | 49 | switch (strtolower($action)) { |
50 | - case 'logout': |
|
51 | - if (isset($errors) && $errors != '') { |
|
52 | - bigbluebutton_bbb_view_errors($errors, $id); |
|
50 | + case 'logout': |
|
51 | + if (isset($errors) && $errors != '') { |
|
52 | + bigbluebutton_bbb_view_errors($errors, $id); |
|
53 | 53 | |
54 | - } else if (isset($bbbsession) && !is_null($bbbsession)) { |
|
55 | - /// Moodle event logger: Create an event for meeting left |
|
56 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm); |
|
54 | + } else if (isset($bbbsession) && !is_null($bbbsession)) { |
|
55 | + /// Moodle event logger: Create an event for meeting left |
|
56 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $context, $cm); |
|
57 | 57 | |
58 | - /// Update the cache |
|
59 | - $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], BIGBLUEBUTTONBN_FORCED); |
|
58 | + /// Update the cache |
|
59 | + $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($bbbsession['meetingid'], $bbbsession['modPW'], BIGBLUEBUTTONBN_FORCED); |
|
60 | 60 | |
61 | - /// Close the tab or window where BBB was opened |
|
62 | - bigbluebutton_bbb_view_close_window(); |
|
63 | - |
|
64 | - } else { |
|
65 | - bigbluebutton_bbb_view_close_window_manually(); |
|
66 | - } |
|
67 | - break; |
|
68 | - case 'join': |
|
69 | - if (isset($bbbsession) && !is_null($bbbsession)) { |
|
70 | - //See if the session is in progress |
|
71 | - if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) { |
|
72 | - /// Since the meeting is already running, we just join the session |
|
73 | - bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
61 | + /// Close the tab or window where BBB was opened |
|
62 | + bigbluebutton_bbb_view_close_window(); |
|
74 | 63 | |
75 | 64 | } else { |
76 | - // If user is administrator, moderator or if is viewer and no waiting is required |
|
77 | - if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) { |
|
78 | - /// Prepare the metadata |
|
79 | - $metadata = array("meta_bn-origin" => $bbbsession['origin'], |
|
80 | - "meta_bbb-origin-version" => $bbbsession['originVersion'], |
|
81 | - "meta_bbb-origin-server-name" => $bbbsession['originServerName'], |
|
82 | - "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'], |
|
83 | - "meta_bbb-origin-tag" => $bbbsession['originTag'], |
|
84 | - "meta_bbb-context" => $bbbsession['course']->fullname, |
|
85 | - "meta_bbb-recording-name" => (isset($name) && $name != '') ? $name : $bbbsession['contextActivityName'], |
|
86 | - "meta_bbb-recording-description" => (isset($description) && $description != '') ? $description : $bbbsession['contextActivityDescription'], |
|
87 | - "meta_bbb-recording-tags" => (isset($tags) && $tags != '') ? $tags : $bbbsession['contextActivityTags'], |
|
88 | - ); |
|
89 | - |
|
90 | - if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) { |
|
91 | - $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL']; |
|
92 | - } |
|
65 | + bigbluebutton_bbb_view_close_window_manually(); |
|
66 | + } |
|
67 | + break; |
|
68 | + case 'join': |
|
69 | + if (isset($bbbsession) && !is_null($bbbsession)) { |
|
70 | + //See if the session is in progress |
|
71 | + if (bigbluebuttonbn_isMeetingRunning($bbbsession['meetingid'], $bbbsession['endpoint'], $bbbsession['shared_secret'])) { |
|
72 | + /// Since the meeting is already running, we just join the session |
|
73 | + bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
93 | 74 | |
94 | - /// Set the duration for the meeting |
|
95 | - if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
|
96 | - $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
|
97 | - if ($durationtime > 0) |
|
98 | - $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
99 | - } else { |
|
100 | - $durationtime = 0; |
|
101 | - } |
|
102 | - /// Execute the create command |
|
103 | - $response = bigbluebuttonbn_getCreateMeetingArray( |
|
104 | - $bbbsession['meetingname'], |
|
105 | - $bbbsession['meetingid'], |
|
106 | - $bbbsession['welcome'], |
|
107 | - $bbbsession['modPW'], |
|
108 | - $bbbsession['viewerPW'], |
|
109 | - $bbbsession['shared_secret'], |
|
110 | - $bbbsession['endpoint'], |
|
111 | - $bbbsession['logoutURL'], |
|
112 | - $bbbsession['record'] ? 'true' : 'false', |
|
113 | - $durationtime, |
|
114 | - $bbbsession['voicebridge'], |
|
115 | - $bbbsession['userlimit'], |
|
116 | - $metadata, |
|
117 | - $bbbsession['presentation']['name'], |
|
118 | - $bbbsession['presentation']['url'] |
|
119 | - ); |
|
120 | - |
|
121 | - if (!$response) { |
|
122 | - // If the server is unreachable, then prompts the user of the necessary action |
|
123 | - if ($bbbsession['administrator']) { |
|
124 | - print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
125 | - } else if ($bbbsession['moderator']) { |
|
126 | - print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
127 | - } else { |
|
128 | - print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
75 | + } else { |
|
76 | + // If user is administrator, moderator or if is viewer and no waiting is required |
|
77 | + if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) { |
|
78 | + /// Prepare the metadata |
|
79 | + $metadata = array("meta_bn-origin" => $bbbsession['origin'], |
|
80 | + "meta_bbb-origin-version" => $bbbsession['originVersion'], |
|
81 | + "meta_bbb-origin-server-name" => $bbbsession['originServerName'], |
|
82 | + "meta_bbb-origin-server-common-name" => $bbbsession['originServerCommonName'], |
|
83 | + "meta_bbb-origin-tag" => $bbbsession['originTag'], |
|
84 | + "meta_bbb-context" => $bbbsession['course']->fullname, |
|
85 | + "meta_bbb-recording-name" => (isset($name) && $name != '') ? $name : $bbbsession['contextActivityName'], |
|
86 | + "meta_bbb-recording-description" => (isset($description) && $description != '') ? $description : $bbbsession['contextActivityDescription'], |
|
87 | + "meta_bbb-recording-tags" => (isset($tags) && $tags != '') ? $tags : $bbbsession['contextActivityTags'], |
|
88 | + ); |
|
89 | + |
|
90 | + if (bigbluebuttonbn_server_offers_bn_capabilities() && bigbluebuttonbn_get_cfg_recordingready_enabled()) { |
|
91 | + $metadata["meta_bn-recording-ready-url"] = $bbbsession['recordingReadyURL']; |
|
129 | 92 | } |
130 | 93 | |
131 | - } else if ($response['returncode'] == "FAILED") { |
|
132 | - // The meeting was not created |
|
133 | - $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
134 | - if (!$error_key) { |
|
135 | - print_error($response['message'], 'bigbluebuttonbn'); |
|
94 | + /// Set the duration for the meeting |
|
95 | + if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
|
96 | + $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
|
97 | + if ($durationtime > 0) |
|
98 | + $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
136 | 99 | } else { |
137 | - print_error($error_key, 'bigbluebuttonbn'); |
|
100 | + $durationtime = 0; |
|
101 | + } |
|
102 | + /// Execute the create command |
|
103 | + $response = bigbluebuttonbn_getCreateMeetingArray( |
|
104 | + $bbbsession['meetingname'], |
|
105 | + $bbbsession['meetingid'], |
|
106 | + $bbbsession['welcome'], |
|
107 | + $bbbsession['modPW'], |
|
108 | + $bbbsession['viewerPW'], |
|
109 | + $bbbsession['shared_secret'], |
|
110 | + $bbbsession['endpoint'], |
|
111 | + $bbbsession['logoutURL'], |
|
112 | + $bbbsession['record'] ? 'true' : 'false', |
|
113 | + $durationtime, |
|
114 | + $bbbsession['voicebridge'], |
|
115 | + $bbbsession['userlimit'], |
|
116 | + $metadata, |
|
117 | + $bbbsession['presentation']['name'], |
|
118 | + $bbbsession['presentation']['url'] |
|
119 | + ); |
|
120 | + |
|
121 | + if (!$response) { |
|
122 | + // If the server is unreachable, then prompts the user of the necessary action |
|
123 | + if ($bbbsession['administrator']) { |
|
124 | + print_error('view_error_unable_join', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
125 | + } else if ($bbbsession['moderator']) { |
|
126 | + print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
127 | + } else { |
|
128 | + print_error('view_error_unable_join_student', 'bigbluebuttonbn', $CFG->wwwroot . '/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
129 | + } |
|
130 | + |
|
131 | + } else if ($response['returncode'] == "FAILED") { |
|
132 | + // The meeting was not created |
|
133 | + $error_key = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
134 | + if (!$error_key) { |
|
135 | + print_error($response['message'], 'bigbluebuttonbn'); |
|
136 | + } else { |
|
137 | + print_error($error_key, 'bigbluebuttonbn'); |
|
138 | + } |
|
139 | + |
|
140 | + } else if ($response['hasBeenForciblyEnded'] == "true") { |
|
141 | + print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
142 | + |
|
143 | + } else { ///////////////Everything is ok ///////////////////// |
|
144 | + /// Moodle event logger: Create an event for meeting created |
|
145 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $context, $cm); |
|
146 | + /// Internal logger: Instert a record with the meeting created |
|
147 | + bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
148 | + /// Since the meeting is already running, we just join the session |
|
149 | + bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
138 | 150 | } |
139 | 151 | |
140 | - } else if ($response['hasBeenForciblyEnded'] == "true") { |
|
141 | - print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
142 | - |
|
143 | - } else { ///////////////Everything is ok ///////////////////// |
|
144 | - /// Moodle event logger: Create an event for meeting created |
|
145 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $context, $cm); |
|
146 | - /// Internal logger: Instert a record with the meeting created |
|
147 | - bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
148 | - /// Since the meeting is already running, we just join the session |
|
149 | - bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $context, $bigbluebuttonbn); |
|
152 | + } else { |
|
153 | + header('Location: ' . $bbbsession['logoutURL']); |
|
150 | 154 | } |
151 | - |
|
152 | - } else { |
|
153 | - header('Location: ' . $bbbsession['logoutURL']); |
|
154 | 155 | } |
155 | - } |
|
156 | 156 | |
157 | - } else { |
|
158 | - print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
159 | - } |
|
160 | - break; |
|
161 | - default: |
|
162 | - bigbluebutton_bbb_view_close_window(); |
|
157 | + } else { |
|
158 | + print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
159 | + } |
|
160 | + break; |
|
161 | + default: |
|
162 | + bigbluebutton_bbb_view_close_window(); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 |
@@ -94,8 +94,9 @@ |
||
94 | 94 | /// Set the duration for the meeting |
95 | 95 | if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
96 | 96 | $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->openingtime, $bigbluebuttonbn->closingtime); |
97 | - if ($durationtime > 0) |
|
98 | - $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
97 | + if ($durationtime > 0) { |
|
98 | + $bbbsession['welcome'] .= '<br><br>' . str_replace("%duration%", '' . $durationtime, get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
99 | + } |
|
99 | 100 | } else { |
100 | 101 | $durationtime = 0; |
101 | 102 | } |
@@ -81,49 +81,49 @@ |
||
81 | 81 | $can_join = false; |
82 | 82 | } |
83 | 83 | |
84 | - if( $bbbsession['administrator'] || $bbbsession['moderator'] ) { |
|
84 | + if ($bbbsession['administrator'] || $bbbsession['moderator']) { |
|
85 | 85 | $end_button_text = get_string('view_conference_action_end', 'bigbluebuttonbn'); |
86 | 86 | $can_end = true; |
87 | - $status_can_end = '"can_end": true, "end_button_text": "'.$end_button_text.'", '; |
|
87 | + $status_can_end = '"can_end": true, "end_button_text": "' . $end_button_text . '", '; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | } else { |
91 | 91 | // If user is administrator, moderator or if is viewer and no waiting is required |
92 | 92 | $join_button_text = get_string('view_conference_action_join', 'bigbluebuttonbn'); |
93 | - if ( $bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait'] ) { |
|
93 | + if ($bbbsession['administrator'] || $bbbsession['moderator'] || !$bbbsession['wait']) { |
|
94 | 94 | $initial_message = get_string('view_message_conference_room_ready', 'bigbluebuttonbn'); |
95 | 95 | $can_join = true; |
96 | 96 | |
97 | 97 | } else { |
98 | 98 | $initial_message = get_string('view_message_conference_not_started', 'bigbluebuttonbn'); |
99 | - if ( $bbbsession['wait'] ) { |
|
100 | - $initial_message .= ' '.get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn'); |
|
99 | + if ($bbbsession['wait']) { |
|
100 | + $initial_message .= ' ' . get_string('view_message_conference_wait_for_moderator', 'bigbluebuttonbn'); |
|
101 | 101 | } |
102 | 102 | $can_join = false; |
103 | 103 | } |
104 | 104 | |
105 | - if( $bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator']) ) { |
|
105 | + if ($bbbsession['tagging'] && ($bbbsession['administrator'] || $bbbsession['moderator'])) { |
|
106 | 106 | $can_tag = true; |
107 | 107 | |
108 | 108 | } else { |
109 | 109 | $can_tag = false; |
110 | 110 | } |
111 | - $status_can_end = '"can_tag": '.($can_tag? 'true': 'false').', '; |
|
111 | + $status_can_end = '"can_tag": ' . ($can_tag ? 'true' : 'false') . ', '; |
|
112 | 112 | } |
113 | 113 | |
114 | - echo $params['callback'].'({ "running": '.($meeting_running? 'true':'false').', "info": '.json_encode($meeting_info).', "status": {"can_join": '.($can_join? 'true':'false').',"join_url": "'.$bbbsession['joinURL'].'","join_button_text": "'.$join_button_text.'", '.$status_can_end.$status_can_tag.'"message": "'.$initial_message.'"} });'; |
|
114 | + echo $params['callback'] . '({ "running": ' . ($meeting_running ? 'true' : 'false') . ', "info": ' . json_encode($meeting_info) . ', "status": {"can_join": ' . ($can_join ? 'true' : 'false') . ',"join_url": "' . $bbbsession['joinURL'] . '","join_button_text": "' . $join_button_text . '", ' . $status_can_end . $status_can_tag . '"message": "' . $initial_message . '"} });'; |
|
115 | 115 | break; |
116 | 116 | case 'meeting_end': |
117 | - if( $bbbsession['administrator'] || $bbbsession['moderator'] ) { |
|
117 | + if ($bbbsession['administrator'] || $bbbsession['moderator']) { |
|
118 | 118 | //Execute the end command |
119 | 119 | $meeting_info = bigbluebuttonbn_bbb_broker_do_end_meeting($params['id'], $bbbsession['modPW']); |
120 | 120 | // Moodle event logger: Create an event for meeting ended |
121 | - if( isset($bigbluebuttonbn) ) |
|
121 | + if (isset($bigbluebuttonbn)) |
|
122 | 122 | bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_ENDED, $bigbluebuttonbn, $context, $cm); |
123 | 123 | // Update the cache |
124 | 124 | $meeting_info = bigbluebuttonbn_bbb_broker_get_meeting_info($params['id'], $bbbsession['modPW'], true); |
125 | 125 | |
126 | - echo $params['callback'].'({ "status": true });'; |
|
126 | + echo $params['callback'] . '({ "status": true });'; |
|
127 | 127 | } else { |
128 | 128 | error_log("ERROR: User not authorized to execute end command"); |
129 | 129 | header("HTTP/1.0 401 Unauthorized. User not authorized to execute end command"); |
@@ -93,7 +93,7 @@ |
||
93 | 93 | } else { |
94 | 94 | $getArray = bigbluebuttonbn_wrap_xml_load_file(bigbluebuttonbn_getEndMeetingURL($meetingID, $modPW, $endpoint, $shared_secret)); |
95 | 95 | } |
96 | - redirect('index.php?id=' . $id); |
|
96 | + redirect('index.php?id=' . $id); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 |