Completed
Pull Request — master (#38)
by Jesus
03:06 queued 01:07
created

view.php ➔ bigbluebuttonbn_view_render()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 42
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 26
nc 8
nop 2
dl 0
loc 42
rs 8.5806
c 0
b 0
f 0
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
$bn = optional_param('n', 0, PARAM_INT);
31
$group = optional_param('group', 0, PARAM_INT);
32
33
$viewinstance = bigbluebuttonbn_views_validator($id, $bn);
34
if (!$viewinstance) {
35
    print_error(get_string('view_error_url_missing_parameters', 'bigbluebuttonbn'));
36
}
37
38
$cm = $viewinstance['cm'];
39
$course = $viewinstance['course'];
40
$bigbluebuttonbn = $viewinstance['bigbluebuttonbn'];
41
42
require_login($course, true, $cm);
43
44
$context = context_module::instance($cm->id);
45
46
bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_ACTIVITY_VIEWED, $bigbluebuttonbn, $cm);
47
48
// Additional info related to the course.
49
$bbbsession['course'] = $course;
50
$bbbsession['coursename'] = $course->fullname;
51
$bbbsession['cm'] = $cm;
52
bigbluebuttonbn_view_bbbsession_set($context, $bigbluebuttonbn, $bbbsession);
53
54
// Validates if the BigBlueButton server is working.
55
$serverversion = bigbluebuttonbn_get_server_version();
56
if (is_null($serverversion)) {
57
    if ($bbbsession['administrator']) {
58
        print_error('view_error_unable_join', 'bigbluebuttonbn',
59
            $CFG->wwwroot.'/admin/settings.php?section=modsettingbigbluebuttonbn');
60
        exit;
61
    }
62
63
    if ($bbbsession['moderator']) {
64
        print_error('view_error_unable_join_teacher', 'bigbluebuttonbn',
65
            $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);
66
        exit;
67
    }
68
69
    print_error('view_error_unable_join_student', 'bigbluebuttonbn',
70
        $CFG->wwwroot.'/course/view.php?id='.$bigbluebuttonbn->course);
71
    exit;
72
}
73
$bbbsession['serverversion'] = (string) $serverversion;
74
75
// Mark viewed by user (if required).
76
$completion = new completion_info($course);
77
$completion->set_module_viewed($cm);
78
79
// Print the page header.
80
$PAGE->set_context($context);
81
$PAGE->set_url($CFG->wwwroot.'/mod/bigbluebuttonbn/view.php', array('id' => $cm->id));
82
$PAGE->set_title(format_string($bigbluebuttonbn->name));
83
$PAGE->set_cacheable(false);
84
$PAGE->set_heading($course->fullname);
85
$PAGE->set_pagelayout('incourse');
86
87
// Validate if the user is in a role allowed to join.
88
if (!has_capability('moodle/category:manage', $context) && !has_capability('mod/bigbluebuttonbn:join', $context)) {
89
    echo $OUTPUT->header();
90
    if (isguestuser()) {
91
        echo $OUTPUT->confirm('<p>'.get_string('view_noguests', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
92
            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
93
    } else {
94
        echo $OUTPUT->confirm('<p>'.get_string('view_nojoin', 'bigbluebuttonbn').'</p>'.get_string('liketologin'),
95
            get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
96
    }
97
    echo $OUTPUT->footer();
98
    exit;
99
}
100
101
// Operation URLs.
102
$bbbsession['bigbluebuttonbnURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/view.php?id=' . $bbbsession['cm']->id;
103
$bbbsession['logoutURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=logout&id='.$id .
104
    '&bn=' . $bbbsession['bigbluebuttonbn']->id;
105
$bbbsession['recordingReadyURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=recording_' .
106
    'ready&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbn']->id;
107
$bbbsession['meetingEventsURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_broker.php?action=meeting' .
108
    '_events&bigbluebuttonbn=' . $bbbsession['bigbluebuttonbn']->id;
109
$bbbsession['joinURL'] = $CFG->wwwroot . '/mod/bigbluebuttonbn/bbb_view.php?action=join&id=' . $id .
110
    '&bn=' . $bbbsession['bigbluebuttonbn']->id;
111
112
// Output starts.
113
echo $OUTPUT->header();
114
115
bigbluebuttonbn_view_groups($bbbsession);
116
117
bigbluebuttonbn_view_render($bbbsession, bigbluebuttonbn_view_get_activity_status($bbbsession, $bigbluebuttonbn));
118
119
// Output finishes.
120
echo $OUTPUT->footer();
121
122
// Shows version as a comment.
123
echo '<!-- '.$bbbsession['originTag'].' -->'."\n";
124
125
// Initialize session variable used across views.
126
$SESSION->bigbluebuttonbn_bbbsession = $bbbsession;
127
128
function bigbluebuttonbn_view_bbbsession_set($context, $bigbluebuttonbn, &$bbbsession) {
129
    global $CFG, $USER;
130
131
    // BigBluebuttonBN activity data.
132
    $bbbsession['bigbluebuttonbn'] = $bigbluebuttonbn;
133
134
    // User data.
135
    $bbbsession['username'] = fullname($USER);
136
    $bbbsession['userID'] = $USER->id;
137
    $bbbsession['roles'] = bigbluebuttonbn_view_bbbsession_roles($context, $USER->id);
138
139
    // User roles.
140
    $bbbsession['administrator'] = is_siteadmin($bbbsession['userID']);
141
    $participantlist = bigbluebuttonbn_get_participant_list($bigbluebuttonbn, $context);
142
    $bbbsession['moderator'] = bigbluebuttonbn_is_moderator(
143
        $context, json_encode($participantlist), $bbbsession['userID'], $bbbsession['roles']);
144
    $bbbsession['managerecordings'] = ($bbbsession['administrator']
145
        || has_capability('mod/bigbluebuttonbn:managerecordings', $context));
146
    $bbbsession['importrecordings'] = ($bbbsession['managerecordings']);
147
148
    // Server data.
149
    $bbbsession['modPW'] = $bigbluebuttonbn->moderatorpass;
150
    $bbbsession['viewerPW'] = $bigbluebuttonbn->viewerpass;
151
152
    // Database info related to the activity.
153
    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.
154
        $bbbsession['bigbluebuttonbn']->id;
155
    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name;
156
    $bbbsession['meetingdescription'] = $bigbluebuttonbn->intro;
157
158
    $bbbsession['userlimit'] = intval((int)\mod_bigbluebuttonbn\locallib\config::get('userlimit_default'));
159
    if ((boolean)\mod_bigbluebuttonbn\locallib\config::get('userlimit_editable')) {
160
        $bbbsession['userlimit'] = intval($bigbluebuttonbn->userlimit);
161
    }
162
    $bbbsession['voicebridge'] = $bigbluebuttonbn->voicebridge;
163
    if ($bigbluebuttonbn->voicebridge > 0) {
164
        $bbbsession['voicebridge'] = 70000 + $bigbluebuttonbn->voicebridge;
165
    }
166
    $bbbsession['wait'] = $bigbluebuttonbn->wait;
167
    $bbbsession['record'] = $bigbluebuttonbn->record;
168
169
    $bbbsession['welcome'] = $bigbluebuttonbn->welcome;
170
    if (!isset($bbbsession['welcome']) || $bbbsession['welcome'] == '') {
171
        $bbbsession['welcome'] = get_string('mod_form_field_welcome_default', 'bigbluebuttonbn');
172
    }
173
    if ($bigbluebuttonbn->record) {
174
        $bbbsession['welcome'] .= '<br><br>'.get_string('bbbrecordwarning', 'bigbluebuttonbn');
175
    }
176
177
    $bbbsession['openingtime'] = $bigbluebuttonbn->openingtime;
178
    $bbbsession['closingtime'] = $bigbluebuttonbn->closingtime;
179
180
    // Additional info related to the course.
181
    $bbbsession['context'] = $context;
182
183
    // Metadata (origin).
184
    $bbbsession['origin'] = 'Moodle';
185
    $bbbsession['originVersion'] = $CFG->release;
186
    $parsedurl = parse_url($CFG->wwwroot);
187
    $bbbsession['originServerName'] = $parsedurl['host'];
188
    $bbbsession['originServerUrl'] = $CFG->wwwroot;
189
    $bbbsession['originServerCommonName'] = '';
190
    $bbbsession['originTag'] = 'moodle-mod_bigbluebuttonbn ('.get_config('mod_bigbluebuttonbn', 'version').')';
191
}
192
193
function bigbluebuttonbn_view_bbbsession_roles($context, $userid) {
194
    if (isguestuser()) {
195
        return bigbluebuttonbn_get_guest_role();
196
    }
197
    return bigbluebuttonbn_get_user_roles($context, $userid);
198
}
199
200
function bigbluebuttonbn_view_get_activity_status(&$bbbsession, $bigbluebuttonbn) {
201
    $now = time();
202
    if (!empty($bigbluebuttonbn->openingtime) && $now < $bigbluebuttonbn->openingtime) {
203
        // The activity has not been opened.
204
        return 'not_started';
205
    }
206
207
    if (!empty($bigbluebuttonbn->closingtime) && $now > $bigbluebuttonbn->closingtime) {
208
        // The activity has been closed.
209
        $bbbsession['presentation'] = bigbluebuttonbn_get_presentation_array(
210
            $bbbsession['context'], $bigbluebuttonbn->presentation);
211
        return 'ended';
212
    }
213
214
    // The activity is open.
215
    $bbbsession['presentation'] = bigbluebuttonbn_get_presentation_array(
216
        $bbbsession['context'], $bigbluebuttonbn->presentation, $bigbluebuttonbn->id);
217
    return 'open';
218
}
219
220
/*
221
There are no groups,
222
*/
223
function bigbluebuttonbn_view_groups(&$bbbsession) {
224
    global $CFG;
225
226
    // Find out current group mode.
227
    $groupmode = groups_get_activity_groupmode($bbbsession['cm']);
228
    if ($groupmode == NOGROUPS) {
229
        // No groups mode.
230
        return;
231
    }
232
233
    // Separate or visible group mode.
234
    $groups = groups_get_all_groups($bbbsession['course']->id);
235
    if (empty($groups)) {
236
        // No groups in this course.
237
        bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_nogroups_warning', 'bigbluebuttonbn'), 'info', true);
238
        return;
239
    }
240
241
    if ($groupmode == SEPARATEGROUPS) {
242
        $groups = groups_get_activity_allowed_groups($bbbsession['cm']);
243
    }
244
245
    $bbbsession['group'] = groups_get_activity_group($bbbsession['cm'], true);
246
    $groupname = get_string('allparticipants');
247
    if ($bbbsession['group'] != 0) {
248
        $groupname = groups_get_group_name($bbbsession['group']);
249
    }
250
251
    // Assign group default values.
252
    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.
253
        $bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
254
    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$groupname.')';
255
256
    if (count($groups) == 0) {
257
        // Only the All participants group exists.
258
        bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_notenrolled_warning', 'bigbluebuttonbn'), 'info', false);
259
        return;
260
    }
261
262
    if (count($groups) == 1) {
263
        // There is only one group and the user has access to it.
264
        return;
265
    }
266
267
    bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_selection_warning', 'bigbluebuttonbn'), 'warning');
268
269
    groups_print_activity_menu(
270
      $bbbsession['cm'], $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id);
271
    echo '<br><br>';
272
}
273
274
function bigbluebuttonbn_view_message_box(&$bbbsession, $message, $type='warning', $onlymoderator=false) {
275
    global $OUTPUT;
276
    if ($onlymoderator && !$bbbsession['moderator'] && !$bbbsession['administrator']) {
277
        return;
278
    }
279
    echo $OUTPUT->box_start('generalbox boxaligncenter');
280
    echo '<br><div class="alert alert-' . $type . '">' . $message . '</div>';
281
    echo $OUTPUT->box_end();
282
}
283
284
function bigbluebuttonbn_view_render(&$bbbsession, $activity) {
285
    global $OUTPUT, $PAGE;
286
287
    $type = null;
288
    if (isset($bbbsession['bigbluebuttonbn']->type)) {
289
        $type = $bbbsession['bigbluebuttonbn']->type;
290
    }
291
292
    $typeprofiles = bigbluebuttonbn_get_instance_type_profiles();
293
    $enabledfeatures = bigbluebuttonbn_get_enabled_features($typeprofiles, $type);
294
    $pinginterval = (int)\mod_bigbluebuttonbn\locallib\config::get('waitformoderator_ping_interval') * 1000;
295
296
    // JavaScript for locales.
297
    $PAGE->requires->strings_for_js(array_keys(bigbluebuttonbn_get_strings_for_js()), 'bigbluebuttonbn');
298
299
    // JavaScript variables.
300
    $jsvars = array('activity' => $activity, 'ping_interval' => $pinginterval,
301
        'locale' => bigbluebuttonbn_get_localcode(), 'profile_features' => $typeprofiles[0]['features']);
302
303
    // Renders general warning when configured.
304
    $cfg = \mod_bigbluebuttonbn\locallib\config::get_options();
305
    $output  = bigbluebuttonbn_view_render_warning($cfg['general_warning_message'], 'info',
306
        (string)$cfg['general_warning_button_href'], (string)$cfg['general_warning_button_text'], (string)$cfg['general_warning_button_class']);
307
308
    $output .= $OUTPUT->heading($bbbsession['meetingname'], 3);
309
    $output .= $OUTPUT->heading($bbbsession['meetingdescription'], 5);
310
311
    if ($enabledfeatures['showroom']) {
312
        $output .= bigbluebuttonbn_view_render_room($bbbsession, $activity, $jsvars);
313
        $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-rooms',
314
            'M.mod_bigbluebuttonbn.rooms.init', array($jsvars));
315
    }
316
317
    if ($enabledfeatures['showrecordings']) {
318
        $output .= bigbluebuttonbn_view_render_recording_section($bbbsession, $type, $enabledfeatures, $jsvars);
319
        $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-recordings',
320
                'M.mod_bigbluebuttonbn.recordings.init', array($jsvars));
321
    }
322
323
    echo $output.html_writer::empty_tag('br').html_writer::empty_tag('br').html_writer::empty_tag('br');
324
    $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-broker', 'M.mod_bigbluebuttonbn.broker.init', array($jsvars));
325
}
326
327
function bigbluebuttonbn_view_render_recording_section(&$bbbsession, $type, $enabledfeatures, &$jsvars) {
328
    $output = '';
329
    // Evaluates if the recordings are enterely disabled
330
    if (!(boolean)\mod_bigbluebuttonbn\locallib\config::recordings_enabled()) {
331
        if ($type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY) {
332
            $output .= bigbluebuttonbn_view_render_warning(get_string('view_message_recordings_disabled', 'bigbluebuttonbn'), 'danger');
333
        }
334
        return $output;
335
    }
336
    // Recordings are rendered either if it is a 'recordings only' instance or it is set to be recorded
337
    if ($type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY || $bbbsession['record']) {
338
        $output .= html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn'));
339
        $output .= bigbluebuttonbn_view_render_recordings($bbbsession, $enabledfeatures['showroom'], $jsvars);
340
        if ($enabledfeatures['importrecordings'] && $bbbsession['importrecordings']) {
341
            $output .= bigbluebuttonbn_view_render_imported($bbbsession);
342
        }
343
    }
344
    return $output;
345
}
346
347
function bigbluebuttonbn_view_render_warning($message, $type='info', $href='', $text='', $class='') {
348
    global $OUTPUT;
349
    $output = "\n";
350
    // Evaluates if config_warning is enabled.
351
    if (empty($message)) {
352
        return $output;
353
    }
354
    $output .= $OUTPUT->box_start('box boxalignleft adminerror alert alert-' . $type . ' alert-block fade in', 'bigbluebuttonbn_view_general_warning')."\n";
355
    $output .= '  <button type="button" class="close" data-dismiss="alert">&times;</button>'.$message."\n";
356
    $output .= '  <div class="singlebutton">'."\n";
357
    if (!empty($href)) {
358
        $output .= bigbluebutton_view_render_general_warning_button($href, $text, $class);
359
    }
360
    $output .= '  </div>'."\n";
361
    $output .= $OUTPUT->box_end()."\n";
362
    return $output;
363
}
364
365
function bigbluebutton_view_render_warning_button($href, $text = '', $class = '') {
366
    if ($text == '') {
367
        $text = get_string('ok', 'moodle');
368
    }
369
    if ($class == '') {
370
        $class = 'btn btn-secondary';
371
    }
372
    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
373
    $output .= '      <button type="submit" class="' . $class . '"'."\n";
374
    $output .= '          title=""'."\n";
375
    $output .= '          >' . $text . '</button>'."\n";
376
    $output .= '  </form>'."\n";
377
    return $output;
378
}
379
380
function bigbluebuttonbn_view_render_room(&$bbbsession, $activity, &$jsvars) {
381
    global $OUTPUT;
382
383
    // JavaScript variables for room.
384
    $openingtime = '';
385
    if ($bbbsession['openingtime']) {
386
        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn').': '.
387
            userdate($bbbsession['openingtime']);
388
    }
389
    $closingtime = '';
390
    if ($bbbsession['closingtime']) {
391
        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn').': '.
392
            userdate($bbbsession['closingtime']);
393
    }
394
    $jsvars += array(
395
        'meetingid' => $bbbsession['meetingid'],
396
        'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbn']->id,
397
        'userlimit' => $bbbsession['userlimit'],
398
        'opening' => $openingtime,
399
        'closing' => $closingtime,
400
    );
401
402
    $output = $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_message_box');
403
    $output .= '<br><span id="status_bar"></span><br>';
404
    $output .= '<span id="control_panel"></span>';
405
    $output .= $OUTPUT->box_end();
406
407
    $output .= $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box');
408
    $output .= '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>'."\n";
409
    $output .= $OUTPUT->box_end();
410
411
    if ($activity == 'ended') {
412
        $output .= bigbluebuttonbn_view_ended($bbbsession);
413
    }
414
415
    return $output;
416
}
417
418
function bigbluebuttonbn_view_include_recordings(&$bbbsession) {
419
    if ($bbbsession['bigbluebuttonbn']->type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY &&
420
        $bbbsession['bigbluebuttonbn']->recordings_imported) {
421
        return false;
422
    }
423
    return true;
424
}
425
426
function bigbluebuttonbn_view_render_recordings(&$bbbsession, $showroom, &$jsvars) {
427
    $bigbluebuttonbnid = null;
428
    if ($showroom) {
429
        $bigbluebuttonbnid = $bbbsession['bigbluebuttonbn']->id;
430
    }
431
432
    // Get recordings.
433
    $recordings = array();
434
    if ( bigbluebuttonbn_view_include_recordings($bbbsession) ) {
435
        $recordings = bigbluebuttonbn_get_recordings(
436
            $bbbsession['course']->id, $bigbluebuttonbnid, $showroom,
437
            $bbbsession['bigbluebuttonbn']->recordings_deleted
438
          );
439
    }
440
441
    // Get recording links.
442
    $recordingsimported = bigbluebuttonbn_get_recordings_imported_array(
443
        $bbbsession['course']->id, $bigbluebuttonbnid, $showroom
444
      );
445
446
    /* Perform aritmetic addition instead of merge so the imported recordings corresponding to existent
447
     * recordings are not included. */
448
    $recordings += $recordingsimported;
449
450
    if (empty($recordings) || array_key_exists('messageKey', $recordings)) {
451
        // There are no recordings to be shown.
452
        return html_writer::div(get_string('view_message_norecordings', 'bigbluebuttonbn'), '',
453
            array('id' => 'bigbluebuttonbn_html_table'));
454
    }
455
456
    // There are recordings for this meeting.
457
    // JavaScript variables for recordings.
458
    $jsvars += array(
459
            'recordings_html' => $bbbsession['bigbluebuttonbn']->recordings_html == '1',
460
          );
461
462
    // If there are meetings with recordings load the data to the table.
463
    if ($bbbsession['bigbluebuttonbn']->recordings_html) {
464
        // Render a plain html table.
465
        return bigbluebutton_output_recording_table($bbbsession, $recordings)."\n";
466
    }
467
468
    // JavaScript variables for recordings with YUI.
469
    $jsvars += array(
470
            'columns' => bigbluebuttonbn_get_recording_columns($bbbsession),
471
            'data' => bigbluebuttonbn_get_recording_data($bbbsession, $recordings),
472
          );
473
474
    // Render a YUI table.
475
    return html_writer::div('', '', array('id' => 'bigbluebuttonbn_yui_table'));
476
}
477
478
function bigbluebuttonbn_view_render_imported(&$bbbsession) {
479
    global $CFG;
480
481
    $button = html_writer::tag('input', '',
482
        array('type' => 'button',
483
              'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'),
484
              'class' => 'btn btn-secondary',
485
              'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='.
486
                  $bbbsession['bigbluebuttonbn']->id.'\''));
487
    $output = html_writer::start_tag('br');
488
    $output .= html_writer::tag('span', $button, array('id' => 'import_recording_links_button'));
489
    $output .= html_writer::tag('span', '', array('id' => 'import_recording_links_table'));
490
491
    return $output;
492
}
493
494
function bigbluebuttonbn_view_ended(&$bbbsession) {
495
    global $OUTPUT;
496
497
    if (!is_null($bbbsession['presentation']['url'])) {
498
        $attributes = array('title' => $bbbsession['presentation']['name']);
499
        $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
500
501
        return '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
502
                ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
503
                ''.$OUTPUT->action_link($bbbsession['presentation']['url'],
504
                      $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
505
    }
506
507
    return '';
508
}
509