]> git.mjollnir.org Git - moodle.git/commitdiff
assign admins page should respect MAX_USERS_PER_PAGE
authormjollnir_ <mjollnir_>
Thu, 20 Apr 2006 00:19:17 +0000 (00:19 +0000)
committermjollnir_ <mjollnir_>
Thu, 20 Apr 2006 00:19:17 +0000 (00:19 +0000)
admin/admin.html
admin/admin.php

index 5d37598c39951795f3df906dd11bccaa2e8b2840..b9913fc059b912ce7ded2d4c2c941392190ad466 100644 (file)
                       echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
                   }
                   echo "</optgroup>\n";
-              }
-              if (!empty($users)) {
-                  foreach ($users as $user) {
-                      $fullname = fullname($user, true);
-                      echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
+              } else {
+                  if ($usercount > MAX_USERS_PER_PAGE) {
+                      echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
+                          .'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
+                  } else {
+                      if (!empty($users)) {
+                          foreach ($users as $user) {
+                              $fullname = fullname($user, true);
+                              echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
+                          }
+                      }
                   }
               }
           ?>
index 8744c0a6dda412966053954b13189821ef1d26e8..68568dff4809b8b9cb9810b751c2c595b089d68c 100644 (file)
 
 /// If no search results then get potential users excluding current admins
     if (empty($searchusers)) {
-        if (!$users = get_users(true, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
-                                0, 99999, 'id, firstname, lastname, email') ) {
-            $users = array();
+
+        $usercount =  get_users(false, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
+                                0, 99999, 'id, firstname, lastname, email');
+
+        $users = array();
+
+        if ($usercount <= MAX_USERS_PER_PAGE) {
+            if (!$users = get_users(true, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
+                               0, 99999, 'id, firstname, lastname, email') ) {
+                $users = array();
+            }
         }
-        $usercount = count($users);
     }
 
     $searchtext = (isset($frm->searchtext)) ? $frm->searchtext : "";