1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 09:23:09 +02:00

Merge branch 'MDL-34054' of git://github.com/timhunt/moodle

This commit is contained in:
Dan Poltawski 2012-07-02 14:56:50 +08:00
commit 337b34fac0
2 changed files with 4 additions and 3 deletions

@ -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));
}
/**

@ -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));
}