diff --git a/mod/quiz/report/attemptsreport_table.php b/mod/quiz/report/attemptsreport_table.php index 787032b5834..c0b798acb78 100644 --- a/mod/quiz/report/attemptsreport_table.php +++ b/mod/quiz/report/attemptsreport_table.php @@ -657,11 +657,15 @@ abstract class quiz_attempts_report_table extends table_sql { * * It returns the HTML for a master \core\output\checkbox_toggleall component that selects/deselects all quiz attempts. * + * @param string $columnname The name of the checkbox column. * @return string */ - public function checkbox_col_header() { + public function checkbox_col_header(string $columnname) { global $OUTPUT; + // Make sure to disable sorting on this column. + $this->no_sorting($columnname); + // Build the select/deselect all control. $selectallid = $this->uniqueid . '-selectall-attempts'; $selectalltext = get_string('selectall', 'quiz'); diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 7627fbeaa8f..50e752b87df 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -172,8 +172,9 @@ class quiz_overview_report extends quiz_attempts_report { $headers = array(); if (!$table->is_downloading() && $options->checkboxcolumn) { - $columns[] = 'checkbox'; - $headers[] = $table->checkbox_col_header(); + $columnname = 'checkbox'; + $columns[] = $columnname; + $headers[] = $table->checkbox_col_header($columnname); } $this->add_user_columns($table, $columns, $headers); diff --git a/mod/quiz/report/responses/report.php b/mod/quiz/report/responses/report.php index 38ee7768659..89f1d6e8974 100644 --- a/mod/quiz/report/responses/report.php +++ b/mod/quiz/report/responses/report.php @@ -141,8 +141,9 @@ class quiz_responses_report extends quiz_attempts_report { $headers = array(); if (!$table->is_downloading() && $options->checkboxcolumn) { - $columns[] = 'checkbox'; - $headers[] = $table->checkbox_col_header(); + $columnname = 'checkbox'; + $columns[] = $columnname; + $headers[] = $table->checkbox_col_header($columnname); } $this->add_user_columns($table, $columns, $headers); diff --git a/mod/quiz/report/upgrade.txt b/mod/quiz/report/upgrade.txt index cbd4b930abf..9c006f2de85 100644 --- a/mod/quiz/report/upgrade.txt +++ b/mod/quiz/report/upgrade.txt @@ -2,6 +2,13 @@ This files describes API changes for quiz report plugins. Overview of this plugin type at http://docs.moodle.org/dev/Quiz_reports +=== 3.8 === + +* New quiz_attempts_report_table method: \quiz_attempts_report_table::checkbox_col_header() + This generates a column header containing a checkbox that toggles the checked state of all the checkboxes corresponding to the + entries listed on a given quiz report table. It requires the name of the checkbox column as a parameter in order to disable + sorting on the checkbox column. + === 3.2 === * A code refactoring based on new sql functions in MDL-31243 and removing