MDL-47494 ddimageortext: NOBUG added feedback for student when they have not dragged an image to each

drop zone.
This commit is contained in:
Jamie Pratt
2011-08-20 20:52:38 +07:00
parent f65546366d
commit 9b2ccabae8
3 changed files with 12 additions and 0 deletions
@@ -48,6 +48,7 @@ $string['formerror_nobgimage'] = 'You need to select an image to use as the back
$string['infinite'] = 'Infinite';
$string['label'] = 'Label';
$string['nolabel'] = 'No label text';
$string['pleasedraganimagetoeachdropregion'] = 'Your answer is not complete, please drag an image to each drop region.';
$string['previewarea'] = 'Preview area -';
$string['previewareaheader'] = 'Preview';
$string['previewareamessage'] = '<ul><li>Select a background image file.</li><li>Select draggable images.</li><li>And define drop zones by selecting an image that the student must drag to the drop zone and drag it to where the student should drag it too.</li></ul>';
+6
View File
@@ -99,6 +99,12 @@ class qtype_ddimagetoimage_question extends qtype_gapselect_question_base {
$filearea, $args, $forcedownload);
}
}
public function get_validation_error(array $response) {
if ($this->is_complete_response($response)) {
return '';
}
return get_string('pleasedraganimagetoeachdropregion', 'qtype_ddimagetoimage');
}
}
+5
View File
@@ -119,6 +119,11 @@ class qtype_ddimagetoimage_renderer extends qtype_with_combined_feedback_rendere
$sendtojs,
true,
$jsmodule);
if ($qa->get_state() == question_state::$invalid) {
$output .= html_writer::nonempty_tag('div',
$question->get_validation_error($qa->get_last_qt_data()),
array('class' => 'validationerror'));
}
return $output;
}