Skip to content

Commit

Permalink
fixed path to colorPalette for PDF in statistics createChart (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbischof authored and olleharstedt committed Dec 14, 2018
1 parent 01c7555 commit 74f02e7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions application/helpers/admin/statistics_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
return false;
}
$rootdir = Yii::app()->getConfig("rootdir");
$admintheme = Yii::app()->getConfig("admintheme");
$chartfontfile = Yii::app()->getConfig("chartfontfile");
$chartfontsize = Yii::app()->getConfig("chartfontsize");
$alternatechartfontfile = Yii::app()->getConfig("alternatechartfontfile");
$cachefilename = "";

$adminThemePath = AdminTheme::getInstance()->path;

/* Set the fonts for the chart */
if ($chartfontfile == 'auto') {
// Tested with ar,be,el,fa,hu,he,is,lt,mt,sr, and en (english)
Expand All @@ -65,7 +66,7 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
$cachefilename = basename($cache->GetFileFromCache("graph".$iSurveyID.$sLanguageCode.$iQuestionID, $DataSet));
} else {
$graph = new pChart(690, 200);
$graph->loadColorPalette(Yii::app()->getConfig('styledir').DIRECTORY_SEPARATOR.$admintheme.DIRECTORY_SEPARATOR.'images/limesurvey.pal');
$graph->loadColorPalette($adminThemePath . DIRECTORY_SEPARATOR . 'images/limesurvey.pal');
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile, $chartfontsize);
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile, $chartfontsize);
$graph->drawTitle(0, 0, gT('Sorry, but this question has too many answer options to be shown properly in a graph.', 'unescaped'), 30, 30, 30, 690, 200);
Expand All @@ -81,7 +82,7 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
$cachefilename = basename($cache->GetFileFromCache("graph".$iSurveyID.$sLanguageCode.$iQuestionID, $DataSet));
} else {
$graph = new pChart(690, 200);
$graph->loadColorPalette(Yii::app()->getConfig('styledir').DIRECTORY_SEPARATOR.$admintheme.DIRECTORY_SEPARATOR.'images/limesurvey.pal');
$graph->loadColorPalette($adminThemePath . DIRECTORY_SEPARATOR . 'images/limesurvey.pal');
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile, $chartfontsize);
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile, $chartfontsize);
$graph->drawTitle(0, 0, gT('Sorry, but this question has no responses yet so a graph cannot be shown.', 'unescaped'), 30, 30, 30, 690, 200);
Expand Down Expand Up @@ -171,7 +172,7 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
}
$graph = new pChart(690 + $legendsize[0], $gheight);
$graph->drawFilledRectangle(0, 0, 690 + $legendsize[0], $gheight, 254, 254, 254, false);
$graph->loadColorPalette(Yii::app()->getConfig('styledir').DIRECTORY_SEPARATOR.$admintheme.DIRECTORY_SEPARATOR.'images/limesurvey.pal');
$graph->loadColorPalette($adminThemePath . DIRECTORY_SEPARATOR . 'images/limesurvey.pal');
$graph->setFontProperties($rootdir.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$chartfontfile, $chartfontsize);
$graph->setGraphArea(50, 30, 500, $gheight - 60);
$graph->drawFilledRoundedRectangle(7, 7, 523 + $legendsize[0], $gheight - 7, 5, 254, 255, 254);
Expand Down Expand Up @@ -255,7 +256,7 @@ function createChart($iQuestionID, $iSurveyID, $type = null, $lbl, $gdata, $graw
$gheight = ceil($gheight);
$graph = new pChart(690, $gheight);
$graph->drawFilledRectangle(0, 0, 690, $gheight, 254, 254, 254, false);
$graph->loadColorPalette(Yii::app()->getConfig('styledir').DIRECTORY_SEPARATOR.$admintheme.'/images/limesurvey.pal');
$graph->loadColorPalette($adminThemePath . DIRECTORY_SEPARATOR . 'images/limesurvey.pal');
$graph->drawFilledRoundedRectangle(7, 7, 687, $gheight - 3, 5, 254, 255, 254);
$graph->drawRoundedRectangle(5, 5, 689, $gheight - 1, 5, 230, 230, 230);

Expand Down

0 comments on commit 74f02e7

Please sign in to comment.