Introduced check before sorting to ensure core_collator class exists as it was only introduced in 2.6

This commit is contained in:
Mark Nelson 2013-07-26 16:28:09 +08:00
parent cef1d2c7d8
commit cee65c6c37
2 changed files with 15 additions and 2 deletions

15
lib.php
View file

@ -403,7 +403,7 @@ function customcert_get_elements() {
}
}
core_collator::asort($options);
customcert_perform_asort($options);
return $options;
}
@ -969,3 +969,16 @@ function customcert_generate_report_file($customcert, $users, $type) {
// Close the workbook.
$workbook->close();
}
/**
* Perform asort on a given array.
*
* @param array $fields
*/
function customcert_perform_asort(&$fields) {
if (class_exists('core_collator')) {
core_collator::asort($fields);
} else {
collatorlib::asort($fields);
}
}