Skip to content

Commit

Permalink
MDL-41811 tweak custom admin pages to force loading of admin tree
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak authored and Rajesh Taneja committed Oct 21, 2013
1 parent 61bb8c9 commit e56c107
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 15 deletions.
10 changes: 5 additions & 5 deletions admin/tool/customlang/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -32,11 +33,10 @@
$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)) {
Expand Down
4 changes: 3 additions & 1 deletion badges/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,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/action.php', array('id' => $badge->id));
$PAGE->set_pagelayout('standard');
navigation_node::override_active_url($navurl);

if ($return !== 0) {
Expand Down
4 changes: 3 additions & 1 deletion badges/award.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
}
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);
Expand All @@ -64,7 +67,6 @@
$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();
Expand Down
4 changes: 3 additions & 1 deletion badges/criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
}
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);

Expand Down
4 changes: 3 additions & 1 deletion badges/criteria_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,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/criteria_action.php');
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
navigation_node::override_active_url($navurl);
Expand Down
4 changes: 3 additions & 1 deletion badges/criteria_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,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/criteria_settings.php');
$PAGE->set_pagelayout('standard');
$PAGE->set_heading($badge->name);
$PAGE->set_title($badge->name);
navigation_node::override_active_url($navurl);
Expand Down
4 changes: 3 additions & 1 deletion badges/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@
}
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);

Expand Down
4 changes: 3 additions & 1 deletion badges/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@
}
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);

Expand Down
4 changes: 3 additions & 1 deletion badges/recipients.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@
}
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);
Expand Down
2 changes: 1 addition & 1 deletion course/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
$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)) {
Expand Down
2 changes: 1 addition & 1 deletion course/editcategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
// 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);
Expand Down

0 comments on commit e56c107

Please sign in to comment.