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
This commit is contained in:
stronk7 2004-11-16 17:30:45 +00:00
parent 3060f68e3d
commit 1757627af3

View file

@ -93,72 +93,74 @@
if (isset($sections[$i])) { // should always be true
$section = $sections[$i];
$showsection = (isteacher($course->id) or $section->visible or !$course->hiddensections);
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>";
if ($showsection) { // prevent hidden sections in user activity. Thanks to Geoff Wilbert!
echo "<ul>";
if ($mode == "outline") {
echo "<table cellpadding=\"4\" cellspacing=\"0\">";
}
$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>";
if (empty($mod->visible)) {
continue;
echo "<ul>";
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);
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;
$sectionmods = explode(",", $section->sequence);
foreach ($sectionmods as $sectionmod) {
if (empty($mods[$sectionmod])) {
continue;
}
$mod = $mods[$sectionmod];
if (empty($mod->visible)) {
continue;
}
$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;
}
}
}
if ($mode == "outline") {
echo "</table>";
print_simple_box_end();
}
echo "</ul>";
}
if ($mode == "outline") {
echo "</table>";
print_simple_box_end();
}
echo "</ul>";
}
}
}