Completed
Pull Request — master (#38)
by Jesus
02:05
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 $OUTPUT, $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
        return;
238
    }
239
240
    if ($groupmode == SEPARATEGROUPS) {
241
        $groups = groups_get_activity_allowed_groups($bbbsession['cm']);
242
    }
243
244
    $bbbsession['group'] = groups_get_activity_group($bbbsession['cm'], true);
245
246
    // Assign group default values.
247
    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.
248
        $bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
249
    $groupname = get_string('allparticipants');
250
    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$groupname.')';
251
252
    if (count($groups) == 0) {
253
        // Only the All participants group exists.
254
        return;
255
    }
256
257
    if ($bbbsession['group'] == 0) {
258
        $bbbsession['group'] = array_values($groups)[0]->id;
259
    }
260
261
    $bbbsession['meetingid'] = $bbbsession['bigbluebuttonbn']->meetingid.'-'.$bbbsession['course']->id.'-'.
262
        $bbbsession['bigbluebuttonbn']->id.'['.$bbbsession['group'].']';
263
    $groupname = groups_get_group_name($bbbsession['group']);
264
    $bbbsession['meetingname'] = $bbbsession['bigbluebuttonbn']->name.' ('.$groupname.')';
265
266
    if (count($groups) == 1) {
267
        // There only one group and the user has access to.
268
        return;
269
    }
270
271
    echo $OUTPUT->box_start('generalbox boxaligncenter');
272
    echo '<br><div class="alert alert-warning">'.get_string('view_groups_selection_warning', 'bigbluebuttonbn').
273
      '</div>';
274
    echo $OUTPUT->box_end();
275
276
    groups_print_activity_menu(
277
      $bbbsession['cm'], $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id);
278
    echo '<br><br>';
279
}
280
281
function bigbluebuttonbn_view_render(&$bbbsession, $activity) {
282
    global $OUTPUT, $PAGE;
283
284
    $type = null;
285
    if (isset($bbbsession['bigbluebuttonbn']->type)) {
286
        $type = $bbbsession['bigbluebuttonbn']->type;
287
    }
288
289
    $typeprofiles = bigbluebuttonbn_get_instance_type_profiles();
290
    $enabledfeatures = bigbluebuttonbn_get_enabled_features($typeprofiles, $type);
291
    $pinginterval = (int)\mod_bigbluebuttonbn\locallib\config::get('waitformoderator_ping_interval') * 1000;
292
293
    // JavaScript for locales.
294
    $PAGE->requires->strings_for_js(array_keys(bigbluebuttonbn_get_strings_for_js()), 'bigbluebuttonbn');
295
296
    // JavaScript variables.
297
    $jsvars = array('activity' => $activity, 'ping_interval' => $pinginterval,
298
        'locale' => bigbluebuttonbn_get_localcode(), 'profile_features' => $typeprofiles[0]['features']);
299
300
    // Renders general warning when configured.
301
    $cfg = \mod_bigbluebuttonbn\locallib\config::get_options();
302
    $output  = bigbluebuttonbn_view_render_warning($cfg['general_warning_message'], 'info',
303
        (string)$cfg['general_warning_button_href'], (string)$cfg['general_warning_button_text'], (string)$cfg['general_warning_button_class']);
304
305
    $output .= $OUTPUT->heading($bbbsession['meetingname'], 3);
306
    $output .= $OUTPUT->heading($bbbsession['meetingdescription'], 5);
307
308
    if ($enabledfeatures['showroom']) {
309
        $output .= bigbluebuttonbn_view_render_room($bbbsession, $activity, $jsvars);
310
        $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-rooms',
311
            'M.mod_bigbluebuttonbn.rooms.init', array($jsvars));
312
    }
313
314
    if ($enabledfeatures['showrecordings']) {
315
        $output .= bigbluebuttonbn_view_render_recording_section($bbbsession, $type, $enabledfeatures, $jsvars);
316
        $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-recordings',
317
                'M.mod_bigbluebuttonbn.recordings.init', array($jsvars));
