]> git.mjollnir.org Git - moodle.git/commitdiff
Better handling of country sorting
authormartin <martin>
Sun, 22 Sep 2002 15:57:23 +0000 (15:57 +0000)
committermartin <martin>
Sun, 22 Sep 2002 15:57:23 +0000 (15:57 +0000)
admin/user.php

index e812c4ba232c24bd1308cfd29ce1321051336ebf..4c706e1e6b656f2f09fbe52217a498d6cfdfbe1a 100644 (file)
         if ($users = get_records_sql("SELECT * from user WHERE username <> 'guest' 
                                       AND deleted <> '1' ORDER BY $sort $dir")) {
 
+            foreach ($users as $user) {
+                $user->country = $COUNTRIES[$user->country];
+            }
+            if ($sort == "country") {  // Need to resort by full country name, not code
+                foreach ($users as $user) {
+                    $susers[$user->country] = $user;
+                }
+                $users = $susers;
+                asort($users);
+            }
+
             print_heading(get_string("chooseuser"));
 
             $table->head = array ($name, $email, $city, $country, $lastaccess, "", "");
                 $table->data[] = array ("<A HREF=\"../user/view.php?id=$user->id&course=$site->id\">$user->firstname $user->lastname</A>",
                                  "$user->email",
                                  "$user->city",
-                                 $COUNTRIES[$user->country],
+                                 "$user->country",
                                  $strlastaccess,
                                  "<A HREF=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</A>",
                                  $deletebutton);