From b60af635df537f1ebdd16a3b052fe65e254b4f02 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 18 Jul 2007 13:57:24 +0000 Subject: [PATCH] MDL-10515 - Change HTML to make it easier to style multiple choice questions. Merged from MOODLE_18_STABLE --- question/type/multichoice/questiontype.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/question/type/multichoice/questiontype.php b/question/type/multichoice/questiontype.php index 18af0e19be..5dd0910d12 100644 --- a/question/type/multichoice/questiontype.php +++ b/question/type/multichoice/questiontype.php @@ -308,8 +308,7 @@ class question_multichoice_qtype extends default_questiontype { $a->feedbackimg = ''; // Print the control - $a->control = "id\" $name $checked $type value=\"$aid\"" . - " alt=\"" . s($answer->answer) . '" />'; + $a->control = "id\" $name $checked $type value=\"$aid\" />"; if ($options->correct_responses && $answer->fraction > 0) { $a->class = question_get_feedback_class(1); @@ -319,8 +318,8 @@ class question_multichoice_qtype extends default_questiontype { } // Print the answer text - $a->text = format_text($this->number_in_style($key, $question->options->answernumbering) . $answer->answer, - FORMAT_MOODLE, $formatoptions, $cmoptions->course); + $a->text = $this->number_in_style($key, $question->options->answernumbering) . + format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course); // Print feedback if feedback is on if (($options->feedback || $options->correct_responses) && $checked) { @@ -602,6 +601,10 @@ class question_multichoice_qtype extends default_questiontype { function get_numbering_styles() { return array('abc', 'ABC', '123', 'none'); } + + function number_html($qnum) { + return '' . $qnum . '. '; + } /** * @param int $num The number, starting at 0. @@ -611,11 +614,11 @@ class question_multichoice_qtype extends default_questiontype { function number_in_style($num, $style) { switch($style) { case 'abc': - return chr(ord('a') + $num) . '. '; + return $this->number_html(chr(ord('a') + $num)); case 'ABC': - return chr(ord('A') + $num) . '. '; + return $this->number_html(chr(ord('A') + $num)); case '123': - return ($num + 1) . '. '; + return $this->number_html(($num + 1)); case 'none': return ''; default: -- 2.39.5