From 682b7373162744d2d885addf3f0273a4b66b1f19 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 15 Mar 2013 11:58:06 +0000 Subject: [PATCH] MDL-38412 fix quiz reports group mode weirdness. Moodle currently selected group uses the session. This can cause weird effects when you have two tabs open. This is particularly weird in the quiz reports, where some actions like delete attempt are checked against the currently selected group. The solution is to put the currently selected group into the URL for all actions like delete/regrade attempt, regrade all attempts, download and sort table. --- mod/quiz/report/attemptsreport_options.php | 6 +++++- mod/quiz/report/overview/report.php | 2 +- mod/quiz/report/responses/report.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mod/quiz/report/attemptsreport_options.php b/mod/quiz/report/attemptsreport_options.php index ffd4287cc18..c37bfe35bdb 100644 --- a/mod/quiz/report/attemptsreport_options.php +++ b/mod/quiz/report/attemptsreport_options.php @@ -113,12 +113,16 @@ class mod_quiz_attempts_report_options { * @return array URL parameter name => value. */ protected function get_url_params() { - return array( + $params = array( 'id' => $this->cm->id, 'mode' => $this->mode, 'attempts' => $this->attempts, 'onlygraded' => $this->onlygraded, ); + if (groups_get_activity_groupmode($this->cm, $this->course)) { + $params['group'] = $this->group; + } + return $params; } /** diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 27b4df5cbe1..fe1ee964dd2 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -69,7 +69,7 @@ class quiz_overview_report extends quiz_attempts_report { $courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id))); $table = new quiz_overview_table($quiz, $this->context, $this->qmsubselect, - $options, $groupstudents, $students, $questions, $this->get_base_url()); + $options, $groupstudents, $students, $questions, $options->get_url()); $filename = quiz_report_download_filename(get_string('overviewfilename', 'quiz_overview'), $courseshortname, $quiz->name); $table->is_downloading($options->download, $filename, diff --git a/mod/quiz/report/responses/report.php b/mod/quiz/report/responses/report.php index 4dda3444c01..854246d0bf9 100644 --- a/mod/quiz/report/responses/report.php +++ b/mod/quiz/report/responses/report.php @@ -77,7 +77,7 @@ class quiz_responses_report extends quiz_attempts_report { $courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id))); $table = new quiz_responses_table($quiz, $this->context, $this->qmsubselect, - $options, $groupstudents, $students, $questions, $this->get_base_url()); + $options, $groupstudents, $students, $questions, $options->get_url()); $filename = quiz_report_download_filename(get_string('responsesfilename', 'quiz_responses'), $courseshortname, $quiz->name); $table->is_downloading($options->download, $filename,