Rearranged code so some output is printed before tackling the big table
authormoodler <moodler>
Mon, 11 Nov 2002 07:58:11 +0000 (07:58 +0000)
committermoodler <moodler>
Mon, 11 Nov 2002 07:58:11 +0000 (07:58 +0000)
admin/user.php

index d8c1459..9036940 100644 (file)
         if ($users = get_records_sql("SELECT id, username, email, firstname, lastname, city, country, lastaccess  from user WHERE username <> 'guest' 
                                       AND deleted <> '1' ORDER BY $sort $dir LIMIT $page,$recordsperpage")) {
 
         if ($users = get_records_sql("SELECT id, username, email, firstname, lastname, city, country, lastaccess  from user WHERE username <> 'guest' 
                                       AND deleted <> '1' ORDER BY $sort $dir LIMIT $page,$recordsperpage")) {
 
-            foreach ($users as $key => $user) {
-                $users[$key]->country = $COUNTRIES[$user->country];
-            }
-            if ($sort == "country") {  // Need to resort by full country name, not code
-                foreach ($users as $user) {
-                    $susers[$user->id] = $user->country;
-                }
-                asort($susers);
-                foreach ($susers as $key => $value) {
-                    $nusers[] = $users[$key];
-                }
-                $users = $nusers;
-            }
-
             print_heading("$usercount ".get_string("users"));
             print_heading("$usercount ".get_string("users"));
+            
             $a->start = $page;
             $a->end = $page + $recordsperpage;
             if ($a->end > $usercount) {
             $a->start = $page;
             $a->end = $page + $recordsperpage;
             if ($a->end > $usercount) {
             }
             echo "</TD></TR></TABLE>";
 
             }
             echo "</TD></TR></TABLE>";
 
+            flush();
+
+            foreach ($users as $key => $user) {
+                $users[$key]->country = $COUNTRIES[$user->country];
+            }
+            if ($sort == "country") {  // Need to resort by full country name, not code
+                foreach ($users as $user) {
+                    $susers[$user->id] = $user->country;
+                }
+                asort($susers);
+                foreach ($susers as $key => $value) {
+                    $nusers[] = $users[$key];
+                }
+                $users = $nusers;
+            }
+
             $table->head = array ($name, $email, $city, $country, $lastaccess, "", "");
             $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER");
             $table->width = "95%";
             $table->head = array ($name, $email, $city, $country, $lastaccess, "", "");
             $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "CENTER", "CENTER");
             $table->width = "95%";