Merge branch 'MDL-29347' of git://github.com/mouneyrac/moodle
This commit is contained in:
+15
-2
@@ -123,7 +123,13 @@ class core_enrol_external extends external_api {
|
||||
'name' => new external_value(PARAM_ALPHANUMEXT, 'option name'),
|
||||
'value' => new external_value(PARAM_RAW, 'option value')
|
||||
)
|
||||
), 'method options', VALUE_DEFAULT, array()),
|
||||
), 'Option names:
|
||||
* withcapability (string) return only users with this capability. This option requires \'moodle/role:review\' on the course context.
|
||||
* groupid (integer) return only users in this group id. This option requires \'moodle/site:accessallgroups\' on the course context.
|
||||
* onlyactive (integer) return only users with active enrolments and matching time restrictions. This option requires \'moodle/course:enrolreview\' on the course context.
|
||||
* userfields (\'string, string, ...\') return only the values of these user fields.
|
||||
* limitfrom (integer) sql limit from.
|
||||
* limitnumber (integer) maximum number of returned users.', VALUE_DEFAULT, array()),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -152,6 +158,8 @@ class core_enrol_external extends external_api {
|
||||
$groupid = 0;
|
||||
$onlyactive = false;
|
||||
$userfields = array();
|
||||
$limitfrom = 0;
|
||||
$limitnumber = 0;
|
||||
foreach ($options as $option) {
|
||||
switch ($option['name']) {
|
||||
case 'withcapability':
|
||||
@@ -168,6 +176,11 @@ class core_enrol_external extends external_api {
|
||||
foreach ($thefields as $f) {
|
||||
$userfields[] = clean_param($f, PARAM_ALPHANUMEXT);
|
||||
}
|
||||
case 'limitfrom' :
|
||||
$limitfrom = clean_param($option['value'], PARAM_INT);
|
||||
break;
|
||||
case 'limitnumber' :
|
||||
$limitnumber = clean_param($option['value'], PARAM_INT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -213,7 +226,7 @@ class core_enrol_external extends external_api {
|
||||
FROM {user} u $ctxjoin
|
||||
WHERE u.id IN ($enrolledsql)
|
||||
ORDER BY u.id ASC";
|
||||
$enrolledusers = $DB->get_recordset_sql($sql, $enrolledparams);
|
||||
$enrolledusers = $DB->get_recordset_sql($sql, $enrolledparams, $limitfrom, $limitnumber);
|
||||
$users = array();
|
||||
foreach ($enrolledusers as $user) {
|
||||
context_instance_preload($user);
|
||||
|
||||
Reference in New Issue
Block a user