From a558acf93f5820ca84315c1813d3169425b806a3 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 3 May 2012 12:02:29 +0100 Subject: [PATCH] MDL-32739 quiz reports: process_actions broken. Regression from MDL-3030 --- mod/quiz/locallib.php | 4 ++-- mod/quiz/report/attemptsreport.php | 6 ++++-- mod/quiz/report/overview/report.php | 14 +++++++------- mod/quiz/report/responses/report.php | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 29457b03548..25f3cf50aea 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -681,7 +681,7 @@ function quiz_update_all_final_grades($quiz) { $join WHERE $where - quiza.quiza.state = :statefinished AND + quiza.state = :statefinished AND quiza.preview = 0 AND quiza.quiz = :quizid3 GROUP BY quiza.userid"; @@ -697,7 +697,7 @@ function quiz_update_all_final_grades($quiz) { SELECT DISTINCT userid FROM {quiz_attempts} quiza2 WHERE - quiza2.quiza.state = :statefinished2 AND + quiza2.state = :statefinished2 AND quiza2.preview = 0 AND quiza2.quiz = :quizid2 ) users diff --git a/mod/quiz/report/attemptsreport.php b/mod/quiz/report/attemptsreport.php index 66ea124cd7c..fe223b78394 100644 --- a/mod/quiz/report/attemptsreport.php +++ b/mod/quiz/report/attemptsreport.php @@ -277,17 +277,19 @@ abstract class quiz_attempts_report extends quiz_default_report { /** * Process any submitted actions. * @param object $quiz the quiz settings. + * @param object $cm the cm object for the quiz. * @param int $currentgroup the currently selected group. * @param array $groupstudents the students in the current group. * @param array $allowed the users whose attempt this user is allowed to modify. + * @param moodle_url $redirecturl where to redircet to after a successful action. */ - protected function process_actions($quiz, $currentgroup, $groupstudents, $allowed) { + protected function process_actions($quiz, $cm, $currentgroup, $groupstudents, $allowed, $redirecturl) { if (empty($currentgroup) || $groupstudents) { if (optional_param('delete', 0, PARAM_BOOL) && confirm_sesskey()) { if ($attemptids = optional_param_array('attemptid', array(), PARAM_INT)) { require_capability('mod/quiz:deleteattempts', $this->context); $this->delete_selected_attempts($quiz, $cm, $attemptids, $allowed); - redirect($options->get_url()); + redirect($redirecturl); } } } diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 0fb535ef0ed..4427df6b911 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -78,7 +78,7 @@ class quiz_overview_report extends quiz_attempts_report { raise_memory_limit(MEMORY_EXTRA); } - $this->process_actions($quiz, $currentgroup, $groupstudents, $allowed); + $this->process_actions($quiz, $cm, $currentgroup, $groupstudents, $allowed, $options->get_url()); // Start output. if (!$table->is_downloading()) { @@ -266,15 +266,15 @@ class quiz_overview_report extends quiz_attempts_report { return true; } - protected function process_actions($quiz, $currentgroup, $groupstudents, $allowed) { - parent::process_actions($quiz, $currentgroup, $groupstudents, $allowed); + protected function process_actions($quiz, $cm, $currentgroup, $groupstudents, $allowed, $redirecturl) { + parent::process_actions($quiz, $cm, $currentgroup, $groupstudents, $allowed, $redirecturl); if (empty($currentgroup) || $groupstudents) { if (optional_param('regrade', 0, PARAM_BOOL) && confirm_sesskey()) { if ($attemptids = optional_param_array('attemptid', array(), PARAM_INT)) { require_capability('mod/quiz:regrade', $this->context); $this->regrade_attempts($quiz, false, $groupstudents, $attemptids); - redirect($options->get_url()); + redirect($redirecturl, '', 5); } } } @@ -282,17 +282,17 @@ class quiz_overview_report extends quiz_attempts_report { if (optional_param('regradeall', 0, PARAM_BOOL) && confirm_sesskey()) { require_capability('mod/quiz:regrade', $this->context); $this->regrade_attempts($quiz, false, $groupstudents); - redirect($options->get_url(), '', 5); + redirect($redirecturl, '', 5); } else if (optional_param('regradealldry', 0, PARAM_BOOL) && confirm_sesskey()) { require_capability('mod/quiz:regrade', $this->context); $this->regrade_attempts($quiz, true, $groupstudents); - redirect($options->get_url(), '', 5); + redirect($redirecturl, '', 5); } else if (optional_param('regradealldrydo', 0, PARAM_BOOL) && confirm_sesskey()) { require_capability('mod/quiz:regrade', $this->context); $this->regrade_attempts_needing_it($quiz, $groupstudents); - redirect($options->get_url(), '', 5); + redirect($redirecturl, '', 5); } } diff --git a/mod/quiz/report/responses/report.php b/mod/quiz/report/responses/report.php index 800637b5f6a..4dda3444c01 100644 --- a/mod/quiz/report/responses/report.php +++ b/mod/quiz/report/responses/report.php @@ -86,7 +86,7 @@ class quiz_responses_report extends quiz_attempts_report { raise_memory_limit(MEMORY_EXTRA); } - $this->process_actions($quiz, $currentgroup, $groupstudents, $allowed); + $this->process_actions($quiz, $cm, $currentgroup, $groupstudents, $allowed, $options->get_url()); // Start output. if (!$table->is_downloading()) {