Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First go at an abbreviated user listing

  • Loading branch information...
commit 6abee9896404b3cec6a7a5c432ad0c606769dd15 1 parent 1e4d8ed
martin authored
Showing with 35 additions and 3 deletions.
  1. +10 −3 user/index.php
  2. +25 −0 user/lib.php
View
13 user/index.php
@@ -45,9 +45,16 @@
}
if ($students = get_course_students($course->id)) {
- echo "<H2 align=center>$course->students</H2>";
- foreach ($students as $student) {
- print_user($student, $course, $string);
+ $numstudents = count($students);
+ echo "<H2 align=center>$numstudents $course->students</H2>";
+ if ($numstudents < 40) {
+ foreach ($students as $student) {
+ print_user($student, $course, $string);
+ }
+ } else {
+ foreach ($students as $student) {
+ print_user_small($student, $course, $string);
+ }
}
}
View
25 user/lib.php
@@ -88,4 +88,29 @@ function print_user($user, $course, $string) {
echo "</TD></TR></TABLE></TD></TR></TABLE>";
}
+function print_user_small($user, $course, $string) {
+ global $CFG, $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=35 BGCOLOR=#FFFFFF>";
+ print_user_picture($user->id, $course->id, $user->picture, false);
+ echo "</A>";
+ echo "</TD><TD BGCOLOR=#FFFFFF>";
+ echo "<FONT SIZE=2><B>&nbsp;<A HREF=\"$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A></B></FONT>";
+ echo "</TD><TD BGCOLOR=#FFFFFF NOWRAP>";
+ echo "<FONT SIZE=1>";
+ echo "<I>$user->city, ".$COUNTRIES["$user->country"]."</I>&nbsp;";
+ echo "</FONT>";
+ echo "</TD><TD BGCOLOR=#FFFFFF NOWRAP>";
+ echo "<FONT SIZE=1>";
+ if ($user->lastaccess) {
+ echo userdate($user->lastaccess);
+ echo "&nbsp (".format_time(time() - $user->lastaccess).")";
+ } else {
+ echo "$string->never";
+ }
+ echo "</FONT>";
+ echo "</TD></TR></TABLE></TD></TR></TABLE>";
+}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.