mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-35776 user ajax: fix sort order in chrome.
It seems that Chrome orders fields of objects in order of array key. Therefore we must stop using user.id in the PHP arrays, and instead ensure that we use sequential numbers. This commit fixes the enrol UI.
This commit is contained in:
parent
c62488c22f
commit
13bd955e65
@ -54,9 +54,9 @@ echo $OUTPUT->header(); // send headers
|
||||
|
||||
$manager = new course_enrolment_manager($PAGE, $course);
|
||||
|
||||
$outcome = new stdClass;
|
||||
$outcome = new stdClass();
|
||||
$outcome->success = true;
|
||||
$outcome->response = new stdClass;
|
||||
$outcome->response = new stdClass();
|
||||
$outcome->error = '';
|
||||
|
||||
switch ($action) {
|
||||
@ -99,6 +99,10 @@ switch ($action) {
|
||||
$user->fullname = fullname($user);
|
||||
unset($user->id);
|
||||
}
|
||||
// Chrome will display users in the order of the array keys, so we need
|
||||
// to ensure that the results ordered array keys. Fortunately, the JavaScript
|
||||
// does not care what the array keys are. It uses user.id where necessary.
|
||||
$outcome->response['users'] = array_values($outcome->response['users']);
|
||||
$outcome->success = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -51,9 +51,9 @@ echo $OUTPUT->header(); // Send headers.
|
||||
|
||||
$manager = new course_enrolment_manager($PAGE, $course);
|
||||
|
||||
$outcome = new stdClass;
|
||||
$outcome = new stdClass();
|
||||
$outcome->success = true;
|
||||
$outcome->response = new stdClass;
|
||||
$outcome->response = new stdClass();
|
||||
$outcome->error = '';
|
||||
|
||||
switch ($action) {
|
||||
@ -77,6 +77,10 @@ switch ($action) {
|
||||
}
|
||||
$user->extrafields = implode(', ', $fieldvalues);
|
||||
}
|
||||
// Chrome will display users in the order of the array keys, so we need
|
||||
// to ensure that the results ordered array keys. Fortunately, the JavaScript
|
||||
// does not care what the array keys are. It uses user.id where necessary.
|
||||
$outcome->response['users'] = array_values($outcome->response['users']);
|
||||
$outcome->success = true;
|
||||
break;
|
||||
case 'enrol':
|
||||
|
Loading…
x
Reference in New Issue
Block a user