From: martin <martin>
Date: Sun, 22 Sep 2002 16:16:13 +0000 (+0000)
Subject: Better country sorting on user index in a course
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=adcb3ac53d7f3ab912a2bdeaf53392377c423b1a;p=moodle.git

Better country sorting on user index in a course
---

diff --git a/user/index.php b/user/index.php
index 3a4a1d8adf..788fe1047f 100644
--- a/user/index.php
+++ b/user/index.php
@@ -78,6 +78,20 @@
                 }
             }
 
+            foreach ($students as $key => $student) {
+                $students[$key]->country = $COUNTRIES[$student->country];
+            }
+            if ($sort == "country") {  // Need to re-sort by full country name, not code
+                foreach ($students as $student) {
+                    $sstudents[$student->id] = $student->country;
+                }
+                asort($sstudents);
+                foreach ($sstudents as $key => $value) {
+                    $nstudents[] = $students[$key];
+                }
+                $students = $nstudents;
+            }
+
             $table->head = array ("&nbsp;", $name, $city, $country, $lastaccess);
             $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "LEFT");
             $table->size = array ("10", "*", "*", "*", "*");