]> git.mjollnir.org Git - moodle.git/commitdiff
Changes to add login/logout button to the right-hand top corner of every page
authormartin <martin>
Sat, 17 Aug 2002 07:02:35 +0000 (07:02 +0000)
committermartin <martin>
Sat, 17 Aug 2002 07:02:35 +0000 (07:02 +0000)
... this is to help encourage people to log out after a session, especially
on shared or public terminals.

index.php
lib/moodlelib.php

index d44954bab2d135de46660e588002811bc9eab077..781af5ee3323527fa5c707301da605c4541dd5bf 100644 (file)
--- a/index.php
+++ b/index.php
             redirect("$CFG->wwwroot/admin/");
         }
         $headerbutton = update_course_icon($site->id);
-    } else if (!isset($USER->id)) {
-        $headerbutton = "<FONT SIZE=2><A HREF=\"login/\">".get_string("login")."</A></FONT>";
+    } else {
+        if (isset($USER->id)) {
+            $headerbutton = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A></FONT>";
+        } else {
+            $headerbutton = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login\">".get_string("login")."</A></FONT>";
+        }
     }
     print_header("$site->fullname", "$site->fullname", "", "",
                  "<META NAME=\"Description\" CONTENT=\"".stripslashes(strip_tags($site->summary))."\">",
index 101387c622bfbc488843061cd3cc4e0c148a620f..245b4472228156319d017e1cd1fa73336d46200d 100644 (file)
@@ -26,6 +26,14 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta=
     } else {
         $styles = "$CFG->wwwroot/theme/standard/styles.css";
     }
+
+    if (!$button and $navigation) {
+        if (isset($USER->id)) {
+            $button = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A></FONT>";
+        } else {
+            $button = "<FONT SIZE=2><A HREF=\"$CFG->wwwroot/login\">".get_string("login")."</A></FONT>";
+        }
+    }
  
     if (!$cache) {   // Do everything we can to prevent clients and proxies caching
         @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");