Commit c0388258 authored by Damyon Wiese's avatar Damyon Wiese
Browse files

MDL-51720 assign: Always fallback on userid as a default sort

Even when the table has no userid column (this is normally the edit column).
parent 336f2e07
......@@ -406,8 +406,6 @@ class assign_grading_table extends table_sql implements renderable {
foreach ($extrauserfields as $extrafield) {
$this->column_class($extrafield, $extrafield);
}
// We require at least one unique column for the sort.
$this->sortable(true, 'userid');
$this->no_sorting('recordid');
$this->no_sorting('finalgrade');
$this->no_sorting('userid');
......@@ -1364,6 +1362,16 @@ class assign_grading_table extends table_sql implements renderable {
has_capability('moodle/grade:viewall', $context);
}
/**
* Always return a valid sort - even if the userid column is missing.
* @return array column name => SORT_... constant.
*/
public function get_sort_columns() {
$result = parent::get_sort_columns();
$result = array_merge($result, array('userid' => SORT_ASC));
return $result;
}
/**
* Override the table show_hide_link to not show for select column.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment