Commit 80d76515 authored by jun's avatar jun
Browse files

MDL-66790 quizreport: Prevent sorting for checkbox column

parent 8111abc3
......@@ -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');
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
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