themes: MDL-19077 new $OUTPUT->header/footer to replace print_header/footer.

Also, part of the change from weblib.php functions to $OUTPUT-> methods.

This is part of http://docs.moodle.org/en/Development:Theme_engines_for_Moodle%3F

This is a big change, and the result is not perfect yet. Expect some debugging output
on some pages.

The main part of these changes are that $OUTPUT->header now looks for a file
in the theme called layout.php, rather than header.html and footer.html. Also
you can have special templates for certain pages like layout-home.php. There is
fallback code for Moodle 1.9 themes, so they still work.

A few of the old arguments to print_header are no longer supported. (You get an
exception if you try to use them.) Sam H will be cleaning those up.

All the weblib functions that have been replaced with $OUTPUT-> have version in
deprecatedlib, so existing code will go on working for the foreseeable future.
This commit is contained in:
tjhunt
2009-06-26 09:06:16 +00:00
parent 520cea9216
commit 34a2777ccb
31 changed files with 1728 additions and 862 deletions
+9 -13
View File
@@ -50,7 +50,7 @@ class testable_renderer_factory extends renderer_factory_base {
public function create_renderer($module) {
$this->createcalls[] = $module;
return new moodle_core_renderer(new xhtml_container_stack());
return new moodle_core_renderer(new xhtml_container_stack(), null);
}
public function standard_renderer_class_for_module($module) {
@@ -63,8 +63,8 @@ class testable_renderer_factory extends renderer_factory_base {
* Renderer class for testing.
*/
class moodle_test_renderer extends moodle_core_renderer {
public function __construct($containerstack) {
parent::__construct($containerstack);
public function __construct($containerstack, $page) {
parent::__construct($containerstack, $page);
}
public function greeting($name = 'world') {
@@ -155,9 +155,7 @@ class standard_renderer_factory_test extends UnitTestCase {
public function setUp() {
parent::setUp();
$page = new stdClass;
$page->opencontainers = new xhtml_container_stack();
$this->factory = new standard_renderer_factory(null, $page);
$this->factory = new standard_renderer_factory(null, null);
}
public function tearDown() {
@@ -188,9 +186,7 @@ class custom_corners_renderer_factory_test extends UnitTestCase {
public function setUp() {
parent::setUp();
$page = new stdClass;
$page->opencontainers = new xhtml_container_stack();
$this->factory = new custom_corners_renderer_factory(null, $page);
$this->factory = new custom_corners_renderer_factory(null, null);
}
public function tearDown() {
@@ -246,7 +242,6 @@ class theme_overridden_renderer_factory_test extends UnitTestCase {
$this->foldertocleanup = $CFG->themedir;
$this->page = new stdClass;
$this->page->opencontainers = new xhtml_container_stack();
}
public function tearDown() {
@@ -414,7 +409,6 @@ class template_renderer_factory_test extends UnitTestCase {
$this->foldertocleanup = $CFG->themedir;
$this->page = new stdClass;
$this->page->opencontainers = new xhtml_container_stack();
}
public function tearDown() {
@@ -722,8 +716,10 @@ class template_renderer_test extends UnitTestCase {
parent::setUp();
$this->templatefolder = $CFG->dataroot . '/temp/template_renderer_fixtures/test';
make_upload_directory('temp/template_renderer_fixtures/test');
$page = new stdClass;
$page->course = new stdClass;
$this->renderer = new template_renderer('moodle_test_renderer',
array($this->templatefolder), new xhtml_container_stack());
array($this->templatefolder), new xhtml_container_stack(), $page);
$this->savedtemplates = array();
}
@@ -788,7 +784,7 @@ class moodle_core_renderer_test extends UnitTestCase {
public function setUp() {
parent::setUp();
$this->containerstack = new xhtml_container_stack();
$this->renderer = new moodle_core_renderer($this->containerstack);
$this->renderer = new moodle_core_renderer($this->containerstack, null);
}
public function test_select_menu_simple() {