/// Print button to turn editing off
if ($adminediting) {
- echo '<div class="categoryediting button" align="right">'.update_category_button($category->id).'</div>';
+ echo '<div class="categoryediting button">'.update_category_button($category->id).'</div>';
}
/// Print link to roles
echo '</div>';
/// 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();
}
} // End of editing stuff
+
+ if ($creatorediting) {
+ echo '<div class="buttons">';
+ 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 '</div>';
+ }
+
/// Print out all the sub-categories
if ($subcategories = get_records("course_categories", "parent", $category->id, "sortorder ASC")) {
$firstentry = true;
}
}
- // Print button for creating new categories
- if (has_capability('moodle/category:create', $context) && $creatorediting) {
- unset($options);
- $options['categoryadd'] = 1;
- $options['id'] = $id;
- echo '<div class="buttons">';
- print_single_button('editcategory.php', $options, get_string('addsubcategory'), 'get');
- echo '<br /></div>';
- }
/// Print out all the courses
unset($course); // To avoid unwanted language effects later
echo '<br />';
}
+ echo '<div class="buttons">';
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;
unset($options);
$options['category'] = $category->id;
print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
- echo '<br />';
}
+ echo '</div>';
- if (has_capability('moodle/category:update', $context)) { /// Print form to rename the category
- $strrename= get_string('rename');
- echo '<form id="renameform" action="category.php" method="post"><div>';
- echo '<input type="hidden" name="id" value="'.$category->id.'" />';
- echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
- echo '<input type="text" size="30" name="rename" value="'.htmlspecialchars($category->name).'" alt="'.$strrename.'" />';
- echo '<input type="submit" value="'.$strrename.'" />';
- echo '</div></form>';
- echo '<br />';
-
- if (!empty($CFG->allowcategorythemes)) {
- $choices = array();
- $choices[''] = get_string('default');
- $choices += get_list_of_themes();
-
- echo '<form id="themeform" action="category.php" method="post"><div>';
- echo '<input type="hidden" name="id" value="'.$category->id.'" />';
- echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
- choose_from_menu($choices, 'categorytheme', $category->theme);
- echo '<input type="submit" value="'.get_string('setcategorytheme').'" />';
- echo '</div></form>';
- echo '<br />';
- }
- }
print_course_search();
}
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';
$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.");
}
}
$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"]);
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.