diff --git a/course/category.php b/course/category.php
index 47400c4a8bb..cd9b35ae401 100644
--- a/course/category.php
+++ b/course/category.php
@@ -9,7 +9,7 @@
$id = required_param('id', PARAM_INT); // Category id
$page = optional_param('page', 0, PARAM_INT); // which page to show
$perpage = optional_param('perpage', 20, PARAM_INT); // how many per page
- $edit = optional_param('edit', -1, PARAM_BOOL);
+ $categoryedit = optional_param('categoryedit', -1, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$moveup = optional_param('moveup', 0, PARAM_INT);
@@ -32,7 +32,7 @@
if (iscreator()) {
if ($edit !== -1) {
- $USER->categoryediting = $edit;
+ $USER->categoryediting = $categoryedit;
}
$navbaritem = update_category_button($category->id);
@@ -89,10 +89,11 @@
if ($creatorediting) {
if ($adminediting) {
- print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
- "admin/index.php\">$stradministration -> ".
- "$strcategories -> $category->name",
- "", "", true, $navbaritem);
+ // modify this to treat this as an admin page
+
+ require_once($CFG->dirroot . '/admin/adminlib.php');
+ admin_externalpage_setup('coursemgmt');
+ admin_externalpage_print_header();
} else {
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses",
"$strcategories -> $category->name", "", "", true, $navbaritem);
@@ -441,7 +442,11 @@
print_course_search();
echo "";
-
- print_footer();
+
+ if ($adminediting) {
+ admin_externalpage_print_footer();
+ } else {
+ print_footer();
+ }
?>
diff --git a/course/index.php b/course/index.php
index 71583cdbccc..ed57d7d0bd8 100644
--- a/course/index.php
+++ b/course/index.php
@@ -5,7 +5,7 @@
require_once("../config.php");
require_once("lib.php");
- $edit = optional_param('edit', -1,PARAM_BOOL);
+ $categoryedit = optional_param('categoryedit', -1,PARAM_BOOL);
$delete = optional_param('delete',0,PARAM_INT);
$hide = optional_param('hide',0,PARAM_INT);
$show = optional_param('show',0,PARAM_INT);
@@ -26,8 +26,8 @@
}
if (isadmin()) {
- if ($edit !== -1) {
- $USER->categoryediting = $edit;
+ if ($categoryedit !== -1) {
+ $USER->categoryediting = $categoryedit;
}
$adminediting = !empty($USER->categoryediting);
} else {
@@ -74,11 +74,10 @@
/// From now on is all the admin functions
- require_login();
- if (!isadmin()) {
- error("Only administrators can use this page!");
- }
+ require_once($CFG->dirroot . '/admin/adminlib.php');
+ admin_externalpage_setup('coursemgmt');
+
/// Print headings
@@ -91,9 +90,9 @@
$straction = get_string("action");
$straddnewcategory = get_string("addnewcategory");
- print_header("$site->shortname: $strcategories", "$site->fullname",
- "admin/index.php\">$stradministration -> $strcategories",
- "addform.addcategory", "", true, update_categories_button());
+
+
+ admin_externalpage_print_header();
print_heading($strcategories);
@@ -324,7 +323,7 @@
echo "
";
echo "";
- print_footer();
+ admin_externalpage_print_footer();
@@ -352,7 +351,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
echo " ";
}
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
- echo "edit\" href=\"category.php?id=$category->id&edit=on&sesskey=$USER->sesskey\">$category->name";
+ echo "edit\" href=\"category.php?id=$category->id&categoryedit=on&sesskey=$USER->sesskey\">$category->name";
echo "";
echo "