MDL-32652 - Make block drag-drop work throughout Moodle

Other than shifting the initialisation from course/lib.php to
lib/outputrequirementslib.php, some workarounds/tweaks were required
in order to make it work correctly on admin pages and My Home.
This commit is contained in:
Paul Nicholls 2013-01-15 13:08:25 +13:00
parent ca48fe5f97
commit d7c29c2257
4 changed files with 41 additions and 11 deletions

View file

@ -53,6 +53,20 @@ require_sesskey();
// Setting layout to replicate blocks configuration for the page we edit
$PAGE->set_pagelayout($pagelayout);
$PAGE->set_subpage($subpage);
$pagetype = explode('-', $pagetype);
switch ($pagetype[0]) {
case 'admin':
// Admin pages need to be in the system context, not Site Course context.
$PAGE->set_context(context_system::instance());
break;
case 'my':
// My Home page needs to be in user context, and to have 'content' block region set up.
$PAGE->set_context(context_user::instance($USER->id));
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
$PAGE->blocks->add_region('content');
break;
}
echo $OUTPUT->header(); // send headers
switch ($action) {