MDL-34054 quiz reports: missing context.

quiz_report_should_show_grades needs to know the context, so pass it
through.
This commit is contained in:
Tim Hunt
2012-07-02 14:57:29 +08:00
committed by Dan Poltawski
parent c3f59e043c
commit 564b878840
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ class mod_quiz_attempts_report_options {
$this->cm = $cm;
$this->course = $course;
$this->usercanseegrades = quiz_report_should_show_grades($quiz);
$this->usercanseegrades = quiz_report_should_show_grades($quiz, context_module::instance($cm->id));
}
/**
+3 -2
View File
@@ -401,9 +401,10 @@ function quiz_no_questions_message($quiz, $cm, $context) {
* Should the grades be displayed in this report. That depends on the quiz
* display options, and whether the quiz is graded.
* @param object $quiz the quiz settings.
* @param context $context the quiz context.
* @return bool
*/
function quiz_report_should_show_grades($quiz) {
function quiz_report_should_show_grades($quiz, context $context) {
if ($quiz->timeclose && time() > $quiz->timeclose) {
$when = mod_quiz_display_options::AFTER_CLOSE;
} else {
@@ -413,5 +414,5 @@ function quiz_report_should_show_grades($quiz) {
return quiz_has_grades($quiz) &&
($reviewoptions->marks >= question_display_options::MARK_AND_MAX ||
has_capability('moodle/grade:viewhidden', $this->context));
has_capability('moodle/grade:viewhidden', $context));
}