Skip to content

Commit

Permalink
MDL-47494 ddimageortext: Final form improvement tweaks. #6614
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed May 22, 2013
1 parent 4139151 commit e9a2711
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion question/type/ddimageortext/edit_ddimageortext_form.php
Expand Up @@ -131,7 +131,7 @@ protected function definition_draggable_items($mform, $itemrepeatsatstart) {
$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(),
Expand Down
17 changes: 9 additions & 8 deletions question/type/ddimageortext/edit_ddtoimage_form_base.php
Expand Up @@ -51,14 +51,14 @@ public static function file_picker_options() {

/**
* 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');
Expand Down Expand Up @@ -102,7 +102,7 @@ abstract protected function drop_zone($mform, $imagerepeats);

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);

Expand All @@ -115,11 +115,12 @@ protected function get_drag_item_repeats() {
$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)) {
Expand Down
3 changes: 1 addition & 2 deletions question/type/ddimageortext/lang/en/qtype_ddimageortext.php
Expand Up @@ -58,8 +58,7 @@
$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';
Expand Down

0 comments on commit e9a2711

Please sign in to comment.