318
    }
319
320
    echo $output.html_writer::empty_tag('br').html_writer::empty_tag('br').html_writer::empty_tag('br');
321
    $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-broker', 'M.mod_bigbluebuttonbn.broker.init', array($jsvars));
322
}
323
324
function bigbluebuttonbn_view_render_recording_section(&$bbbsession, $type, $enabledfeatures, &$jsvars) {
325
    $output = '';
326
    // Evaluates if the recordings are enterely disabled
327
    if (!(boolean)\mod_bigbluebuttonbn\locallib\config::recordings_enabled()) {
328
        if ($type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY) {
329
            $output .= bigbluebuttonbn_view_render_warning(get_string('view_message_recordings_disabled', 'bigbluebuttonbn'), 'danger');
330
        }
331
        return $output;
332
    }
333
    // Recordings are rendered either if it is a 'recordings only' instance or it is set to be recorded
334
    if ($type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY || $bbbsession['record']) {
335
        $output .= html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn'));
336
        $output .= bigbluebuttonbn_view_render_recordings($bbbsession, $enabledfeatures['showroom'], $jsvars);
337
        if ($enabledfeatures['importrecordings'] && $bbbsession['importrecordings']) {
338
            $output .= bigbluebuttonbn_view_render_imported($bbbsession);
339
        }
340
    }
341
    return $output;
342
}
343
344
function bigbluebuttonbn_view_render_warning($message, $type='info', $href='', $text='', $class='') {
345
    global $OUTPUT;
346
    $output = "\n";
347
    // Evaluates if config_warning is enabled.
348
    if (empty($message)) {
349
        return $output;
350
    }
351
    $output .= $OUTPUT->box_start('box boxalignleft adminerror alert alert-' . $type . ' alert-block fade in', 'bigbluebuttonbn_view_general_warning')."\n";
352
    $output .= '  <button type="button" class="close" data-dismiss="alert">&times;</button>'.$message."\n";
353
    $output .= '  <div class="singlebutton">'."\n";
354
    if (!empty($href)) {
355
        $output .= bigbluebutton_view_render_general_warning_button($href, $text, $class);
356
    }
357
    $output .= '  </div>'."\n";
358
    $output .= $OUTPUT->box_end()."\n";
359
    return $output;
360
}
361
362
function bigbluebutton_view_render_warning_button($href, $text = '', $class = '') {
363
    if ($text == '') {
364
        $text = get_string('ok', 'moodle');
365
    }
366
    if ($class == '') {
367
        $class = 'btn btn-secondary';
368
    }
369
    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
370
    $output .= '      <button type="submit" class="' . $class . '"'."\n";
371
    $output .= '          title=""'."\n";
372
    $output .= '          >' . $text . '</button>'."\n";
373
    $output .= '  </form>'."\n";
374
    return $output;
375
}
376
377
function bigbluebuttonbn_view_render_room(&$bbbsession, $activity, &$jsvars) {
378
    global $OUTPUT;
379
380
    // JavaScript variables for room.
381
    $openingtime = '';
382
    if ($bbbsession['openingtime']) {
383
        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn').': '.
384
            userdate($bbbsession['openingtime']);
385
    }
386
    $closingtime = '';
387
    if ($bbbsession['closingtime']) {
388
        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn').': '.
389
            userdate($bbbsession['closingtime']);
390
    }
391
    $jsvars += array(
392
        'meetingid' => $bbbsession['meetingid'],
393
        'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbn']->id,
394
        'userlimit' => $bbbsession['userlimit'],
395
        'opening' => $openingtime,
396
        'closing' => $closingtime,
397
    );
398
399
    $output = $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_message_box');
400
    $output .= '<br><span id="status_bar"></span><br>';
401
    $output .= '<span id="control_panel"></span>';
402
    $output .= $OUTPUT->box_end();
403
404
    $output .= $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box');
405
    $output .= '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>'."\n";
