Permalink
Browse files

Now hidden sections are hidden completely from student view if

"invisible sections" are configured in course settings.
Patch sent by Geoff Wilbert. Thanks!
See Bug 2185
(http://moodle.org/bugs/bug.php?op=show&bugid=2185)

Merged from MOODLE_14_STABLE
  • Loading branch information...
1 parent 3060f68 commit 1757627af3a88d10451990fe7fe83488a3c8e11e stronk7 committed Nov 16, 2004
Showing with 57 additions and 55 deletions.
  1. +57 −55 course/user.php
View
@@ -93,72 +93,74 @@
if (isset($sections[$i])) { // should always be true
$section = $sections[$i];
-
- if ($section->sequence) {
- echo "<hr />";
- echo "<h2>";
- switch ($course->format) {
- case "weeks": print_string("week"); break;
- case "topics": print_string("topic"); break;
- default: print_string("section"); break;
- }
- echo " $i</h2>";
-
- echo "<ul>";
+ $showsection = (isteacher($course->id) or $section->visible or !$course->hiddensections);
- if ($mode == "outline") {
- echo "<table cellpadding=\"4\" cellspacing=\"0\">";
- }
+ if ($showsection) { // prevent hidden sections in user activity. Thanks to Geoff Wilbert!
- $sectionmods = explode(",", $section->sequence);
- foreach ($sectionmods as $sectionmod) {
- if (empty($mods[$sectionmod])) {
- continue;
+ if ($section->sequence) {
+ echo "<hr />";
+ echo "<h2>";
+ switch ($course->format) {
+ case "weeks": print_string("week"); break;
+ case "topics": print_string("topic"); break;
+ default: print_string("section"); break;
}
- $mod = $mods[$sectionmod];
+ echo " $i</h2>";
+
+ echo "<ul>";
- if (empty($mod->visible)) {
- continue;
+ if ($mode == "outline") {
+ echo "<table cellpadding=\"4\" cellspacing=\"0\">";
}
- $instance = get_record("$mod->modname", "id", "$mod->instance");
- $libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
-
- if (file_exists($libfile)) {
- require_once($libfile);
+ $sectionmods = explode(",", $section->sequence);
+ foreach ($sectionmods as $sectionmod) {
+ if (empty($mods[$sectionmod])) {
+ continue;
+ }
+ $mod = $mods[$sectionmod];
+
+ if (empty($mod->visible)) {
+ continue;
+ }
- switch ($mode) {
- case "outline":
- $user_outline = $mod->modname."_user_outline";
- if (function_exists($user_outline)) {
- $output = $user_outline($course, $user, $mod, $instance);
- print_outline_row($mod, $instance, $output);
- }
- break;
- case "complete":
- $user_complete = $mod->modname."_user_complete";
- if (function_exists($user_complete)) {
- $image = "<img src=\"../mod/$mod->modname/icon.gif\" ".
- "height=\"16\" width=\"16\" alt=\"$mod->modfullname\" />";
- echo "<h4>$image $mod->modfullname: ".
- "<a href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
- "$instance->name</a></h4>";
- echo "<ul>";
- $user_complete($course, $user, $mod, $instance);
- echo "</ul>";
+ $instance = get_record("$mod->modname", "id", "$mod->instance");
+ $libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
+
+ if (file_exists($libfile)) {
+ require_once($libfile);
+
+ switch ($mode) {
+ case "outline":
+ $user_outline = $mod->modname."_user_outline";
+ if (function_exists($user_outline)) {
+ $output = $user_outline($course, $user, $mod, $instance);
+ print_outline_row($mod, $instance, $output);
+ }
+ break;
+ case "complete":
+ $user_complete = $mod->modname."_user_complete";
+ if (function_exists($user_complete)) {
+ $image = "<img src=\"../mod/$mod->modname/icon.gif\" ".
+ "height=\"16\" width=\"16\" alt=\"$mod->modfullname\" />";
+ echo "<h4>$image $mod->modfullname: ".
+ "<a href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
+ "$instance->name</a></h4>";
+ echo "<ul>";
+ $user_complete($course, $user, $mod, $instance);
+ echo "</ul>";
+ }
+ break;
}
- break;
+ }
}
+
+ if ($mode == "outline") {
+ echo "</table>";
+ print_simple_box_end();
}
+ echo "</ul>";
}
-
- if ($mode == "outline") {
- echo "</table>";
- print_simple_box_end();
- }
- echo "</ul>";
-
-
}
}
}

0 comments on commit 1757627

Please sign in to comment.