]> git.mjollnir.org Git - moodle.git/commitdiff
question/type/qtype hide scores when requested by teacher
authormjollnir_ <mjollnir_>
Wed, 3 May 2006 02:44:25 +0000 (02:44 +0000)
committermjollnir_ <mjollnir_>
Wed, 3 May 2006 02:44:25 +0000 (02:44 +0000)
Changed question/type/questiontype.php such that when review.php
displays a state-by-state review of answers submitted,
scores are not displayed unless allowed by quiz options.

Credit: Peter Bulmer <peter.bulmer@catalyst.net.nz>

question/type/questiontype.php

index d21c1ce31d3734430ab8519ac66b67916fa6f232..1713a1e0c41ec339cd779707ca35ba06d8368c6f 100644 (file)
@@ -504,16 +504,25 @@ class default_questiontype {
             if (count($states) > 1) {
                 $strreviewquestion = get_string('reviewresponse', 'quiz');
                 unset($table);
-                $table->head  = array (
-                    get_string('numberabbr', 'quiz'),
-                    get_string('action', 'quiz'),
-                    get_string('response', 'quiz'),
-                    get_string('time'),
-                    get_string('score', 'quiz'),
-                    //get_string('penalty', 'quiz'),
-                    get_string('grade', 'quiz'),
-                );
                 $table->width = '100%';
+                if ($options->scores) {
+                    $table->head  = array (
+                                           get_string('numberabbr', 'quiz'),
+                                           get_string('action', 'quiz'),
+                                           get_string('response', 'quiz'),
+                                           get_string('time'),
+                                           get_string('score', 'quiz'),
+                                           //get_string('penalty', 'quiz'),
+                                           get_string('grade', 'quiz'),
+                                           );
+                } else {
+                    $table->head  = array (
+                                           get_string('numberabbr', 'quiz'),
+                                           get_string('action', 'quiz'),
+                                           get_string('response', 'quiz'),
+                                           get_string('time'),
+                                           );
+
                 foreach ($states as $st) {
                     $st->responses[''] = $st->answer;
                     $this->restore_session_and_responses($question, $st);
@@ -529,15 +538,24 @@ class default_questiontype {
                             $link = $st->seq_number;
                         }
                     }
-                    $table->data[] = array (
-                        $link,
-                        $b.get_string('event'.$st->event, 'quiz').$be,
-                        $b.$this->response_summary($question, $st).$be,
-                        $b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
-                        $b.round($st->raw_grade, $cmoptions->decimalpoints).$be,
-                        //$b.round($st->penalty, $cmoptions->decimalpoints).$be,
-                        $b.round($st->grade, $cmoptions->decimalpoints).$be
-                    );
+                    if ($options->scores) {
+                        $table->data[] = array (
+                                                $link,
+                                                $b.get_string('event'.$st->event, 'quiz').$be,
+                                                $b.$this->response_summary($question, $st).$be,
+                                                $b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
+                                                $b.round($st->raw_grade, $cmoptions->decimalpoints).$be,
+                                                //$b.round($st->penalty, $cmoptions->decimalpoints).$be,
+                                                $b.round($st->grade, $cmoptions->decimalpoints).$be
+                                                );
+                    } else {
+                        $table->data[] = array (
+                                                $link,
+                                                $b.get_string('event'.$st->event, 'quiz').$be,
+                                                $b.$this->response_summary($question, $st).$be,
+                                                $b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
+                                                );
+                    }
                 }
                 $history = make_table($table);
             }