]> git.mjollnir.org Git - moodle.git/commitdiff
Use global $COURSE in print_header to avoid ugly hack
authormoodler <moodler>
Mon, 29 May 2006 08:22:52 +0000 (08:22 +0000)
committermoodler <moodler>
Mon, 29 May 2006 08:22:52 +0000 (08:22 +0000)
lib/weblib.php

index 35aed412674211ebc4facc01d64c031153ee4b4a..0a38a7f0bd2778d157d85461bff06c880f3ee6ea 100644 (file)
@@ -1882,7 +1882,7 @@ function highlightfast($needle, $haystack) {
 function print_header ($title='', $heading='', $navigation='', $focus='', $meta='',
                        $cache=true, $button='&nbsp;', $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();
         }
     }