Skip to content
Browse files

Added some functions from 1.4 to provide some backward compatibility

for modules
  • Loading branch information...
1 parent 8ada23b commit 5781d6d16862d90428a8eae1ed6ece31e6f9db46 moodler committed Aug 24, 2004
Showing with 30 additions and 0 deletions.
  1. +13 −0 lib/moodlelib.php
  2. +17 −0 lib/weblib.php
View
13 lib/moodlelib.php
@@ -418,6 +418,19 @@ function require_login($courseid=0) {
}
}
+function require_course_login($course, $autologinguest=true) {
+// This is a weaker version of require_login which only requires login
+// when called from within a course rather than the site page, unless
+// the forcelogin option is turned on.
+ global $CFG;
+ if ($CFG->forcelogin) {
+ require_login();
+ }
+ if ($course->category) {
+ require_login($course->id, $autologinguest);
+ }
+}
+
function update_user_login_times() {
global $USER;
View
17 lib/weblib.php
@@ -1028,6 +1028,23 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta=
include ("$CFG->dirroot/theme/$CFG->theme/header.html");
}
+function print_header_simple($title="", $heading="", $navigation="", $focus="", $meta="",
+ $cache=true, $button=" ", $menu="", $usexml=false, $bodytags="") {
+/// This version of print_header is simpler because the course name does not have to be
+/// provided explicitly in the strings. It can be used on the site page as in courses
+/// Eventually all print_header could be replaced by print_header_simple
+
+ global $course; // The same hack is used in print_header
+
+ $shortname ='';
+ if ($course->category) {
+ $shortname = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
+ }
+
+ print_header("$course->shortname: $title", "$course->fullname $heading", "$shortname $navigation", $focus, $meta,
+ $cache, $button, $menu, $usexml, $bodytags);
+}
+
function print_footer ($course=NULL) {
// Can provide a course object to make the footer contain a link to
// to the course home page, otherwise the link will go to the site home

0 comments on commit 5781d6d

Please sign in to comment.
Something went wrong with that request. Please try again.