From: martin Date: Tue, 25 Jun 2002 07:56:26 +0000 (+0000) Subject: Nicer formatting of editing modules, takes into account course format X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d9d1c35db146afa69e78e01100a99962f9906ae7;p=moodle.git Nicer formatting of editing modules, takes into account course format --- diff --git a/course/lib.php b/course/lib.php index f3375d9ecc..694725fdbc 100644 --- a/course/lib.php +++ b/course/lib.php @@ -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") { diff --git a/course/mod.php b/course/mod.php index 76c35edc8a..1e4083cd06 100644 --- a/course/mod.php +++ b/course/mod.php @@ -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 {