MDL-42210-Feedback-Input-Labels

Adds labels to the input fields in the Feedback module including: multichoice, multichoicerated, numeric, textarea and textfield.
This commit is contained in:
Michael Milette 2013-10-09 11:32:57 -04:00 committed by Andreas Grabs
parent 4e47920f08
commit 690266bcf7
5 changed files with 53 additions and 5 deletions

View File

@ -316,6 +316,9 @@ class feedback_item_multichoice extends feedback_item_base {
//print the question and label
echo '<div class="feedback_item_label_'.$align.'">';
if ($info->subtype == 'd') {
echo '<label for="'. $item->typ . '_' . $item->id .'">';
}
echo '('.$item->label.') ';
echo format_text($item->name.$requiredmark, true, false, false);
if ($item->dependitem) {
@ -325,6 +328,9 @@ class feedback_item_multichoice extends feedback_item_base {
echo '</span>';
}
}
if ($info->subtype == 'd') {
echo '</label>';
}
echo '</div>';
//print the presentation
@ -420,7 +426,13 @@ class feedback_item_multichoice extends feedback_item_base {
//print the question and label
echo '<div class="feedback_item_label_'.$align.$highlight.'">';
if ($info->subtype == 'd') {
echo '<label for="'. $item->typ . '_' . $item->id .'">';
echo format_text($item->name.$requiredmark, true, false, false);
echo '</label>';
} else {
echo format_text($item->name.$requiredmark, true, false, false);
}
echo '</div>';
//print the presentation

View File

@ -301,6 +301,9 @@ class feedback_item_multichoicerated extends feedback_item_base {
$requiredmark = ($item->required == 1) ? $str_required_mark : '';
//print the question and label
echo '<div class="feedback_item_label_'.$align.'">';
if ($info->subtype == 'd') {
echo '<label for="'. $item->typ . '_' . $item->id .'">';
}
echo '('.$item->label.') ';
echo format_text($item->name.$requiredmark, true, false, false);
if ($item->dependitem) {
@ -310,6 +313,9 @@ class feedback_item_multichoicerated extends feedback_item_base {
echo '</span>';
}
}
if ($info->subtype == 'd') {
echo '</label>';
}
echo '</div>';
//print the presentation
@ -350,7 +356,13 @@ class feedback_item_multichoicerated extends feedback_item_base {
//print the question and label
echo '<div class="feedback_item_label_'.$align.$highlight.'">';
if ($info->subtype == 'd') {
echo '<label for="'. $item->typ . '_' . $item->id .'">';
echo format_text($item->name.$requiredmark, true, false, false);
echo '</label>';
} else {
echo format_text($item->name.$requiredmark, true, false, false);
}
echo '</div>';
//print the presentation

View File

@ -252,7 +252,9 @@ class feedback_item_numeric extends feedback_item_base {
$requiredmark = ($item->required == 1) ? $str_required_mark : '';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '<div class="feedback_item_label_'.$align.'">';
echo '<label for="'. $inputname .'">';
echo '('.$item->label.') ';
echo format_text($item->name . $requiredmark, true, false, false);
if ($item->dependitem) {
@ -281,13 +283,15 @@ class feedback_item_numeric extends feedback_item_base {
break;
}
echo '</span>';
echo '</label>';
echo '</div>';
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
echo '<span class="feedback_item_textfield">';
echo '<input type="text" '.
'name="'.$item->typ.'_'.$item->id.'" '.
'id="'.$inputname.'" '.
'name="'.$inputname.'" '.
'size="10" '.
'maxlength="10" '.
'value="" />';
@ -335,7 +339,9 @@ class feedback_item_numeric extends feedback_item_base {
$requiredmark = ($item->required == 1) ? $str_required_mark : '';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '<div class="feedback_item_label_'.$align.$highlight.'">';
echo '<label for="'. $inputname .'">';
echo format_text($item->name . $requiredmark, true, false, false);
echo '<span class="feedback_item_numinfo">';
switch(true) {
@ -355,12 +361,14 @@ class feedback_item_numeric extends feedback_item_base {
break;
}
echo '</span>';
echo '</label>';
echo '</div>';
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';
echo '<span class="feedback_item_textfield">';
echo '<input type="text" '.
'id="'.$inputname.'" '.
'name="'.$item->typ.'_'.$item->id.'" '.
'size="10" '.
'maxlength="10" '.

View File

@ -206,7 +206,9 @@ class feedback_item_textarea extends feedback_item_base {
$presentation = explode ("|", $item->presentation);
$requiredmark = ($item->required == 1) ? $str_required_mark : '';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '<div class="feedback_item_label_'.$align.'">';
echo '<label for="'. $inputname .'">';
echo '('.$item->label.') ';
echo format_text($item->name.$requiredmark, true, false, false);
if ($item->dependitem) {
@ -216,12 +218,14 @@ class feedback_item_textarea extends feedback_item_base {
echo '</span>';
}
}
echo '</label>';
echo '</div>';
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
echo '<span class="feedback_item_textarea">';
echo '<textarea name="'.$item->typ.'_'.$item->id.'" '.
echo '<textarea id="'.$inputname.'" '.
'name="'.$inputname.'" '.
'cols="'.$presentation[0].'" '.
'rows="'.$presentation[1].'">';
echo '</textarea>';
@ -252,14 +256,18 @@ class feedback_item_textarea extends feedback_item_base {
$requiredmark = ($item->required == 1) ? $str_required_mark :'';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '<div class="feedback_item_label_'.$align.$highlight.'">';
echo '<label for="'. $inputname .'">';
echo format_text($item->name . $requiredmark, true, false, false);
echo '</label>';
echo '</div>';
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';
echo '<span class="feedback_item_textarea">';
echo '<textarea name="'.$item->typ.'_'.$item->id.'" '.
echo '<textarea id="'.$inputname.'" '.
'name="'.$inputname.'" '.
'cols="'.$presentation[0].'" '.
'rows="'.$presentation[1].'">';
echo $value;

View File

@ -194,7 +194,9 @@ class feedback_item_textfield extends feedback_item_base {
$presentation = explode ("|", $item->presentation);
$requiredmark = ($item->required == 1) ? $str_required_mark : '';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '<div class="feedback_item_label_'.$align.'">';
echo '<label for="'. $inputname .'">';
echo '('.$item->label.') ';
echo format_text($item->name.$requiredmark, true, false, false);
if ($item->dependitem) {
@ -204,13 +206,15 @@ class feedback_item_textfield extends feedback_item_base {
echo '</span>';
}
}
echo '</label>';
echo '</div>';
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.'">';
echo '<span class="feedback_item_textfield">';
echo '<input type="text" '.
'name="'.$item->typ.'_'.$item->id.'" '.
'id="'.$inputname.'" '.
'name="'.$inputname.'" '.
'size="'.$presentation[0].'" '.
'maxlength="'.$presentation[1].'" '.
'value="" />';
@ -241,15 +245,19 @@ class feedback_item_textfield extends feedback_item_base {
$requiredmark = ($item->required == 1) ? $str_required_mark : '';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '<div class="feedback_item_label_'.$align.$highlight.'">';
echo '<label for="'. $inputname .'">';
echo format_text($item->name.$requiredmark, true, false, false);
echo '</label>';
echo '</div>';
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';
echo '<span class="feedback_item_textfield">';
echo '<input type="text" '.
'name="'.$item->typ.'_'.$item->id.'" '.
'id="'.$inputname.'" '.
'name="'.$inputname.'" '.
'size="'.$presentation[0].'" '.
'maxlength="'.$presentation[1].'" '.
'value="'.$value.'" />';