1
|
|
|
<?php |
2
|
|
|
// This file is part of Moodle - http://moodle.org/ |
3
|
|
|
// |
4
|
|
|
// Moodle is free software: you can redistribute it and/or modify |
5
|
|
|
// it under the terms of the GNU General Public License as published by |
6
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
7
|
|
|
// (at your option) any later version. |
8
|
|
|
// |
9
|
|
|
// Moodle is distributed in the hope that it will be useful, |
10
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
// GNU General Public License for more details. |
13
|
|
|
// |
14
|
|
|
// You should have received a copy of the GNU General Public License |
15
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* View a BigBlueButton room. |
19
|
|
|
* |
20
|
|
|
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com) |
21
|
|
|
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com) |
22
|
|
|
* @copyright 2010-2017 Blindside Networks Inc |
23
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); |
27
|
|
|
require_once(dirname(__FILE__).'/locallib.php'); |
28
|
|
|
|
29
|
|
|
$id = required_param('id', PARAM_INT); |
30
|
|
|
$b = optional_param('n', 0, PARAM_INT); |
31
|
|
|
$group = optional_param('group', 0, PARAM_INT); |
32
|
|
|
|
33
|
|
View Code Duplication |
if ($id) { |
|
|
|
|
34
|
|
|
$cm = get_coursemodule_from_id('bigbluebuttonbn', $id, 0, false, MUST_EXIST); |
35
|
|
|
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); |
36
|
|
|
$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $cm->instance), '*', MUST_EXIST); |
37
|
|
|
} else if ($b) { |
38
|
|
|
$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', array('id' => $b), '*', MUST_EXIST); |
39
|
|
|
$course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST); |
40
|
|
|
$cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST); |
41
|
|
|
} else { |
42
|
|
|
print_error(get_string('view_error_url_missing_parameters', 'bigbluebuttonbn')); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
require_login($course, true, $cm); |
46
|
|
|
|
47
|
|
|
$context = context_module::instance($cm->id); |
48
|
|
|
|
49
|
|
|
bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED, $bigbluebuttonbn, $cm); |
50
|
|
|
|
51
|
|
|
// Additional info related to the course. |
52
|
|
|
$bbbsession['course'] = $course; |
53
|
|
|
$bbbsession['coursename'] = $course->fullname; |
54
|
|
|
$bbbsession['cm'] = $cm; |
55
|
|
|
bigbluebuttonbn_view_bbbsession_set($context, $bigbluebuttonbn, $bbbsession); |
56
|
|
|
|
57
|
|
|
// Validates if the BigBlueButton server is working. |
58
|
|
|
$serverversion = bigbluebuttonbn_get_server_version(); |
59
|
|
|
if (is_null($serverversion)) { |
60
|
|
|
if ($bbbsession['administrator']) { |
61
|
|
|
print_error('view_error_unable_join', 'bigbluebuttonbn', |
62
|
|
|
$CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn'); |
63
|
|
|
exit; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
if ($bbbsession['moderator']) { |
67
|
|
|
print_error('view_error_unable_join_teacher', 'bigbluebuttonbn', |
68
|
|
|
$CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course); |
69
|
|
|
exit; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
print_error('view_error_unable_join_student', 'bigbluebuttonbn', |
73
|
|
|
$CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course); |
74
|
|
|
exit; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
// Mark viewed by user (if required). |
78
|
|
|
$completion = new completion_info($course); |
79
|
|
|
$completion->set_module_viewed($cm); |
80
|
|
|
|
81
|
|
|
// Print the page header. |
82
|
|
|
$PAGE->set_context($context); |
83
|
|
|
$PAGE->set_url($CFG->wwwroot.'/mod/bigbluebuttonbn/view.php', array('id' => $cm->id)); |
84
|
|
|
$PAGE->set_title(format_string($bigbluebuttonbn->name)); |
85
|
|
|
$PAGE->set_cacheable(false); |
86
|
|
|
$PAGE->set_heading($course->fullname); |
87
|
|
|
$PAGE->set_pagelayout('incourse'); |
88
|
|
|
|
89
|
|
|
// Validate if the user is in a role allowed to join. |
90
|
|
|
if (!has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context)) { |
91
|
|
|
echo $OUTPUT->header(); |
92
|
|
|
if (isguestuser()) { |
93
|
|
|
echo $OUTPUT->confirm('<p>'.get_string('view_noguests', 'bigbluebuttonbn').'</p>'.get_string('liketologin'), |
94
|
|
|
get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id); |
95
|
|
|
} else { |
96
|
|
|
echo $OUTPUT->confirm('<p>'.get_string('view_nojoin', 'bigbluebuttonbn').'</p>'.get_string('liketologin'), |
97
|
|
|
get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id); |
98
|
|
|
} |
99
|
|
|
echo $OUTPUT->footer(); |
100
|
|
|
exit; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
// Operation URLs. |
104
|
|
|
$bbbsession['courseURL'] = $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course; |
105
|
|
|
$bbbsession['logoutURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id. |
106
|
|
|
'&bn='.$bbbsession['bigbluebuttonbn']->id; |
107
|
|
|
$bbbsession['recordingReadyURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_broker.php?action=recording_'. |
108
|
|
|
'ready&bigbluebuttonbn='.$bbbsession['bigbluebuttonbn']->id; |
109
|
|
|
$bbbsession['meetingEventsURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_broker.php?action=meeting'. |
110
|
|
|
'_events&bigbluebuttonbn='.$bbbsession['bigbluebuttonbn']->id; |
111
|
|
|
$bbbsession['joinURL'] = $CFG->wwwroot.'/mod/bigbluebuttonbn/bbb_view.php?action=join&id='.$id. |
112
|
|
|
'&bn='.$bbbsession['bigbluebuttonbn']->id; |
113
|
|
|
|
114
|
|
|
// Output starts. |
115
|
|
|
echo $OUTPUT->header(); |
116
|
|
|
|
117
|
|
|
bigbluebuttonbn_view_groups($bbbsession); |
118
|
|
|
|
119
|
|
|
bigbluebuttonbn_view_main($bbbsession, bigbluebuttonbn_view_get_activity_status($bbbsession, $bigbluebuttonbn)); |
120
|
|
|
|
121
|
|
|
// Output finishes. |
122
|
|
|
echo $OUTPUT->footer(); |
123
|
|
|
|
124
|
|
|
// Shows version as a comment. |
125
|
|
|
echo '<!-- '.$bbbsession['originTag'].' -->'."\n"; |
126
|
|
|
|
127
|
|
|
// Initialize session variable used across views. |
128
|
|
|
$SESSION->bigbluebuttonbn_bbbsession = $bbbsession; |
129
|
|
|
|
130
|
|
|
|
131
|
|
|
|
132
|
|
|
function bigbluebuttonbn_view_bbbsession_set($context, $bigbluebuttonbn, &$bbbsession) { |
133
|
|
|
global $CFG, $USER; |
134
|
|
|
|
135
|
|
|
// BigBluebuttonBN activity data. |
136
|
|
|
$bbbsession['bigbluebuttonbn'] = $bigbluebuttonbn; |
137
|
|
|
|
138
|
|
|
// User data. |
139
|
|
|
$bbbsession['username'] = fullname($USER); |
140
|
|
|
$bbbsession['userID'] = $USER->id; |
141
|
|
|
$bbbsession['roles'] = bigbluebuttonbn_view_bbbsession_roles($context, $USER->id); |
142
|
|
|
|
143
|
|
|
// User roles. |
144
|
|
|
$bbbsession['administrator'] = is_siteadmin($bbbsession['userID']); |
145
|
|
|
$bbbsession['moderator'] = bigbluebuttonbn_is_moderator( |
146
|
|
|
$context, $bigbluebuttonbn->participants, $bbbsession['userID'], $bbbsession['roles']); |
147
|
|
|
$bbbsession['managerecordings'] = ($bbbsession['administrator'] |
148
|
|
|
|| has_capability('mod/bigbluebuttonbn:managerecordings', $context)); |
149
|
|
|
$bbbsession['importrecordings'] = ($bbbsession['managerecordings'] |
150
|
|
|
&& bigbluebuttonbn_get_cfg_importrecordings_enabled()); |
151
|
|
|
|
152
|
|
|
// Server data. |
153
|
|
|
$bbbsession['modPW'] = $bigbluebuttonbn->moderatorpass; |
154
|
|
|
$bbbsession['viewerPW'] = $bigbluebuttonbn->viewerpass; |
155
|
|
|
|
156
|
|
|
// Database info related to the activity. |
157
|
|
|
$bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'. |
158
|
|
|
$bbbsession['bigbluebuttonbn']->id; |
159
|
|
|
$bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name; |
160
|
|
|
$bbbsession['meetingdescription'] = $bigbluebuttonbn->intro; |
161
|
|
|
|
162
|
|
|
$bbbsession['userlimit'] = intval(bigbluebuttonbn_get_cfg_userlimit_default()); |
163
|
|
|
if (bigbluebuttonbn_get_cfg_userlimit_editable()) { |
164
|
|
|
$bbbsession['userlimit'] = intval($bigbluebuttonbn->userlimit); |
165
|
|
|
} |
166
|
|
|
$bbbsession['voicebridge'] = $bigbluebuttonbn->voicebridge; |
167
|
|
|
if ($bigbluebuttonbn->voicebridge > 0) { |
168
|
|
|
$bbbsession['voicebridge'] = 70000 + $bigbluebuttonbn->voicebridge; |
169
|
|
|
} |
170
|
|
|
$bbbsession['wait'] = $bigbluebuttonbn->wait; |
171
|
|
|
$bbbsession['record'] = $bigbluebuttonbn->record; |
172
|
|
|
|
173
|
|
|
$bbbsession['welcome'] = $bigbluebuttonbn->welcome; |
174
|
|
|
if (!isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') { |
175
|
|
|
$bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn'); |
176
|
|
|
} |
177
|
|
|
if ($bigbluebuttonbn->record) { |
178
|
|
|
$bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn'); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
$bbbsession['openingtime'] = $bigbluebuttonbn->openingtime; |
182
|
|
|
$bbbsession['closingtime'] = $bigbluebuttonbn->closingtime; |
183
|
|
|
|
184
|
|
|
// Additional info related to the course. |
185
|
|
|
$bbbsession['context'] = $context; |
186
|
|
|
|
187
|
|
|
// Metadata (origin). |
188
|
|
|
$bbbsession['origin'] = 'Moodle'; |
189
|
|
|
$bbbsession['originVersion'] = $CFG->release; |
190
|
|
|
$parsedurl = parse_url($CFG->wwwroot); |
191
|
|
|
$bbbsession['originServerName'] = $parsedurl['host']; |
192
|
|
|
$bbbsession['originServerUrl'] = $CFG->wwwroot; |
193
|
|
|
$bbbsession['originServerCommonName'] = ''; |
194
|
|
|
$bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')'; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
function bigbluebuttonbn_view_bbbsession_roles($context, $userid) { |
198
|
|
|
if (isguestuser()) { |
199
|
|
|
return bigbluebuttonbn_get_guest_role(); |
200
|
|
|
} |
201
|
|
|
return bigbluebuttonbn_get_user_roles($context, $userid); |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
function bigbluebuttonbn_view_get_activity_status(&$bbbsession, $bigbluebuttonbn) { |
205
|
|
|
$now = time(); |
206
|
|
|
if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime) { |
207
|
|
|
// The activity has not been opened. |
208
|
|
|
return 'not_started'; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
if (!empty($bigbluebuttonbn->closingtime) && $now > $bigbluebuttonbn->closingtime) { |
212
|
|
|
// The activity has been closed. |
213
|
|
|
$bbbsession['presentation'] = bigbluebuttonbn_get_presentation_array( |
214
|
|
|
$bbbsession['context'], $bigbluebuttonbn->presentation); |
215
|
|
|
return 'ended'; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
// The activity is opene. |
219
|
|
|
$bbbsession['presentation'] = bigbluebuttonbn_get_presentation_array( |
220
|
|
|
$bbbsession['context'], $bigbluebuttonbn->presentation, $bigbluebuttonbn->id); |
221
|
|
|
return 'open'; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/* |
225
|
|
|
There are no groups, |
226
|
|
|
*/ |
227
|
|
|
function bigbluebuttonbn_view_groups(&$bbbsession) { |
228
|
|
|
global $OUTPUT, $CFG; |
229
|
|
|
|
230
|
|
|
// Find out current group mode. |
231
|
|
|
$groupmode = groups_get_activity_groupmode($bbbsession['cm']); |
232
|
|
|
if ($groupmode == NOGROUPS) { |
233
|
|
|
// No groups mode. |
234
|
|
|
return; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
// Separate or visible group mode. |
238
|
|
|
$groups = groups_get_all_groups($bbbsession['course']->id); |
239
|
|
|
if (empty($groups)) { |
240
|
|
|
// No groups in this course. |
241
|
|
|
return; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
$onlyexistentgroups = false; |
245
|
|
|
if ($groupmode == SEPARATEGROUPS) { |
246
|
|
|
$groups = groups_get_activity_allowed_groups($bbbsession['cm']); |
247
|
|
|
$onlyexistentgroups = true; |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
$bbbsession['group'] = groups_get_activity_group($bbbsession['cm'], true); |
251
|
|
|
|
252
|
|
|
// Assign group default values. |
253
|
|
|
$bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'. |
254
|
|
|
$bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']'; |
255
|
|
|
$groupname = get_string('allparticipants'); |
256
|
|
|
$bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$groupname.')'; |
257
|
|
|
|
258
|
|
|
|
259
|
|
|
if (sizeof($groups) == 0) { |
260
|
|
|
// Only the All participants group exists |
261
|
|
|
return; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
if ($bbbsession['group'] == 0) { |
265
|
|
|
$bbbsession['group'] = array_values($groups)[0]->id; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
$bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'. |
269
|
|
|
$bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']'; |
270
|
|
|
$groupname = groups_get_group_name($bbbsession['group']); |
271
|
|
|
$bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$groupname.')'; |
272
|
|
|
|
273
|
|
|
if (sizeof($groups) == 1) { |
274
|
|
|
// There only one group and the user has access to. |
275
|
|
|
return; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
echo $OUTPUT->box_start('generalbox boxaligncenter'); |
279
|
|
|
echo '<br><div class="alert alert-warning">'.get_string('view_groups_selection_warning', 'bigbluebuttonbn'). |
280
|
|
|
'</div>'; |
281
|
|
|
echo $OUTPUT->box_end(); |
282
|
|
|
|
283
|
|
|
groups_print_activity_menu( |
284
|
|
|
$bbbsession['cm'], $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id, false, $onlyexistentgroups); |
285
|
|
|
echo '<br><br>'; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
function bigbluebuttonbn_view_main(&$bbbsession, $activity) { |
289
|
|
|
global $OUTPUT, $PAGE; |
290
|
|
|
|
291
|
|
|
$type = null; |
292
|
|
|
if (isset($bbbsession['bigbluebuttonbn']->type)) { |
293
|
|
|
$type = $bbbsession['bigbluebuttonbn']->type; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
$typeprofiles = bigbluebuttonbn_get_instance_type_profiles(); |
297
|
|
|
$enabledfeatures = bigbluebuttonbn_get_enabled_features($typeprofiles, $type); |
298
|
|
|
$pinginterval = bigbluebuttonbn_get_cfg_waitformoderator_ping_interval() * 1000; |
299
|
|
|
|
300
|
|
|
// JavaScript for locales. |
301
|
|
|
$PAGE->requires->strings_for_js(array_keys(bigbluebuttonbn_get_strings_for_js()), 'bigbluebuttonbn'); |
302
|
|
|
|
303
|
|
|
// JavaScript variables. |
304
|
|
|
$jsvars = array('activity' => $activity, 'ping_interval' => $pinginterval, |
305
|
|
|
'locale' => bigbluebuttonbn_get_localcode(), 'profile_features' => $typeprofiles[0]['features']); |
306
|
|
|
|
307
|
|
|
$output = $OUTPUT->heading($bbbsession['meetingname'], 3); |
308
|
|
|
$output .= $OUTPUT->heading($bbbsession['meetingdescription'], 5); |
309
|
|
|
|
310
|
|
|
if ($enabledfeatures['showroom']) { |
311
|
|
|
$output .= bigbluebuttonbn_view_show_room($bbbsession, $activity, $jsvars); |
312
|
|
|
$PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-rooms', |
313
|
|
|
'M.mod_bigbluebuttonbn.rooms.init', array($jsvars)); |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
if ($enabledfeatures['showrecordings'] && $bbbsession['record']) { |
317
|
|
|
$output .= html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn')); |
318
|
|
|
$output .= bigbluebuttonbn_view_show_recordings($bbbsession, $enabledfeatures['showroom'], $jsvars); |
319
|
|
|
if ($enabledfeatures['importrecordings'] && $bbbsession['importrecordings']) { |
320
|
|
|
$output .= bigbluebuttonbn_view_show_imported($bbbsession); |
321
|
|
|
} |
322
|
|
|
$PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-recordings', |
323
|
|
|
'M.mod_bigbluebuttonbn.recordings.init', array($jsvars)); |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
echo $output.html_writer::empty_tag('br').html_writer::empty_tag('br').html_writer::empty_tag('br'); |
327
|
|
|
|
328
|
|
|
$PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-broker', 'M.mod_bigbluebuttonbn.broker.init', array($jsvars)); |
329
|
|
|
} |
330
|
|
|
|
331
|
|
|
function bigbluebuttonbn_view_show_room(&$bbbsession, $activity, &$jsvars) { |
332
|
|
|
global $OUTPUT; |
333
|
|
|
|
334
|
|
|
// JavaScript variables for room. |
335
|
|
|
$openingtime = ''; |
336
|
|
|
if ($bbbsession['openingtime']) { |
337
|
|
|
$openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn').': '. |
338
|
|
|
userdate($bbbsession['openingtime']); |
339
|
|
|
} |
340
|
|
|
$closingtime = ''; |
341
|
|
|
if ($bbbsession['closingtime']) { |
342
|
|
|
$closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn').': '. |
343
|
|
|
userdate($bbbsession['closingtime']); |
344
|
|
|
} |
345
|
|
|
$jsvars += array( |
346
|
|
|
'meetingid' => $bbbsession['meetingid'], |
347
|
|
|
'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbn']->id, |
348
|
|
|
'userlimit' => $bbbsession['userlimit'], |
349
|
|
|
'opening' => $openingtime, |
350
|
|
|
'closing' => $closingtime, |
351
|
|
|
); |
352
|
|
|
|
353
|
|
|
$output = $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_message_box'); |
354
|
|
|
$output .= '<br><span id="status_bar"></span><br>'; |
355
|
|
|
$output .= '<span id="control_panel"></span>'; |
356
|
|
|
$output .= $OUTPUT->box_end(); |
357
|
|
|
|
358
|
|
|
$output .= $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box'); |
359
|
|
|
$output .= '<br><br><span id="join_button"></span> <span id="end_button"></span>'."\n"; |
360
|
|
|
$output .= $OUTPUT->box_end(); |
361
|
|
|
|
362
|
|
|
if ($activity == 'ended') { |
363
|
|
|
$output .= bigbluebuttonbn_view_ended($bbbsession); |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
return $output; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
function bigbluebuttonbn_view_show_recordings(&$bbbsession, $showroom, &$jsvars) { |
370
|
|
|
|
371
|
|
|
// Get recordings. |
372
|
|
|
$bigbluebuttonbnid = null; |
373
|
|
|
if ($showroom) { |
374
|
|
|
$bigbluebuttonbnid = $bbbsession['bigbluebuttonbn']->id; |
375
|
|
|
} |
376
|
|
|
$recordings = bigbluebuttonbn_get_recordings( |
377
|
|
|
$bbbsession['course']->id, $bigbluebuttonbnid, $showroom, |
378
|
|
|
$bbbsession['bigbluebuttonbn']->recordings_deleted_activities); |
379
|
|
|
|
380
|
|
|
if (empty($recordings) || array_key_exists('messageKey', $recordings)) { |
381
|
|
|
// There are no recordings to be shown. |
382
|
|
|
return html_writer::div(get_string('view_message_norecordings', 'bigbluebuttonbn'), '', |
383
|
|
|
array('id' => 'bigbluebuttonbn_html_table')); |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
// There are recordings for this meeting. |
387
|
|
|
// JavaScript variables for recordings. |
388
|
|
|
$jsvars += array( |
389
|
|
|
'recordings_html' => $bbbsession['bigbluebuttonbn']->recordings_html == '1', |
390
|
|
|
); |
391
|
|
|
|
392
|
|
|
// If there are meetings with recordings load the data to the table. |
393
|
|
|
if ($bbbsession['bigbluebuttonbn']->recordings_html) { |
394
|
|
|
// Render a plain html table. |
395
|
|
|
return bigbluebutton_output_recording_table($bbbsession, $recordings)."\n"; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
// JavaScript variables for recordings with YUI. |
399
|
|
|
$jsvars += array( |
400
|
|
|
'columns' => bigbluebuttonbn_get_recording_columns($bbbsession), |
401
|
|
|
'data' => bigbluebuttonbn_get_recording_data($bbbsession, $recordings), |
402
|
|
|
); |
403
|
|
|
|
404
|
|
|
// Render a YUI table. |
405
|
|
|
return html_writer::div('', '', array('id' => 'bigbluebuttonbn_yui_table')); |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
function bigbluebuttonbn_view_show_imported(&$bbbsession) { |
409
|
|
|
global $CFG; |
410
|
|
|
|
411
|
|
|
$button = html_writer::tag('input', '', |
412
|
|
|
array('type' => 'button', |
413
|
|
|
'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'), |
414
|
|
|
'class' => 'btn btn-secondary', |
415
|
|
|
'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='. |
416
|
|
|
$bbbsession['bigbluebuttonbn']->id.'\'')); |
417
|
|
|
$output = html_writer::start_tag('br'); |
418
|
|
|
$output .= html_writer::tag('span', $button, array('id' => 'import_recording_links_button')); |
419
|
|
|
$output .= html_writer::tag('span', '', array('id' => 'import_recording_links_table')); |
420
|
|
|
|
421
|
|
|
return $output; |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
function bigbluebuttonbn_view_ended(&$bbbsession) { |
425
|
|
|
global $OUTPUT; |
426
|
|
|
|
427
|
|
|
if (!is_null($bbbsession['presentation']['url'])) { |
428
|
|
|
$attributes = array('title' => $bbbsession['presentation']['name']); |
429
|
|
|
$icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']); |
430
|
|
|
|
431
|
|
|
return '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'. |
432
|
|
|
''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''. |
433
|
|
|
''.$OUTPUT->action_link($bbbsession['presentation']['url'], |
434
|
|
|
$bbbsession['presentation']['name'], null, $attributes).'<br><br>'; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
return ''; |
438
|
|
|
} |
439
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.