@@ -63,135 +63,135 @@ |
||
63 | 63 | $bbbsession = $SESSION->bigbluebuttonbn_bbbsession; |
64 | 64 | } |
65 | 65 | switch (strtolower($action)) { |
66 | - case 'logout': |
|
67 | - if (isset($errors) && $errors != '') { |
|
68 | - bigbluebutton_bbb_view_errors($errors, $id); |
|
69 | - } else if (isset($bbbsession) && !is_null($bbbsession)) { |
|
70 | - // Moodle event logger: Create an event for meeting left. |
|
71 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm); |
|
72 | - |
|
73 | - // Update the cache. |
|
74 | - $meetinginfo = bigbluebuttonbn_get_meetinginfo($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED); |
|
75 | - |
|
76 | - // Close the tab or window where BBB was opened. |
|
77 | - bigbluebutton_bbb_view_close_window(); |
|
78 | - } else { |
|
79 | - bigbluebutton_bbb_view_close_window_manually(); |
|
80 | - } |
|
81 | - break; |
|
82 | - case 'join': |
|
83 | - if (isset($bbbsession) && !is_null($bbbsession)) { |
|
84 | - // See if the session is in progress. |
|
85 | - if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) { |
|
86 | - // Since the meeting is already running, we just join the session. |
|
87 | - bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $bigbluebuttonbn); |
|
88 | - break; |
|
89 | - } |
|
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']); |
|
94 | - break; |
|
95 | - } |
|
96 | - |
|
97 | - // Prepare the metadata. |
|
98 | - $bbbrecordingname = $bbbsession['contextActivityName']; |
|
99 | - if (isset($name) && $name != '') { |
|
100 | - $bbbrecordingname = $name; |
|
66 | + case 'logout': |
|
67 | + if (isset($errors) && $errors != '') { |
|
68 | + bigbluebutton_bbb_view_errors($errors, $id); |
|
69 | + } else if (isset($bbbsession) && !is_null($bbbsession)) { |
|
70 | + // Moodle event logger: Create an event for meeting left. |
|
71 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_LEFT, $bigbluebuttonbn, $cm); |
|
72 | + |
|
73 | + // Update the cache. |
|
74 | + $meetinginfo = bigbluebuttonbn_get_meetinginfo($bbbsession['meetingid'], BIGBLUEBUTTONBN_FORCED); |
|
75 | + |
|
76 | + // Close the tab or window where BBB was opened. |
|
77 | + bigbluebutton_bbb_view_close_window(); |
|
78 | + } else { |
|
79 | + bigbluebutton_bbb_view_close_window_manually(); |
|
101 | 80 | } |
102 | - $bbbrecordingdescription = $bbbsession['contextActivityDescription']; |
|
103 | - if (isset($description) && $description != '') { |
|
104 | - $bbbrecordingdescription = $description; |
|
105 | - } |
|
106 | - $bbbrecordingtags = $bbbsession['contextActivityTags']; |
|
107 | - if (isset($tags) && $tags != '') { |
|
108 | - $bbbrecordingtags = $tags; |
|
109 | - } |
|
110 | - $metadata = array('bbb-origin' => $bbbsession['origin'], |
|
111 | - 'bbb-origin-version' => $bbbsession['originVersion'], |
|
112 | - 'bbb-origin-server-name' => $bbbsession['originServerName'], |
|
113 | - 'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'], |
|
114 | - 'bbb-origin-tag' => $bbbsession['originTag'], |
|
115 | - 'bbb-context' => $bbbsession['course']->fullname, |
|
116 | - 'bbb-recording-name' => $bbbrecordingname, |
|
117 | - 'bbb-recording-description' => $bbbrecordingdescription, |
|
118 | - 'bbb-recording-tags' => $bbbrecordingtags, |
|
119 | - ); |
|
120 | - |
|
121 | - if (bigbluebuttonbn_server_offers_bn_capabilities()) { |
|
122 | - if (bigbluebuttonbn_get_cfg_recordingready_enabled()) { |
|
123 | - $metadata['bn-recording-ready-url'] = $bbbsession['recordingReadyURL']; |
|
81 | + break; |
|
82 | + case 'join': |
|
83 | + if (isset($bbbsession) && !is_null($bbbsession)) { |
|
84 | + // See if the session is in progress. |
|
85 | + if (bigbluebuttonbn_is_meeting_running($bbbsession['meetingid'])) { |
|
86 | + // Since the meeting is already running, we just join the session. |
|
87 | + bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $bigbluebuttonbn); |
|
88 | + break; |
|
124 | 89 | } |
125 | 90 | |
126 | - if (bigbluebuttonbn_get_cfg_meetingevents_enabled()) { |
|
127 | - $metadata['bn-meeting-events-url'] = $bbbsession['meetingEventsURL']; |
|
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; |
|
128 | 95 | } |
129 | - } |
|
130 | 96 | |
131 | - // Set the duration for the meeting. |
|
132 | - $durationtime = 0; |
|
133 | - if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
|
134 | - $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->closingtime); |
|
135 | - if ($durationtime > 0) { |
|
136 | - $bbbsession['welcome'] .= '<br><br>'.str_replace('%duration%', ''.$durationtime, |
|
137 | - get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
97 | + // Prepare the metadata. |
|
98 | + $bbbrecordingname = $bbbsession['contextActivityName']; |
|
99 | + if (isset($name) && $name != '') { |
|
100 | + $bbbrecordingname = $name; |
|
138 | 101 | } |
139 | - } |
|
140 | - // Execute the create command. |
|
141 | - $response = bigbluebuttonbn_get_create_meeting_array( |
|
142 | - $bbbsession['meetingname'], |
|
143 | - $bbbsession['meetingid'], |
|
144 | - $bbbsession['welcome'], |
|
145 | - $bbbsession['modPW'], |
|
146 | - $bbbsession['viewerPW'], |
|
147 | - $bbbsession['logoutURL'], |
|
148 | - $bbbsession['record'] ? 'true' : 'false', |
|
149 | - $durationtime, |
|
150 | - $bbbsession['voicebridge'], |
|
151 | - $bbbsession['userlimit'], |
|
152 | - $metadata, |
|
153 | - $bbbsession['presentation']['name'], |
|
154 | - $bbbsession['presentation']['url'] |
|
102 | + $bbbrecordingdescription = $bbbsession['contextActivityDescription']; |
|
103 | + if (isset($description) && $description != '') { |
|
104 | + $bbbrecordingdescription = $description; |
|
105 | + } |
|
106 | + $bbbrecordingtags = $bbbsession['contextActivityTags']; |
|
107 | + if (isset($tags) && $tags != '') { |
|
108 | + $bbbrecordingtags = $tags; |
|
109 | + } |
|
110 | + $metadata = array('bbb-origin' => $bbbsession['origin'], |
|
111 | + 'bbb-origin-version' => $bbbsession['originVersion'], |
|
112 | + 'bbb-origin-server-name' => $bbbsession['originServerName'], |
|
113 | + 'bbb-origin-server-common-name' => $bbbsession['originServerCommonName'], |
|
114 | + 'bbb-origin-tag' => $bbbsession['originTag'], |
|
115 | + 'bbb-context' => $bbbsession['course']->fullname, |
|
116 | + 'bbb-recording-name' => $bbbrecordingname, |
|
117 | + 'bbb-recording-description' => $bbbrecordingdescription, |
|
118 | + 'bbb-recording-tags' => $bbbrecordingtags, |
|
155 | 119 | ); |
156 | 120 | |
157 | - if (!$response) { |
|
158 | - // If the server is unreachable, then prompts the user of the necessary action. |
|
159 | - $printerrorkey = 'view_error_unable_join_student'; |
|
160 | - if ($bbbsession['administrator']) { |
|
161 | - $printerrorkey = 'view_error_unable_join'; |
|
121 | + if (bigbluebuttonbn_server_offers_bn_capabilities()) { |
|
122 | + if (bigbluebuttonbn_get_cfg_recordingready_enabled()) { |
|
123 | + $metadata['bn-recording-ready-url'] = $bbbsession['recordingReadyURL']; |
|
124 | + } |
|
125 | + |
|
126 | + if (bigbluebuttonbn_get_cfg_meetingevents_enabled()) { |
|
127 | + $metadata['bn-meeting-events-url'] = $bbbsession['meetingEventsURL']; |
|
128 | + } |
|
162 | 129 | } |
163 | - if ($bbbsession['moderator']) { |
|
164 | - $printerrorkey = 'view_error_unable_join_teacher'; |
|
130 | + |
|
131 | + // Set the duration for the meeting. |
|
132 | + $durationtime = 0; |
|
133 | + if (bigbluebuttonbn_get_cfg_scheduled_duration_enabled()) { |
|
134 | + $durationtime = bigbluebuttonbn_get_duration($bigbluebuttonbn->closingtime); |
|
135 | + if ($durationtime > 0) { |
|
136 | + $bbbsession['welcome'] .= '<br><br>'.str_replace('%duration%', ''.$durationtime, |
|
137 | + get_string('bbbdurationwarning', 'bigbluebuttonbn')); |
|
138 | + } |
|
165 | 139 | } |
166 | - print_error($printerrorkey, 'bigbluebuttonbn', |
|
167 | - $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
168 | - break; |
|
169 | - } else if ($response['returncode'] == 'FAILED') { |
|
170 | - // The meeting was not created. |
|
171 | - $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
172 | - if (!$printerrorkey) { |
|
173 | - $printerrorkey = $response['message']; |
|
140 | + // Execute the create command. |
|
141 | + $response = bigbluebuttonbn_get_create_meeting_array( |
|
142 | + $bbbsession['meetingname'], |
|
143 | + $bbbsession['meetingid'], |
|
144 | + $bbbsession['welcome'], |
|
145 | + $bbbsession['modPW'], |
|
146 | + $bbbsession['viewerPW'], |
|
147 | + $bbbsession['logoutURL'], |
|
148 | + $bbbsession['record'] ? 'true' : 'false', |
|
149 | + $durationtime, |
|
150 | + $bbbsession['voicebridge'], |
|
151 | + $bbbsession['userlimit'], |
|
152 | + $metadata, |
|
153 | + $bbbsession['presentation']['name'], |
|
154 | + $bbbsession['presentation']['url'] |
|
155 | + ); |
|
156 | + |
|
157 | + if (!$response) { |
|
158 | + // If the server is unreachable, then prompts the user of the necessary action. |
|
159 | + $printerrorkey = 'view_error_unable_join_student'; |
|
160 | + if ($bbbsession['administrator']) { |
|
161 | + $printerrorkey = 'view_error_unable_join'; |
|
162 | + } |
|
163 | + if ($bbbsession['moderator']) { |
|
164 | + $printerrorkey = 'view_error_unable_join_teacher'; |
|
165 | + } |
|
166 | + print_error($printerrorkey, 'bigbluebuttonbn', |
|
167 | + $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
|
168 | + break; |
|
169 | + } else if ($response['returncode'] == 'FAILED') { |
|
170 | + // The meeting was not created. |
|
171 | + $printerrorkey = bigbluebuttonbn_get_error_key($response['messageKey'], 'view_error_create'); |
|
172 | + if (!$printerrorkey) { |
|
173 | + $printerrorkey = $response['message']; |
|
174 | + } |
|
175 | + print_error($printerrorkey, 'bigbluebuttonbn'); |
|
176 | + break; |
|
177 | + } else if ($response['hasBeenForciblyEnded'] == 'true') { |
|
178 | + print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
179 | + break; |
|
174 | 180 | } |
175 | - print_error($printerrorkey, 'bigbluebuttonbn'); |
|
176 | - break; |
|
177 | - } else if ($response['hasBeenForciblyEnded'] == 'true') { |
|
178 | - print_error(get_string('index_error_forciblyended', 'bigbluebuttonbn')); |
|
181 | + |
|
182 | + // Moodle event logger: Create an event for meeting created. |
|
183 | + bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm); |
|
184 | + // Internal logger: Insert a record with the meeting created. |
|
185 | + bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
186 | + // Since the meeting is already running, we just join the session. |
|
187 | + bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $bigbluebuttonbn); |
|
179 | 188 | break; |
180 | 189 | } |
181 | 190 | |
182 | - // Moodle event logger: Create an event for meeting created. |
|
183 | - bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_MEETING_CREATED, $bigbluebuttonbn, $cm); |
|
184 | - // Internal logger: Insert a record with the meeting created. |
|
185 | - bigbluebuttonbn_logs($bbbsession, BIGBLUEBUTTONBN_LOG_EVENT_CREATE); |
|
186 | - // Since the meeting is already running, we just join the session. |
|
187 | - bigbluebutton_bbb_view_execute_join($bbbsession, $cm, $bigbluebuttonbn); |
|
191 | + print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
188 | 192 | break; |
189 | - } |
|
190 | - |
|
191 | - print_error('view_error_unable_join', 'bigbluebuttonbn'); |
|
192 | - break; |
|
193 | - default: |
|
194 | - bigbluebutton_bbb_view_close_window(); |
|
193 | + default: |
|
194 | + bigbluebutton_bbb_view_close_window(); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | function bigbluebutton_bbb_view_close_window() { |