Skip to content

Commit

Permalink
Fixed issue #6846: Graph statistics in Arabic are bad
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 9, 2012
1 parent f8190bb commit ffe5f8a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 21 deletions.
16 changes: 0 additions & 16 deletions application/controllers/Statistics_userController.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,6 @@ function actionAction($surveyid,$language)
$language = Survey::model()->findByPk($iSurveyID)->language;



$chartfontfile = Yii::app()->getConfig("chartfontfile");
//pick the best font file if font setting is 'auto'
if ($chartfontfile=='auto')
{
$chartfontfile='vera.ttf';
if ( $language=='ar')
{
$chartfontfile='KacstOffice.ttf';
}
elseif ($language=='fa' )
{
$chartfontfile='KacstFarsi.ttf';
}
}

//set survey language for translations
$clang = SetSurveyLanguage($iSurveyID, $language);

Expand Down
7 changes: 3 additions & 4 deletions application/helpers/admin/statistics_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$scriptname = Yii::app()->getConfig("scriptname");
$chartfontfile = Yii::app()->getConfig("chartfontfile");
$chartfontsize = Yii::app()->getConfig("chartfontsize");
$language = Survey::model()->findByPk($iSurveyID)->language;
$statlang = $oLanguage;
$language = $oLanguage->langcode;
$cachefilename = "";

/* Set the fonts for the chart */
Expand Down Expand Up @@ -163,7 +162,7 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
$i = 0;
while (isset ($gdata[$i]))
{
if ($gdata[$i] == 0 || ($type == "O" && substr($lbl[$i],0,strlen($statlang->gT("Comments")))==$statlang->gT("Comments")))
if ($gdata[$i] == 0 || ($type == "O" && substr($lbl[$i],0,strlen($oLanguage->gT("Comments")))==$oLanguage->gT("Comments")))
{
array_splice ($gdata, $i, 1);
array_splice ($lbl, $i, 1);
Expand All @@ -176,7 +175,7 @@ function createChart($iQuestionID, $iSurveyID, $type=null, $lbl, $gdata, $grawda
if ($language=='ar')
{
$lblout=$lbl; //reset text order to original
Yii::import('application.libraries.admin.Arabic', true);
Yii::import('application.libraries.Arabic', true);
$Arabic = new Arabic('ArGlyphs');
foreach($lblout as $kkey => $kval){
if (preg_match("^[A-Za-z]^", $kval)) { //auto detect if english
Expand Down
2 changes: 1 addition & 1 deletion application/libraries/Arabic.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Arabic
*/
public function __construct($library)
{
if($library[0]) $this->load($library[0]);
$this->load($library);
}

public function load($library)
Expand Down

0 comments on commit ffe5f8a

Please sign in to comment.