Nicer formatting of editing modules, takes into account course format

This commit is contained in:
martin
2002-06-25 07:56:26 +00:00
parent 77f4a40bbb
commit d9d1c35db1
2 changed files with 14 additions and 3 deletions
+6
View File
@@ -8,6 +8,12 @@ $FORMATS = array (
"3" => "Topics layout"
);
$SECTION = array (
"1" => "week",
"2" => "section",
"3" => "topic"
);
function print_log_selector_form($course, $selecteduser=0, $selecteddate="today") {
+8 -3
View File
@@ -3,6 +3,7 @@
// Moves, adds, updates or deletes modules in a course
require("../config.php");
require("lib.php");
if (isset($course) && isset($HTTP_POST_VARS)) { // add or update form submitted
$mod = (object)$HTTP_POST_VARS;
@@ -131,6 +132,8 @@
error("This module doesn't exist");
}
$section = $SECTION[$course->format];
if (! $form = get_record($module->name, "id", $cm->instance)) {
error("The required instance of this module doesn't exist");
}
@@ -147,7 +150,7 @@
$form->instance = $cm->instance;
$form->mode = "update";
$pageheading = "Updating a $module->fullname in Week $cw->week";
$pageheading = "Updating a ".strtolower($module->fullname)." in $section $cw->week";
} else if (isset($add)) {
@@ -164,6 +167,8 @@
error("This course doesn't exist");
}
$section = $SECTION[$course->format];
if (! $module = get_record("modules", "name", $add)) {
error("This module type doesn't exist");
}
@@ -176,9 +181,9 @@
$form->mode = "add";
if ($form->week) {
$pageheading = "Adding a new $module->fullname to Week $form->week";
$pageheading = "Adding a new ".strtolower($module->fullname)." to $section $form->week";
} else {
$pageheading = "Adding a new $module->fullname";
$pageheading = "Adding a new ".strtolower($module->fullname);
}
} else {