Use global $COURSE in print_header to avoid ugly hack

This commit is contained in:
moodler
2006-05-29 08:22:52 +00:00
parent 1a2ea6f488
commit 80acd6be74
+6 -8
View File
@@ -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();
}
}