Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Nicer formatting of editing modules, takes into account course format

  • Loading branch information...
commit d9d1c35db146afa69e78e01100a99962f9906ae7 1 parent 77f4a40
martin authored
Showing with 14 additions and 3 deletions.
  1. +6 −0 course/lib.php
  2. +8 −3 course/mod.php
View
6 course/lib.php
@@ -8,6 +8,12 @@
"3" => "Topics layout"
);
+$SECTION = array (
+ "1" => "week",
+ "2" => "section",
+ "3" => "topic"
+ );
+
function print_log_selector_form($course, $selecteduser=0, $selecteddate="today") {
View
11 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 {
Please sign in to comment.
Something went wrong with that request. Please try again.