diff --git a/course/category.php b/course/category.php
index dbb00d0469b..7b9e212252c 100644
--- a/course/category.php
+++ b/course/category.php
@@ -122,7 +122,7 @@
/// Print button to turn editing off
if ($adminediting) {
- echo '
'.update_category_button($category->id).'
';
+ echo ''.update_category_button($category->id).'
';
}
/// Print link to roles
@@ -143,9 +143,8 @@
echo '';
/// Print current category description
- if ($category->description) {
+ if (!$creatorediting && $category->description) {
print_box_start();
- print_heading(get_string('description'));
echo $category->description;
print_box_end();
}
@@ -237,6 +236,24 @@
} // End of editing stuff
+
+ if ($creatorediting) {
+ echo '';
+ if (has_capability('moodle/category:update', $context)) { // Print button to update this category
+ unset($options);
+ $options['id'] = $category->id;
+ print_single_button('editcategory.php', $options, get_string('editcategorythis'), 'get');
+ }
+
+ if (has_capability('moodle/category:create', $context)) { // Print button for creating new categories
+ unset($options);
+ $options['categoryadd'] = 1;
+ $options['id'] = $id;
+ print_single_button('editcategory.php', $options, get_string('addsubcategory'), 'get');
+ }
+ echo '
';
+ }
+
/// Print out all the sub-categories
if ($subcategories = get_records("course_categories", "parent", $category->id, "sortorder ASC")) {
$firstentry = true;
@@ -260,15 +277,6 @@
}
}
- // Print button for creating new categories
- if (has_capability('moodle/category:create', $context) && $creatorediting) {
- unset($options);
- $options['categoryadd'] = 1;
- $options['id'] = $id;
- echo '';
- print_single_button('editcategory.php', $options, get_string('addsubcategory'), 'get');
- echo '
';
- }
/// Print out all the courses
unset($course); // To avoid unwanted language effects later
@@ -464,6 +472,7 @@
echo '
';
}
+ echo '';
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $numcourses > 1) { /// Print button to re-sort courses by name
unset($options);
$options['id'] = $category->id;
@@ -476,33 +485,9 @@
unset($options);
$options['category'] = $category->id;
print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
- echo '
';
}
+ echo '
';
- if (has_capability('moodle/category:update', $context)) { /// Print form to rename the category
- $strrename= get_string('rename');
- echo '';
- echo '
';
-
- if (!empty($CFG->allowcategorythemes)) {
- $choices = array();
- $choices[''] = get_string('default');
- $choices += get_list_of_themes();
-
- echo '';
- echo '
';
- }
- }
print_course_search();
diff --git a/course/editcategory.php b/course/editcategory.php
index 5aa160665ac..bba2c4a3180 100644
--- a/course/editcategory.php
+++ b/course/editcategory.php
@@ -290,7 +290,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
}
if (!update_record('course_categories', $category)) {
- notice( "Could not update the category '$category->name' ");
+ error( "Could not update the category '$category->name' ");
} else {
if ($category->parent == 0) {
$redirect_link = 'index.php?categoryedit=on';
@@ -298,11 +298,11 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
$redirect_link = 'category.php?id='.$category->id.'&categoryedit=on';
}
fix_course_sortorder();
- redirect($redirect_link, get_string('categoryupdated', null, $category->name));
+ redirect($redirect_link);
}
}
} else {
- notice("You do not have the permission to update this category.");
+ error("You do not have the permission to update this category.");
}
}
diff --git a/course/editcategory_form.php b/course/editcategory_form.php
index 005bdc28577..59bab64d26b 100644
--- a/course/editcategory_form.php
+++ b/course/editcategory_form.php
@@ -19,7 +19,7 @@ class editcategory_form extends moodleform {
$mform->addRule('name', get_string('required'), 'required', null);
$mform->addElement('htmleditor', 'description', get_string('description'));
$mform->setType('description', PARAM_RAW);
- if (!empty($CFG->allowcoursethemes)) {
+ if (!empty($CFG->allowcategorythemes)) {
$themes=array();
$themes[''] = get_string('forceno');
$themes += get_list_of_themes();
diff --git a/course/loginas.php b/course/loginas.php
index 1a1b7bac2c1..8b93bca4eb8 100644
--- a/course/loginas.php
+++ b/course/loginas.php
@@ -23,6 +23,10 @@
$USER->timeaccess = $SESSION->oldtimeaccess;
unset($SESSION->oldtimeaccess);
}
+ if (isset($SESSION->grade_last_report)) { // Restore grade defaults if any
+ $USER->grade_last_report = $SESSION->grade_last_report;
+ unset($SESSION->grade_last_report);
+ }
if ($return and isset($_SERVER["HTTP_REFERER"])) { // That's all we wanted to do, so let's go back
redirect($_SERVER["HTTP_REFERER"]);
@@ -73,6 +77,9 @@
if (isset($USER->timeaccess)) {
$SESSION->oldtimeaccess = $USER->timeaccess;
}
+ if (isset($USER->grade_last_report)) {
+ $SESSION->grade_last_report = $USER->grade_last_report;
+ }
/// Login as this user and return to course home page.
diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php
index da5da52c751..32315e76fed 100644
--- a/lang/en_utf8/moodle.php
+++ b/lang/en_utf8/moodle.php
@@ -405,6 +405,7 @@ $string['edhelpfontlist'] = 'Define the fonts used on editors dropdown menu.';
$string['edhelpfontsize'] = 'The default font-size sets the size of a font.
Valid values are for example: medium, large, smaller, larger, 10pt, 11px.';
$string['edit'] = 'Edit $a';
$string['editcategorysettings'] = 'Edit category settings';
+$string['editcategorythis'] = 'Edit this category';
$string['editcoursesettings'] = 'Edit course settings';
$string['editfiles'] = 'Edit files';
$string['editgroupprofile'] = 'Edit group profile';
diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css
index 442d080d824..1ef3987f42b 100644
--- a/theme/standard/styles_layout.css
+++ b/theme/standard/styles_layout.css
@@ -1922,6 +1922,15 @@ body#course-category .addcategory {
padding: 10px;
}
+body#course-category .buttons .singlebutton {
+ display: inline;
+}
+
+body#course-category .buttons {
+ text-align: center;
+ margin-bottom: 15px;
+}
+
body#course-index #middle-column .editcourse {
margin-left:auto;
margin-right:auto;