diff --git a/admin/roles/lib.php b/admin/roles/lib.php index 45dccf6d5b8..7473f86ba88 100644 --- a/admin/roles/lib.php +++ b/admin/roles/lib.php @@ -1089,8 +1089,6 @@ class override_permissions_table_advanced extends capability_table_with_risks { * Base class to avoid duplicating code. */ abstract class role_assign_user_selector_base extends user_selector_base { - const MAX_USERS_PER_PAGE = 100; - protected $roleid; protected $context; @@ -1159,7 +1157,7 @@ class potential_assignees_below_course extends role_assign_user_selector_base { // Check to see if there are too many to show sensibly. if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > role_assign_user_selector_base::MAX_USERS_PER_PAGE) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } @@ -1187,9 +1185,6 @@ class potential_assignees_below_course extends role_assign_user_selector_base { * @copyright 2012 Petr Skoda {@link http://skodak.org} */ class role_check_users_selector extends user_selector_base { - const MAX_ENROLLED_PER_PAGE = 100; - const MAX_POTENTIAL_PER_PAGE = 100; - /** @var bool limit listing of users to enrolled only */ var $onlyenrolled; @@ -1270,7 +1265,7 @@ class role_check_users_selector extends user_selector_base { if ($sql1) { $enrolleduserscount = $DB->count_records_sql($countfields . $sql1, $params); - if (!$this->is_validating() and $enrolleduserscount > $this::MAX_ENROLLED_PER_PAGE) { + if (!$this->is_validating() and $enrolleduserscount > $this->maxusersperpage) { $result[$groupname1] = array(); $toomany = $this->too_many_results($search, $enrolleduserscount); $result[implode(' - ', array_keys($toomany))] = array(); @@ -1287,7 +1282,7 @@ class role_check_users_selector extends user_selector_base { } if ($sql2) { $otheruserscount = $DB->count_records_sql($countfields . $sql2, $params); - if (!$this->is_validating() and $otheruserscount > $this::MAX_POTENTIAL_PER_PAGE) { + if (!$this->is_validating() and $otheruserscount > $this->maxusersperpage) { $result[$groupname2] = array(); $toomany = $this->too_many_results($search, $otheruserscount); $result[implode(' - ', array_keys($toomany))] = array(); @@ -1340,7 +1335,7 @@ class potential_assignees_course_and_above extends role_assign_user_selector_bas if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > role_assign_user_selector_base::MAX_USERS_PER_PAGE) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } @@ -1765,7 +1760,7 @@ class admins_potential_selector extends user_selector_base { // Check to see if there are too many to show sensibly. if (!$this->is_validating()) { $potentialcount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialcount > 100) { + if ($potentialcount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialcount); } } diff --git a/admin/settings/users.php b/admin/settings/users.php index 07835992d12..0365ab529f0 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -150,6 +150,7 @@ if ($hassiteconfig 'department' => new lang_string('department'), 'institution' => new lang_string('institution'), ))); + $temp->add(new admin_setting_configtext('maxusersperpage', new lang_string('maxusersperpage','admin'), new lang_string('configmaxusersperpage','admin'), 100, PARAM_INT)); $temp->add(new admin_setting_configcheckbox('enablegravatar', new lang_string('enablegravatar', 'admin'), new lang_string('enablegravatar_help', 'admin'), 0)); $temp->add(new admin_setting_configtext('gravatardefaulturl', new lang_string('gravatardefaulturl', 'admin'), new lang_string('gravatardefaulturl_help', 'admin'), 'mm')); } diff --git a/admin/webservice/lib.php b/admin/webservice/lib.php index 161c03af1f1..b135d0f9bb3 100644 --- a/admin/webservice/lib.php +++ b/admin/webservice/lib.php @@ -29,8 +29,6 @@ require_once($CFG->dirroot . '/user/selector/lib.php'); * either all the other Moodle users. */ class service_user_selector extends user_selector_base { - const MAX_USERS_PER_PAGE = 100; - protected $serviceid; protected $displayallowedusers; //set to true if the selector displays the //allowed users on this service @@ -85,7 +83,7 @@ class service_user_selector extends user_selector_base { if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > service_user_selector::MAX_USERS_PER_PAGE) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } diff --git a/cohort/locallib.php b/cohort/locallib.php index 3cb1d3bfff8..23fa8a6deb1 100644 --- a/cohort/locallib.php +++ b/cohort/locallib.php @@ -62,7 +62,7 @@ class cohort_candidate_selector extends user_selector_base { if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > 100) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } diff --git a/enrol/manual/locallib.php b/enrol/manual/locallib.php index 16ad4a2a92e..80631b24260 100644 --- a/enrol/manual/locallib.php +++ b/enrol/manual/locallib.php @@ -63,7 +63,7 @@ class enrol_manual_potential_participant extends user_selector_base { if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > 100) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } @@ -127,7 +127,7 @@ class enrol_manual_current_participant extends user_selector_base { if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > 100) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } diff --git a/lang/en/admin.php b/lang/en/admin.php index 394334032d2..9bfba65b18f 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -687,6 +687,8 @@ from a STABLE branch of the Moodle code. See Moodle Docs for more details.'; $string['maxbytes'] = 'Maximum uploaded file size'; $string['maxconsecutiveidentchars'] = 'Consecutive identical characters'; $string['maxeditingtime'] = 'Maximum time to edit posts'; +$string['maxusersperpage'] = ' Maximum users per page'; +$string['configmaxusersperpage'] = 'Maximum number of users displayed within user selector in course, group, cohort, webservice etc.'; $string['mbstringrecommended'] = 'Installing the optional MBSTRING library is highly recommended in order to improve site performance, particularly if your site is supporting non-Latin languages.'; $string['mediapluginavi'] = 'Enable .avi filter'; $string['mediapluginflv'] = 'Enable .flv filter'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index dc06db964a3..73a5000825f 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -7894,8 +7894,6 @@ abstract class forum_subscriber_selector_base extends user_selector_base { * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class forum_potential_subscriber_selector extends forum_subscriber_selector_base { - const MAX_USERS_PER_PAGE = 100; - /** * If set to true EVERYONE in this course is force subscribed to this forum * @var bool @@ -7983,7 +7981,7 @@ class forum_potential_subscriber_selector extends forum_subscriber_selector_base // Check to see if there are too many to show sensibly. if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params); - if ($potentialmemberscount > self::MAX_USERS_PER_PAGE) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } diff --git a/user/selector/lib.php b/user/selector/lib.php index f1d95336ab5..00bcd7e9d22 100644 --- a/user/selector/lib.php +++ b/user/selector/lib.php @@ -77,6 +77,8 @@ abstract class user_selector_base { array('none', 'moodle') )); + /** @var int this is used to define maximum number of users visible in list */ + public $maxusersperpage = 100; // Public API ============================================================== @@ -120,6 +122,10 @@ abstract class user_selector_base { $this->preserveselected = $this->initialise_option('userselector_preserveselected', $this->preserveselected); $this->autoselectunique = $this->initialise_option('userselector_autoselectunique', $this->autoselectunique); $this->searchanywhere = $this->initialise_option('userselector_searchanywhere', $this->searchanywhere); + + if (!empty($CFG->maxusersperpage)) { + $this->maxusersperpage = $CFG->maxusersperpage; + } } /** @@ -751,8 +757,6 @@ class group_members_selector extends groups_user_selector_base { * Used on the add group members page. */ class group_non_members_selector extends groups_user_selector_base { - const MAX_USERS_PER_PAGE = 100; - /** * An array of user ids populated by find_users() used in print_user_summaries() */ @@ -860,7 +864,7 @@ class group_non_members_selector extends groups_user_selector_base { if (!$this->is_validating()) { $potentialmemberscount = $DB->count_records_sql("SELECT COUNT(DISTINCT u.id) $sql", $params); - if ($potentialmemberscount > group_non_members_selector::MAX_USERS_PER_PAGE) { + if ($potentialmemberscount > $this->maxusersperpage) { return $this->too_many_results($search, $potentialmemberscount); } } diff --git a/version.php b/version.php index 64f42bb1c14..4bdeefa34ed 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2013030800.00; // YYYYMMDD = weekly release date of this DEV branch +$version = 2013031200.00; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes