diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php
index 78de4dba79f..e04a638c1f0 100644
--- a/question/behaviour/rendererbase.php
+++ b/question/behaviour/rendererbase.php
@@ -86,25 +86,30 @@ abstract class qbehaviour_renderer extends plugin_renderer_base {
$commenteditor = html_writer::tag('div', html_writer::tag('textarea', s($commenttext),
array('id' => $id, 'name' => $inputname, 'rows' => 10, 'cols' => 60)));
+ $commenteditor .= html_writer::end_tag('div');
- $commenteditor .= html_writer::start_tag('div');
+ $editorformat = '';
if (count($formats) == 1) {
reset($formats);
- $commenteditor .= html_writer::empty_tag('input', array('type' => 'hidden',
+ $editorformat .= html_writer::empty_tag('input', array('type' => 'hidden',
'name' => $inputname . 'format', 'value' => key($formats)));
-
} else {
- $commenteditor .= html_writer::label(get_string('formattexttype'), 'menu' . $inputname . 'format', false, array('class' => 'accesshide'));
- $commenteditor .= html_writer::select(
- $formats, $inputname . 'format', $commentformat, '');
+ $editorformat = html_writer::start_tag('div', array('class' => 'fitem'));
+ $editorformat .= html_writer::start_tag('div', array('class' => 'fitemtitle'));
+ $editorformat .= html_writer::tag('label', get_string('format'), array('for'=>'menu'.$inputname.'format'));
+ $editorformat .= html_writer::end_tag('div');
+ $editorformat .= html_writer::start_tag('div', array('class' => 'felement fhtmleditor'));
+ $editorformat .= html_writer::select($formats, $inputname.'format', $commentformat, '');
+ $editorformat .= html_writer::end_tag('div');
+ $editorformat .= html_writer::end_tag('div');
}
- $commenteditor .= html_writer::end_tag('div');
$comment = html_writer::tag('div', html_writer::tag('div',
html_writer::tag('label', get_string('comment', 'question'),
array('for' => $id)), array('class' => 'fitemtitle')) .
html_writer::tag('div', $commenteditor, array('class' => 'felement fhtmleditor')),
array('class' => 'fitem'));
+ $comment .= $editorformat;
$mark = '';
if ($qa->get_max_mark()) {
@@ -118,6 +123,7 @@ abstract class qbehaviour_renderer extends plugin_renderer_base {
'type' => 'text',
'size' => $fieldsize,
'name' => $markfield,
+ 'id'=> $markfield
);
if (!is_null($currentmark)) {
$attributes['value'] = $qa->format_fraction_as_mark(
diff --git a/question/format/xhtml/format.php b/question/format/xhtml/format.php
index a289ae6d5ac..7c929d69b94 100644
--- a/question/format/xhtml/format.php
+++ b/question/format/xhtml/format.php
@@ -115,19 +115,22 @@ class qformat_xhtml extends qformat_default {
}
shuffle( $ans_list ); // random display order
- // build drop down for answers
- $dropdown = html_writer::label(get_string('selectansweroption'), 'quest_'.$id, false, array('class' => 'accesshide'));
- $dropdown .= "\n";
- // finally display
+ // display
+ $option = 0;
foreach($question->options->subquestions as $subquestion) {
- $quest_text = $this->repchar( $subquestion->questiontext );
- $expout .= "
$quest_text\n";
- $expout .= $dropdown;
+ // build drop down for answers
+ $quest_text = $this->repchar( $subquestion->questiontext );
+ $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
+ $dropdown .= "\n";
+ $expout .= " $quest_text\n";
+ $expout .= $dropdown;
+ $option++;
}
$expout .= "\n";
break;
diff --git a/question/format/xhtml/lang/en/qformat_xhtml.php b/question/format/xhtml/lang/en/qformat_xhtml.php
index ddbadfce123..e5492eb94aa 100644
--- a/question/format/xhtml/lang/en/qformat_xhtml.php
+++ b/question/format/xhtml/lang/en/qformat_xhtml.php
@@ -26,4 +26,3 @@
$string['pluginname'] = 'XHTML format';
$string['pluginname_help'] = 'XHTML format enables all questions in the category to be exported to a single page of strict XHTML for possible use in another application.';
$string['pluginname_link'] = 'qformat/xhtml';
-$string['selectansweroption'] = 'Select answer option';
diff --git a/question/type/essay/lang/en/qtype_essay.php b/question/type/essay/lang/en/qtype_essay.php
index 735a968b389..2e8d524ca45 100644
--- a/question/type/essay/lang/en/qtype_essay.php
+++ b/question/type/essay/lang/en/qtype_essay.php
@@ -38,4 +38,3 @@ $string['pluginnameediting'] = 'Editing an Essay question';
$string['pluginnamesummary'] = 'Allows a response of a few sentences or paragraphs. This must then be graded manually.';
$string['responsefieldlines'] = 'Input box size';
$string['responseformat'] = 'Response format';
-$string['selectanswerformat'] = 'Select answer format';
diff --git a/question/type/essay/renderer.php b/question/type/essay/renderer.php
index 8b44811a5ea..a564bb12085 100644
--- a/question/type/essay/renderer.php
+++ b/question/type/essay/renderer.php
@@ -223,7 +223,8 @@ class qtype_essay_format_editor_renderer extends plugin_renderer_base {
'name' => $inputname . 'format', 'value' => key($formats)));
} else {
- $output .= html_writer::label(get_string('selectanswerformat'), 'menu' . $inputname . 'format', false, array("class" => 'accesshide'));
+ $output .= html_writer::label(get_string('format'), 'menu' . $inputname . 'format', false);
+ $output .= ' ';
$output .= html_writer::select($formats, $inputname . 'format', $responseformat, '');
}
$output .= html_writer::end_tag('div');
diff --git a/question/type/match/lang/en/qtype_match.php b/question/type/match/lang/en/qtype_match.php
index 4b7bc71cc1c..5dd3c4ad329 100644
--- a/question/type/match/lang/en/qtype_match.php
+++ b/question/type/match/lang/en/qtype_match.php
@@ -24,6 +24,7 @@
*/
$string['addmoreqblanks'] = '{no} More Sets of Blanks';
+$string['answer'] = 'Answer {$a}';
$string['availablechoices'] = 'Available choices';
$string['correctansweris'] = 'The correct answer is: {$a}';
$string['filloutthreeqsandtwoas'] = 'You must provide at least two questions and three answers. You can provide extra wrong answers by giving an answer with a blank question. Entries where both the question and the answer are blank will be ignored.';
@@ -40,4 +41,3 @@ $string['pluginname_link'] = 'question/type/match';
$string['pluginnameadding'] = 'Adding a Matching question';
$string['pluginnameediting'] = 'Editing a Matching question';
$string['pluginnamesummary'] = 'The answer to each of a number of sub-question must be selected from a list of possibilities.';
-$string['selectananswer'] = 'Select an answer';
diff --git a/question/type/match/renderer.php b/question/type/match/renderer.php
index 0a464ef04a5..2cadb7ef93c 100644
--- a/question/type/match/renderer.php
+++ b/question/type/match/renderer.php
@@ -53,6 +53,7 @@ class qtype_match_renderer extends qtype_with_combined_feedback_renderer {
$result .= html_writer::start_tag('tbody');
$parity = 0;
+ $i = 1;
foreach ($stemorder as $key => $stemid) {
$result .= html_writer::start_tag('tr', array('class' => 'r' . $parity));
@@ -80,13 +81,14 @@ class qtype_match_renderer extends qtype_with_combined_feedback_renderer {
}
$result .= html_writer::tag('td',
- html_writer::label(get_string('selectananswer', 'qtype_match'), 'menu' . $qa->get_qt_field_name('sub' . $key), false, array('class' => 'accesshide')) .
+ html_writer::label(get_string('answer', 'qtype_match', $i), 'menu' . $qa->get_qt_field_name('sub' . $key), false, array('class' => 'accesshide')) .
html_writer::select($choices, $qa->get_qt_field_name('sub' . $key), $selected,
array('0' => 'choose'), array('disabled' => $options->readonly)) .
' ' . $feedbackimage, array('class' => $classes));
$result .= html_writer::end_tag('tr');
$parity = 1 - $parity;
+ $i++;
}
$result .= html_writer::end_tag('tbody');
$result .= html_writer::end_tag('table');
diff --git a/question/type/multianswer/renderer.php b/question/type/multianswer/renderer.php
index 992cccd69d3..fceebbbaea7 100644
--- a/question/type/multianswer/renderer.php
+++ b/question/type/multianswer/renderer.php
@@ -223,11 +223,11 @@ class qtype_multianswer_textfield_renderer extends qtype_multianswer_subq_render
s($correctanswer->answer), $options);
$output = '';
- $output .= html_writer::start_tag('label', array('class' => 'subq', 'for' => $inputattributes['id']));
+ $output .= html_writer::tag('label', get_string('answer'),
+ array('class' => 'subq accesshide', 'for' => $inputattributes['id']));
$output .= html_writer::empty_tag('input', $inputattributes);
$output .= $feedbackimg;
$output .= $feedbackpopup;
- $output .= html_writer::end_tag('label');
return $output;
}
@@ -274,8 +274,7 @@ class qtype_multianswer_multichoice_inline_renderer
$inputattributes['class'] = $this->feedback_class($matchinganswer->fraction);
$feedbackimg = $this->feedback_image($matchinganswer->fraction);
}
- $select = html_writer::label($response, $inputattributes['id'], false, array('class' => 'accesshide'));
- $select .= html_writer::select($choices, $qa->get_qt_field_name($fieldname),
+ $select = html_writer::select($choices, $qa->get_qt_field_name($fieldname),
$response, array('' => ''), $inputattributes);
$order = $subq->get_order($qa);
@@ -287,11 +286,11 @@ class qtype_multianswer_multichoice_inline_renderer
$qa, 'question', 'answer', $rightanswer->id), $options);
$output = '';
- $output .= html_writer::start_tag('label', array('class' => 'subq'));
+ $output .= html_writer::tag('label', get_string('answer'),
+ array('class' => 'subq accesshide', 'for' => $inputattributes['id']));
$output .= $select;
$output .= $feedbackimg;
$output .= $feedbackpopup;
- $output .= html_writer::end_tag('label');
return $output;
}
diff --git a/question/type/numerical/lang/en/qtype_numerical.php b/question/type/numerical/lang/en/qtype_numerical.php
index 75dc4570c05..fb4784b6c77 100644
--- a/question/type/numerical/lang/en/qtype_numerical.php
+++ b/question/type/numerical/lang/en/qtype_numerical.php
@@ -26,6 +26,7 @@
$string['acceptederror'] = 'Accepted error';
$string['addmoreanswerblanks'] = 'Blanks for {no} More Answers';
$string['addmoreunitblanks'] = 'Blanks for {no} More Units';
+$string['answercolon'] = 'Answer:';
$string['answermustbenumberorstar'] = 'The answer must be a number, for example -1.234 or 3e8, or \'*\'.';
$string['answerno'] = 'Answer {$a}';
$string['decfractionofquestiongrade'] = 'as a fraction (0-1) of the question grade';
diff --git a/question/type/numerical/renderer.php b/question/type/numerical/renderer.php
index 2486740636d..d1b7c0ad30c 100644
--- a/question/type/numerical/renderer.php
+++ b/question/type/numerical/renderer.php
@@ -76,8 +76,7 @@ class qtype_numerical_renderer extends qtype_renderer {
$inputattributes['size'] = round(strlen($placeholder) * 1.1);
}
- $input = html_writer::label($inputattributes['name'], $inputattributes['id'], false, array('class' => 'accesshide'));
- $input .= html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
+ $input = html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
if ($question->has_separate_unit_field()) {
if ($question->unitdisplay == qtype_numerical::UNITRADIO) {
@@ -99,7 +98,7 @@ class qtype_numerical_renderer extends qtype_renderer {
array('class' => 'unitchoices'));
} else if ($question->unitdisplay == qtype_numerical::UNITSELECT) {
- $unitchoice = html_writer::label(get_string('selectunits', 'qtype_numerical'),
+ $unitchoice = html_writer::label(get_string('selectunit', 'qtype_numerical'),
'menu' . $qa->get_qt_field_name('unit'), false, array('class' => 'accesshide'));
$unitchoice .= html_writer::select($question->ap->get_unit_options(),
$qa->get_qt_field_name('unit'), $selectedunit, array(''=>'choosedots'),
@@ -114,7 +113,10 @@ class qtype_numerical_renderer extends qtype_renderer {
}
if ($placeholder) {
- $questiontext = substr_replace($questiontext, $input,
+ $inputinplace = html_writer::tag('label', get_string('answer'),
+ array('for' => $inputattributes['id'], 'class' => 'accesshide'));
+ $inputinplace .= $input;
+ $questiontext = substr_replace($questiontext, $inputinplace,
strpos($questiontext, $placeholder), strlen($placeholder));
}
@@ -122,8 +124,8 @@ class qtype_numerical_renderer extends qtype_renderer {
if (!$placeholder) {
$result .= html_writer::start_tag('div', array('class' => 'ablock'));
- $result .= get_string('answer', 'qtype_shortanswer',
- html_writer::tag('div', $input, array('class' => 'answer')));
+ $result .= html_writer::tag('label', get_string('answercolon', 'qtype_numerical'), array('for' => $inputattributes['id']));
+ $result .= html_writer::tag('span', $input, array('class' => 'answer'));
$result .= html_writer::end_tag('div');
}
diff --git a/question/type/shortanswer/renderer.php b/question/type/shortanswer/renderer.php
index 0595b57e5e2..cfdca17d826 100644
--- a/question/type/shortanswer/renderer.php
+++ b/question/type/shortanswer/renderer.php
@@ -71,11 +71,13 @@ class qtype_shortanswer_renderer extends qtype_renderer {
$placeholder = $matches[0];
$inputattributes['size'] = round(strlen($placeholder) * 1.1);
}
- $input = html_writer::label($inputattributes['name'], $inputattributes['id'], false, array('class' => 'accesshide'));
- $input .= html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
+ $input = html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
if ($placeholder) {
- $questiontext = substr_replace($questiontext, $input,
+ $inputinplace = html_writer::tag('label', get_string('answer'),
+ array('for' => $inputattributes['id'], 'class' => 'accesshide'));
+ $inputinplace .= $input;
+ $questiontext = substr_replace($questiontext, $inputinplace,
strpos($questiontext, $placeholder), strlen($placeholder));
}
@@ -83,8 +85,9 @@ class qtype_shortanswer_renderer extends qtype_renderer {
if (!$placeholder) {
$result .= html_writer::start_tag('div', array('class' => 'ablock'));
- $result .= get_string('answer', 'qtype_shortanswer',
- html_writer::tag('div', $input, array('class' => 'answer')));
+ $result .= html_writer::tag('label', get_string('answer', 'qtype_shortanswer',
+ html_writer::tag('span', $input, array('class' => 'answer'))),
+ array('for' => $inputattributes['id']));
$result .= html_writer::end_tag('div');
}