2 <?php echo $questiontext; ?>
5 <div class="ablock clearfix">
7 <?php echo get_string("answer", "quiz").': '; ?>
9 <div class="que numerical clearfix">
15 if ( $question->options->unitsleft == 0 ){ ?>
18 <fieldset class="answer" id="generalheader">
19 <legend class="ftoggler">
20 <?php echo get_string('datasetnumber', 'quiz') ; ?>
22 <input type="text" class="<?php echo $class; ?>" <?php echo "$readonly $nameanswer $valueanswer"; //
23 ?> size="<?php echo $textlength;?>" />
24 <?php echo $feedbackimg; ?>
29 <?php }// display unit
31 if ($question->options->showunits == NUMERICALQUESTIONUNITNODISPLAY || (isset($question->options->units) && count($question->options->units) == 0 )) {// no unit display or tested
42 } else if ($question->options->showunits == NUMERICALQUESTIONUNITTEXTINPUTDISPLAY ) {// display unit text input
44 <div class="answer numerical ">
45 <fieldset class="clearfix" id="generalheader">
46 <legend class="ftoggler">
47 <?php echo get_string('unit', 'quiz'); ?>
49 <input type="text" class="<?php echo $classunit; ?>" <?php echo "$readonly $nameunit $valueunit"; //
50 ?> size="<?php echo $textlength;?>"/>
51 <?php echo $feedbackimgunit;
52 if ($options->feedback && $classunitvalue == 0 && ! $answerasterisk ){
53 if(isset($question->options->units) && count($question->options->units) > 0){
55 foreach($question->options->units as $key => $unit){
56 if($state->responses['unit'] == $unit->unit){
57 print_string('unitnotvalid', 'qtype_numerical');
63 print_string('unitunknown', 'qtype_numerical');
73 } else if ($question->options->showunits == NUMERICALQUESTIONUNITTEXTDISPLAY ) {// display text
77 <fieldset class="clearfix" id="generalheader">
78 <legend class="ftoggler">
79 <?php echo get_string('unit', 'quiz');
84 echo $nameunit; echo $valueunit ;
88 <?php echo $question->options->units[0]->unit ;
97 //display the units as choice
99 } else if ($question->options->showunits == NUMERICALQUESTIONUNITMULTICHOICEDISPLAY){?>
104 //display the units as choice
105 if ( isset($question->options->units)){?>
107 <fieldset class="clearfix" id="generalheader">
108 <legend class="ftoggler">
109 <?php echo get_string('unit', 'quiz');
112 <!-- <div class="que multichoice clearfix">
113 <div class="content"> class="answer"
114 <div class="ablock clearfix"> -->
118 // the order is not shuffled
119 //however the unitvalue is related to the number value
120 // if the response/unit->multiplier is true then
123 foreach ($question->options->units as $key => $unit) {
126 $classunitvalue = 0 ;
127 $type = 'type="radio"';
128 // $nameunit = "name=\"".$question->name_prefix;//."unit\"";
129 if ($response != '' && isset($state->responses['unit']) && $state->responses['unit'] != '' ){
130 // we have a unit response
131 // this unit is the one chosen
132 // test if the unit give a valid response
133 $testresponse = $response /$unit->multiplier ;
134 if($answerasterisk || ($answer->min <= $testresponse && $testresponse <= $answer->max)) {
135 $classunitvalue = $answer->fraction ;
137 // echo "<p> dans display classunitvalue $classunitvalue response $response $unit->multiplier $unit->unit state <pre>";print_r($answer);echo "</pre></p>";
138 if ($state->responses['unit'] == $unit->unit) {
139 $checked = 'checked="checked"';
143 }else if ($key == 0) {
144 $checked = 'checked="checked"';
148 $aid = $question->id ;
150 $a->id = $question->name_prefix."unit" ;//. "2"
152 $a->feedbackimg = '';
154 $a->control = "<input $readonly $nameunit $checked $type value=\"$key\" />";
156 if ($options->correct_responses && $classunitvalue > 0 ) { //$answer->fraction
157 $a->class = question_get_feedback_class($classunitvalue);
159 if (($options->feedback && $chosen) || $options->correct_responses) {
160 $a->feedbackimg = question_get_feedback_image($classunitvalue, $chosen && $options->feedback);
164 // Print the answer text
165 $a->text = format_text($unit->unit, FORMAT_MOODLE, $formatoptions, $cmoptions->course);
169 <tr class="<?php echo 'r'.$row = $row ? 0 : 1; ?>">
170 <td class="c0 control " style=" ">
171 <?php echo $a->control.' '; ?>
173 <td style=" " class="c1 text <?php echo $a->class ?>">
174 <label for="<?php echo $a->id ?>">
175 <?php echo $a->text.'<br />'; ?>
176 <?php echo $a->feedbackimg;
177 if ($options->feedback && $classunitvalue == 0 && $chosen && !$answerasterisk){
178 print_string('unitnotvalid', 'qtype_numerical');
194 <?php } // end unit choices
195 // display intructions
196 // general message first
199 if ($question->options->unitsleft == 1 ){?>
202 <fieldset class="clearfix" id="generalheader">
203 <legend class="ftoggler">
204 <?php echo get_string('datasetnumber', 'quiz'); ?>
206 <input type="text" class="<?php echo $class; ?>" <?php echo "$readonly $nameanswer $valueanswer"; //
207 ?> size="<?php echo $textlength;?>"/>
208 <?php echo $feedbackimg; ?>
213 //</div> put a div to enclose the answer and unit elements
218 <div class="feedback">
219 <fieldset class="clearfix" id="generalheader">
220 <legend class="ftoggler">
221 <?php echo get_string('instructions', 'auth'); ?>
223 <div class="feedback">
224 <fieldset class="clearfix" id="generalheader">
225 <legend class="ftoggler">
226 <?php echo get_string('validnumberformats', 'qtype_numerical');?>
228 <?php echo get_string('validnumbers', 'qtype_numerical');
234 <?php if (!empty($question->options->instructions)){?>
236 <?php echo format_text($question->options->instructions, $question->options->instructionsformat, $formatoptions, $cmoptions->course);?>
242 <?php if ($feedback) { ?>
243 <div class="feedback">
244 <?php echo $feedback ?>
247 <?php $this->print_question_submit_buttons($question, $state, $cmoptions, $options); ?>