function survey_print_multi($question) {
- GLOBAL $USER, $db, $qnum, $checklist;
+ global $USER, $db, $qnum, $checklist;
$stripreferthat = get_string("ipreferthat", "survey");
$strifoundthat = get_string("ifoundthat", "survey");
- echo "<br />\n";
- echo "<span class='questiontext'><b>$question->text</b></span><br />";
- echo "<div style=\"text-align:center\">";
- echo "<table width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">";
+ $strdefault = get_string('default');
+ $strresponses = get_string('responses', 'survey');
+
+ print_heading($question->text, null, 3, 'questiontext');
+ echo "\n<table width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">";
$options = explode( ",", $question->options);
$numoptions = count($options);
} else {
$P = "";
}
-
- if ($oneanswer) {
- echo "<tr><td colspan=\"2\">$question->intro</td>";
- } else {
- echo "<tr><td colspan=\"3\">$question->intro</td>";
- }
+ echo "<tr class=\"smalltext\"><th scope=\"row\">$strresponses</th>";
while (list ($key, $val) = each ($options)) {
- echo "<td class=\"smalltextcell\"><span class='smalltext'>$val</span></td>\n";
+ echo "<th scope=\"col\" class=\"hresponse\">$val</th>\n";
+ }
+ echo "<th> </th></tr>\n";
+
+ if ($oneanswer) {
+ echo "<tr><th scope=\"col\" colspan=\"6\">$question->intro</th></tr>\n";
+ } else {
+ echo "<tr><th scope=\"col\" colspan=\"7\">$question->intro</th></tr>\n";
}
- echo "<td align=\"center\"> </td></tr>\n";
$subquestions = get_records_list("survey_questions", "id", $question->multi);
-
+
foreach ($subquestions as $q) {
$qnum++;
$rowclass = survey_question_rowclass($qnum);
$q->text = get_string($q->text, "survey");
}
- echo "<tr class=\"$rowclass\">";
+ echo "<tr class=\"$rowclass rblock\">";
if ($oneanswer) {
- echo "<td class=\"qnumtopcell\"><b>$qnum</b></td>";
- echo "<td valign=\"top\">$q->text</td>";
- for ($i=1;$i<=$numoptions;$i++) {
- $screenreader = !empty($USER->screenreader)?"<label for=\"q$P" . $q->id . "_$i\">".$options[$i-1]."</label><br/>":'';
- echo "<td class=\"screenreadertext\">".$screenreader."<input type=\"radio\" name=\"q$P$q->id\" id=\"q$P" . $q->id . "_$i\" value=\"$i\" alt=\"$i\" /></td>";
+ echo "<th scope=\"row\" class=\"optioncell\">";
+ echo "<b class=\"qnumtopcell\">$qnum</b> ";
+ echo $q->text ."</th>\n";
+ for ($i=1;$i<=$numoptions;$i++) {
+ $hiddentext = get_accesshide($options[$i-1]);
+ $id = "q$P" . $q->id . "_$i";
+ echo "<td><label for=\"$id\"><input type=\"radio\" name=\"q$P$q->id\" id=\"$id\" value=\"$i\" />$hiddentext</label></td>";
}
- echo "<td class=\"whitecell\"><input type=\"radio\" name=\"q$P$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
+ $default = get_accesshide($strdefault, 'label', '', "for=\"q$P$q->id\"");
+ echo "<td class=\"whitecell\"><input type=\"radio\" name=\"q$P$q->id\" id=\"q$P" . $q->id . "_D\" value=\"0\" checked=\"checked\" />$default</td>";
$checklist["q$P$q->id"] = $numoptions;
} else {
// yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly.
- echo "<td class=\"qnummiddlecell\"><b>$qnum</b></td>";
+ echo "<th scope=\"row\" class=\"optioncell\">";
+ echo "<b class=\"qnumtopcell\">$qnum</b> ";
$qnum++;
- echo "<td class=\"preferthat\"><span class='smalltext'>$stripreferthat </span></td>";
- echo "<td class=\"optioncell\">$q->text</td>";
+ echo "<span class=\"preferthat smalltext\">$stripreferthat</span> ";
+ echo "<span class=\"option\">$q->text</span></th>\n";
for ($i=1;$i<=$numoptions;$i++) {
- $screenreader = !empty($USER->screenreader)?"<label for=\"qP" . $q->id . "_$i\">".$options[$i-1]."</label><br/>":'';
- echo "<td class=\"screenreadertext\">".$screenreader."<input type=\"radio\" name=\"qP$q->id\" id=\"qP" . $q->id . "_$i\" value=\"$i\" alt=\"$i\"/></td>";
+ $hiddentext = get_accesshide($options[$i-1]);
+ $id = "qP" . $q->id . "_$i";
+ echo "<td><label for=\"$id\"><input type=\"radio\" name=\"qP$q->id\" id=\"$id\" value=\"$i\" />$hiddentext</label></td>";
}
- echo "<td><input type=\"radio\" name=\"qP$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
+ $default = get_accesshide($strdefault, 'label', '', "for=\"qP$q->id\"");
+ echo "<td><input type=\"radio\" name=\"qP$q->id\" id=\"qP$q->id\" value=\"0\" checked=\"checked\" />$default</td>";
echo "</tr>";
- echo "<tr class=\"$rowclass\">";
- echo "<td class=\"qnumtopcell\"><b>$qnum</b></td>";
- echo "<td class=\"foundthat\"><span class='smalltext'>$strifoundthat </span></td>";
- echo "<td class=\"optioncell\">$q->text</td>";
+ echo "<tr class=\"$rowclass rblock\">";
+ echo "<th scope=\"row\" class=\"optioncell\">";
+ echo "<b class=\"qnumtopcell\">$qnum</b> ";
+ echo "<span class=\"foundthat smalltext\">$strifoundthat</span> ";
+ echo "<span class=\"option\">$q->text</span></th>\n";
for ($i=1;$i<=$numoptions;$i++) {
- $screenreader = !empty($USER->screenreader)?"<label for=\"q" . $q->id . "_$i\">".$options[$i-1]."</label><br/>":'';
- echo "<td class=\"screenreadertext\">".$screenreader."<input type=\"radio\" name=\"q$q->id\" id=\"q" . $q->id . "_$i\" value=\"$i\" alt=\"$i\" /></td>";
+ $hiddentext = get_accesshide($options[$i-1]);
+ $id = "q" . $q->id . "_$i";
+ echo "<td><label for=\"$id\"><input type=\"radio\" name=\"q$q->id\" id=\"$id\" value=\"$i\" />$hiddentext</label></td>";
}
- echo "<td class=\"buttoncell\"><input type=\"radio\" name=\"q$q->id\" value=\"0\" checked=\"checked\" alt=\"0\" /></td>";
+ $default = get_accesshide($strdefault, 'label', '', "for=\"q$q->id\"");
+ echo "<td class=\"buttoncell\"><input type=\"radio\" name=\"q$q->id\" id=\"q$q->id\" value=\"0\" checked=\"checked\" />$default</td>";
$checklist["qP$q->id"] = $numoptions;
$checklist["q$q->id"] = $numoptions;
}
echo "</tr>\n";
-
}
echo "</table>";
- echo "</div>";
}
function survey_print_single($question) {
- GLOBAL $db, $qnum;
+ global $db, $qnum;
$rowclass = survey_question_rowclass(0);
echo "<br />\n";
echo "<table width=\"90%\" cellpadding=\"4\" cellspacing=\"0\">\n";
echo "<tr class=\"$rowclass\">";
- echo "<td valign=\"top\"><b>$qnum</b></td>";
- echo "<td class=\"questioncell\">$question->text</td>\n";
- echo "<td class=\"questioncell\"><span class='smalltext'>\n";
+ echo "<th scope=\"row\" class=\"optioncell\"><label for=\"q$question->id\"><b class=\"qnumtopcell\">$qnum</b> ";
+ echo "<span class=\"questioncell\">$question->text</span></label></th>\n";
+ echo "<td class=\"questioncell smalltext\">\n";
if ($question->type == 0) { // Plain text field
- echo "<textarea rows=\"3\" cols=\"30\" name=\"q$question->id\">$question->options</textarea>";
+ echo "<textarea rows=\"3\" cols=\"30\" name=\"q$question->id\" id=\"q$question->id\">$question->options</textarea>";
} else if ($question->type > 0) { // Choose one of a number
$strchoose = get_string("choose");
- echo "<select name=\"q$question->id\">";
+ echo "<select name=\"q$question->id\" id=\"q$question->id\">";
echo "<option value=\"0\" selected=\"selected\">$strchoose...</option>";
$options = explode( ",", $question->options);
foreach ($options as $key => $val) {
notify("This question type not supported yet");
}
- echo "</span></td></tr></table>";
+ echo "</td></tr></table>";
}