Adding user's name at the top of the course page.

Just experimenting with it there for a while ... feedback welcome
This commit is contained in:
moodler
2003-04-25 06:40:30 +00:00
parent 87b490dfc6
commit a282d0ffda
2 changed files with 22 additions and 9 deletions
+3 -1
View File
@@ -53,8 +53,10 @@
$courseword = get_string("course");
$loggedinas = "<font size=2>".user_login_string($course, $USER)."</font>";
print_header("$courseword: $course->fullname", "$course->fullname", "$course->shortname", "search.search", "", true,
update_course_icon($course->id));
update_course_icon($course->id), $loggedinas);
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
+19 -8
View File
@@ -653,28 +653,39 @@ function print_footer ($course=NULL) {
}
/// User links
if (isset($USER->realuser)) {
if ($realuser = get_record("user", "id", $USER->realuser)) {
$realuserinfo = " [<A HREF=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname</A>] ";
$loggedinas = user_login_string($course, $USER);
include ("$CFG->dirroot/theme/$CFG->theme/footer.html");
}
function user_login_string($course, $user=NULL) {
global $USER, $CFG;
if (!$user) {
$user = $USER;
}
if (isset($user->realuser)) {
if ($realuser = get_record("user", "id", $user->realuser)) {
$realuserinfo = " [<a href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&return=$realuser->id\">$realuser->firstname $realuser->lastname</A>] ";
}
} else {
$realuserinfo = "";
}
if (isset($USER->id) and $USER->id) {
$username = "<A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$USER->firstname $USER->lastname</A>";
if (isset($user->id) and $user->id) {
$username = "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A>";
$loggedinas = $realuserinfo.get_string("loggedinas", "moodle", "$username").
" (<A HREF=\"$CFG->wwwroot/login/logout.php\">".get_string("logout")."</A>)";
} else {
$loggedinas = get_string("loggedinnot", "moodle").
" (<A HREF=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</A>)";
}
include ("$CFG->dirroot/theme/$CFG->theme/footer.html");
return $loggedinas;
}
function print_navigation ($navigation) {
global $CFG;