diff --git a/lang/en/help/quiz/review.html b/lang/en/help/quiz/review.html
new file mode 100644
index 00000000000..6376609f602
--- /dev/null
+++ b/lang/en/help/quiz/review.html
@@ -0,0 +1,6 @@
+
Allow review once quiz is closed
+
+
If you enable this option, then students will be able to
+ review their past attempts at this quiz.
+
+
This is only enabled once the quiz is closed.
diff --git a/lang/en/quiz.php b/lang/en/quiz.php
index e5eb1ace21a..9af28c6c19d 100644
--- a/lang/en/quiz.php
+++ b/lang/en/quiz.php
@@ -6,6 +6,7 @@ $string['modulenameplural'] = "Quizzes";
#------------------------------------------------------------
$string['addselectedtoquiz'] = "Add selected to quiz";
+$string['allowreview'] = "Allow review";
$string['alwaysavailable'] = "Always available";
$string['alreadysubmitted'] = "It is likely that you have already submitted this attempt";
$string['answer'] = "Answer";
@@ -68,6 +69,8 @@ $string['noanswers'] = "No answers were selected!";
$string['noattempts'] = "No attempts have been made on this quiz";
$string['nomoreattempts'] = "No more attempts are allowed";
$string['noquestions'] = "No questions have been added yet";
+$string['noreview'] = "You are not allowed to review this quiz";
+$string['noreviewuntil'] = "You are not allowed to review this quiz until \$a";
$string['publish'] = "Publish";
$string['question'] = "Question";
$string['questioninuse'] = "The question '\$a' is currently being used:";
diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php
index 241d31b54e4..58cc00a3982 100644
--- a/mod/quiz/lib.php
+++ b/mod/quiz/lib.php
@@ -453,10 +453,10 @@ function quiz_print_question($number, $questionid, $grade, $courseid,
$answer = $answers[$answerid];
$qnum = $key + 1;
- if ($feedback and $response[$answerid]) {
- $checked = "CHECKED";
- } else {
+ if (empty($feedback) or empty($response[$answerid])) {
$checked = "";
+ } else {
+ $checked = "CHECKED";
}
echo "
";
if ($options->single) {
@@ -465,14 +465,14 @@ function quiz_print_question($number, $questionid, $grade, $courseid,
echo "id"."a$answer->id VALUE=\"$answer->id\">";
}
echo "
";
- if ($feedback and $correct[$answer->id]) {
- echo "
$qnum. $answer->answer
";
- } else {
+ if (empty($feedback) or empty($correct[$answer->id])) {
echo "
$qnum. $answer->answer
";
+ } else {
+ echo "
$qnum. $answer->answer
";
}
- if ($feedback) {
+ if (!empty($feedback)) {
echo "
";
- if ($response[$answerid]) {
+ if (!empty($response[$answerid])) {
quiz_print_comment($feedback[$answerid]);
}
echo "
";
@@ -498,7 +498,7 @@ function quiz_print_question($number, $questionid, $grade, $courseid,
function quiz_print_quiz_questions($quiz, $results=NULL) {
// Prints a whole quiz on one page.
- if (!$quiz->questions) {
+ if (empty($quiz->questions)) {
notify("No questions have been defined!", "view.php?id=$cm->id");
return false;
}
@@ -520,12 +520,20 @@ function quiz_print_quiz_questions($quiz, $results=NULL) {
$response = NULL;
$actualgrades = NULL;
$correct = NULL;
- if ($results) {
- $feedback = $results->feedback[$questionid];
- $response = $results->response[$questionid];
- $actualgrades = $results->grades[$questionid];
+ if (!empty($results)) {
+ if (!empty($results->feedback[$questionid])) {
+ $feedback = $results->feedback[$questionid];
+ }
+ if (!empty($results->response[$questionid])) {
+ $response = $results->response[$questionid];
+ }
+ if (!empty($results->grades[$questionid])) {
+ $actualgrades = $results->grades[$questionid];
+ }
if ($quiz->correctanswers) {
- $correct = $results->correct[$questionid];
+ if (!empty($results->correct[$questionid])) {
+ $correct = $results->correct[$questionid];
+ }
}
}
@@ -536,7 +544,7 @@ function quiz_print_quiz_questions($quiz, $results=NULL) {
echo " ";
}
- if (!$results) {
+ if (empty($results)) {
echo "