Skip to content

Commit db0de49

Browse files
committed
[#69] - manages the sections / activities with restricted access and also the case where the section only had hidden activities
1 parent c732266 commit db0de49

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

block_course_modulenavigation.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,13 @@ public function get_content() {
247247
}
248248
foreach ($sections as $section) {
249249
$i = $section->section;
250-
if (!$section->uservisible || $section->visible == 0) {
250+
if (!$section->uservisible || $section->visible == 0 || $section->available == false) {
251251
continue;
252-
} else if (count($section->modinfo->sections[$i]) == 1
252+
} else if ( isset($section->modinfo->sections[$i])
253+
&& count($section->modinfo->sections[$i]) == 1
253254
&& ( $section->modinfo->cms[$section->modinfo->sections[$i][0]]->visible == 0 ||
254-
$section->modinfo->cms[$section->modinfo->sections[$i][0]]->visibleoncoursepage == 0)
255+
$section->modinfo->cms[$section->modinfo->sections[$i][0]]->visibleoncoursepage == 0
256+
|| $section->modinfo->cms[$section->modinfo->sections[$i][0]]->available == false)
255257
) {
256258
continue;
257259
}
@@ -332,7 +334,7 @@ public function get_content() {
332334
) == 1) && ($module->modname == 'label')) {
333335
continue;
334336
}
335-
if (!$module->uservisible || !$module->visible || !$module->visibleoncoursepage) {
337+
if (!$module->uservisible || !$module->visible || !$module->visibleoncoursepage || !$module->available) {
336338
continue;
337339
}
338340
$thismod = new stdClass();
@@ -374,7 +376,9 @@ public function get_content() {
374376
$thissection->modules[] = $thismod;
375377
}
376378
$thissection->hasmodules = (count($thissection->modules) > 0);
377-
$template->sections[] = $thissection;
379+
if ($thissection->hasmodules) {
380+
$template->sections[] = $thissection;
381+
}
378382
}
379383
if ($thissection->selected) {
380384

0 commit comments

Comments
 (0)