]> git.mjollnir.org Git - moodle.git/commitdiff
SMall cleanups on print_footer, and you can now call it with "none"
authormoodler <moodler>
Tue, 11 Jan 2005 08:26:35 +0000 (08:26 +0000)
committermoodler <moodler>
Tue, 11 Jan 2005 08:26:35 +0000 (08:26 +0000)
lib/weblib.php

index 951255f2fdd6d6bb0a57816d7d0b11f27eae81f1..0eaf75361d23e1fe3b60fd122c85fbc2db8658a8 100644 (file)
@@ -1669,32 +1669,40 @@ function print_header_simple($title='', $heading='', $navigation='', $focus='',
  * @param ? $usercourse ?
  * @todo Finish documenting this function
  */
-function print_footer ($course=NULL, $usercourse=NULL) {
+function print_footer($course=NULL, $usercourse=NULL) {
     global $USER, $CFG, $THEME;
 
 /// Course links
     if ($course) {
-        if ($course == 'home') {   // special case for site home page - please do not remove
+        if ($course == 'none') {          // Don't print any links etc
+            $homelink = '';
+            $loggedinas = '';
+        } else if ($course == 'home') {   // special case for site home page - please do not remove
+            $course = get_site();
             $homelink  = '<a title="moodle '. $CFG->release .' ('. $CFG->version .')" href="http://moodle.org/" target="_blank">';
             $homelink .= '<br /><img width="100" height="30" src="pix/moodlelogo.gif" border="0" alt="moodlelogo" /></a>';
-            $course = get_site();
-            $homepage = true;
+            $homepage  = true;
         } else {
-            $homelink = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>";
+            $homelink = '<a target="'.$CFG->framename.'" href="'.$CFG->wwwroot.
+                        '/course/view.php?id='.$course->id.'">'.$course->shortname.'</a>';
         }
     } else {
-        $homelink = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/\">".get_string('home').'</a>';
-        $course = get_site();
+        $course = get_site();  // Set course as site course by default
+        $homelink = '<a target="'.$CFG->framename.'" href="'.$CFG->wwwroot.'/">'.get_string('home').'</a>';
     }
 
-    if (!$usercourse) {
+/// Set the user link if necessary
+    if (!$usercourse and is_object($course)) {
         $usercourse = $course;
     }
 
-/// User links
-    $loggedinas = user_login_string($usercourse, $USER);
+    if (!isset($loggedinas)) {
+        $loggedinas = user_login_string($usercourse, $USER);
+    }
+
+/// Include the actual footer file
 
-    include ($CFG->dirroot .'/theme/'. $CFG->theme .'/footer.html');
+    include ($CFG->dirroot.'/theme/'.$CFG->theme.'/footer.html');
 }
 
 /**