From 156de651c79698b1ab92d2d0fd7860846c9ace4f Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 26 Jan 2016 11:53:21 +0100 Subject: [PATCH] MDL-51704 survey: Fix display problems in report page --- mod/survey/report.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mod/survey/report.php b/mod/survey/report.php index 66d366d6345..dad4a8b9e11 100644 --- a/mod/survey/report.php +++ b/mod/survey/report.php @@ -400,7 +400,7 @@ } } - echo "

"; + echo "

"; echo $OUTPUT->user_picture($user, array('courseid'=>$course->id)); echo "

"; @@ -409,7 +409,7 @@ if ($showscales) { // Print overall summary - echo "

>"; + echo "

"; survey_print_graph("id=$id&sid=$student&type=student.png"); echo "

"; @@ -446,7 +446,16 @@ $table = new html_table(); $table->head = array(get_string($question->text, "survey")); $table->align = array ("left"); - $table->data[] = array(s($answer->answer1)); // no html here, just plain text + if (!empty($question->options) && $answer->answer1 > 0) { + $answers = explode(',', get_string($question->options, 'survey')); + if ($answer->answer1 <= count($answers)) { + $table->data[] = array(s($answers[$answer->answer1 - 1])); // No html here, just plain text. + } else { + $table->data[] = array(s($answer->answer1)); // No html here, just plain text. + } + } else { + $table->data[] = array(s($answer->answer1)); // No html here, just plain text. + } echo html_writer::table($table); echo $OUTPUT->spacer(array('height'=>30)); } -- 2.17.1