| Línea 109... |
Línea 109... |
| 109 |
|
109 |
|
| 110 |
// Whether or not section name should be displayed.
|
110 |
// Whether or not section name should be displayed.
|
| Línea 111... |
Línea 111... |
| 111 |
$showsectionname = !empty($config->showsectionname) ? true : false;
|
111 |
$showsectionname = !empty($config->showsectionname) ? true : false;
|
| 112 |
|
112 |
|
| 113 |
// Prepare an array of sections to create links for.
|
113 |
// Prepare an array of sections to create links for.
|
| 114 |
$sections = array();
|
114 |
$sections = [];
|
| 115 |
$canviewhidden = has_capability('moodle/course:update', $context);
|
115 |
$canviewhidden = has_capability('moodle/course:update', $context);
|
| 116 |
$coursesections = $courseformat->get_sections();
|
116 |
$coursesections = $courseformat->get_sections();
|
| 117 |
$coursesectionscount = count($coursesections);
|
117 |
$coursesectionscount = count($coursesections);
|
| 118 |
$sectiontojumpto = false;
|
118 |
$sectiontojumpto = false;
|
| 119 |
for ($i = $inc; $i <= $coursesectionscount; $i += $inc) {
|
119 |
for ($i = $inc; $i <= $coursesectionscount; $i += $inc) {
|
| 120 |
if ($i > $numsections || !isset($coursesections[$i])) {
|
120 |
if ($i > $numsections || !isset($coursesections[$i])) {
|
| 121 |
continue;
|
121 |
continue;
|
| - |
|
122 |
}
|
| - |
|
123 |
$section = $coursesections[$i];
|
| - |
|
124 |
// Delegated sections (like subsections) are not listed in the block.
|
| - |
|
125 |
if ($section->get_component_instance() !== null) {
|
| 122 |
}
|
126 |
continue;
|
| 123 |
$section = $coursesections[$i];
|
127 |
}
|
| 124 |
if ($section->section && ($section->visible || $canviewhidden)) {
|
128 |
if ($section->section && ($section->visible || $canviewhidden)) {
|
| 125 |
$sections[$i] = (object)array(
|
129 |
$sections[$i] = (object) [
|
| 126 |
'section' => $section->section,
|
130 |
'section' => $section->section,
|
| 127 |
'visible' => $section->visible,
|
131 |
'visible' => $section->visible,
|
| 128 |
'highlight' => false
|
132 |
'highlight' => false
|
| 129 |
);
|
133 |
];
|
| 130 |
if ($courseformat->is_section_current($section)) {
|
134 |
if ($courseformat->is_section_current($section)) {
|
| 131 |
$sections[$i]->highlight = true;
|
135 |
$sections[$i]->highlight = true;
|
| 132 |
$sectiontojumpto = $section->section;
|
136 |
$sectiontojumpto = $section->section;
|