Completed
Pull Request — master (#40)
by Jesus
02:06
created

view.php ➔ bigbluebutton_view_render_warning_button()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 11
nc 4
nop 3
dl 0
loc 14
rs 9.4285
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,
259
            get_string('view_groups_notenrolled_warning', 'bigbluebuttonbn'), 'info', false);
260
        return;
261
    }
262
263
    if (count($groups) == 1) {
264
        // There is only one group and the user has access to it.
265
        return;
266
    }
267
268
    bigbluebuttonbn_view_message_box($bbbsession, get_string('view_groups_selection_warning', 'bigbluebuttonbn'), 'warning');
269
    $urltoroot = $CFG->wwwroot.'/mod/bigbluebuttonbn/view.php?id='.$bbbsession['cm']->id;
270
    groups_print_activity_menu($bbbsession['cm'], $urltoroot);
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'],
307
        (string)$cfg['general_warning_button_text'],
308
        (string)$cfg['general_warning_button_class']);
309
310
    $output .= $OUTPUT->heading($bbbsession['meetingname'], 3);
311
    $output .= $OUTPUT->heading($bbbsession['meetingdescription'], 5);
312
313
    if ($enabledfeatures['showroom']) {
314
        $output .= bigbluebuttonbn_view_render_room($bbbsession, $activity, $jsvars);
315
        $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-rooms',
316
            'M.mod_bigbluebuttonbn.rooms.init', array($jsvars));
317
    }
318
319
    if ($enabledfeatures['showrecordings']) {
320
        $output .= bigbluebuttonbn_view_render_recording_section($bbbsession, $type, $enabledfeatures, $jsvars);
321
        $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-recordings',
322
                'M.mod_bigbluebuttonbn.recordings.init', array($jsvars));
323
    }
324
325
    echo $output.html_writer::empty_tag('br').html_writer::empty_tag('br').html_writer::empty_tag('br');
326
    $PAGE->requires->yui_module('moodle-mod_bigbluebuttonbn-broker', 'M.mod_bigbluebuttonbn.broker.init', array($jsvars));
327
}
328
329
function bigbluebuttonbn_view_render_recording_section(&$bbbsession, $type, $enabledfeatures, &$jsvars) {
330
    $output = '';
331
    // Evaluates if the recordings are enterely disabled.
332
    if (!(boolean)\mod_bigbluebuttonbn\locallib\config::recordings_enabled()) {
333
        if ($type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY) {
334
            $output .= bigbluebuttonbn_view_render_warning(
335
                get_string('view_message_recordings_disabled', 'bigbluebuttonbn'), 'danger');
336
        }
337
        return $output;
338
    }
339
    // Recordings are rendered either if it is a 'recordings only' instance or it is set to be recorded.
340
    if ($type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY || $bbbsession['record']) {
341
        $output .= html_writer::tag('h4', get_string('view_section_title_recordings', 'bigbluebuttonbn'));
342
        $output .= bigbluebuttonbn_view_render_recordings($bbbsession, $enabledfeatures['showroom'], $jsvars);
343
        if ($enabledfeatures['importrecordings'] && $bbbsession['importrecordings']) {
344
            $output .= bigbluebuttonbn_view_render_imported($bbbsession);
345
        }
346
    }
347
    return $output;
348
}
349
350
function bigbluebuttonbn_view_render_warning($message, $type='info', $href='', $text='', $class='') {
351
    global $OUTPUT;
352
    $output = "\n";
353
    // Evaluates if config_warning is enabled.
354
    if (empty($message)) {
355
        return $output;
356
    }
357
    $output .= $OUTPUT->box_start('box boxalignleft adminerror alert alert-' . $type . ' alert-block fade in',
358
      'bigbluebuttonbn_view_general_warning')."\n";
359
    $output .= '  <button type="button" class="close" data-dismiss="alert">&times;</button>'.$message."\n";
360
    $output .= '  <div class="singlebutton">'."\n";
361
    if (!empty($href)) {
362
        $output .= bigbluebuttonbn_view_render_warning_button($href, $text, $class);
363
    }
364
    $output .= '  </div>'."\n";
365
    $output .= $OUTPUT->box_end()."\n";
366
    return $output;
367
}
368
369
function bigbluebuttonbn_view_render_warning_button($href, $text = '', $class = '') {
370
    if ($text == '') {
371
        $text = get_string('ok', 'moodle');
372
    }
373
    if ($class == '') {
374
        $class = 'btn btn-secondary';
375
    }
376
    $output  = '  <form method="post" action="' . $href . '" class="form-inline">'."\n";
377
    $output .= '      <button type="submit" class="' . $class . '"'."\n";
378
    $output .= '          title=""'."\n";
379
    $output .= '          >' . $text . '</button>'."\n";
380
    $output .= '  </form>'."\n";
381
    return $output;
382
}
383
384
function bigbluebuttonbn_view_render_room(&$bbbsession, $activity, &$jsvars) {
385
    global $OUTPUT;
386
387
    // JavaScript variables for room.
388
    $openingtime = '';
389
    if ($bbbsession['openingtime']) {
390
        $openingtime = get_string('mod_form_field_openingtime', 'bigbluebuttonbn').': '.
391
            userdate($bbbsession['openingtime']);
392
    }
393
    $closingtime = '';
394
    if ($bbbsession['closingtime']) {
395
        $closingtime = get_string('mod_form_field_closingtime', 'bigbluebuttonbn').': '.
396
            userdate($bbbsession['closingtime']);
397
    }
398
    $jsvars += array(
399
        'meetingid' => $bbbsession['meetingid'],
400
        'bigbluebuttonbnid' => $bbbsession['bigbluebuttonbn']->id,
401
        'userlimit' => $bbbsession['userlimit'],
402
        'opening' => $openingtime,
403
        'closing' => $closingtime,
404
    );
405
406
    $output = $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_message_box');
407
    $output .= '<br><span id="status_bar"></span><br>';
408
    $output .= '<span id="control_panel"></span>';
409
    $output .= $OUTPUT->box_end();
410
411
    $output .= $OUTPUT->box_start('generalbox boxaligncenter', 'bigbluebuttonbn_view_action_button_box');
412
    $output .= '<br><br><span id="join_button"></span>&nbsp;<span id="end_button"></span>'."\n";
413
    $output .= $OUTPUT->box_end();
414
415
    if ($activity == 'ended') {
416
        $output .= bigbluebuttonbn_view_ended($bbbsession);
417
    }
418
419
    return $output;
420
}
421
422
function bigbluebuttonbn_view_include_recordings(&$bbbsession) {
423
    if ($bbbsession['bigbluebuttonbn']->type == BIGBLUEBUTTONBN_TYPE_RECORDING_ONLY &&
424
        $bbbsession['bigbluebuttonbn']->recordings_imported) {
425
        return false;
426
    }
427
    return true;
428
}
429
430
function bigbluebuttonbn_view_render_recordings(&$bbbsession, $showroom, &$jsvars) {
431
    $bigbluebuttonbnid = null;
432
    if ($showroom) {
433
        $bigbluebuttonbnid = $bbbsession['bigbluebuttonbn']->id;
434
    }
435
436
    // Get recordings.
437
    $recordings = array();
438
    if ( bigbluebuttonbn_view_include_recordings($bbbsession) ) {
439
        $recordings = bigbluebuttonbn_get_recordings(
440
            $bbbsession['course']->id, $bigbluebuttonbnid, $showroom,
441
            $bbbsession['bigbluebuttonbn']->recordings_deleted
442
          );
443
    }
444
445
    // Get recording links.
446
    $recordingsimported = bigbluebuttonbn_get_recordings_imported_array(
447
        $bbbsession['course']->id, $bigbluebuttonbnid, $showroom
448
      );
449
450
    /* Perform aritmetic addition instead of merge so the imported recordings corresponding to existent
451
     * recordings are not included. */
452
    $recordings += $recordingsimported;
453
454
    if (empty($recordings) || array_key_exists('messageKey', $recordings)) {
455
        // There are no recordings to be shown.
456
        return html_writer::div(get_string('view_message_norecordings', 'bigbluebuttonbn'), '',
457
            array('id' => 'bigbluebuttonbn_html_table'));
458
    }
459
460
    // There are recordings for this meeting.
461
    // JavaScript variables for recordings.
462
    $jsvars += array(
463
            'recordings_html' => $bbbsession['bigbluebuttonbn']->recordings_html == '1',
464
          );
465
466
    // If there are meetings with recordings load the data to the table.
467
    if ($bbbsession['bigbluebuttonbn']->recordings_html) {
468
        // Render a plain html table.
469
        return bigbluebutton_output_recording_table($bbbsession, $recordings)."\n";
470
    }
471
472
    // JavaScript variables for recordings with YUI.
473
    $jsvars += array(
474
            'columns' => bigbluebuttonbn_get_recording_columns($bbbsession),
475
            'data' => bigbluebuttonbn_get_recording_data($bbbsession, $recordings),
476
          );
477
478
    // Render a YUI table.
479
    return html_writer::div('', '', array('id' => 'bigbluebuttonbn_yui_table'));
480
}
481
482
function bigbluebuttonbn_view_render_imported(&$bbbsession) {
483
    global $CFG;
484
485
    $button = html_writer::tag('input', '',
486
        array('type' => 'button',
487
              'value' => get_string('view_recording_button_import', 'bigbluebuttonbn'),
488
              'class' => 'btn btn-secondary',
489
              'onclick' => 'window.location=\''.$CFG->wwwroot.'/mod/bigbluebuttonbn/import_view.php?bn='.
490
                  $bbbsession['bigbluebuttonbn']->id.'\''));
491
    $output = html_writer::start_tag('br');
492
    $output .= html_writer::tag('span', $button, array('id' => 'import_recording_links_button'));
493
    $output .= html_writer::tag('span', '', array('id' => 'import_recording_links_table'));
494
495
    return $output;
496
}
497
498
function bigbluebuttonbn_view_ended(&$bbbsession) {
499
    global $OUTPUT;
500
501
    if (!is_null($bbbsession['presentation']['url'])) {
502
        $attributes = array('title' => $bbbsession['presentation']['name']);
503
        $icon = new pix_icon($bbbsession['presentation']['icon'], $bbbsession['presentation']['mimetype_description']);
504
505
        return '<h4>'.get_string('view_section_title_presentation', 'bigbluebuttonbn').'</h4>'.
506
                ''.$OUTPUT->action_icon($bbbsession['presentation']['url'], $icon, null, array(), false).''.
507
                ''.$OUTPUT->action_link($bbbsession['presentation']['url'],
508
                      $bbbsession['presentation']['name'], null, $attributes).'<br><br>';
509
    }
510
511
    return '';
512
}
513