diff --git a/course/edit.html b/course/edit.html
index 0edd2db411f2e..dde4e28b48f2e 100644
--- a/course/edit.html
+++ b/course/edit.html
@@ -4,28 +4,28 @@
print_string("fullname") ?>: |
helpbutton("coursefullname", get_string("fullname")) ?>
- formerr($err["fullname"]) ?>
+ if (isset($err["fullname"])) formerr($err["fullname"]); ?>
|
print_string("shortname") ?>: |
helpbutton("courseshortname", get_string("shortname")) ?>
- formerr($err["shortname"]) ?>
+ if (isset($err["shortname"])) formerr($err["shortname"]); ?>
|
print_string("summary") ?>: |
helpbutton("text", get_string("helptext")) ?>
- formerr($err["summary"]) ?>
+ if (isset($err["summary"])) formerr($err["summary"]); ?>
|
print_string("enrolmentkey") ?>: |
helpbutton("enrolmentkey", get_string("enrolmentkey")) ?>
- formerr($err["password"]) ?>
+ if (isset($err["password"])) formerr($err["password"]); ?>
|
@@ -43,7 +43,6 @@
choose_from_menu ($form->categories, "category", "$form->category", "");
helpbutton("coursecategory", get_string("category"));
- formerr($err["category"]);
?>
|
@@ -52,7 +51,6 @@
choose_from_menu ($form->courseformats, "format", "$form->format", "");
helpbutton("courseformats", get_string("courseformats"));
- formerr($err["format"]);
?>
|
@@ -75,7 +73,6 @@
"10" => "10 $newsitems");
choose_from_menu ($options, "newsitems", "$form->newsitems", "");
helpbutton("coursenewsitems", get_string("newsitemsnumber"));
- formerr($err["newsitems"]);
?>
@@ -84,7 +81,6 @@
print_date_selector("startday", "startmonth", "startyear", $form->startdate);
helpbutton("coursestartdate", get_string("startdate"));
- formerr($err["startdate"]);
?> |
@@ -93,9 +89,8 @@
for ($i=1; $i<=52; $i++) {
$sectionmenu[$i] = "$i";
}
- choose_from_menu ($sectionmenu, "numsections", "$form->numsections");
+ choose_from_menu ($sectionmenu, "numsections", "$form->numsections", "");
helpbutton("coursenumsections", get_string("numberweeks"));
- formerr($err["numsections"]);
?>
@@ -111,25 +106,29 @@
print_string("wordforteacher") ?>: |
- ( print_string("wordforteachereg") ?>) formerr($err["teacher"]) ?>
+ ( print_string("wordforteachereg") ?>)
+ if (isset($err["teacher"])) formerr($err["teacher"]); ?>
|
print_string("wordforteachers") ?>: |
- ( print_string("wordforteacherseg") ?>) formerr($err["teachers"]) ?>
+ ( print_string("wordforteacherseg") ?>)
+ if (isset($err["teachers"])) formerr($err["teachers"]); ?>
|
print_string("wordforstudent") ?>: |
- ( print_string("wordforstudenteg") ?>) formerr($err["student"]) ?>
+ ( print_string("wordforstudenteg") ?>)
+ if (isset($err["student"])) formerr($err["student"]); ?>
|
print_string("wordforstudents") ?>: |
- ( print_string("wordforstudentseg") ?>) formerr($err["students"]) ?>
+ ( print_string("wordforstudentseg") ?>)
+ if (isset($err["students"])) formerr($err["students"]); ?>
|
diff --git a/course/edit.php b/course/edit.php
index 156dcf7c68c5a..2552dc8bae28f 100644
--- a/course/edit.php
+++ b/course/edit.php
@@ -76,7 +76,7 @@
/// Otherwise fill and print the form.
- if (!$form) {
+ if (empty($form)) {
if ($course) {
$form = $course;
} else {
@@ -96,6 +96,10 @@
}
}
+ if (empty($focus)) {
+ $focus = "";
+ }
+
$form->categories = get_records_select_menu("course_categories", "", "name", "id,name");
$form->courseformats = array (