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>";
-
-
}
}
}