From: martin Date: Sat, 17 Aug 2002 07:02:35 +0000 (+0000) Subject: Changes to add login/logout button to the right-hand top corner of every page X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4efeb8c3e3a102dd9cc165982ee6099e72688db9;p=moodle.git Changes to add login/logout button to the right-hand top corner of every page ... this is to help encourage people to log out after a session, especially on shared or public terminals. --- diff --git a/index.php b/index.php index d44954bab2..781af5ee33 100644 --- a/index.php +++ b/index.php @@ -15,8 +15,12 @@ redirect("$CFG->wwwroot/admin/"); } $headerbutton = update_course_icon($site->id); - } else if (!isset($USER->id)) { - $headerbutton = "".get_string("login").""; + } else { + if (isset($USER->id)) { + $headerbutton = "wwwroot/login/logout.php\">".get_string("logout").""; + } else { + $headerbutton = "wwwroot/login\">".get_string("login").""; + } } print_header("$site->fullname", "$site->fullname", "", "", "summary))."\">", diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 101387c622..245b447222 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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 = "wwwroot/login/logout.php\">".get_string("logout").""; + } else { + $button = "wwwroot/login\">".get_string("login").""; + } + } if (!$cache) { // Do everything we can to prevent clients and proxies caching @header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");