From a187ada8cf0a434cc6da449f69d767f87a1bb67f Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Wed, 23 Nov 2011 12:50:29 +0700 Subject: [PATCH 1/3] MDL-47494 ddimageortext: NOBUG if any choice is 'infinite' return null for random guess score --- question/type/ddimageortext/questionbase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/question/type/ddimageortext/questionbase.php b/question/type/ddimageortext/questionbase.php index 3f594355ba7..4ad33327f25 100644 --- a/question/type/ddimageortext/questionbase.php +++ b/question/type/ddimageortext/questionbase.php @@ -133,6 +133,11 @@ class qtype_ddtoimage_question_base extends qtype_gapselect_question_base { $accum = 0; foreach ($this->places as $place) { + foreach ($this->choices[$place->group] as $choice) { + if ($choice->infinite) { + return null; + } + } $accum += 1 / count($this->choices[$place->group]); } From 1e62114e5d0bd4a606f214fcc43a0a5cfe1e07c7 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 23 Nov 2011 17:04:35 +0000 Subject: [PATCH 2/3] MDL-47494 ddimageortext: Fix invalid HTML caused by empty_tag('div', ...). #2273 --- question/type/ddimageortext/rendererbase.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/question/type/ddimageortext/rendererbase.php b/question/type/ddimageortext/rendererbase.php index 13e899fc974..a6a2ab77c87 100644 --- a/question/type/ddimageortext/rendererbase.php +++ b/question/type/ddimageortext/rendererbase.php @@ -102,15 +102,17 @@ class qtype_ddtoimage_renderer_base extends qtype_with_combined_feedback_rendere $dragitemsclass .= ' readonly'; } $dragitems = html_writer::tag('div', $dragimagehomes, array('class'=> $dragitemsclass)); - $dropzones = html_writer::empty_tag('div', array('class'=>'dropzones')); - $output .= html_writer::tag('div', $droparea.$dragitems.$dropzones, - array('class'=>'ddarea')); + $dropzones = html_writer::tag('div', '', array('class'=>'dropzones')); + + $hiddens = ''; foreach ($question->places as $placeno => $place) { $varname = $question->field($placeno); list($fieldname, $html) = $this->hidden_field_for_qt_var($qa, $varname); - $output .= $html; + $hiddens .= $html; $question->places[$placeno]->fieldname = $fieldname; } + $output .= html_writer::tag('div', + $droparea . $dragitems . $dropzones . $hiddens, array('class'=>'ddarea')); $topnode = 'div#q'.$qa->get_slot().' div.ddarea'; $params = array('drops' => $question->places, 'topnode' => $topnode, From f8f8163e94e1c2259e5d2186d5ddb12def7b6d6b Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Tue, 29 Nov 2011 07:06:24 +0700 Subject: [PATCH 3/3] MDL-47494 ddimageortext: NOBUG lang string changes --- .../type/ddimageortext/lang/en/qtype_ddimageortext.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/question/type/ddimageortext/lang/en/qtype_ddimageortext.php b/question/type/ddimageortext/lang/en/qtype_ddimageortext.php index 9f8262bf1f5..d7e9948adc6 100644 --- a/question/type/ddimageortext/lang/en/qtype_ddimageortext.php +++ b/question/type/ddimageortext/lang/en/qtype_ddimageortext.php @@ -23,10 +23,10 @@ */ $string['addingddimageortext'] = 'Adding drag and drop onto image'; -$string['addmoredropzones'] = 'Blanks for {no} More Drop Zones'; -$string['addmoreimages'] = 'Blanks for {no} More Draggable Items'; +$string['addmoredropzones'] = 'Blanks for {no} more drop zones'; +$string['addmoreimages'] = 'Blanks for {no} more draggable items'; $string['answer'] = 'Answer'; -$string['bgimage'] = 'Background Image'; +$string['bgimage'] = 'Background image'; $string['correctansweris'] = 'The correct answer is: {$a}'; $string['ddimageortext'] = 'Drag and drop onto image'; $string['ddimageortext_help'] = 'Select a background image file, select draggable images or enter text and define the drop zones on the background image to which they must be dragged.'; @@ -57,7 +57,7 @@ $string['previewarea'] = 'Preview area -'; $string['previewareaheader'] = 'Preview'; $string['previewareamessage'] = 'Select a background image file and select draggable images or just enter text that will be made draggable. Then choose a drag item for each \'drop zone\', and drag the drag item to where the student should drag it to.'; $string['refresh'] = 'Refresh Preview'; -$string['shuffleimages'] = 'Shuffle Drag Items Each Time Question Is Attempted'; +$string['shuffleimages'] = 'Shuffle drag items each time question is attempted'; $string['summarisechoice'] = '{$a->no}. {$a->text}'; $string['summariseplace'] = '{$a->no}. {$a->text}'; $string['summarisechoiceno'] = 'Item {$a}';