From 12c85e659d95d57cf600aacd13a68bd9512ac06c Mon Sep 17 00:00:00 2001 From: Mike Churchward Date: Fri, 17 Jan 2020 15:31:12 -0500 Subject: [PATCH] GHI234 Changing rate results display to work with PDF HTML. --- classes/responsetype/display_support.php | 17 +++++++++++------ images/hbartransp.gif | Bin 0 -> 50 bytes lang/en/questionnaire.php | 1 + questionnaire.class.php | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 images/hbartransp.gif diff --git a/classes/responsetype/display_support.php b/classes/responsetype/display_support.php index 9b1dad01..ca89bb2a 100644 --- a/classes/responsetype/display_support.php +++ b/classes/responsetype/display_support.php @@ -81,6 +81,7 @@ public static function mkresavg($counts, $total, $question, $showtotals, $sort, } $imageurl = $CFG->wwwroot.'/mod/questionnaire/images/'; + $blankimage = $CFG->wwwroot . '/mod/questionnaire/images/hbartransp.gif'; $llength = $question->length; if (!$llength) { $llength = 5; @@ -104,7 +105,9 @@ public static function mkresavg($counts, $total, $question, $showtotals, $sort, $str = $j + 1; } } - $out = ''; + // Using a hard value so we can have things look right in a PDF as well. + $innertablewidth = 450; + $out = '
'; for ($i = 0; $i <= $llength - 1; $i++) { if (isset($n[$i])) { $str = $n[$i]; @@ -155,14 +158,16 @@ public static function mkresavg($counts, $total, $question, $showtotals, $sort, if ($avg) { $out = ''; if (($j = $avg * $width) > 0) { - $marginposition = ($avg - 0.5 ) / ($question->length + $isrestricted) * 100; + $marginposition = ($avg - 0.5 ) / ($question->length + $isrestricted); } if (!right_to_left()) { - $out .= ''; + $out .= '' . + ''; } else { - $out .= ''; + $out .= '' . + ''; } } else { $out = ''; diff --git a/images/hbartransp.gif b/images/hbartransp.gif new file mode 100644 index 0000000000000000000000000000000000000000..31838a05e358ff9dda9bfb2995f7755e3a5471d4 GIT binary patch literal 50 vcmZ?wbh9u|WMtrEn8*ME|Ns97(+r9~SvW-)m>6_GT#!5i6Z4dMRt9ST?_>xH literal 0 HcmV?d00001 diff --git a/lang/en/questionnaire.php b/lang/en/questionnaire.php index 59fe5e7f..09a69184 100644 --- a/lang/en/questionnaire.php +++ b/lang/en/questionnaire.php @@ -143,6 +143,7 @@ $string['directwarnings'] = 'Direct dependencies to this question will be removed. This will affect:'; $string['displaymethod'] = 'Display method not defined for question.'; $string['download'] = 'Download'; +$string['downloadpdf'] = 'Download PDF'; $string['downloadtextformat'] = 'Download'; $string['downloadtextformat_help'] = 'This feature enables you to save all the responses of a questionnaire to a selectable, supported file format. You can choose to include extra data items in the export, as well as choose to automatically send the file to selected users.'; diff --git a/questionnaire.class.php b/questionnaire.class.php index 86378230..4f41b863 100644 --- a/questionnaire.class.php +++ b/questionnaire.class.php @@ -1322,7 +1322,7 @@ private function print_survey_start($message, $section, $numsections, $hasrequir if ($ruser) { $respinfo = ''; if ($outputtarget == 'html') { - $linkname = 'Download PDF'; + $linkname = get_string('downloadpdf', 'mod_questionnaire'); $link = new moodle_url('/mod/questionnaire/report.php', ['action' => 'vresp', 'instance' => $this->id, 'target' => 'pdf', 'individualresponse' => 1, 'rid' => $rid]); $downpdficon = new pix_icon('b/pdfdown', $linkname, 'mod_questionnaire');