From c5b6666eafdc9ee21b530a617896f0b89008efaf Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 14 Apr 2003 02:42:40 +0000 Subject: [PATCH] Better support for large classes --- user/index.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/user/index.php b/user/index.php index 44fedb3d02..2ee15ada09 100644 --- a/user/index.php +++ b/user/index.php @@ -8,7 +8,8 @@ require_variable($id); //course optional_variable($sort, "lastaccess"); //how to sort students - optional_variable($dir,"DESC"); //how to sort students + optional_variable($dir,"DESC"); //how to sort students + optional_variable($showall,"0"); //show all of the students? if (! $course = get_record("course", "id", $id)) { error("Course ID is incorrect"); @@ -63,15 +64,20 @@ if ($students = get_course_students($course->id, "$dsort $dir")) { $numstudents = count($students); - echo "

$numstudents $course->students

"; + echo "

$numstudents $course->students

"; if ($numstudents < $USER_SMALL_CLASS) { foreach ($students as $student) { print_user($student, $course, $string); } - } else if ($numstudents > $USER_HUGE_CLASS) { - print_heading(get_string("toomanytoshow")); } else { // Print one big table with abbreviated info + if ($numstudents > $USER_LARGE_CLASS and $showall == "0") { + $a->count = $USER_LARGE_CLASS; + $a->things = strtolower($course->students); + echo "

".get_string("displayingfirst", "", $a); + echo "(id&sort=$sort&dir=$dir&showall=1\">".get_string("showallusers").")"; + echo "

"; + } $columns = array("name", "city", "country", "lastaccess"); foreach ($columns as $column) { @@ -110,14 +116,19 @@ $table->cellpadding = 2; $table->cellspacing = 0; + $count = 0; foreach ($students as $student) { + $count++; + if ($showall == "0" and $count > $USER_LARGE_CLASS) { + break; + } if ($student->lastaccess) { $lastaccess = format_time(time() - $student->lastaccess, $string); } else { $lastaccess = $string->never; } - if ($numstudents > $USER_LARGE_CLASS) { // Don't show pictures + if ($numstudents > $USER_LARGE_CLASS and $showall == "1") { // Don't show pictures $picture = ""; } else { $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); -- 2.39.5