MDL-19077: Fix some initialisation order issues on the course/category management pages

This commit is contained in:
tjhunt 2009-07-20 03:28:50 +00:00
parent 75c7b84f16
commit a8ecfa4d5b
3 changed files with 9 additions and 13 deletions

View File

@ -7,6 +7,7 @@
$id = required_param('id', PARAM_INT); // course id
$delete = optional_param('delete', '', PARAM_ALPHANUM); // delete confirmation hash
$PAGE->set_url('course/delete.php', array('id' => $id));
require_login();
if (!can_delete_course($id)) {
@ -45,7 +46,7 @@
"delete.php?id=$course->id&delete=".md5($course->timemodified)."&sesskey=".sesskey(),
"category.php?id=$course->category");
print_footer($course);
print_footer();
exit;
}

View File

@ -17,10 +17,12 @@ if ($id) {
if (!$category = $DB->get_record('course_categories', array('id' => $id))) {
print_error('unknowcategory');
}
$PAGE->set_url('course/editcategory.php', array('id' => $id));
require_capability('moodle/category:manage', get_context_instance(CONTEXT_COURSECAT, $id));
$strtitle = get_string('editcategorysettings');
} else {
$parent = required_param('parent', PARAM_INT);
$PAGE->set_url('course/editcategory.php', array('parent' => $parent));
if ($parent) {
if (!$DB->record_exists('course_categories', array('id' => $parent))) {
print_error('unknowcategory');

View File

@ -89,6 +89,8 @@
exit;
}
/// Everything else is editing on mode.
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('coursemgmt', update_category_button());
/// Delete a category.
if (!empty($delete) and confirm_sesskey()) {
@ -109,14 +111,14 @@
} else if (!$data= $mform->get_data()) {
require_once($CFG->libdir . '/questionlib.php');
print_category_edit_header();
admin_externalpage_print_header();
print_heading($heading);
$mform->display();
admin_externalpage_print_footer();
exit();
}
print_category_edit_header();
admin_externalpage_print_header();
print_heading($heading);
if ($data->fulldelete) {
@ -211,7 +213,7 @@
}
/// Print headings
print_category_edit_header();
admin_externalpage_print_header();
print_heading($strcategories);
/// Print out the categories with all the knobs
@ -361,12 +363,3 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
}
}
function print_category_edit_header() {
global $CFG;
global $SITE;
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup('coursemgmt', update_category_button());
admin_externalpage_print_header();
}
?>