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...
1 parent b46b093 commit f60c7e6851ff502b47514e671a9d6d39ac02a0f0 @mudrd8mz mudrd8mz committed Sep 4, 2013
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++) {

0 comments on commit f60c7e6

Please sign in to comment.