MDL-47494 ddimageortext: Final form improvement tweaks. #6614

This commit is contained in:
Tim Hunt
2013-05-22 14:02:38 +01:00
parent 4139151f75
commit e9a2711b85
3 changed files with 11 additions and 11 deletions
@@ -131,7 +131,7 @@ class qtype_ddimageortext_edit_form extends qtype_ddtoimage_edit_form_base {
$mform->addElement('header', 'draggableitemheader',
get_string('draggableitems', 'qtype_ddimageortext'));
$mform->addElement('advcheckbox', 'shuffleanswers', ' ',
get_string('shuffleimages', 'qtype_'.$this->qtype()));
get_string('shuffleimages', 'qtype_'.$this->qtype()));
$mform->setDefault('shuffleanswers', 0);
$this->repeat_elements($this->draggable_item($mform), $itemrepeatsatstart,
$this->draggable_items_repeated_options(),
@@ -51,14 +51,14 @@ abstract class qtype_ddtoimage_edit_form_base extends question_edit_form {
/**
* definition_inner adds all specific fields to the form.
* @param object $mform (the form being built).
* @param MoodleQuickForm $mform (the form being built).
*/
protected function definition_inner($mform) {
$mform->addElement('header', 'previewareaheader',
get_string('previewareaheader', 'qtype_'.$this->qtype()));
$mform->addElement('static', 'previewarea',
get_string('previewarea', 'qtype_'.$this->qtype()),
$mform->setExpanded('previewareaheader');
$mform->addElement('static', 'previewarea', '',
get_string('previewareamessage', 'qtype_'.$this->qtype()));
$mform->registerNoSubmitButton('refresh');
@@ -102,7 +102,7 @@ abstract class qtype_ddtoimage_edit_form_base extends question_edit_form {
abstract protected function drop_zones_repeated_options();
abstract protected function definition_draggable_items($mform, $itemrepeatsatstart) ;
abstract protected function definition_draggable_items($mform, $itemrepeatsatstart);
abstract protected function draggable_item($mform);
@@ -115,11 +115,12 @@ abstract class qtype_ddtoimage_edit_form_base extends question_edit_form {
$countimages = max($countimages, $drag->no);
}
}
if ($this->question->formoptions->repeatelements) {
$itemrepeatsatstart = max(self::START_NUM_ITEMS, $countimages + self::ADD_NUM_ITEMS);
} else {
$itemrepeatsatstart = $countimages;
if (!$countimages) {
$countimages = self::START_NUM_ITEMS;
}
$itemrepeatsatstart = $countimages;
$imagerepeats = optional_param('noitems', $itemrepeatsatstart, PARAM_INT);
$addfields = optional_param('additems', '', PARAM_TEXT);
if (!empty($addfields)) {
@@ -58,8 +58,7 @@ $string['pluginname_link'] = 'question/type/ddimageortext';
$string['pluginnameadding'] = 'Adding drag and drop onto image';
$string['pluginnameediting'] = 'Editing drag and drop onto image';
$string['pluginnamesummary'] = 'Images or text labels are dragged and dropped into drop zones on a background image.';
$string['previewarea'] = '';
$string['previewareaheader'] = 'Background image';
$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';