mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
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:
parent
3060f68e3d
commit
1757627af3
1 changed files with 59 additions and 57 deletions
116
course/user.php
116
course/user.php
|
@ -93,72 +93,74 @@
|
||||||
if (isset($sections[$i])) { // should always be true
|
if (isset($sections[$i])) { // should always be true
|
||||||
|
|
||||||
$section = $sections[$i];
|
$section = $sections[$i];
|
||||||
|
$showsection = (isteacher($course->id) or $section->visible or !$course->hiddensections);
|
||||||
|
|
||||||
if ($section->sequence) {
|
if ($showsection) { // prevent hidden sections in user activity. Thanks to Geoff Wilbert!
|
||||||
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>";
|
if ($section->sequence) {
|
||||||
|
echo "<hr />";
|
||||||
if ($mode == "outline") {
|
echo "<h2>";
|
||||||
echo "<table cellpadding=\"4\" cellspacing=\"0\">";
|
switch ($course->format) {
|
||||||
}
|
case "weeks": print_string("week"); break;
|
||||||
|
case "topics": print_string("topic"); break;
|
||||||
$sectionmods = explode(",", $section->sequence);
|
default: print_string("section"); break;
|
||||||
foreach ($sectionmods as $sectionmod) {
|
|
||||||
if (empty($mods[$sectionmod])) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
$mod = $mods[$sectionmod];
|
echo " $i</h2>";
|
||||||
|
|
||||||
if (empty($mod->visible)) {
|
echo "<ul>";
|
||||||
continue;
|
|
||||||
|
if ($mode == "outline") {
|
||||||
|
echo "<table cellpadding=\"4\" cellspacing=\"0\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
$instance = get_record("$mod->modname", "id", "$mod->instance");
|
$sectionmods = explode(",", $section->sequence);
|
||||||
$libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
|
foreach ($sectionmods as $sectionmod) {
|
||||||
|
if (empty($mods[$sectionmod])) {
|
||||||
if (file_exists($libfile)) {
|
continue;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
$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>";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue