]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15539 - Rework review.php to use attemptlib.php - clean up how review options...
authortjhunt <tjhunt>
Tue, 8 Jul 2008 17:46:59 +0000 (17:46 +0000)
committertjhunt <tjhunt>
Tue, 8 Jul 2008 17:46:59 +0000 (17:46 +0000)
mod/quiz/locallib.php
mod/quiz/reviewquestion.php
mod/quiz/view.php

index 9ed0bd7bdd334cb56920a7fa8cefd582ab7a4aba..a0e17ee8375ad65dd79fa71ae499797ef4d06a3d 100644 (file)
@@ -778,9 +778,6 @@ function quiz_get_renderoptions($reviewoptions, $state) {
     // Show feedback once the question has been graded (if allowed by the quiz)
     $options->feedback = question_state_is_graded($state) && ($reviewoptions & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
 
-    // Show validation only after a validation event
-    $options->validation = QUESTION_EVENTVALIDATE === $state->event;
-
     // Show correct responses in readonly mode if the quiz allows it
     $options->correct_responses = $options->readonly && ($reviewoptions & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
 
@@ -794,6 +791,7 @@ function quiz_get_renderoptions($reviewoptions, $state) {
     $options->responses = true;
     $options->scores = true;
     $options->quizstate = QUIZ_STATE_DURING;
+    $options->history = false;
 
     return $options;
 }
@@ -821,8 +819,11 @@ function quiz_get_reviewoptions($quiz, $attempt, $context=null) {
         $options->questioncommentlink = '/mod/quiz/comment.php';
     }
 
-    if (!is_null($context) && has_capability('mod/quiz:viewreports', $context) &&
-            has_capability('moodle/grade:viewhidden', $context) && !$attempt->preview) {
+    // Whether to display a response history.
+    $canviewreports = !is_null($context) && has_capability('mod/quiz:viewreports', $context);
+    $options->history = ($canviewreports && !$attempt->preview) ? 'all' : 'graded';
+
+    if ($canviewreports && 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;
index ae9f97eaf059c2edd55e449eceac1ff6d8fd5d78..588a477d15c5ff67392ebf9220dd2c49713a504c 100644 (file)
@@ -2,15 +2,12 @@
 /**
  * This page prints a review of a particular question attempt
  *
- * @author Martin Dougiamas and many others. This has recently been completely
- *         rewritten by Alex Smith, Julian Sedding and Gustav Delius as part of
- *         the Serving Mathematics project
- *         {@link http://maths.york.ac.uk/serving_maths}
+ * @author Martin Dougiamas and many others.
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * @package quiz
  */
 
-    require_once('../../config.php');
+    require_once(dirname(__FILE__) . '/../../config.php');
     require_once('locallib.php');
 
     // Either stateid or (attemptid AND questionid) must be given
     $state->last_graded = $state;
 
     $options = quiz_get_reviewoptions($quiz, $attempt, $context);
-    $options->validation = ($state->event == QUESTION_EVENTVALIDATE);
-    $options->history = (has_capability('mod/quiz:viewreports', $context) and !$attempt->preview) ? 'all' : 'graded';
 
 /// Print infobox
     $table->align  = array("right", "left");
index 317b3ab7da4f239cd2f1321d7568b929a3c80797..03962aee3d4fa07d0b566ccde0a1a08f5946bef8 100644 (file)
@@ -2,7 +2,7 @@
 
 /// This page prints a particular instance of quiz
 
-    require_once("../../config.php");
+    require_once(dirname(__FILE__) . '/../../config.php');
     require_once($CFG->libdir.'/blocklib.php');
     require_once($CFG->libdir.'/gradelib.php');
     require_once($CFG->dirroot.'/mod/quiz/locallib.php');