]> git.mjollnir.org Git - moodle.git/commitdiff
mod/quiz/review only display grade summary if student allowed to see scores
authormjollnir_ <mjollnir_>
Tue, 18 Apr 2006 22:50:04 +0000 (22:50 +0000)
committermjollnir_ <mjollnir_>
Tue, 18 Apr 2006 22:50:04 +0000 (22:50 +0000)
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

mod/quiz/review.php

index f601d56c5cdabd7bf6fabc33b98eeb2692736fa0..d6a2ad048b76d1186d13150433cece9534b11005 100644 (file)
     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