-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.php
50 lines (41 loc) · 1.69 KB
/
renderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
class mod_testingdemo_renderer extends plugin_renderer_base {
function group_selected_page(array $groups) {
$groupnames = array();
foreach ($groups as $group) {
$groupnames[] = html_writer::tag('strong', $group->name);
}
$groupnames = implode(', ', $groupnames);
$string = count($groups) == 1 ? 'yourgroup' : 'yourgroups';
$content = html_writer::div(get_string($string, 'testingdemo') . ': ' . $groupnames);
return $this->view_page($content);
}
function no_groups_page() {
$msg = html_writer::div(get_string('nogroups', 'testingdemo'), 'warning');
return $this->view_page($msg);
}
function not_enrolled_page() {
$msg = html_writer::div(get_string('notenrolled', 'testingdemo'), 'warning');
return $this->view_page($msg);
}
function no_permission_page() {
$msg = html_writer::div(get_string('nopermission', 'testingdemo'), 'warning');
return $this->view_page($msg);
}
function select_group_page(moodleform $form) {
return $this->view_page($form->render());
}
private function view_page($content) {
global $PAGE;
$output = $this->header();
if ($PAGE->activityrecord->intro) {
$intro = file_rewrite_pluginfile_urls($PAGE->activityrecord->intro, 'pluginfile.php',
$PAGE->context->id, 'mod_testingdemo', 'intro', null);
$intro = format_text($intro, $PAGE->activityrecord->introformat);
$output .= html_writer::div($intro, 'generalbox');
}
$output .= $content;
$output .= $this->footer();
return $output;
}
}