From e2833e870082c4cb2a1b1dac8be8cfc3d5a8b4a8 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 9 Oct 2007 15:19:07 +0000 Subject: [PATCH] MDL-11617 - 'Student may review' heading on quiz settings form is now misleading. I have fixed some lang strings and improved the help. Also, finish off the clarification of how various capabilites affect quiz review that was started in MDL-11580. --- lang/en_utf8/help/quiz/review2.html | 1 + lang/en_utf8/help/quiz/reviewoptions.html | 18 +++++++++ lang/en_utf8/quiz.php | 1 + mod/quiz/locallib.php | 46 +++++++++++------------ mod/quiz/mod_form.php | 4 +- 5 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 lang/en_utf8/help/quiz/reviewoptions.html diff --git a/lang/en_utf8/help/quiz/review2.html b/lang/en_utf8/help/quiz/review2.html index 9ffd516e46..69ecf976b1 100644 --- a/lang/en_utf8/help/quiz/review2.html +++ b/lang/en_utf8/help/quiz/review2.html @@ -3,3 +3,4 @@

This option controls whether and when students will be able to review their past attempts at this quiz.

+ \ No newline at end of file diff --git a/lang/en_utf8/help/quiz/reviewoptions.html b/lang/en_utf8/help/quiz/reviewoptions.html new file mode 100644 index 0000000000..2ea273e45a --- /dev/null +++ b/lang/en_utf8/help/quiz/reviewoptions.html @@ -0,0 +1,18 @@ +

Allow review

+ +

These options control what information users can see when they review a +quiz attempt or look at the quiz reports.

+ +

Immediately after the attempt means within two minuets of the attempt being +finished by the user clicking 'Submit all and finish'.

+ +

Later, while the quiz is still open means after this, and before the quiz +close date.

+ +

After the quiz is closed means after the quiz close date has passed. If +the quiz does not have a close date, this state is never reached.

+ +

Users with the capability 'View hidden grades' [moodle/grade:viewhidden] +(typically teachers and administrators) are not affected by these settings +and will always by able to review all information about a student's attempt +at any time.

\ No newline at end of file diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index d3e8f9e866..d86002802a 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -488,6 +488,7 @@ $string['reviewnever'] = 'Never allow review'; $string['reviewofattempt'] = 'Review of Attempt $a'; $string['reviewopen'] = 'Later, while the quiz is still open'; $string['reviewoptions'] = 'Students may review'; +$string['reviewoptionsheading'] = 'Review options'; $string['reviewresponse'] = 'Review response'; $string['rqp'] = 'Remote Question'; $string['rqps'] = 'Remote Questions'; diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 7bba35e567..0ec0677999 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -707,45 +707,43 @@ function quiz_get_renderoptions($reviewoptions, $state) { * correct_responses, solutions and general feedback */ function quiz_get_reviewoptions($quiz, $attempt, $context=null) { - - global $CFG; - $options = new stdClass; $options->readonly = true; + // Provide the links to the question review and comment script $options->questionreviewlink = '/mod/quiz/reviewquestion.php'; - // Work out the state of the attempt. - if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) { - $quiz_state_mask = QUIZ_REVIEW_IMMEDIATELY; - $options->quizstate = QUIZ_STATE_IMMEDIATELY; - } else if (!$quiz->timeclose or time() < $quiz->timeclose) { - $quiz_state_mask = QUIZ_REVIEW_OPEN; - $options->quizstate = QUIZ_STATE_OPEN; - } else { - $quiz_state_mask = QUIZ_REVIEW_CLOSED; - $options->quizstate = QUIZ_STATE_CLOSED; + // Show a link to the comment box only for closed attempts + if ($attempt->timefinish && has_capability('mod/quiz:grade', $context)) { + $options->questioncommentlink = '/mod/quiz/comment.php'; } - if (!is_null($context) && has_capability('mod/quiz:viewreports', $context) and !$attempt->preview) { - // The teacher should be shown everything except: - // - during preview when teachers want to see what students see - // - hidden scores are controlled by the moodle/grade:viewhidden capability + if (!is_null($context) && has_capability('mod/quiz:viewreports', $context) && + has_capability('moodle/grade:viewhidden', $context) && !$attempt->preview) { + // People who can see reports and hidden grades should be shown everything, + // except during preview when teachers want to see what students see. $options->responses = true; - $options->scores = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SCORES) || - has_capability('moodle/grade:viewhidden', $context); + $options->scores = true; $options->feedback = true; $options->correct_responses = true; $options->solutions = false; $options->generalfeedback = true; $options->overallfeedback = true; $options->quizstate = QUIZ_STATE_TEACHERACCESS; - - // Show a link to the comment box only for closed attempts - if ($attempt->timefinish) { - $options->questioncommentlink = '/mod/quiz/comment.php'; - } } else { + // Work out the state of the attempt ... + if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) { + $quiz_state_mask = QUIZ_REVIEW_IMMEDIATELY; + $options->quizstate = QUIZ_STATE_IMMEDIATELY; + } else if (!$quiz->timeclose or time() < $quiz->timeclose) { + $quiz_state_mask = QUIZ_REVIEW_OPEN; + $options->quizstate = QUIZ_STATE_OPEN; + } else { + $quiz_state_mask = QUIZ_REVIEW_CLOSED; + $options->quizstate = QUIZ_STATE_CLOSED; + } + + // ... and hence extract the appropriate review options. $options->responses = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_RESPONSES) ? 1 : 0; $options->scores = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SCORES) ? 1 : 0; $options->feedback = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_FEEDBACK) ? 1 : 0; diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index ff9b30047c..002e69009d 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -140,8 +140,8 @@ class mod_quiz_mod_form extends moodleform_mod { $mform->addElement('hidden', 'grade', $CFG->quiz_maximumgrade); //------------------------------------------------------------------------------- - $mform->addElement('header', 'reviewoptionshdr', get_string("reviewoptions", "quiz")); - $mform->setHelpButton('reviewoptionshdr', array("review2", get_string("allowreview","quiz"), "quiz")); + $mform->addElement('header', 'reviewoptionshdr', get_string('reviewoptionsheading', 'quiz')); + $mform->setHelpButton('reviewoptionshdr', array('reviewoptions', get_string('reviewoptionsheading','quiz'), 'quiz')); $mform->setAdvanced('reviewoptionshdr', $CFG->quiz_fix_review); $immediatelyoptionsgrp=array(); -- 2.39.5