From: tjhunt Date: Tue, 8 Jul 2008 17:46:59 +0000 (+0000) Subject: MDL-15539 - Rework review.php to use attemptlib.php - clean up how review options... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1aab356193ae4b8d1cff6aa01e53aac278220941;p=moodle.git MDL-15539 - Rework review.php to use attemptlib.php - clean up how review options are calculated, fix up some comments, and make some requires more robust. --- diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 9ed0bd7bdd..a0e17ee837 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -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; diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index ae9f97eaf0..588a477d15 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -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 @@ -111,8 +108,6 @@ $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"); diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 317b3ab7da..03962aee3d 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -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');