MDL-44054 quiz_statistics fix lang string concatenation.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 9 May 2014 14:54:32 +0000 (15:54 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 29 May 2014 13:44:21 +0000 (14:44 +0100)
mod/quiz/report/statistics/lang/en/quiz_statistics.php
mod/quiz/report/statistics/report.php

index 9fa1c41..91ad03d 100644 (file)
@@ -26,8 +26,12 @@ $string['actualresponse'] = 'Actual response';
 $string['allattempts'] = 'all attempts';
 $string['allattemptsavg'] = 'Average grade of all attempts';
 $string['allattemptscount'] = 'Total number of complete graded attempts';
+$string['analysisnameonly'] = '"{$a->name}"';
+$string['analysisno'] = '({$a->number}) "{$a->name}"';
+$string['analysisnovariant'] = '({$a->number}) "{$a->name}" variant {$a->variant}';
 $string['analysisofresponses'] = 'Analysis of responses';
-$string['analysisofresponsesfor'] = 'Analysis of responses for {$a}.';
+$string['analysisofresponsesfor'] = 'Analysis of responses for {$a}';
+$string['analysisvariant'] = '"{$a->name}" variant {$a->variant}';
 $string['attempts'] = 'Attempts';
 $string['attemptsall'] = 'all attempts';
 $string['attemptsfirst'] = 'first attempt';
@@ -110,6 +114,5 @@ $string['statisticsreportgraph'] = 'Statistics for question positions';
 $string['statistics:view'] = 'View statistics report';
 $string['statsfor'] = 'Quiz statistics (for {$a})';
 $string['variant'] = 'Variant';
-$string['variantno'] = 'Variant {$a}';
 $string['whichtries'] = 'Analyze responses for';
 
index cd83de5..fadb7c4 100644 (file)
@@ -387,13 +387,19 @@ class quiz_statistics_report extends quiz_default_report {
 
         } else {
             // Work out an appropriate title.
-            $questiontabletitle = '"' . $question->name . '"';
-            if (!empty($question->number)) {
-                $questiontabletitle = '(' . $question->number . ') ' . $questiontabletitle;
-            }
-            if (!is_null($variantno)) {
-                $questiontabletitle .= ' '.get_string('variantno', 'quiz_statistics', $variantno);
+            $a = clone($question);
+            $a->variant = $variantno;
+
+            if (!empty($question->number) && !is_null($variantno)) {
+                $questiontabletitle = get_string('analysisnovariant', 'quiz_statistics', $a);
+            } else if (!empty($question->number)) {
+                $questiontabletitle = get_string('analysisno', 'quiz_statistics', $a);
+            } else if (!is_null($variantno)) {
+                $questiontabletitle = get_string('analysisvariant', 'quiz_statistics', $a);
+            } else {
+                $questiontabletitle = get_string('analysisnameonly', 'quiz_statistics', $a);
             }
+
             if ($this->table->is_downloading() == 'xhtml') {
                 $questiontabletitle = get_string('analysisofresponsesfor', 'quiz_statistics', $questiontabletitle);
             }