MDL-34570 accessibility compliance for question: edit string label
This commit is contained in:
committed by
Frederic Massart
parent
c5575c63b8
commit
735280b159
@@ -88,12 +88,13 @@ abstract class qbehaviour_renderer extends plugin_renderer_base {
|
||||
array('id' => $id, 'name' => $inputname, 'rows' => 10, 'cols' => 60)));
|
||||
|
||||
$commenteditor .= html_writer::start_tag('div');
|
||||
if (count($formats == 1)) {
|
||||
if (count($formats) == 1) {
|
||||
reset($formats);
|
||||
$commenteditor .= 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, '');
|
||||
}
|
||||
|
||||
@@ -95,12 +95,14 @@ class qformat_xhtml extends qformat_default {
|
||||
break;
|
||||
case SHORTANSWER:
|
||||
$expout .= "<ul class=\"shortanswer\">\n";
|
||||
$expout .= " <li><input name=\"quest_$id\" type=\"text\" /></li>\n";
|
||||
$expout .= " <li>" . html_writer::label(get_string('answer'), 'quest_'.$id, false, array('class' => 'accesshide'));
|
||||
$expout .= " <input id=\"quest_$id\" name=\"quest_$id\" type=\"text\" /></li>\n";
|
||||
$expout .= "</ul>\n";
|
||||
break;
|
||||
case NUMERICAL:
|
||||
$expout .= "<ul class=\"numerical\">\n";
|
||||
$expout .= " <li><input name=\"quest_$id\" type=\"text\" /></li>\n";
|
||||
$expout .= " <li>" . html_writer::label(get_string('answer'), 'quest_'.$id, false, array('class' => 'accesshide'));
|
||||
$expout .= " <input id=\"quest_$id\" name=\"quest_$id\" type=\"text\" /></li>\n";
|
||||
$expout .= "</ul>\n";
|
||||
break;
|
||||
case MATCH:
|
||||
@@ -114,7 +116,8 @@ class qformat_xhtml extends qformat_default {
|
||||
shuffle( $ans_list ); // random display order
|
||||
|
||||
// build drop down for answers
|
||||
$dropdown = "<select name=\"quest_$id\">\n";
|
||||
$dropdown = html_writer::label(get_string('selectansweroption'), 'quest_'.$id, false, array('class' => 'accesshide'));
|
||||
$dropdown .= "<select id=\"quest_$id\" name=\"quest_$id\">\n";
|
||||
foreach($ans_list as $ans) {
|
||||
$dropdown .= "<option value=\"" . s($ans) . "\">" . s($ans) . "</option>\n";
|
||||
}
|
||||
|
||||
@@ -26,3 +26,4 @@
|
||||
$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';
|
||||
|
||||
@@ -49,6 +49,7 @@ $string['datasetrole']= ' The wild cards <strong>{x..}</strong> will be substitu
|
||||
$string['decimals'] = 'with {$a}';
|
||||
$string['deleteitem'] = 'Delete item';
|
||||
$string['deletelastitem'] = 'Delete last item';
|
||||
$string['distributionoption'] = 'Select distribution option';
|
||||
$string['editdatasets'] = 'Edit the wildcards datasets';
|
||||
$string['editdatasets_help'] = 'Wildcard values may be created by entering a number in each wild card field then clicking the add button. To automatically generate 10 or more values, select the number of values required before clicking the add button. A uniform distribution means any value between the limits is equally likely to be generated; a loguniform distribution means that values towards the lower limit are more likely.';
|
||||
$string['editdatasets_link'] = 'question/type/calculated';
|
||||
@@ -79,6 +80,7 @@ $string['keptlocal1'] = 'will use the same existing private dataset as before';
|
||||
$string['keptlocal2'] = 'a file from the same question private set of files as before';
|
||||
$string['keptlocal3'] = 'a link from the same question private set of links as before';
|
||||
$string['lastitem(s)'] = 'last items(s)';
|
||||
$string['lengthoption'] = 'Select length option';
|
||||
$string['loguniform'] = 'Loguniform';
|
||||
$string['loguniformbit'] = 'digits, from a loguniform distribution';
|
||||
$string['makecopynextpage'] = 'Next page (new question)';
|
||||
|
||||
@@ -749,11 +749,13 @@ class qtype_calculated extends question_type {
|
||||
? 'decimals'
|
||||
: 'significantfigures'), 'qtype_calculated', $i);
|
||||
}
|
||||
$menu1 = html_writer::select($lengthoptions, 'calclength[]', $regs[4], null);
|
||||
$menu1 = html_writer::label(get_string('lengthoption', 'qtype_calculated'), 'menucalclength', false, array('class' => 'accesshide'));
|
||||
$menu1 .= html_writer::select($lengthoptions, 'calclength[]', $regs[4], null);
|
||||
|
||||
$options = array('uniform' => get_string('uniformbit', 'qtype_calculated'),
|
||||
'loguniform' => get_string('loguniformbit', 'qtype_calculated'));
|
||||
$menu2 = html_writer::select($options, 'calcdistribution[]', $regs[1], null);
|
||||
$menu2 = html_writer::label(get_string('distributionoption', 'qtype_calculated'), 'menucalcdistribution', false, array('class' => 'accesshide'));
|
||||
$menu2 .= html_writer::select($options, 'calcdistribution[]', $regs[1], null);
|
||||
return '<input type="submit" onclick="'
|
||||
. "getElementById('addform').regenerateddefid.value='$defid'; return true;"
|
||||
.'" value="'. get_string('generatevalue', 'qtype_calculated') . '"/><br/>'
|
||||
|
||||
@@ -38,3 +38,4 @@ $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';
|
||||
|
||||
@@ -217,12 +217,13 @@ class qtype_essay_format_editor_renderer extends plugin_renderer_base {
|
||||
array('id' => $id, 'name' => $inputname, 'rows' => $lines, 'cols' => 60)));
|
||||
|
||||
$output .= html_writer::start_tag('div');
|
||||
if (count($formats == 1)) {
|
||||
if (count($formats) == 1) {
|
||||
reset($formats);
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'hidden',
|
||||
'name' => $inputname . 'format', 'value' => key($formats)));
|
||||
|
||||
} else {
|
||||
$output .= html_writer::label(get_string('selectanswerformat'), 'menu' . $inputname . 'format', false, array("class" => 'accesshide'));
|
||||
$output .= html_writer::select($formats, $inputname . 'format', $responseformat, '');
|
||||
}
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
@@ -40,3 +40,4 @@ $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';
|
||||
|
||||
@@ -80,6 +80,7 @@ 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::select($choices, $qa->get_qt_field_name('sub' . $key), $selected,
|
||||
array('0' => 'choose'), array('disabled' => $options->readonly)) .
|
||||
' ' . $feedbackimage, array('class' => $classes));
|
||||
|
||||
@@ -223,7 +223,7 @@ class qtype_multianswer_textfield_renderer extends qtype_multianswer_subq_render
|
||||
s($correctanswer->answer), $options);
|
||||
|
||||
$output = '';
|
||||
$output .= html_writer::start_tag('label', array('class' => 'subq'));
|
||||
$output .= html_writer::start_tag('label', array('class' => 'subq', 'for' => $inputattributes['id']));
|
||||
$output .= html_writer::empty_tag('input', $inputattributes);
|
||||
$output .= $feedbackimg;
|
||||
$output .= $feedbackpopup;
|
||||
@@ -274,8 +274,8 @@ class qtype_multianswer_multichoice_inline_renderer
|
||||
$inputattributes['class'] = $this->feedback_class($matchinganswer->fraction);
|
||||
$feedbackimg = $this->feedback_image($matchinganswer->fraction);
|
||||
}
|
||||
|
||||
$select = html_writer::select($choices, $qa->get_qt_field_name($fieldname),
|
||||
$select = html_writer::label($response, $inputattributes['id'], false, array('class' => 'accesshide'));
|
||||
$select .= html_writer::select($choices, $qa->get_qt_field_name($fieldname),
|
||||
$response, array('' => ''), $inputattributes);
|
||||
|
||||
$order = $subq->get_order($qa);
|
||||
|
||||
@@ -76,7 +76,8 @@ class qtype_numerical_renderer extends qtype_renderer {
|
||||
$inputattributes['size'] = round(strlen($placeholder) * 1.1);
|
||||
}
|
||||
|
||||
$input = html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
|
||||
$input = html_writer::label($inputattributes['name'], $inputattributes['id'], false, array('class' => 'accesshide'));
|
||||
$input .= html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
|
||||
|
||||
if ($question->has_separate_unit_field()) {
|
||||
if ($question->unitdisplay == qtype_numerical::UNITRADIO) {
|
||||
@@ -98,7 +99,9 @@ class qtype_numerical_renderer extends qtype_renderer {
|
||||
array('class' => 'unitchoices'));
|
||||
|
||||
} else if ($question->unitdisplay == qtype_numerical::UNITSELECT) {
|
||||
$unitchoice = html_writer::select($question->ap->get_unit_options(),
|
||||
$unitchoice = html_writer::label(get_string('selectunits', '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'),
|
||||
array('disabled' => $options->readonly));
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ class qtype_shortanswer_renderer extends qtype_renderer {
|
||||
$placeholder = $matches[0];
|
||||
$inputattributes['size'] = round(strlen($placeholder) * 1.1);
|
||||
}
|
||||
|
||||
$input = html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
|
||||
$input = html_writer::label($inputattributes['name'], $inputattributes['id'], false, array('class' => 'accesshide'));
|
||||
$input .= html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
|
||||
|
||||
if ($placeholder) {
|
||||
$questiontext = substr_replace($questiontext, $input,
|
||||
|
||||
Reference in New Issue
Block a user