MDL-74171 core_question: qbank_plugins page table sort.

This commit is contained in:
Luca Bösch 2022-03-11 09:02:16 +01:00
parent a23f0bff3e
commit 102c93edb5

View file

@ -134,6 +134,18 @@ class manage_qbank_plugins_page extends \admin_setting {
$table->data[] = $row;
$count++;
}
// Sort table data.
usort($table->data, function($a, $b) {
$aid = $a->cells[0]->text;
$bid = $b->cells[0]->text;
if ($aid == $bid) {
return 0;
}
return $aid < $bid ? -1 : 1;
});
$return .= \html_writer::table($table);
return highlight($query, $return);
}