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
+18 -5
View File
@@ -94,11 +94,19 @@ global $PAGE;
global $COURSE;
/**
* $THEME is a global that defines the site theme.
* $OUTPUT is an instance of moodle_core_renderer or one of its subclasses. Use
* it to generate HTML for output.
*
* Items found in the theme record:
* - $THEME->cellheading - Cell colors.
* - $THEME->cellheading2 - Alternate cell colors.
* $OUTPUT is initialised when the theme is setup. That normally happens during
* the call to require_login, or $PAGE->set_course.
*
* @global object $OUTPUT
* @name $OUTPUT
*/
global $OUTPUT;
/**
* $THEME is a global that defines the current theme.
*
* @global object $THEME
* @name THEME
@@ -222,7 +230,8 @@ global $SCRIPT;
require_once($CFG->libdir .'/textlib.class.php'); // Functions to handle multibyte strings
require_once($CFG->libdir .'/filterlib.php'); // Functions for filtering test as it is output
require_once($CFG->libdir .'/ajax/ajaxlib.php'); // Functions for managing our use of JavaScript and YUI
require_once($CFG->libdir .'/weblib.php'); // Functions for producing HTML
require_once($CFG->libdir .'/weblib.php'); // Functions relating to HTTP and content
require_once($CFG->libdir .'/outputlib.php'); // Functions for generating output
require_once($CFG->libdir .'/dmllib.php'); // Database access
require_once($CFG->libdir .'/datalib.php'); // Legacy lib with a big-mix of functions.
require_once($CFG->libdir .'/accesslib.php'); // Access control functions
@@ -367,6 +376,10 @@ global $SCRIPT;
$classname = 'moodle_page';
}
$PAGE = new $classname();
/// Create an initial $OUTPUT. This will be changes later once we know the theme.
setup_bootstrat_output();
unset($classname);
/// detect unsupported upgrade jump as soon as possible - do not change anything, do not use system functions