Skip to content

Commit

Permalink
MDL-47494 ddimageortext: NOBUG added feedback for student when they h…
Browse files Browse the repository at this point in the history
…ave not dragged an image to each

drop zone.
  • Loading branch information
jamiepratt committed Aug 20, 2011
1 parent f655463 commit 9b2ccab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Expand Up @@ -48,6 +48,7 @@
$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>';
Expand Down
6 changes: 6 additions & 0 deletions question/type/ddimageortext/question.php
Expand Up @@ -99,6 +99,12 @@ public function check_file_access($qa, $options, $component, $filearea, $args, $
$filearea, $args, $forcedownload);
}
}
public function get_validation_error(array $response) {
if ($this->is_complete_response($response)) {
return '';
}
return get_string('pleasedraganimagetoeachdropregion', 'qtype_ddimagetoimage');
}
}


Expand Down
5 changes: 5 additions & 0 deletions question/type/ddimageortext/renderer.php
Expand Up @@ -119,6 +119,11 @@ public function formulation_and_controls(question_attempt $qa,
$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;
}

Expand Down

0 comments on commit 9b2ccab

Please sign in to comment.