1 |
efrain |
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 |
namespace mod_bigbluebuttonbn\output;
|
|
|
18 |
|
|
|
19 |
use core\notification;
|
|
|
20 |
use core\output\inplace_editable;
|
|
|
21 |
use html_table;
|
|
|
22 |
use html_writer;
|
|
|
23 |
use mod_bigbluebuttonbn\instance;
|
|
|
24 |
use plugin_renderer_base;
|
|
|
25 |
|
|
|
26 |
/**
|
|
|
27 |
* Renderer for the mod_bigbluebuttonbn plugin.
|
|
|
28 |
*
|
|
|
29 |
* @package mod_bigbluebuttonbn
|
|
|
30 |
* @copyright 2010 onwards, Blindside Networks Inc
|
|
|
31 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
32 |
* @author Darko Miletic (darko.miletic [at] gmail [dt] com)
|
|
|
33 |
*/
|
|
|
34 |
class renderer extends plugin_renderer_base {
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* Render the index table.
|
|
|
38 |
*
|
|
|
39 |
* @param index $index
|
|
|
40 |
* @return string
|
|
|
41 |
*/
|
|
|
42 |
protected function render_index(index $index): string {
|
|
|
43 |
$this->page->requires->js_call_amd('mod_bigbluebuttonbn/index', 'init');
|
|
|
44 |
|
|
|
45 |
return html_writer::table($index->get_table($this));
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Render the groups selector.
|
|
|
50 |
*
|
|
|
51 |
* @param instance $instance
|
|
|
52 |
* @return string
|
|
|
53 |
*/
|
|
|
54 |
public function render_groups_selector(instance $instance): string {
|
|
|
55 |
$groupmode = groups_get_activity_groupmode($instance->get_cm());
|
|
|
56 |
if ($groupmode == NOGROUPS) {
|
|
|
57 |
return '';
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
// Separate or visible group mode.
|
|
|
61 |
$groups = groups_get_activity_allowed_groups($instance->get_cm());
|
|
|
62 |
if (empty($groups)) {
|
|
|
63 |
// No groups in this course.
|
|
|
64 |
notification::add(get_string('view_groups_nogroups_warning', 'bigbluebuttonbn'), notification::INFO);
|
|
|
65 |
return '';
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
// Assign group default values.
|
|
|
69 |
if (count($groups) == 0) {
|
|
|
70 |
// Only the All participants group exists.
|
|
|
71 |
notification::add(get_string('view_groups_notenrolled_warning', 'bigbluebuttonbn'), notification::INFO);
|
|
|
72 |
return '';
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
if (count($groups) > 1) {
|
|
|
76 |
notification::add(get_string('view_groups_selection_warning', 'bigbluebuttonbn'), notification::INFO);
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
$groupsmenu = groups_print_activity_menu(
|
|
|
80 |
$instance->get_cm(),
|
|
|
81 |
$instance->get_view_url(),
|
|
|
82 |
true
|
|
|
83 |
);
|
|
|
84 |
|
|
|
85 |
return $groupsmenu . '<br><br>';
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
/**
|
|
|
89 |
* Render the view page.
|
|
|
90 |
*
|
|
|
91 |
* @param view_page $page
|
|
|
92 |
* @return string
|
|
|
93 |
*/
|
|
|
94 |
public function render_view_page(view_page $page): string {
|
|
|
95 |
return $this->render_from_template(
|
|
|
96 |
'mod_bigbluebuttonbn/view_page',
|
|
|
97 |
$page->export_for_template($this)
|
|
|
98 |
);
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
/**
|
|
|
102 |
* Render inplace editable
|
|
|
103 |
*
|
|
|
104 |
* @param inplace_editable $e
|
|
|
105 |
* @return bool|string
|
|
|
106 |
*/
|
|
|
107 |
public function render_inplace_editable(inplace_editable $e) {
|
|
|
108 |
return $this->render_from_template('core/inplace_editable', $e->export_for_template($this));
|
|
|
109 |
}
|
|
|
110 |
}
|