View Issue Details

IDProjectCategoryView StatusLast Update
04862User patchesStatisticspublic2012-06-21 14:18
ReporterIngrimmsch Assigned To 
PrioritynormalSeverityminor 
Status confirmedResolutionopen 
Product Version1.90 
Target VersionFixed in Version 
Summary04862: Alternative Title
Description

Hi,

i made a little function that allows to give your survey a alternative title in the pdf file.

Its useful if you need more than 1 statistic.
Example:

I need a complete statistic ( you write nothing in the textfield ) the title is the normal title

I need a statistic where answer 1 is = b and answer 2 is = c ( you write "Surveyname - Special" in the textfield) The title in the pdf is "Surveyname - Special"

If you want i can make a user patch for this function

it affects the statistics.php on 2 lines and the statistics_function.php in 2 lines.

Let me know if you need it and you get it soon

TagsNo tags attached.
Complete LimeSurvey version number (& build)9561

Activities

Ingrimmsch

Ingrimmsch

2011-01-12 15:31

reporter   ~13882

I forget to say some of the language files have to be modified... i dont know which.. im looking for it if you say you implement it in the next version

c_schmitz

c_schmitz

2011-01-13 23:52

administrator   ~13907

Please attach the patch.

Ingrimmsch

Ingrimmsch

2011-01-14 12:02

reporter   ~13911

Im ready.. but i have a problem with the message file. I added:

#: D:\web\xampp\htdocs\limesurvey/admin/statistics.php:348
msgid "Alternate"
msgstr "Alternativer Titel"

to the de.po

#: D:\web\xampp\htdocs\limesurvey/admin/statistics.php:348
msgid "Alternate"
msgstr "Alternate Title"

to the en.po

and

$clang->gT('Alternate') to the statistics.php

But the label is Alternate and not Alternativer Titel.

Ingrimmsch

Ingrimmsch

2011-01-14 12:47

reporter   ~13912

ok i solved it and i add the patch if you have questions feel free to ask

Ingrimmsch

Ingrimmsch

2011-01-14 12:47

reporter  

AlternateTitle.patch (5,711 bytes)
Index: admin/statistics.php
===================================================================
--- admin/statistics.php	(revision 9681)
+++ admin/statistics.php	(working copy)
@@ -345,9 +345,9 @@
 $statisticsoutput .= "<li>"
 ."<label>"
 .$clang->gT("Select output format").":</label>"
-."<input type='radio' name='outputtype' value='html' checked='checked' /><label for='outputtype'>HTML</label> <input type='radio' name='outputtype' value='pdf' /><label for='outputtype'>PDF</label> <input type='radio' onclick='nographs();' name='outputtype' value='xls' /><label for='outputtype'>Excel</label>";
+."<input type='radio' name='outputtype' value='html' checked='checked' /><label for='outputtype'>HTML</label> <input type='radio' name='outputtype' value='pdf' /><label for='outputtype'>PDF</label> <input type='radio' onclick='nographs();' name='outputtype' value='xls' /><label for='outputtype'>Excel</label>"
+."</li><li><label for='alttitle'>".$clang->gT("Alternate").": </label><input type='text' id='alttitle' name='alttitle' style='width:300px'/>";
 
-
 $statisticsoutput .= "</ul></fieldset></div><p>"
 ."<input type='submit' value='".$clang->gT("View stats")."' />\n"
 ."<input type='button' value='".$clang->gT("Clear")."' onclick=\"window.open('$scriptname?action=statistics&amp;sid=$surveyid', '_top')\" />\n";
@@ -1610,13 +1610,14 @@
     }
     include_once("statistics_function.php");
     $outputType = $_POST['outputtype'];
+    $alttitle = $_POST['alttitle'];
     switch($outputType){
 
         case 'html':
             $statisticsoutput .= generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'DD',$statlang);
             break;
         case 'pdf':
-            generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'I',$statlang);
+            generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'I',$statlang, $alttitle);
             break;
         case 'xls':
             generate_statistics($surveyid,$summary,$summary,$usegraph,$outputType,'DD',$statlang);
Index: admin/statistics_function.php
===================================================================
--- admin/statistics_function.php	(revision 9681)
+++ admin/statistics_function.php	(working copy)
@@ -74,7 +74,7 @@
 * @param mixed $browse  Show browse buttons
 * @return buffer
 */
