From d57cf4c132669c38ee24d36efc07e939b7e72c21 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Wed, 3 May 2006 02:44:25 +0000 Subject: [PATCH] question/type/qtype hide scores when requested by teacher 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 --- question/type/questiontype.php | 54 ++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/question/type/questiontype.php b/question/type/questiontype.php index d21c1ce31d..1713a1e0c4 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -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); } -- 2.39.5