Permalink
Browse files

MDL-42210-Feedback-Input-Labels

Adds labels to the input fields in the Feedback module including: multichoice, multichoicerated, numeric, textarea and textfield.
  • Loading branch information...
1 parent b6ced2f commit 60293b276a493ef948fd1a8f0e7e1abf68efaf46 @michael-milette michael-milette committed with grabs Oct 9, 2013
@@ -316,6 +316,9 @@ public function print_item_preview($item) {
//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 @@ public function print_item_preview($item) {
echo '</span>';
}
}
+ if ($info->subtype == 'd') {
+ echo '</label>';
+ }
echo '</div>';
//print the presentation
@@ -420,7 +426,13 @@ public function print_item_complete($item, $value = null, $highlightrequire = fa
//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
@@ -301,6 +301,9 @@ public function print_item_preview($item) {
$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 @@ public function print_item_preview($item) {
echo '</span>';
}
}
+ if ($info->subtype == 'd') {
+ echo '</label>';
+ }
echo '</div>';
//print the presentation
@@ -350,7 +356,13 @@ public function print_item_complete($item, $value = '', $highlightrequire = fals
//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
@@ -252,7 +252,9 @@ public function print_item_preview($item) {
$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 @@ public function print_item_preview($item) {
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 @@ public function print_item_complete($item, $value = '', $highlightrequire = fals
$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 @@ public function print_item_complete($item, $value = '', $highlightrequire = fals
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" '.
@@ -206,7 +206,9 @@ public function print_item_preview($item) {
$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 @@ public function print_item_preview($item) {
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 @@ public function print_item_complete($item, $value = '', $highlightrequire = fals
$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;
@@ -194,7 +194,9 @@ public function print_item_preview($item) {
$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 @@ public function print_item_preview($item) {
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 @@ public function print_item_complete($item, $value = '', $highlightrequire = fals
$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.'" />';

0 comments on commit 60293b2

Please sign in to comment.