-function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0, $outputType='pdf', $pdfOutput='I',$statlangcode=null, $browse = true)
+function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0, $outputType='pdf', $pdfOutput='I',$statlangcode=null, $alttitle='', $browse = true)
 {
     //$allfields ="";
     global $connect, $dbprefix, $clang,
@@ -231,7 +231,10 @@
         // set header and footer fonts
         $pdf->setHeaderFont(Array($pdfdefaultfont, '', PDF_FONT_SIZE_MAIN));
         $pdf->setFooterFont(Array($pdfdefaultfont, '', PDF_FONT_SIZE_DATA));
-
+        if (trim($alttitle) != "")
+        {
+            $surveyInfo['surveyls_title'] = $alttitle;
+        }
         // set default header data
         $pdf->SetHeaderData("statistics.png", 10, $statlang->gT("Quick statistics",'unescaped') , $statlang->gT("Survey")." ".$surveyid." '".html_entity_decode($surveyInfo['surveyls_title'],ENT_QUOTES,'UTF-8')."'");
         
Index: locale/de/LC_MESSAGES/de.mo
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: locale/de/LC_MESSAGES/de.po
===================================================================
--- locale/de/LC_MESSAGES/de.po	(revision 9681)
+++ locale/de/LC_MESSAGES/de.po	(working copy)
@@ -3,8 +3,8 @@
 "Project-Id-Version: LimeSurvey German language file\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2010-12-09 21:50+0100\n"
-"PO-Revision-Date: 2010-12-09 21:52+0100\n"
-"Last-Translator: Carsten Schmitz <info@limesurvey.org>\n"
+"PO-Revision-Date: 2011-01-14 12:29+0100\n"
+"Last-Translator: dsf <sdf>\n"
 "Language-Team: LimeSurvey <c_schmitz@users.sourceforge.net>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -7470,6 +7470,10 @@
 msgid "View stats"
 msgstr "Statistik anzeigen"
 
+#: D:\web\xampp\htdocs\limesurvey/admin/statistics.php:348
+msgid "Alternate"
+msgstr "Alternativer Titel"
+
 #: D:\web\xampp\htdocs\limesurvey/admin/statistics.php:357
 msgid "Response filters"
 msgstr "Antwortfilter"
Index: locale/en/LC_MESSAGES/en.mo
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: locale/en/LC_MESSAGES/en.po
===================================================================
--- locale/en/LC_MESSAGES/en.po	(revision 9681)
+++ locale/en/LC_MESSAGES/en.po	(working copy)
@@ -8,8 +8,8 @@
 "Project-Id-Version: LimeSurvey\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2010-11-11 18:00+0100\n"
-"PO-Revision-Date: 2010-12-02 00:59+0100\n"
-"Last-Translator: Carsten Schmitz <info@limesurvey.org>\n"
+"PO-Revision-Date: 2011-01-14 12:29+0100\n"
+"Last-Translator: dsf <sdf>\n"
 "Language-Team: LimeSurvey <c_schmitz@users.sourceforge.net>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -996,6 +996,10 @@
 msgid "View stats"
 msgstr "View stats"
 
+#: D:\web\xampp\htdocs\limesurvey/admin/statistics.php:348
+msgid "Alternate"
+msgstr "Alternate Title"
+
 #: /var/lib/limesurvey-svn/subversion1x/admin/statistics.php:352
 #: /var/lib/limesurvey-svn/subversion1x/admin/statistics.php:1563
 #: /var/lib/limesurvey-svn/subversion1x/admin/conditionshandling.php:1930
AlternateTitle.patch (5,711 bytes)
Ingrimmsch

Ingrimmsch

2011-01-26 15:01

reporter   ~13964

will it be added in the next version?

c_schmitz

c_schmitz

2011-03-28 02:11

administrator   ~14572

Last edited: 2011-03-28 02:12

View 2 revisions

The label of the field should be 'Alternate PDF title'.
Also after submitting the form the title is disappearing. It should be preserved between submissions. Can you fix these two issues?

Don't worry about the language files, they will be updated automatically.
By the way, please attach a patch made with subversione (svn -diff) against the latest dev version. That is the easiest for us to apply.

Ingrimmsch

Ingrimmsch

2011-05-05 15:54

reporter   ~14933

I fix it in the next week.

If i can i wouldnt change the title because the function can be implemented in my ppt export.

So there are two parts for the alternative title

Issue History

Date Modified Username Field Change
2011-01-12 15:11 Ingrimmsch New Issue
2011-01-12 15:31 Ingrimmsch Note Added: 13882
2011-01-13 23:52 c_schmitz Note Added: 13907
2011-01-13 23:52 c_schmitz Assigned To => c_schmitz
2011-01-13 23:52 c_schmitz Status new => feedback
2011-01-14 12:02 Ingrimmsch Note Added: 13911
2011-01-14 12:02 Ingrimmsch Status feedback => assigned
2011-01-14 12:47 Ingrimmsch Note Added: 13912
2011-01-14 12:47 Ingrimmsch File Added: AlternateTitle.patch
2011-01-26 15:01 Ingrimmsch Note Added: 13964
2011-03-28 02:11 c_schmitz Note Added: 14572
2011-03-28 02:11 c_schmitz Status assigned => feedback
2011-03-28 02:12 c_schmitz Note Edited: 14572 View Revisions
2011-05-05 15:54 Ingrimmsch Note Added: 14933
2011-05-05 15:54 Ingrimmsch Status feedback => assigned
2012-06-21 14:18 c_schmitz Assigned To c_schmitz =>
2012-06-21 14:18 c_schmitz Status assigned => confirmed