Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

MDL-29378 Code cleanup in the Survey module

While working on the issue, I spotted these two places that were worth of
fixing. The first one is a trivial reminiscence of a previous refactoring,
after which both branches of the if() statement became equal.

The second one is actually a typo as in theory it could generate unexpected
input fields with the name like qPP1. Luckily this never happened due to the
way how survey questions are hardcoded (there are no questions with the type 2
that would require two answers to their subquestions).
  • Loading branch information...
commit f2578055730250018b0f2fadf739500e83b4b743 1 parent 2e5d19d
@mudrd8mz mudrd8mz authored
Showing with 2 additions and 6 deletions.
  1. +2 −6 mod/survey/lib.php
8 mod/survey/lib.php
@@ -532,11 +532,7 @@ function survey_print_multi($question) {
echo "</tr>\n";
- if ($oneanswer) {
- echo "<tr><th scope=\"col\" colspan=\"7\">$question->intro</th></tr>\n";
- } else {
- echo "<tr><th scope=\"col\" colspan=\"7\">$question->intro</th></tr>\n";
- }
+ echo "<tr><th scope=\"col\" colspan=\"7\">$question->intro</th></tr>\n";
$subquestions = $DB->get_records_list("survey_questions", "id", explode(',', $question->multi));
@@ -575,7 +571,7 @@ function survey_print_multi($question) {
echo "<span class=\"option\">$q->text</span></th>\n";
$default = get_accesshide($strdefault);
- echo '<td class="whitecell"><label for="qP'. $P.$q->id .'"><input type="radio" name="qP'.$P.$q->id. '" id="qP'. $q->id .'" value="0" checked="checked" />'.$default.'</label></td>';
+ echo '<td class="whitecell"><label for="qP'.$q->id.'"><input type="radio" name="qP'.$q->id.'" id="qP'.$q->id.'" value="0" checked="checked" />'.$default.'</label></td>';
for ($i=1;$i<=$numoptions;$i++) {
Please sign in to comment.
Something went wrong with that request. Please try again.