MDL-35899 fix cohort sorting in enrol UI

This commit is contained in:
Petr Škoda 2012-11-24 11:11:37 +01:00
parent ca48fe5f97
commit a069c3f76a
2 changed files with 3 additions and 1 deletions

View File

@ -77,6 +77,8 @@ switch ($action) {
$offset = optional_param('offset', 0, PARAM_INT);
$search = optional_param('search', '', PARAM_RAW);
$outcome->response = enrol_cohort_search_cohorts($manager, $offset, 25, $search);
// Some browsers reorder collections by key.
$outcome->response['cohorts'] = array_values($outcome->response['cohorts']);
break;
case 'enrolcohort':
require_capability('moodle/course:enrolconfig', $context);

View File

@ -229,7 +229,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
var rawcohorts = response.cohorts;
var cohorts = [], i=0;
for (i in rawcohorts) {
cohorts[rawcohorts[i].cohortid] = new COHORT(rawcohorts[i]);
cohorts[i] = new COHORT(rawcohorts[i]);
}
this.set(COHORTS, cohorts);
},