Skip to content

Commit

Permalink
Fixed issue #08453: word is not displayed in statistic page
Browse files Browse the repository at this point in the history
Dev: fix the config(default, bad language for fireflysung.ttf
Dev: do not generate graph if fonts is known and not in directory
Dev: tested in zh-Hans with fireflysung.ttf : seems OK
  • Loading branch information
Shnoulle committed Dec 17, 2013
1 parent 0438d99 commit b5ff0a9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 40 deletions.
4 changes: 2 additions & 2 deletions application/config/config-defaults.php
Expand Up @@ -400,9 +400,9 @@
'ko'=>'UnBatang.ttf',
'si'=>'FreeSans.ttf',
'th'=>'TlwgTypist.ttf',
'zh-Hans'=>'fireflysung.ttf',
'zh-Hant-HK'=>'fireflysung.ttf',
'zh-Hant-HK'=>'fireflysung.ttf',
'zh-Hant-HK'=>'fireflysung.ttf',
'zh-Hant-TW'=>'fireflysung.ttf',
);

/**
Expand Down
81 changes: 43 additions & 38 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -30,7 +30,11 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
/* This is a lazy solution to bug #6389. A better solution would be to find out how
the "T" gets passed to this function from the statistics.js file in the first place! */
if(substr($iSurveyID,0,1)=="T") {$iSurveyID=substr($iSurveyID,1);}
static $bErrorGenerate=false;

if($bErrorGenerate){
return false;
}
$rootdir = Yii::app()->getConfig("rootdir");
$homedir = Yii::app()->getConfig("homedir");
$homeurl = Yii::app()->getConfig("homeurl");
Expand All @@ -42,7 +46,7 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$language = $oLanguage->langcode;
$clang = $oLanguage;
$cachefilename = "";

/* Set the fonts for the chart */
if ($chartfontfile=='auto')
{
Expand All @@ -58,11 +62,12 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
}
else
{
Yii::app()->session['flashmessage'] = sprintf($clang->gT('The fonts file %s was not found in <limesurvey root folder>/fonts directory. Please, see the txt file for your language in fonts directory.'),$neededfontfile);
Yii::app()->setFlashMessage(sprintf($clang->gT('The fonts file %s was not found in <limesurvey root folder>/fonts directory. Please, see the txt file for your language in fonts directory to generate the charts.'),$neededfontfile),'error');
$bErrorGenerate=true;// Don't do a graph again.
return false;
}
}
}

if (count($lbl)>72)
{
$DataSet = array(1=>array(1=>1));
Expand Down Expand Up @@ -2719,49 +2724,49 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
if ($bShowGraph == true)
{
$cachefilename = createChart($qqid, $qsid, $bShowPieChart, $lbl, $gdata, $grawdata, $MyCache, $statlang, $outputs['qtype']);
//introduce new counter
if (!isset($ci)) {$ci=0;}

//increase counter, start value -> 1
$ci++;
switch($outputType)
if($cachefilename) // Add the image only if constructed
{
case 'xls':

/**
* No Image for Excel...
*/
//introduce new counter
if (!isset($ci)) {$ci=0;}

break;
case 'pdf':
//increase counter, start value -> 1
$ci++;
switch($outputType)
{
case 'xls':

$this->pdf->AddPage('P','A4');
/**
* No Image for Excel...
*/

$this->pdf->titleintopdf($pdfTitle,$titleDesc);
$this->pdf->Image($tempdir."/".$cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/".$surveyid), 'B', true, 150,'C',false,false,0,true);
break;
case 'pdf':

break;
case 'html':
$statisticsoutput .= "<img src=\"$tempurl/".$cachefilename."\" border='1' />";

$aattr = getQuestionAttributeValues($qqid, $firstletter);
if ($bShowMap) {
$statisticsoutput .= "<div id=\"statisticsmap_$rt\" class=\"statisticsmap\"></div>";

$agmapdata[$rt] = array (
"coord" => getQuestionMapData(substr($rt, 1), $qsid),
"zoom" => $aattr['location_mapzoom'],
"width" => $aattr['location_mapwidth'],
"height" => $aattr['location_mapheight']
);
}
break;
default:
$this->pdf->AddPage('P','A4');

$this->pdf->titleintopdf($pdfTitle,$titleDesc);
$this->pdf->Image($tempdir."/".$cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/".$surveyid), 'B', true, 150,'C',false,false,0,true);

break;
break;
case 'html':
$statisticsoutput .= "<img src=\"$tempurl/".$cachefilename."\" border='1' />";

$aattr = getQuestionAttributeValues($qqid, $firstletter);
if ($bShowMap) {
$statisticsoutput .= "<div id=\"statisticsmap_$rt\" class=\"statisticsmap\"></div>";

$agmapdata[$rt] = array (
"coord" => getQuestionMapData(substr($rt, 1), $qsid),
"zoom" => $aattr['location_mapzoom'],
"width" => $aattr['location_mapwidth'],
"height" => $aattr['location_mapheight']
);
}
break;
default:
break;
}
}

}
}

Expand Down

0 comments on commit b5ff0a9

Please sign in to comment.