mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
themes: MDL-19077 change how the theme is initialised and CSS is served.
This is part of http://docs.moodle.org/en/Development:Theme_engines_for_Moodle%3F $THEME is now initialised at the same time as $OUTPUT. Old functions like theme_setup are deprecated in favour of methods on $PAGE. There is a new theme_config class in outputlib.php that deals with loading the theme config.php file. CSS used to be served by themes styles.php files calling a function in weblib.php. Now it works by each theme's styles.php file doing $themename = basename(dirname(__FILE__)); require_once(dirname(__FILE__) . '/../../theme/styles.php'); which is less code to be copied into each theme. (Old-style styles.php files still work thanks to some code in deprecatedlib.php.) Admin UI for choosing a theme cleaned up. A couple of theme-specific hard-coded hacks like $THEME->cssconstants and $THEME->CSSEdit have been replaced by a more generic $THEME->customcssoutputfunction hook. See examples at the end of outputlib.php Also: * Fix setting the theme in the URL, which seems to have been broken since 1.9. * Fix up errors on a few pages caused by the new initialisation order. * MDL-19097 moodle_page::set_course should not set $COURSE unless it is $PAGE. * httpsrequired() from moodlelib.php moved to $PAGE->https_required(). * Move has_started() method to the renderer base class. * Further fixes to display of early errors. * Remove print_header/footer_old from weblib. I did not mean to commit them before.
This commit is contained in:
parent
0456fc1ac4
commit
b70094743a
37 changed files with 1646 additions and 1531 deletions
|
@ -5205,9 +5205,6 @@ function admin_get_root($reload=false, $requirefulltree=true) {
|
|||
$ADMIN->purge_children($requirefulltree);
|
||||
}
|
||||
|
||||
// Some parts of the tree require $CFG->pixpath.
|
||||
$OUTPUT->initialise_deprecated_cfg_pixpath();
|
||||
|
||||
if (!$ADMIN->loaded) {
|
||||
// we process this file first to create categories first and in correct order
|
||||
require($CFG->dirroot.'/'.$CFG->admin.'/settings/top.php');
|
||||
|
@ -5275,7 +5272,7 @@ function admin_apply_default_settings($node=NULL, $unconditional=true) {
|
|||
* @return int number of changed settings
|
||||
*/
|
||||
function admin_write_settings($formdata) {
|
||||
global $CFG, $SITE, $PAGE, $DB;
|
||||
global $CFG, $SITE, $DB;
|
||||
|
||||
$olddbsessions = !empty($CFG->dbsessions);
|
||||
$formdata = (array)$formdata;
|
||||
|
@ -5314,9 +5311,12 @@ function admin_write_settings($formdata) {
|
|||
require_logout();
|
||||
}
|
||||
|
||||
// now update $SITE - it might have been changed
|
||||
$SITE = $DB->get_record('course', array('id'=>$SITE->id));
|
||||
$PAGE->set_course($SITE);
|
||||
// Now update $SITE - just update the fields, in case other people have a
|
||||
// a reference to it (e.g. $PAGE, $COURSE).
|
||||
$newsite = $DB->get_record('course', array('id'=>$SITE->id));
|
||||
foreach (get_object_vars($newsite) as $field => $value) {
|
||||
$SITE->$field = $value;
|
||||
}
|
||||
|
||||
// now reload all settings - some of them might depend on the changed
|
||||
admin_get_root(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue