mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
On enrol students to a course page, force searching if too many users to display (controlled by MAX_USERS_PER_PAGE - not previously used and bumped up to 1000 as a more reasonable limit) - trying to put 30,000 users in a drop down menu crashes some browsers
This commit is contained in:
parent
eb46f6a322
commit
4f3fecf4a6
3 changed files with 22 additions and 9 deletions
|
@ -40,6 +40,7 @@
|
|||
document.studentform.remove.disabled=true;
|
||||
document.studentform.removeselect.selectedIndex=-1;">
|
||||
<?php
|
||||
|
||||
if (!empty($searchusers)) {
|
||||
echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
|
||||
foreach ($searchusers as $user) {
|
||||
|
@ -49,9 +50,15 @@
|
|||
echo "</optgroup>\n";
|
||||
}
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $user) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
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 {
|
||||
foreach ($users as $user) {
|
||||
$fullname = fullname($user, true);
|
||||
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue