From 80acd6be74d503e05ae6f4ed3cd900d2aca7a6bb Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 29 May 2006 08:22:52 +0000 Subject: [PATCH] Use global $COURSE in print_header to avoid ugly hack --- lib/weblib.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 35aed41267..0a38a7f0bd 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1882,7 +1882,7 @@ function highlightfast($needle, $haystack) { function print_header ($title='', $heading='', $navigation='', $focus='', $meta='', $cache=true, $button=' ', $menu='', $usexml=false, $bodytags='') { - global $USER, $CFG, $THEME, $SESSION, $ME, $SITE, $HTTPSPAGEREQUIRED; + global $USER, $CFG, $THEME, $SESSION, $ME, $SITE, $COURSE, $HTTPSPAGEREQUIRED; /// This makes sure that the header is never repeated twice on a page if (defined('HEADER_PRINTED')) { @@ -1893,15 +1893,13 @@ function print_header ($title='', $heading='', $navigation='', $focus='', $meta= } define('HEADER_PRINTED', 'true'); - -/// This is an ugly hack to be replaced later by a proper global $COURSE - global $course; - if (!empty($course->lang)) { - $CFG->courselang = $course->lang; +/// Set up course-based lang and theme if any + if (!empty($COURSE->lang)) { + $CFG->courselang = $COURSE->lang; } - if (!empty($course->theme)) { + if (!empty($COURSE->theme)) { if (!empty($CFG->allowcoursethemes)) { - $CFG->coursetheme = $course->theme; + $CFG->coursetheme = $COURSE->theme; theme_setup(); } } -- 2.39.5