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 all BigBlueButton instances in this course. |
19
|
|
|
* |
20
|
|
|
* @package mod_bigbluebuttonbn |
21
|
|
|
* @copyright 2010 onwards, Blindside Networks Inc |
22
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
23
|
|
|
* @author Jesus Federico (jesus [at] blindsidenetworks [dt] com) |
24
|
|
|
* @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com) |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
use mod_bigbluebuttonbn\plugin; |
28
|
|
|
use mod_bigbluebuttonbn\output\renderer; |
29
|
|
|
use mod_bigbluebuttonbn\output\index; |
30
|
|
|
|
31
|
|
|
require(__DIR__.'/../../config.php'); |
32
|
|
|
require_once(__DIR__.'/locallib.php'); |
33
|
|
|
|
34
|
|
|
$id = required_param('id', PARAM_INT); |
35
|
|
|
$a = optional_param('a', 0, PARAM_INT); |
36
|
|
|
$g = optional_param('g', 0, PARAM_INT); |
37
|
|
|
|
38
|
|
|
$course = $DB->get_record('course', ['id' => $id]); |
39
|
|
|
if (!$course) { |
40
|
|
|
print_error('invalidcourseid'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
require_login($course, true); |
44
|
|
|
|
45
|
|
|
$PAGE->set_url('/mod/bigbluebuttonbn/index.php', ['id' => $id]); |
46
|
|
|
$PAGE->set_title(get_string('modulename', plugin::COMPONENT)); |
47
|
|
|
$PAGE->set_heading($course->fullname); |
48
|
|
|
$PAGE->set_cacheable(false); |
49
|
|
|
$PAGE->set_pagelayout('incourse'); |
50
|
|
|
|
51
|
|
|
$PAGE->navbar->add($PAGE->title, $PAGE->url); |
52
|
|
|
|
53
|
|
|
$action = optional_param('action', '', PARAM_TEXT); |
54
|
|
|
if ($action === 'end') { |
55
|
|
|
// A request to end the meeting. |
56
|
|
|
$bigbluebuttonbn = $DB->get_record('bigbluebuttonbn', ['id' => $a]); |
57
|
|
|
if (!$bigbluebuttonbn) { |
58
|
|
|
print_error('index_error_bbtn', plugin::COMPONENT, '', $a); |
59
|
|
|
} |
60
|
|
|
$course = $DB->get_record('course', array('id' => $bigbluebuttonbn->course), '*', MUST_EXIST); |
61
|
|
|
$cm = get_coursemodule_from_instance('bigbluebuttonbn', $bigbluebuttonbn->id, $course->id, false, MUST_EXIST); |
62
|
|
|
// User roles. |
63
|
|
|
$participantlist = bigbluebuttonbn_get_participant_list($bigbluebuttonbn, $PAGE->context); |
64
|
|
|
$moderator = bigbluebuttonbn_is_moderator($PAGE->context, $participantlist); |
65
|
|
|
$administrator = is_siteadmin(); |
66
|
|
|
if ($moderator || $administrator) { |
67
|
|
|
bigbluebuttonbn_event_log(\mod_bigbluebuttonbn\event\events::$events['meeting_end'], $bigbluebuttonbn); |
68
|
|
|
echo get_string('index_ending', plugin::COMPONENT); |
69
|
|
|
$meetingid = sprintf('%s-%d-%d', $bigbluebuttonbn->meetingid, $course->id, $bigbluebuttonbn->id); |
70
|
|
|
if ($g != 0) { |
71
|
|
|
$meetingid .= sprintf('[%d]', $g); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
bigbluebuttonbn_end_meeting($meetingid, $bigbluebuttonbn->moderatorpass); |
75
|
|
|
redirect($PAGE->url); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** @var renderer $renderer */ |
80
|
|
|
$renderer = $PAGE->get_renderer(plugin::COMPONENT); |
81
|
|
|
|
82
|
|
|
echo $OUTPUT->header(); |
83
|
|
|
echo $OUTPUT->heading(get_string('index_heading', plugin::COMPONENT)); |
84
|
|
|
echo $renderer->render(new index($course)); |
85
|
|
|
echo $OUTPUT->footer(); |