Skip to content

Commit

Permalink
Fixed issue #6285: Error on response export to PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jul 6, 2012
1 parent dde038f commit 9bd2e88
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
10 changes: 4 additions & 6 deletions application/config/config-defaults.php
Expand Up @@ -306,15 +306,13 @@

/**
* PDF Export Settings
* This feature configures PDF export for Print Answers
* The PDF export is totally experimental. The output is mostly ugly.
* At this point no support can be given - if you want to help to fix it please get in touch with us
* This feature configures PDF export for Export Answers
*/

//$config['pdfdefaultfont'] = 'freemono'; //Default font for the pdf Export
//$config['pdffontsize'] = 9; //Fontsize for normal text; Surveytitle is +4; grouptitle is +2
$config['pdfdefaultfont'] = 'freemono'; //Default font for the pdf Export
$config['pdffontsize'] = 9; //Fontsize for normal text; Surveytitle is +4; grouptitle is +2
$config['notsupportlanguages'] = array('zh-Hant-TW','zh-Hant-HK','zh-Hans','ja','th');
//$config['pdforientation'] = 'P'; // Set L for Landscape or P for portrait format
$config['pdforientation'] = 'P'; // Set L for Landscape or P for portrait format



Expand Down
2 changes: 0 additions & 2 deletions application/controllers/admin/export.php
Expand Up @@ -193,8 +193,6 @@ public function exportresults()

$afieldcount = count($excesscols);

$this->getController()->_getAdminHeader();

$selecthide = "'";
$selectshow = "";
$selectinc = "";
Expand Down
9 changes: 5 additions & 4 deletions application/helpers/admin/exportresults_helper.php
Expand Up @@ -1588,10 +1588,11 @@ public function __construct($filename = null)
//The $pdforientation, $pdfDefaultFont, and $pdfFontSize values
//come from the Lime Survey config files.

global $pdforientation, $pdfdefaultfont, $pdffontsize;
global $pdforientation, $pdfdefaultfont, $pdffontsize;

$this->pdf = new PDF($pdforientation,'mm','A4');
$this->pdf->SetFont($pdfdefaultfont, '', $pdffontsize);
Yii::import('application.libraries.admin.pdf', true);
$this->pdf = new PDF(Yii::app()->getConfig('pdforientation'),'mm','A4');
$this->pdf->SetFont(Yii::app()->getConfig('pdfdefaultfont'), '', Yii::app()->getConfig('pdffontsize'));
$this->pdf->AddPage();
$this->pdf->intopdf("PDF export ".date("Y.m.d-H:i", time()));

Expand Down Expand Up @@ -1653,7 +1654,7 @@ public function close()
else
{
//Presuming this else branch is a send to client via HTTP.
$filename = $this->translate($this->surveyName, $this->languageCode).'pdf';
$filename = $this->translate($this->surveyName, $this->languageCode).'.pdf';
}
$this->pdf->Output($filename, $this->pdfDestination);
}
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/export/exportresults_view.php
Expand Up @@ -61,7 +61,7 @@
<li><input type='radio' class='radiobtn' name='type' value='csv' id='csvdoc' <?php if (!function_exists('iconv'))
{ echo 'checked="checked" ';} ?>onclick='document.getElementById(\"ansabbrev\").disabled=false;' />
<label for='csvdoc'><?php $clang->eT("CSV File (All charsets)");?></label></li>
<li><input type='radio' class='radiobtn' name='type' value='pdf' id='pdfdoc' onclick='document.getElementById(\"ansabbrev\").disabled=false;' />"
<li><input type='radio' class='radiobtn' name='type' value='pdf' id='pdfdoc' onclick='document.getElementById(\"ansabbrev\").disabled=false;' />
<label for='pdfdoc'><?php $clang->eT("PDF");?><br />
</label></li>
</ul></fieldset>
Expand Down
6 changes: 5 additions & 1 deletion styles/gringegreen/adminstyle.css
Expand Up @@ -83,7 +83,7 @@ th, p, div {
}

fieldset {
padding:0 6px 0px 6px;
padding:4px 8px 4px 8px;
margin: 3px;
border-color:#DDD;
border-style: solid;
Expand Down Expand Up @@ -1658,3 +1658,7 @@ ol.organizer {
{
width:140px;
}

legend{
margin:1em;
}

0 comments on commit 9bd2e88

Please sign in to comment.