-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrenderer.php
More file actions
152 lines (128 loc) · 5.43 KB
/
Copy pathrenderer.php
File metadata and controls
152 lines (128 loc) · 5.43 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
require_once($CFG->dirroot . '/course/format/renderer.php');
defined('MOODLE_INTERNAL') || die();
/**
* Basic renderer for missions format.
*
*/
class format_missions_renderer extends format_section_renderer_base
{
public function __construct(moodle_page $page, $target)
{
parent::__construct($page, $target);
$page->set_other_editing_capability('moodle/course:setcurrentsection');
}
/**
* Generate the starting container html for a list of sections
* @return string HTML to output.
*/
protected function start_section_list()
{
return html_writer::start_tag('ul', ['class' => 'topics']);
}
/**
* Generate the closing container html for a list of sections
* @return string HTML to output.
*/
protected function end_section_list()
{
return html_writer::end_tag('ul');
}
/**
* Generate the title for this section page
* @return string the page title
*/
protected function page_title()
{
return get_string('missions_outline', 'format_missions');
}
/**
* Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page
*
* @param stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title($section, $course)
{
return $this->render(course_get_format($course)->inplace_editable_render_section_name($section));
}
/**
* Generate the section title to be displayed on the section page, without a link
*
* @param stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title_without_link($section, $course)
{
return $this->render(course_get_format($course)->inplace_editable_render_section_name($section, false));
}
/**
* Output the html for a single section page .
*
* @param stdClass $course The course entry from DB
* @param array $sections (argument not used)
* @param array $mods (argument not used)
* @param array $modnames (argument not used)
* @param array $modnamesused (argument not used)
* @param int $displaysection The section number in the course which is being displayed
*/
public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
{
$modinfo = get_fast_modinfo($course);
$course = course_get_format($course)->get_course();
// Can we view the section in question?
if (!($sectioninfo = $modinfo->get_section_info($displaysection)) || !$sectioninfo->uservisible) {
// This section doesn't exist or is not available for the user.
// We actually already check this in course/view.php but just in case exit from this function as well.
print_error(
'unknowncoursesection',
'error',
course_get_url($course),
format_string($course->fullname)
);
}
// Copy activity clipboard..
echo $this->course_activity_clipboard($course, $displaysection);
$thissection = $modinfo->get_section_info(0);
if ($thissection->summary or !empty($modinfo->sections[0]) or $this->page->user_is_editing()) {
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true, $displaysection);
echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
echo $this->courserenderer->course_section_add_cm_control($course, 0, $displaysection);
echo $this->section_footer();
echo $this->end_section_list();
}
// Start single-section div
echo html_writer::start_tag('div', array('class' => 'single-section'));
// The requested section page.
$thissection = $modinfo->get_section_info($displaysection);
// Section title.
$sectiontitle = '';
// Title attributes
$classes = 'sectionname';
if (!$thissection->visible) {
$classes .= ' dimmed_text';
}
$sectionname = html_writer::tag('span', $this->section_title_without_link($thissection, $course));
$sectiontitle .= $this->output->heading($sectionname, 3, $classes);
$sectiontitle .= html_writer::end_tag('div');
echo $sectiontitle;
// $sections = $this->output->get_sections($course, $displaysection);
// $missions_path_renderer = new \format_missions\output\missions_path($sections);
// echo $missions_path_renderer->export_for_template();
// Show completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
// Now the list of sections..
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true, $displaysection);
echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection);
echo $this->section_footer();
echo $this->end_section_list();
// Close single-section div.
echo html_writer::end_tag('div');
}
}