/** * Returns the block manager for a given course. */ private function get_block_manager($course) { $page = new \moodle_page(); $page->set_context(\context_course::instance($course->id)); $page->set_pagetype('course-view-*'); return new \block_manager($page); }
function xmldb_local_iomad_dashboard_install() { global $SITE; // Add some default blocks to the dashboard // yes, I know this isn't really what this is for!! $systemcontext = context_system::instance(); $page = new moodle_page(); $page->set_context($systemcontext); $page->set_pagetype('local-iomad-dashboard-index'); $page->set_pagelayout('mydashboard'); $page->blocks->add_region('content'); $defaultblocks = array('side_pre' => array('course_list'), 'content' => array('iomad_company_admin', 'iomad_reports'), 'side_post' => array('news_items')); $page->blocks->add_blocks($defaultblocks); return true; }
theme_reset_all_caches(); } else if ($choose && $device && !$unsettheme && confirm_sesskey()) { // Load the theme to make sure it is valid. $theme = theme_config::load($choose); // Get the config argument for the chosen device. $themename = get_device_cfg_var_name($device); set_config($themename, $theme->name); // Create a new page for the display of the themes readme. // This ensures that the readme page is shown using the new theme. $confirmpage = new moodle_page(); $confirmpage->set_context($PAGE->context); $confirmpage->set_url($PAGE->url); $confirmpage->set_pagelayout($PAGE->pagelayout); $confirmpage->set_pagetype($PAGE->pagetype); $confirmpage->set_title($PAGE->title); $confirmpage->set_heading($PAGE->heading); // Get the core renderer for the new theme. $output = $confirmpage->get_renderer('core'); echo $output->header(); echo $output->heading(get_string('themesaved')); echo $output->box_start(); echo format_text(get_string('choosereadme', 'theme_'.$theme->name), FORMAT_MOODLE); echo $output->box_end(); echo $output->continue_button($CFG->wwwroot . '/theme/index.php'); echo $output->footer(); exit; } else if ($device && $unsettheme && confirm_sesskey() && ($device != 'default')) {
protected function get_a_page_and_block_manager($regions, $context, $pagetype, $subpage = '') { $page = new moodle_page; $page->set_context($context); $page->set_pagetype($pagetype); $page->set_subpage($subpage); $blockmanager = new testable_block_manager($page); $blockmanager->add_regions($regions); $blockmanager->set_default_region($regions[0]); return array($page, $blockmanager); }