MDL-41811 tweak custom admin pages to force loading of admin tree

This commit is contained in:
Petr Škoda 2013-10-11 09:50:03 +02:00 committed by Rajesh Taneja
parent 61bb8c933f
commit e56c107da8
11 changed files with 31 additions and 15 deletions

View File

@ -24,6 +24,7 @@
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/filter_form.php');
require_once($CFG->libdir.'/adminlib.php');
require_login(SITEID, false);
require_capability('tool/customlang:edit', context_system::instance());
@ -32,11 +33,10 @@ $lng = required_param('lng', PARAM_LANG);
$currentpage = optional_param('p', 0, PARAM_INT);
$translatorsubmitted = optional_param('translatorsubmitted', 0, PARAM_BOOL);
$PAGE->set_pagelayout('report'); // Allows for wide page contents.
$PAGE->set_url('/admin/tool/customlang/edit.php', array('lng' => $lng));
navigation_node::override_active_url(new moodle_url('/admin/tool/customlang/index.php'));
$PAGE->set_title(get_string('pluginname', 'tool_customlang'));
$PAGE->set_heading(get_string('pluginname', 'tool_customlang'));
admin_externalpage_setup('toolcustomlang', '', null,
new moodle_url('/admin/tool/customlang/edit.php', array('lng' => $lng)),
array('pagelayout' => 'report')); // Hack: allows for wide page contents.
$PAGE->requires->js_init_call('M.tool_customlang.init_editor', array(), true);
if (empty($lng)) {

View File

@ -44,11 +44,13 @@ $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
if ($badge->type == BADGE_TYPE_COURSE) {
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_context($context);
$PAGE->set_url('/badges/action.php', array('id' => $badge->id));
$PAGE->set_pagelayout('standard');
navigation_node::override_active_url($navurl);
if ($return !== 0) {

View File

@ -50,6 +50,9 @@ if ($badge->type == BADGE_TYPE_COURSE) {
}
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
require_capability('moodle/badges:awardbadge', $context);
@ -64,7 +67,6 @@ navigation_node::override_active_url($navurl);
$PAGE->navbar->add($badge->name, new moodle_url('overview.php', array('id' => $badge->id)))->add($strrecipients);
$PAGE->set_title($strrecipients);
$PAGE->set_heading($badge->name);
$PAGE->set_pagelayout('standard');
if (!$badge->is_active()) {
echo $OUTPUT->header();

View File

@ -48,13 +48,15 @@ if ($badge->type == BADGE_TYPE_COURSE) {
}
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$currenturl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
$PAGE->set_context($context);
$PAGE->set_url($currenturl);
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);

View File

@ -48,11 +48,13 @@ if ($badge->is_active() || $badge->is_locked()) {
if ($badge->type == BADGE_TYPE_COURSE) {
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_context($context);
$PAGE->set_url('/badges/criteria_action.php');
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
navigation_node::override_active_url($navurl);

View File

@ -58,11 +58,13 @@ if ($badge->is_active() || $badge->is_locked()) {
if ($badge->type == BADGE_TYPE_COURSE) {
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_context($context);
$PAGE->set_url('/badges/criteria_settings.php');
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
navigation_node::override_active_url($navurl);

View File

@ -53,13 +53,15 @@ if ($badge->type == BADGE_TYPE_COURSE) {
}
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$currenturl = new moodle_url('/badges/edit.php', array('id' => $badge->id, 'action' => $action));
$PAGE->set_context($context);
$PAGE->set_url($currenturl);
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);

View File

@ -46,13 +46,15 @@ if ($badge->type == BADGE_TYPE_COURSE) {
}
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$currenturl = new moodle_url('/badges/overview.php', array('id' => $badge->id));
$PAGE->set_context($context);
$PAGE->set_url($currenturl);
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);

View File

@ -60,11 +60,13 @@ if ($badge->type == BADGE_TYPE_COURSE) {
}
require_login($badge->courseid);
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
$PAGE->set_pagelayout('standard');
} else {
$PAGE->set_pagelayout('admin');
}
$PAGE->set_context($context);
$PAGE->set_url('/badges/recipients.php', array('id' => $badgeid, 'sort' => $sortby, 'dir' => $sorthow));
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
$PAGE->navbar->add($badge->name);

View File

@ -44,7 +44,7 @@ $courseshortname = format_string($course->shortname, true, array('context' => $c
$coursefullname = format_string($course->fullname, true, array('context' => $coursecontext));
$categoryurl = new moodle_url('/course/management.php', array('categoryid' => $course->category));
navigation_node::override_active_url(new moodle_url('/course/management.php'));
navigation_node::override_active_url(new moodle_url('/course/management.php', true));
// Check if we've got confirmation.
if ($delete === md5($course->timemodified)) {

View File

@ -69,7 +69,7 @@ require_capability('moodle/category:manage', $context);
// Page "Add new category" (with "Top" as a parent) does not exist in navigation.
// We pretend we are on course management page.
if ($id !== 0) {
navigation_node::override_active_url(new moodle_url('/course/management.php'));
navigation_node::override_active_url(new moodle_url('/course/management.php', true));
}
$PAGE->set_context($context);