406
    $output .= $OUTPUT->box_end();
407
408
    if ($activity == 'ended') {
409
        $output .= bigbluebuttonbn_view_ended($bbbsession);
410
    }
411
412
    return $output;
413
}
414
415
function bigbluebuttonbn_view_include_recordings(&$bbbsession) {
416
    if ($bbbsession['bigbluebuttonbn']->type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY &&
417
        $bbbsession['bigbluebuttonbn']->recordings_imported) {
418
        return false;
419
    }
420
    return true;
421
}
422
423
function bigbluebuttonbn_view_render_recordings(&$bbbsession, $showroom, &$jsvars) {
424
    $bigbluebuttonbnid = null;
425
    if ($showroom) {
426
        $bigbluebuttonbnid = $bbbsession['bigbluebuttonbn']->id;
427
    }
428
429
    // Get recordings.
430
    $recordings = array();
431
    if ( bigbluebuttonbn_view_include_recordings($bbbsession) ) {
432
        $recordings = bigbluebuttonbn_get_recordings(
433
            $bbbsession['course']->id, $bigbluebuttonbnid, $showroom,
434
            $bbbsession['bigbluebuttonbn']->recordings_deleted
435
          );
436
    }
437
438
    // Get recording links.
439
    $recordingsimported = bigbluebuttonbn_get_recordings_imported_array(
440
        $bbbsession['course']->id, $bigbluebuttonbnid, $showroom
441
      );
442
443
    /* Perform aritmetic addition instead of merge so the imported recordings corresponding to existent
444
     * recordings are not included. */
445
    $recordings += $recordingsimported;
446
447
    if (empty($recordings) || array_key_exists('messageKey', $recordings)) {
448
        // There are no recordings to be shown.
449
        return html_writer::div(get_string('view_message_norecordings', 'bigbluebuttonbn'), '',
450
            array('id' => 'bigbluebuttonbn_html_table'));
451
    }
452
453
    // There are recordings for this meeting.
454
    // JavaScript variables for recordings.
455
    $jsvars += array(
456
            'recordings_html' => $bbbsession['bigbluebuttonbn']->recordings_html == '1',
457
          );
458
459
    // If there are meetings with recordings load the data to the table.
460
    if ($bbbsession['bigbluebuttonbn']->recordings_html) {
461
        // Render a plain html table.
462
        return bigbluebutton_output_recording_table($bbbsession, $recordings)."\n";
463
    }
464
465
    // JavaScript variables for recordings with YUI.
466
    $jsvars += array(
467
            'columns' => bigbluebuttonbn_get_recording_columns($bbbsession),
468
            'data' => bigbluebuttonbn_get_recording_data($bbbsession, $recordings),
469
          );
470
471
    // Render a YUI table.
472
    return html_writer::div('', '', array('id' => 'bigbluebuttonbn_yui_table'));
473
}
474
475
function bigbluebuttonbn_view_render_imported(&$bbbsession) {
476
    global $CFG;
477
478
    $button = html_writer::tag('input', '',
479
        array('type' => 'button',
480
              'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'),
481
              'class' => 'btn btn-secondary',
482
              'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='.
483
                  $bbbsession['bigbluebuttonbn']->id.'\''));
484
    $output = html_writer::start_tag('br');
485
    $output .= html_writer::tag('span', $button, array('id' => 'import_recording_links_button'));
486
    $output .= html_writer::tag('span', '', array('id' => 'import_recording_links_table'));
487
488
    return $output;
489
}
490
491
function bigbluebuttonbn_view_ended(&$bbbsession) {
492
    global $OUTPUT;
493
494
    if (!is_null($bbbsession['presentation']['url'])) {
495
        $attributes = array('title' => $bbbsession['presentation']['name']);
496
        $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
497
498
        return '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
499
                ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
500
                ''.$OUTPUT->action_link($bbbsession['presentation']['url'],
501
                      $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
502
    }
503
504
    return '';
505
}
506