Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-34563 accessibility compliance for data module: Add forform input…

… text and select tag
  • Loading branch information...
commit 01f8e80def1fdfb14a7c0ccfaa3a1fa50ea54b27 1 parent 87e9331
rwijaya rwijaya authored
1  mod/data/field.php
View
@@ -352,6 +352,7 @@
$options = array(0 => get_string('ascending', 'data'),
1 => get_string('descending', 'data'));
+ echo html_writer::label(get_string('sortby'), 'menudefaultsortdir', false, array('class' => 'accesshide'));
echo html_writer::select($options, 'defaultsortdir', $data->defaultsortdir, false);
echo '<input type="submit" value="'.get_string('save', 'data').'" />';
echo '</div>';
14 mod/data/field/date/field.class.php
View
@@ -44,9 +44,12 @@ function display_add_field($recordid=0) {
}
$str = '<div title="'.s($this->field->description).'">';
- $dayselector = html_writer::select_time('days', 'field_'.$this->field->id.'_day', $content);
- $monthselector = html_writer::select_time('months', 'field_'.$this->field->id.'_month', $content);
- $yearselector = html_writer::select_time('years', 'field_'.$this->field->id.'_year', $content);
+ $dayselector = html_writer::label(get_string('day'), 'menufield_'.$this->field->id.'_day', false, array('class' => 'accesshide'))
+ . html_writer::select_time('days', 'field_'.$this->field->id.'_day', $content);
+ $monthselector = html_writer::label(get_string('month'), 'menufield_'.$this->field->id.'_month', false, array('class' => 'accesshide'))
+ . html_writer::select_time('months', 'field_'.$this->field->id.'_month', $content);
+ $yearselector = html_writer::label(get_string('year'), 'menufield_'.$this->field->id.'_year', false, array('class' => 'accesshide'))
+ . html_writer::select_time('years', 'field_'.$this->field->id.'_year', $content);
$str .= $dayselector . $monthselector . $yearselector;
$str .= '</div>';
@@ -55,8 +58,11 @@ function display_add_field($recordid=0) {
//Enable the following three functions once core API issues have been addressed.
function display_search_field($value=0) {
- $selectors = html_writer::select_time('days', 'f_'.$this->field->id.'_d', $value)
+ $selectors = html_writer::label(get_string('day'), 'menuf_'.$this->field->id.'_d', false, array('class' => 'accesshide'))
+ . html_writer::select_time('days', 'f_'.$this->field->id.'_d', $value)
+ . html_writer::label(get_string('month'), 'menuf_'.$this->field->id.'_m', false, array('class' => 'accesshide'))
. html_writer::select_time('months', 'f_'.$this->field->id.'_m', $value)
+ . html_writer::label(get_string('year'), 'menuf_'.$this->field->id.'_y', false, array('class' => 'accesshide'))
. html_writer::select_time('years', 'f_'.$this->field->id.'_y', $value);
return $selectors;
3  mod/data/field/file/field.class.php
View
@@ -91,7 +91,8 @@ function display_add_field($recordid=0) {
}
function display_search_field($value = '') {
- return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
+ return '<label class="accesshide" for=f_"' . $this->field->id . '">' . $this->field->name . '</label>' .
+ '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function generate_sql($tablealias, $value) {
1  mod/data/field/file/mod.html
View
@@ -14,6 +14,7 @@
<?php
$course = $DB->get_record('course', array('id'=>$this->data->course));
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
+ echo html_writer::label($this->field->param3, 'menuparam3', false, array('class' => 'accesshide'));
echo html_writer::select($choices, 'param3', $this->field->param3, false, array('id' => 'param3'));
?>
</td>
8 mod/data/field/latlong/field.class.php
View
@@ -82,7 +82,9 @@ function display_search_field($value = '') {
}
$latlongsrs->close();
- return html_writer::select($options, 'f_'.$this->field->id, $value);
+ $return = html_writer::label(get_string('latlong', 'data'), 'menuf_'.$this->field->id, false, array('class' => 'accesshide'));
+ $return .= html_writer::select($options, 'f_'.$this->field->id, $value);
+ return $return;
}
function parse_search_field() {
@@ -150,7 +152,9 @@ function display_browse_field($recordid, $template) {
. str_replace(array_keys($urlreplacements), array_values($urlreplacements), $this->linkoutservices[$servicesshown[0]])
."' title='$servicesshown[0]'>$compasslat, $compasslong</a>";
} elseif (sizeof($servicesshown)>1) {
- $str .= "$compasslat, $compasslong\n<select name='jumpto'>";
+ $str .= "$compasslat, $compasslong\n";
+ $str .= "<label class='accesshide' for='jumpto'>". get_string('jumpto') ."</label>";
+ $str .= "<select id='jumpto' name='jumpto'>";
foreach($servicesshown as $servicename){
// Add a link to a service
$str .= "\n <option value='"
6 mod/data/field/menu/field.class.php
View
@@ -46,7 +46,7 @@ function display_add_field($recordid=0) {
}
}
-
+ $str .= html_writer::label(get_string('menuchoose', 'data'), 'field_'.$this->field->id, false, array('class' => 'accesshide'));
$str .= html_writer::select($options, 'field_'.$this->field->id, $content, array(''=>get_string('menuchoose', 'data')), array('id'=>'field_'.$this->field->id));
$str .= '</div>';
@@ -86,7 +86,9 @@ function display_search_field($content = '') {
return '';
}
- return html_writer::select($options, 'f_'.$this->field->id, $content);
+ $return = html_writer::label(get_string('namemenu', 'data'), 'menuf_'. $this->field->id, false, array('class' => 'accesshide'));
+ $return .= html_writer::select($options, 'f_'.$this->field->id, $content);
+ return $return;
}
function parse_search_field() {
4 mod/data/field/multimenu/field.class.php
View
@@ -38,6 +38,7 @@ function display_add_field($recordid=0) {
$str = '<div title="'.s($this->field->description).'">';
$str .= '<input name="field_' . $this->field->id . '[xxx]" type="hidden" value="xxx"/>'; // hidden field - needed for empty selection
+ $str .= '<label class="accesshide" for="field_' . $this->field->id . '">' . $this->field->name. ': </label>';
$str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
foreach (explode("\n",$this->field->param1) as $option) {
@@ -71,7 +72,8 @@ function display_search_field($value = '') {
static $c = 0;
- $str = '<select name="f_'.$this->field->id.'[]" multiple="multiple">';
+ $str = '<label class="accesshide" for="f_' . $this->field->id . '">' . $this->field->name . '</label>';
+ $str .= '<select id="f_'.$this->field->id.'" name="f_'.$this->field->id.'[]" multiple="multiple">';
// display only used options
$varcharcontent = $DB->sql_compare_text('content', 255);
3  mod/data/field/number/field.class.php
View
@@ -70,7 +70,8 @@ function display_browse_field($recordid, $template) {
}
function display_search_field($value = '') {
- return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
+ return '<label class="accesshide" for="f_'.$this->field->id.'">' . get_string('fieldname', 'data') . '</label>' .
+ '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {
3  mod/data/field/picture/field.class.php
View
@@ -118,7 +118,8 @@ function get_file($recordid, $content=null) {
}
function display_search_field($value = '') {
- return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
+ return '<label class="accesshide" for="f_'.$this->field->id.'">' . get_string('fieldname', 'data') . '</label>' .
+ '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {
1  mod/data/field/picture/mod.html
View
@@ -46,6 +46,7 @@
<?php
$course = $DB->get_record('course', array('id'=>$this->data->course));
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
+ echo html_writer::label($this->field->param3, 'menuparam3', false, array('class' => 'accesshide'));
echo html_writer::select($choices, 'param3', $this->field->param3, false, array('id'=>'param3'));
?>
</td>
4 mod/data/field/radiobutton/field.class.php
View
@@ -78,7 +78,9 @@ function display_search_field($value = '') {
$options[$rec->content] = $rec->content; //Build following indicies from the sql.
}
}
- return html_writer::select($options, 'f_'.$this->field->id, $value);
+ $return = html_writer::label(get_string('nameradiobutton', 'data'), 'menuf_'. $this->field->id, false, array('class' => 'accesshide'));
+ $return .= html_writer::select($options, 'f_'.$this->field->id, $value);
+ return $return;
}
function parse_search_field() {
2  mod/data/field/text/field.class.php
View
@@ -27,7 +27,7 @@ class data_field_text extends data_field_base {
var $type = 'text';
function display_search_field($value = '') {
- return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
+ return '<label class="accesshide" for="f_' . $this->field->id . '">'. $this->field->name.'</label>' . '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {
6 mod/data/field/textarea/field.class.php
View
@@ -126,7 +126,8 @@ function display_add_field($recordid=0) {
$editor->use_editor($field, $options, $fpoptions);
$str .= '<input type="hidden" name="'.$field.'_itemid" value="'.$draftitemid.'" />';
$str .= '<div><textarea id="'.$field.'" name="'.$field.'" rows="'.$this->field->param3.'" cols="'.$this->field->param2.'">'.s($text).'</textarea></div>';
- $str .= '<div><select name="'.$field.'_content1">';
+ $str .= '<div><label class="accesshide" for="' . $field . '_content1">' . get_string('format') . '</label>';
+ $str .= '<select id="' . $field . '_content1" name="'.$field.'_content1">';
foreach ($formats as $key=>$desc) {
$selected = ($format == $key) ? 'selected="selected"' : '';
$str .= '<option value="'.s($key).'" '.$selected.'>'.$desc.'</option>';
@@ -140,7 +141,8 @@ function display_add_field($recordid=0) {
function display_search_field($value = '') {
- return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
+ return '<label class="accesshide" for="f_' . $this->field->id . '">' . $this->field->name . '</label>' .
+ '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {
8 mod/data/field/url/field.class.php
View
@@ -52,11 +52,14 @@ function display_add_field($recordid=0) {
$str = '<div title="'.s($this->field->description).'">';
if (!empty($this->field->param1) and empty($this->field->param2)) {
$str .= '<table><tr><td align="right">';
- $str .= get_string('url','data').':</td><td><input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.$url.'" size="60" /></td></tr>';
+ $str .= get_string('url','data').':</td><td>';
+ $str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
+ $str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.$url.'" size="60" /></td></tr>';
$str .= '<tr><td align="right">'.get_string('text','data').':</td><td><input type="text" name="field_'.$this->field->id.'_1" id="field_'.$this->field->id.'_1" value="'.s($text).'" size="60" /></td></tr>';
$str .= '</table>';
} else {
// Just the URL field
+ $str .= '<label class="accesshide" for="' . $fieldid . '">'. $this->field->name .'</label>';
$str .= '<input type="text" name="field_'.$this->field->id.'_0" id="'.$fieldid.'" value="'.s($url).'" size="60" />';
}
@@ -74,7 +77,8 @@ function display_add_field($recordid=0) {
}
function display_search_field($value = '') {
- return '<input type="text" size="16" name="f_'.$this->field->id.'" value="'.$value.'" />';
+ return '<label class="accesshide" for="f_'.$this->field->id.'">' . get_string('fieldname', 'data') . '</label>' .
+ '<input type="text" size="16" id="f_'.$this->field->id.'" name="f_'.$this->field->id.'" value="'.$value.'" />';
}
function parse_search_field() {
Please sign in to comment.
Something went wrong with that request. Please try again.