Performance enhancement for user listing (caching of language strings)

This commit is contained in:
martin 2002-08-06 09:21:14 +00:00
parent 1ebede32c2
commit cd052f8ccc
2 changed files with 47 additions and 44 deletions

View file

@ -25,63 +25,28 @@
get_string("participants"), "");
}
$string->email = get_string("email");
$string->location = get_string("location");
$string->lastaccess = get_string("lastaccess");
$string->activity = get_string("activity");
$string->unenrol = get_string("unenrol");
$string->loginas = get_string("loginas");
$string->fullprofile = get_string("fullprofile");
if ( $teachers = get_course_teachers($course->id)) {
echo "<H2 align=center>".$course->teacher."s</H2>";
foreach ($teachers as $teacher) {
print_user($teacher, $course);
print_user($teacher, $course, $string);
}
}
if ($students = get_course_students($course->id)) {
echo "<H2 align=center>".$course->student."s</H2>";
foreach ($students as $student) {
print_user($student, $course);
print_user($student, $course, $string);
}
}
print_footer($course);
/// FUNCTIONS //////////////////
function print_user($user, $course) {
global $USER, $COUNTRIES;
echo "<TABLE WIDTH=80% ALIGN=CENTER BORDER=0 CELLPADDING=1 CELLSPACING=1><TR><TD BGCOLOR=#888888>";
echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR>";
echo "<TD WIDTH=100 BGCOLOR=#FFFFFF VALIGN=top>";
echo "<A HREF=\"view.php?id=$user->id&course=$course->id\">";
if ($user->picture) {
echo "<IMG BORDER=0 ALIGN=left WIDTH=100 SRC=\"pix.php/$user->id/f1.jpg\">";
} else {
echo "<IMG BORDER=0 ALIGN=left WIDTH=100 SRC=\"default/f1.jpg\">";
}
echo "</A>";
echo "</TD><TD WIDTH=100% BGCOLOR=#FFFFFF VALIGN=top>";
echo "<FONT SIZE=-1>";
echo "<FONT SIZE=3><B>$user->firstname $user->lastname</B></FONT>";
echo "<P>";
echo get_string("email").": <A HREF=\"mailto:$user->email\">$user->email</A><BR>";
echo get_string("location").": $user->city, ".$COUNTRIES["$user->country"]."<BR>";
echo get_string("lastaccess").": ".userdate($user->lastaccess);
echo "&nbsp (".format_time(time() - $user->lastaccess).")";
echo "</TD><TD VALIGN=bottom BGCOLOR=#FFFFFF NOWRAP>";
echo "<FONT SIZE=1>";
if (isteacher($course->id)) {
$timemidnight = usergetmidnight(time());
echo "<A HREF=\"../course/user.php?id=$course->id&user=$user->id\">".get_string("activity")."</A><BR>";
echo "<A HREF=\"../course/unenrol.php?id=$course->id&user=$user->id\">".get_string("unenrol")."</A><BR>";
if (isstudent($course->id, $user->id)) {
echo "<A HREF=\"../course/loginas.php?id=$course->id&user=$user->id\">".get_string("loginas")."</A><BR>";
}
}
echo "<A HREF=\"view.php?id=$user->id&course=$course->id\">".get_string("fullprofile")."...</A>";
echo "</FONT>";
echo "</TD></TR></TABLE></TD></TR></TABLE>";
}
?>