diff --git a/report/attempts/attempts_table.php b/report/attempts/attempts_table.php index 16e974c..258e3bc 100644 --- a/report/attempts/attempts_table.php +++ b/report/attempts/attempts_table.php @@ -93,6 +93,15 @@ public function other_cols($colname, $attempt): ?string { }; } + /** + * TODO: Fix this workaround for preventing errors with name column preferences. + * + * @return string + */ + public function get_sql_where(): string { + return ''; + } + /** * Format a single column, used in other_cols * diff --git a/report/attempts/report.php b/report/attempts/report.php index 8e504ba..285f79e 100644 --- a/report/attempts/report.php +++ b/report/attempts/report.php @@ -112,7 +112,6 @@ public function display($capquiz, $cm, $course, $download): bool { } if ($hasquestions && !empty($questions) && ($hasstudents || $this->options->attempts == self::ALL_WITH)) { - $table->setup_sql_queries($studentsjoins); // Define table columns. @@ -127,7 +126,7 @@ public function display($capquiz, $cm, $course, $download): bool { $this->add_user_columns($table, $columns, $headers); if ($table->is_downloading()) { - $this->add_uesrid_column($columns, $headers); + $this->add_userid_column($columns, $headers); $this->add_moodlequestionid_column($columns, $headers); } @@ -179,6 +178,7 @@ public function display($capquiz, $cm, $course, $download): bool { $table->collapsible(true); $table->out($this->options->pagesize, true); + } return true; } diff --git a/report/attemptsreport.php b/report/attemptsreport.php index 6e4182e..9fe5bef 100644 --- a/report/attemptsreport.php +++ b/report/attemptsreport.php @@ -25,11 +25,11 @@ namespace mod_capquiz\report; +use capquizreport_attempts\capquizreport_attempts_options; use context_module; use core\context\module; use core\dml\sql_join; use mod_capquiz\capquiz; -use mod_quiz\local\reports\attempts_report_options; use mod_quiz\local\reports\attempts_report_options_form; use moodle_url; use stdClass; @@ -69,7 +69,7 @@ abstract class capquiz_attempts_report extends report { /** @var attempts_report_options_form The settings form to use. */ protected $form; - /** @var attempts_report_options the options affecting this report. */ + /** @var ?capquizreport_attempts_options the options affecting this report. */ protected $options = null; /** @@ -113,12 +113,12 @@ protected function get_base_url(): moodle_url { * @param stdClass $cm the course_module information. * @param stdClass $course the course settings. * @param capquiz $capquiz the capquiz settings. - * @param attempts_report_options $options the current report settings. + * @param capquiz_attempts_report_options $options the current report settings. * @param bool $hasquestions whether there are any questions in the capquiz. * @param bool $hasstudents whether there are any relevant students. */ protected function print_standard_header_and_messages(stdClass $cm, stdClass $course, capquiz $capquiz, - attempts_report_options $options, bool $hasquestions, + capquiz_attempts_report_options $options, bool $hasquestions, bool $hasstudents): void { global $OUTPUT; @@ -215,7 +215,7 @@ protected function add_moodlequestionid_column(array &$columns, array &$headers) * @param array $columns the list of columns. Added to. * @param array $headers the columns headings. Added to. */ - protected function add_uesrid_column(array &$columns, array &$headers): void { + protected function add_userid_column(array &$columns, array &$headers): void { $columns[] = 'userid'; $headers[] = get_string('userid', 'capquiz'); } diff --git a/report/attemptsreport_table.php b/report/attemptsreport_table.php index 173bbbf..f474ea4 100644 --- a/report/attemptsreport_table.php +++ b/report/attemptsreport_table.php @@ -85,6 +85,9 @@ abstract class capquiz_attempts_report_table extends table_sql { /** @var bool whether to include the column with checkboxes to select each attempt. */ protected $includecheckboxes; + /** @var string date format. */ + protected $strtimeformat; + /** * Constructor. * diff --git a/report/questions/questions_options.php b/report/questions/questions_options.php index bd1754e..7a77f78 100644 --- a/report/questions/questions_options.php +++ b/report/questions/questions_options.php @@ -43,13 +43,13 @@ class capquizreport_questions_options extends capquiz_attempts_report_options { /** @var bool whether to show the question text columns. */ - public bool $showqtext = false; + public $showqtext = false; /** * @var string quiz_attempts_report::ALL_WITH or quiz_attempts_report::ENROLLED_WITH * quiz_attempts_report::ENROLLED_WITHOUT or quiz_attempts_report::ENROLLED_ALL */ - public string $attempts = capquiz_attempts_report::ALL_WITH; + public $attempts = capquiz_attempts_report::ALL_WITH; /** * Get the current value of the settings to pass to the settings form. diff --git a/report/questions/questions_table.php b/report/questions/questions_table.php index ec5e339..6f39675 100644 --- a/report/questions/questions_table.php +++ b/report/questions/questions_table.php @@ -89,7 +89,7 @@ public function build_table(): void { * @param string $colname * @param stdClass $attempt */ - public function other_cols(string $colname, stdClass $attempt): ?string { + public function other_cols($colname, $attempt): ?string { return match ($colname) { 'question' => $this->data_col($attempt->slot, 'questionsummary', $attempt), default => null, @@ -159,7 +159,6 @@ public function col_answerstate(stdClass $attempt): string { } } - /** * Generate the display of the question rating column. * diff --git a/report/questions/report.php b/report/questions/report.php index 051580d..6305e22 100644 --- a/report/questions/report.php +++ b/report/questions/report.php @@ -28,7 +28,7 @@ use context_course; use mod_capquiz\capquiz; use mod_capquiz\report\capquiz_attempts_report; -use mod_quiz\local\reports\attempts_report_options; +use mod_capquiz\report\capquiz_attempts_report_options; use stdClass; defined('MOODLE_INTERNAL') || die(); @@ -170,11 +170,12 @@ public function display($capquiz, $cm, $course, $download): bool { * @param stdClass $cm the course_module information. * @param stdClass $course the course settings. * @param capquiz $capquiz the capquiz settings. - * @param attempts_report_options $options the current report settings. + * @param capquiz_attempts_report_options $options the current report settings. * @param bool $hasquestions whether there are any questions in the capquiz. * @param bool $hasstudents whether there are any relevant students. */ - protected function print_standard_header_and_messages($cm, $course, capquiz $capquiz, attempts_report_options $options, + protected function print_standard_header_and_messages($cm, $course, capquiz $capquiz, + capquiz_attempts_report_options $options, bool $hasquestions, bool $hasstudents): void { global $OUTPUT; $this->print_header_and_tabs($cm, $course, $capquiz, $this->mode);