From: martin Date: Sat, 21 Sep 2002 06:27:00 +0000 (+0000) Subject: more refinements to sorting display X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=32b4b9746ab2f6c9cb07baae8323035b10c6a1fd;p=moodle.git more refinements to sorting display --- diff --git a/user/index.php b/user/index.php index 99ae2bfa30..2a0767f984 100644 --- a/user/index.php +++ b/user/index.php @@ -50,15 +50,25 @@ if ($students = get_course_students($course->id, "$sort $dir")) { $numstudents = count($students); echo "

$numstudents $course->students

"; - if ($numstudents < 30) { + if ($numstudents < $USER_SMALL_CLASS) { foreach ($students as $student) { print_user($student, $course, $string); } } else { // Print one big table with abbreviated info - $table->head = array (" ", - "$string->name id&sort=u.firstname&dir=ASC\">", - "$string->location id&sort=u.country&dir=ASC\">", - "$string->lastaccess id&sort=u.lastaccess&dir=DESC\">"); + if ($sort == "u.firstname") { + $name = "$string->name"; + $location = "id&sort=u.country&dir=ASC\">$string->location"; + $lastaccess = "id&sort=u.lastaccess&dir=DESC\">$string->lastaccess"; + } else if ($sort == "u.country") { + $name = "id&sort=u.firstname&dir=ASC\">$string->name"; + $location = "$string->location"; + $lastaccess = "id&sort=u.lastaccess&dir=DESC\">$string->lastaccess"; + } else { + $name = "id&sort=u.firstname&dir=ASC\">$string->name"; + $location = "id&sort=u.country&dir=ASC\">$string->location"; + $lastaccess = "$string->lastaccess"; + } + $table->head = array (" ", $name, $location, $lastaccess); $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT"); $table->size = array ("35", "*", "*", "*"); @@ -72,8 +82,8 @@ $table->data[] = array (print_user_picture($student->id, $course->id, $student->picture, false, true), "wwwroot/user/view.php?id=$student->id&course=$course->id\">$student->firstname $student->lastname", - "$student->city, ".$COUNTRIES["$student->country"], - "$lastaccess"); + "$student->city, ".$COUNTRIES["$student->country"]."", + "$lastaccess"); } print_table($table, 2, 0); } diff --git a/user/lib.php b/user/lib.php index fa085030e7..8a87860915 100644 --- a/user/lib.php +++ b/user/lib.php @@ -1,5 +1,7 @@