From 3a2e0fe97a05fa76068b8167ee55bc496835d501 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Thu, 23 Nov 2006 04:49:48 +0000 Subject: [PATCH] fix for MDL-7472, explicitly label radio buttons in survey. Note you need $USER->screenreader flag for this to be active --- mod/survey/lib.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/mod/survey/lib.php b/mod/survey/lib.php index 3e97da9657..11dd4d99cc 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -348,8 +348,7 @@ function survey_shorten_name ($name, $numwords) { function survey_print_multi($question) { - GLOBAL $db, $qnum, $checklist; - + GLOBAL $USER, $db, $qnum, $checklist; $stripreferthat = get_string("ipreferthat", "survey"); $strifoundthat = get_string("ifoundthat", "survey"); @@ -380,33 +379,35 @@ function survey_print_multi($question) { echo " \n"; $subquestions = get_records_list("survey_questions", "id", $question->multi); - + foreach ($subquestions as $q) { $qnum++; $rowclass = survey_question_rowclass($qnum); - if ($q->text) { $q->text = get_string($q->text, "survey"); } echo ""; if ($oneanswer) { + echo "$qnum"; echo "$q->text"; - for ($i=1;$i<=$numoptions;$i++) { - echo "id\" value=\"$i\" alt=\"$i\" />"; + for ($i=1;$i<=$numoptions;$i++) { + $screenreader = !empty($USER->screenreader)?"
":''; + echo "".$screenreader."id\" id=\"q$P$q->id".$i."\" value=\"$i\" alt=\"$i\" />"; } echo "id\" value=\"0\" checked=\"checked\" alt=\"0\" />"; $checklist["q$P$q->id"] = $numoptions; - } else { + } else { // yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly. echo "$qnum"; $qnum++; echo "$stripreferthat "; echo "$q->text"; for ($i=1;$i<=$numoptions;$i++) { - echo "id\" value=\"$i\" alt=\"$i\"/>"; + $screenreader = !empty($USER->screenreader)?"
":''; + echo "".$screenreader."id\" id=\"qP$q->id".$i."\" value=\"$i\" alt=\"$i\"/>"; } echo "id\" value=\"0\" checked=\"checked\" alt=\"0\" />"; echo ""; @@ -416,13 +417,15 @@ function survey_print_multi($question) { echo "$strifoundthat "; echo "$q->text"; for ($i=1;$i<=$numoptions;$i++) { - echo "id\" value=\"$i\" alt=\"$i\" />"; + $screenreader = !empty($USER->screenreader)?"
":''; + echo "".$screenreader."id\" id=\"q$q->id".$i."\" value=\"$i\" alt=\"$i\" />"; } echo "id\" value=\"0\" checked=\"checked\" alt=\"0\" />"; $checklist["qP$q->id"] = $numoptions; $checklist["q$q->id"] = $numoptions; } echo "\n"; + } echo ""; } -- 2.39.5