From: mjollnir_ Date: Tue, 18 Apr 2006 22:50:04 +0000 (+0000) Subject: mod/quiz/review only display grade summary if student allowed to see scores X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=15db443c8777ad5f4f78bab449b0364b42c21faf;p=moodle.git mod/quiz/review only display grade summary if student allowed to see scores Change to review.php so that the student will only see the grade summary if they are allowed to view their scores - as determined by quiz options set by the teacher. Credit: Peter Bulmer peterbulmer@catalyst.net.nz --- diff --git a/mod/quiz/review.php b/mod/quiz/review.php index f601d56c5c..d6a2ad048b 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -181,17 +181,20 @@ if (!empty($overtime)) { $table->data[] = array("$stroverdue:", $overtime); } - if ($quiz->grade and $quiz->sumgrades) { - if($overtime) { - $result->sumgrades = "0"; - $result->grade = "0.0"; + //if the student is allowed to see their score + if ($options->scores) { + if ($quiz->grade and $quiz->sumgrades) { + if($overtime) { + $result->sumgrades = "0"; + $result->grade = "0.0"; + } + + $percentage = round(($attempt->sumgrades/$quiz->sumgrades)*100, 0); + $grade = round(($attempt->sumgrades/$quiz->sumgrades)*$quiz->grade, $CFG->quiz_decimalpoints); + $rawscore = round($attempt->sumgrades, $CFG->quiz_decimalpoints); + $table->data[] = array("$strscore:", "$rawscore/$quiz->sumgrades ($percentage %)"); + $table->data[] = array("$strgrade:", $grade.get_string('outof', 'quiz').$quiz->grade); } - - $percentage = round(($attempt->sumgrades/$quiz->sumgrades)*100, 0); - $grade = round(($attempt->sumgrades/$quiz->sumgrades)*$quiz->grade, $CFG->quiz_decimalpoints); - $rawscore = round($attempt->sumgrades, $CFG->quiz_decimalpoints); - $table->data[] = array("$strscore:", "$rawscore/$quiz->sumgrades ($percentage %)"); - $table->data[] = array("$strgrade:", $grade.get_string('outof', 'quiz').$quiz->grade); } if ($isteacher and $attempt->userid == $USER->id) { // the teacher is at the end of a preview. Print button to start new preview