Changes to improve hide/show of individual activities when the last

action was to hide/show a topic
This commit is contained in:
moodler 2003-05-06 02:51:38 +00:00
parent 5f350e8f6d
commit 266fbe1a8a
2 changed files with 30 additions and 8 deletions

View File

@ -544,6 +544,10 @@ function set_section_visible($courseid, $sectionnumber, $visibility) {
set_field("course_modules", "visible", "$visibility", "id", $moduleid);
}
}
$modinfo = serialize(get_array_of_activities($courseid));
if (!set_field("course", "modinfo", $modinfo, "id", $courseid)) {
error("Could not cache module information!");
}
}
}

View File

@ -5,6 +5,7 @@
require("../config.php");
require("lib.php");
if (isset($cancel)) {
if (!empty($SESSION->returnpage)) {
$return = $SESSION->returnpage;
@ -115,7 +116,12 @@
error("Could not cache module information!");
}
redirect($_SERVER["HTTP_REFERER"]);
$site = get_site();
if ($site->id == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course");
}
exit;
} else if (isset($hide)) {
@ -131,7 +137,12 @@
error("Could not cache module information!");
}
redirect($_SERVER["HTTP_REFERER"]);
$site = get_site();
if ($site->id == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course");
}
exit;
} else if (isset($show)) {
@ -139,15 +150,22 @@
if (! $cm = get_record("course_modules", "id", $show)) {
error("This course module doesn't exist");
}
show_course_module($show);
$modinfo = serialize(get_array_of_activities($cm->course));
if (!set_field("course", "modinfo", $modinfo, "id", $cm->course)) {
error("Could not cache module information!");
$site = get_site();
if ($cm->visible or $site->id == $cm->course) {
show_course_module($show);
$modinfo = serialize(get_array_of_activities($cm->course));
if (!set_field("course", "modinfo", $modinfo, "id", $cm->course)) {
error("Could not cache module information!");
}
}
redirect($_SERVER["HTTP_REFERER"]);
if ($site->id == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course");
}
exit;
} else if (isset($delete)) { // value = course module