".sprintf($statlang->gT("Field summary for %s"),$qtitle).":"
+ ."\t
".sprintf(gT("Field summary for %s"),$qtitle).":"
."
\n"
."\t
$qquestion
\n"
."\t
\n\t\t
"
- .$statlang->gT("Calculation")."
\n"
+ .gT("Calculation")."\n"
."\t\t
"
- .$statlang->gT("Result")."
\n"
+ .gT("Result")."\n"
."\t
\n";
break;
@@ -1063,10 +1063,10 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
foreach ($result as $row)
{
//put translation of mean and calculated data into $showem array
- $showem[]=array($statlang->gT("Sum"), $row['sum']);
- $showem[]=array($statlang->gT("Standard deviation"), round($row['stdev'],2));
- $showem[]=array($statlang->gT("Average"), round($row['average'],2));
- $showem[]=array($statlang->gT("Minimum"), $row['minimum']);
+ $showem[]=array(gT("Sum"), $row['sum']);
+ $showem[]=array(gT("Standard deviation"), round($row['stdev'],2));
+ $showem[]=array(gT("Average"), round($row['average'],2));
+ $showem[]=array(gT("Minimum"), $row['minimum']);
//Display the maximum and minimum figures after the quartiles for neatness
$maximum=$row['maximum'];
@@ -1082,104 +1082,104 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
$quartiles[3] = $this->getQuartile(3, $fieldname, $surveyid, $sql, $excludezeros);
//we just put the total number of records at the beginning of this array
- array_unshift($showem, array($statlang->gT("Count"), $medcount));
+ array_unshift($showem, array(gT("Count"), $medcount));
/* IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT */
/* IF YOU DON'T UNDERSTAND WHAT QUARTILES ARE DO NOT MODIFY THIS CODE */
/* Quartiles and Median values are NOT related to average, and the sum is irrelevent */
- if (isset($quartiles[1])) $showem[]=array($statlang->gT("1st quartile (Q1)"), $quartiles[1]);
- if (isset($quartiles[2])) $showem[]=array($statlang->gT("2nd quartile (Median)"), $quartiles[2]);
- if (isset($quartiles[3])) $showem[]=array($statlang->gT("3rd quartile (Q3)"), $quartiles[3]);
- $showem[]=array($statlang->gT("Maximum"), $maximum);
+ if (isset($quartiles[1])) $showem[]=array(gT("1st quartile (Q1)"), $quartiles[1]);
+ if (isset($quartiles[2])) $showem[]=array(gT("2nd quartile (Median)"), $quartiles[2]);
+ if (isset($quartiles[3])) $showem[]=array(gT("3rd quartile (Q3)"), $quartiles[3]);
+ $showem[]=array(gT("Maximum"), $maximum);
- //output results
- foreach ($showem as $shw)
+ //output results
+ foreach ($showem as $shw)
+ {
+ switch($outputType)
{
- switch($outputType)
- {
- case 'xls':
+ case 'xls':
- $this->xlsRow++;
- $this->sheet->write($this->xlsRow, 0,html_entity_decode($shw[0],ENT_QUOTES,'UTF-8'));
- $this->sheet->write($this->xlsRow, 1,html_entity_decode($shw[1],ENT_QUOTES,'UTF-8'));
+ $this->xlsRow++;
+ $this->sheet->write($this->xlsRow, 0,html_entity_decode($shw[0],ENT_QUOTES,'UTF-8'));
+ $this->sheet->write($this->xlsRow, 1,html_entity_decode($shw[1],ENT_QUOTES,'UTF-8'));
- break;
- case 'pdf':
+ break;
+ case 'pdf':
- $tablePDF[] = array(html_entity_decode($shw[0],ENT_QUOTES,'UTF-8'),html_entity_decode($shw[1],ENT_QUOTES,'UTF-8'));
+ $tablePDF[] = array(html_entity_decode($shw[0],ENT_QUOTES,'UTF-8'),html_entity_decode($shw[1],ENT_QUOTES,'UTF-8'));
- break;
- case 'html':
+ break;
+ case 'html':
- $statisticsoutput .= "\t
\n"
- ."\t\t
$shw[0]
\n"
- ."\t\t
$shw[1]
\n"
- ."\t
\n";
+ $statisticsoutput .= "\t
\n"
+ ."\t\t
$shw[0]
\n"
+ ."\t\t
$shw[1]
\n"
+ ."\t
\n";
- break;
- default:
+ break;
+ default:
- break;
- }
+ break;
}
- switch($outputType)
- {
- case 'xls':
+ }
+ switch($outputType)
+ {
+ case 'xls':
- $this->xlsRow++;
- $this->sheet->write($this->xlsRow, 0,$statlang->gT("Null values are ignored in calculations"));
- $this->xlsRow++;
- $this->sheet->write($this->xlsRow, 0,sprintf($statlang->gT("Q1 and Q3 calculated using %s"), $statlang->gT("minitab method")));
+ $this->xlsRow++;
+ $this->sheet->write($this->xlsRow, 0,gT("Null values are ignored in calculations"));
+ $this->xlsRow++;
+ $this->sheet->write($this->xlsRow, 0,sprintf(gT("Q1 and Q3 calculated using %s"), gT("minitab method")));
- $footXLS[] = array($statlang->gT("Null values are ignored in calculations"));
- $footXLS[] = array(sprintf($statlang->gT("Q1 and Q3 calculated using %s"), $statlang->gT("minitab method")));
+ $footXLS[] = array(gT("Null values are ignored in calculations"));
+ $footXLS[] = array(sprintf(gT("Q1 and Q3 calculated using %s"), gT("minitab method")));
- break;
- case 'pdf':
+ break;
+ case 'pdf':
- $footPDF[] = array($statlang->gT("Null values are ignored in calculations"));
- $footPDF[] = array(sprintf($statlang->gT("Q1 and Q3 calculated using %s"), "".$statlang->gT("minitab method").""));
- $this->pdf->AddPage('P','A4');
- $this->pdf->Bookmark($this->pdf->delete_html($qquestion), 1, 0);
- $this->pdf->titleintopdf($pdfTitle,$titleDesc);
+ $footPDF[] = array(gT("Null values are ignored in calculations"));
+ $footPDF[] = array(sprintf(gT("Q1 and Q3 calculated using %s"), "".gT("minitab method").""));
+ $this->pdf->AddPage('P','A4');
+ $this->pdf->Bookmark($this->pdf->delete_html($qquestion), 1, 0);
+ $this->pdf->titleintopdf($pdfTitle,$titleDesc);
- $this->pdf->headTable($headPDF, $tablePDF);
+ $this->pdf->headTable($headPDF, $tablePDF);
- $this->pdf->tablehead($footPDF);
+ $this->pdf->tablehead($footPDF);
- break;
- case 'html':
+ break;
+ case 'html':
- //footer of question type "N"
+ //footer of question type "N"
+ $statisticsoutput .= "\t
\n"
+ ."\t\t
\n"
+ ."\t\t\t".gT("Null values are ignored in calculations")." \n"
+ ."\t\t\t".sprintf(gT("Q1 and Q3 calculated using %s"), "".gT("minitab method")."")
+ ."\n"
+ ."\t\t
\n"
+ ."\t
\n";
+ if($browse)
+ {
$statisticsoutput .= "\t
\n"
- ."\t\t
\n"
- ."\t\t\t".$statlang->gT("Null values are ignored in calculations")." \n"
- ."\t\t\t".sprintf($statlang->gT("Q1 and Q3 calculated using %s"), "".$statlang->gT("minitab method")."")
- ."\n"
- ."\t\t
\n"
- ."\t
\n";
- if($browse)
- {
- $statisticsoutput .= "\t
\n"
- ."\t\t
-
\n
";
- $statisticsoutput .= "
-
";
- }
- $statisticsoutput .= "
\n";
+ ."\t\t
+
\n
";
+ $statisticsoutput .= "
+
";
+ }
+ $statisticsoutput .= "
\n";
- break;
- default:
+ break;
+ default:
- break;
- }
+ break;
+ }
- //clean up
- unset($showem);
+ //clean up
+ unset($showem);
//not enough (<1) results for calculation
@@ -1189,12 +1189,12 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
{
case 'xls':
$this->xlsRow++;
- $this->sheet->write($this->xlsRow, 0, $statlang->gT("Not enough values for calculation"));
+ $this->sheet->write($this->xlsRow, 0, gT("Not enough values for calculation"));
break;
case 'pdf':
$tablePDF = array();
- $tablePDF[] = array($statlang->gT("Not enough values for calculation"));
+ $tablePDF[] = array(gT("Not enough values for calculation"));
$this->pdf->AddPage('P','A4');
$this->pdf->Bookmark($this->pdf->delete_html($qquestion), 1, 0);
$this->pdf->titleintopdf($pdfTitle,$titleDesc);
@@ -1205,7 +1205,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
//output
$statisticsoutput .= "\t
\n"
- ."\t\t
".$statlang->gT("Not enough values for calculation")."
\n"
+ ."\t\t
".gT("Not enough values for calculation")."
\n"
."\t
\n \n";
break;
@@ -1319,7 +1319,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
- //Array of Yes/No/$statlang->gT("Uncertain")
+ //Array of Yes/No/gT("Uncertain")
case "C":
$qquery = "SELECT title, question FROM {{questions}} WHERE parent_qid='$qiqid' AND title='$qanswer' AND language='{$language}' ORDER BY question_order";
$qresult=Yii::app()->db->createCommand($qquery)->query();
@@ -1329,9 +1329,9 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
{
$qrow=array_values($qrow);
//add results
- $alist[]=array("Y", $statlang->gT("Yes"));
- $alist[]=array("N", $statlang->gT("No"));
- $alist[]=array("U", $statlang->gT("Uncertain"));
+ $alist[]=array("Y", gT("Yes"));
+ $alist[]=array("N", gT("No"));
+ $alist[]=array("U", gT("Uncertain"));
$atext=flattenText($qrow[1]);
}
//output
@@ -1341,7 +1341,7 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
- //Array of Yes/No/$statlang->gT("Uncertain")
+ //Array of Yes/No/gT("Uncertain")
//same as above
case "E":
$qquery = "SELECT title, question FROM {{questions}} WHERE parent_qid='$qiqid' AND title='$qanswer' AND language='{$language}' ORDER BY question_order";
@@ -1349,9 +1349,9 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
foreach ($qresult->readAll() as $qrow)
{
$qrow=array_values($qrow);
- $alist[]=array("I", $statlang->gT("Increase"));
- $alist[]=array("S", $statlang->gT("Same"));
- $alist[]=array("D", $statlang->gT("Decrease"));
+ $alist[]=array("I", gT("Increase"));
+ $alist[]=array("S", gT("Same"));
+ $alist[]=array("D", gT("Decrease"));
$atext=flattenText($qrow[1]);
}
$qquestion .= $linefeed."[".$atext."]";
@@ -1455,15 +1455,15 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
case "G": //Gender
- $alist[]=array("F", $statlang->gT("Female"));
- $alist[]=array("M", $statlang->gT("Male"));
+ $alist[]=array("F", gT("Female"));
+ $alist[]=array("M", gT("Male"));
break;
case "Y": //Yes\No
- $alist[]=array("Y", $statlang->gT("Yes"));
- $alist[]=array("N", $statlang->gT("No"));
+ $alist[]=array("Y", gT("Yes"));
+ $alist[]=array("N", gT("No"));
break;
@@ -1574,19 +1574,19 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
if ((($qtype == "L" || $qtype == "!") && $qother == "Y"))
{
//add "other"
- $alist[]=array($statlang->gT("Other"),$statlang->gT("Other"),$fielddata['fieldname'].'other');
+ $alist[]=array(gT("Other"),gT("Other"),$fielddata['fieldname'].'other');
}
if ( $qtype == "O")
{
//add "comment"
- $alist[]=array($statlang->gT("Comments"),$statlang->gT("Comments"),$fielddata['fieldname'].'comment');
+ $alist[]=array(gT("Comments"),gT("Comments"),$fielddata['fieldname'].'comment');
}
} //end switch question type
//moved because it's better to have "no answer" at the end of the list instead of the beginning
//put data into array
- $alist[]=array("", $statlang->gT("No answer"));
+ $alist[]=array("", gT("No answer"));
}
@@ -1604,11 +1604,10 @@ protected function buildOutputList($rt, $language, $surveyid, $outputType, $sql,
* @param mixed $sql
* @param mixed $usegraph
*/
- protected function displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $oLanguage) {
+ protected function displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $sLanguage) {
/* Set up required variables */
$TotalCompleted = 0; //Count of actually completed answers
- $statlang = $oLanguage;
$statisticsoutput="";
$sDatabaseType = Yii::app()->db->getDriverName();
$tempdir = Yii::app()->getConfig("tempdir");
@@ -1629,7 +1628,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
{
case 'xls':
- $xlsTitle = sprintf($statlang->gT("Field summary for %s"),html_entity_decode($outputs['qtitle'],ENT_QUOTES,'UTF-8'));
+ $xlsTitle = sprintf(gT("Field summary for %s"),html_entity_decode($outputs['qtitle'],ENT_QUOTES,'UTF-8'));
$xlsDesc = html_entity_decode($outputs['qquestion'],ENT_QUOTES,'UTF-8');
$this->xlsRow++;
@@ -1645,7 +1644,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
case 'pdf':
$sPDFQuestion=flattenText($outputs['qquestion'],false,true);
- $pdfTitle = $this->pdf->delete_html(sprintf($statlang->gT("Field summary for %s"),html_entity_decode($outputs['qtitle'],ENT_QUOTES,'UTF-8')));
+ $pdfTitle = $this->pdf->delete_html(sprintf(gT("Field summary for %s"),html_entity_decode($outputs['qtitle'],ENT_QUOTES,'UTF-8')));
$titleDesc = $sPDFQuestion;
$this->pdf->AddPage('P','A4');
@@ -1661,7 +1660,7 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
."\t
"
//headline
- .sprintf($statlang->gT("Field summary for %s"),$outputs['qtitle']).""
+ .sprintf(gT("Field summary for %s"),$outputs['qtitle']).""
."
";
}
@@ -2808,31 +2807,25 @@ protected function displayResults($outputs, $results, $rt, $outputType, $surveyi
* @param mixed $browse Show browse buttons
* @return buffer
*/
- public function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0, $outputType='pdf', $pdfOutput='I',$statlangcode=null, $browse = true)
+ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0, $outputType='pdf', $pdfOutput='I',$sLanguageCode=null, $browse = true)
{
- $astatdata=array(); //astatdata generates data for the output page's javascript so it can rebuild graphs on the fly
+ $aStatisticsData=array(); //astatdata generates data for the output page's javascript so it can rebuild graphs on the fly
//load surveytranslator helper
Yii::import('application.helpers.surveytranslator_helper', true);
Yii::import('application.third_party.ar-php.Arabic', true);
- $statisticsoutput = ""; //This string carries all the actual HTML code to print.
- $imagedir = Yii::app()->getConfig("imagedir");
- $tempdir = Yii::app()->getConfig("tempdir");
- $tempurl = Yii::app()->getConfig("tempurl");
+ $sOutputHTML = ""; //This string carries all the actual HTML code to print.
+ $sTempDir = Yii::app()->getConfig("tempdir");
$this->pdf=array(); //Make sure $this->pdf exists - it will be replaced with an object if a $this->pdf is actually being created
-
- // Used for getting coordinates for google maps
- $agmapdata = array();
-
//pick the best font file if font setting is 'auto'
- if (is_null($statlangcode))
+ if (is_null($sLanguageCode))
{
- $statlangcode = getBaseLanguageFromSurveyID($surveyid);
+ $sLanguageCode = getBaseLanguageFromSurveyID($surveyid);
}
- $statlang = new Limesurvey_lang($statlangcode);
+ Yii::app()->setLanguage($sLanguageCode);
/*
* this variable is used in the function shortencode() which cuts off a question/answer title
@@ -2840,7 +2833,7 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
*/
$maxchars = 13;
//we collect all the html-output within this variable
- $statisticsoutput ='';
+ $sOutputHTML ='';
/**
* $outputType: html || pdf ||
*/
@@ -2855,10 +2848,10 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
$surveylanguagecodes = Survey::model()->findByPk($surveyid)->additionalLanguages;
$surveylanguagecodes[] = Survey::model()->findByPk($surveyid)->language;
- $fieldmap=createFieldMap($surveyid, "full", false, false, $statlangcode);
+ $fieldmap=createFieldMap($surveyid, "full", false, false, $sLanguageCode);
// Set language for questions and answers to base language of this survey
- $language=$statlangcode;
+ $language=$sLanguageCode;
if($q2show=='all' )
{
@@ -2942,9 +2935,9 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
// set document information
$this->pdf->SetCreator(PDF_CREATOR);
$this->pdf->SetAuthor('LimeSurvey');
- $this->pdf->SetTitle(sprintf($statlang->gT("Statistics survey %s"),$surveyid));
+ $this->pdf->SetTitle(sprintf(gT("Statistics survey %s"),$surveyid));
$this->pdf->SetSubject($surveyInfo['surveyls_title']);
- $this->pdf->SetKeywords('LimeSurvey,'.$statlang->gT("Statistics").', '.sprintf($statlang->gT("Survey %s"),$surveyid));
+ $this->pdf->SetKeywords('LimeSurvey,'.gT("Statistics").', '.sprintf(gT("Survey %s"),$surveyid));
$this->pdf->SetDisplayMode('fullpage', 'two');
$this->pdf->setLanguageArray($aPdfLanguageSettings['lg']);
@@ -2955,7 +2948,7 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
// set default header data
// Since png crashes some servers (and we can not try/catch that) we use .gif (or .jpg) instead
$headerlogo = 'statistics.gif';
- $this->pdf->SetHeaderData($headerlogo, 10, $statlang->gT("Quick statistics",'unescaped') , $statlang->gT("Survey")." ".$surveyid." '".flattenText($surveyInfo['surveyls_title'],false,true,'UTF-8')."'");
+ $this->pdf->SetHeaderData($headerlogo, 10, gT("Quick statistics",'unescaped') , gT("Survey")." ".$surveyid." '".flattenText($surveyInfo['surveyls_title'],false,true,'UTF-8')."'");
$this->pdf->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
// set default monospaced font
$this->pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
@@ -2969,7 +2962,7 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
if($pdfOutput=='F')
{
- $sFileName = $tempdir.'/statistic-survey'.$surveyid.'.xls';
+ $sFileName = $sTempDir.'/statistic-survey'.$surveyid.'.xls';
$this->workbook = new Xlswriter($sFileName);
}
else
@@ -2978,12 +2971,12 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
$this->workbook->setVersion(8);
// Inform the module that our data will arrive as UTF-8.
// Set the temporary directory to avoid PHP error messages due to open_basedir restrictions and calls to tempnam("", ...)
- $this->workbook->setTempDir($tempdir);
+ $this->workbook->setTempDir($sTempDir);
// Inform the module that our data will arrive as UTF-8.
// Set the temporary directory to avoid PHP error messages due to open_basedir restrictions and calls to tempnam("", ...)
- if (!empty($tempdir)) {
- $this->workbook->setTempDir($tempdir);
+ if (!empty($sTempDir)) {
+ $this->workbook->setTempDir($sTempDir);
}
if ($pdfOutput!='F')
$this->workbook->send('statistic-survey'.$surveyid.'.xls');
@@ -3041,16 +3034,16 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
{
case "xls":
$this->xlsRow = 0;
- $this->sheet->write($this->xlsRow,0,$statlang->gT("Number of records in this query:",'unescaped'));
+ $this->sheet->write($this->xlsRow,0,gT("Number of records in this query:",'unescaped'));
$this->sheet->writeNumber($this->xlsRow,1,$results);
$this->xlsRow++;
- $this->sheet->write($this->xlsRow,0,$statlang->gT("Total records in survey:",'unescaped'));
+ $this->sheet->write($this->xlsRow,0,gT("Total records in survey:",'unescaped'));
$this->sheet->writeNumber($this->xlsRow,1,$total);
if($total)
{
$this->xlsRow++;
- $this->sheet->write($this->xlsRow,0,$statlang->gT("Percentage of total:",'unescaped'));
+ $this->sheet->write($this->xlsRow,0,gT("Percentage of total:",'unescaped'));
$this->sheet->writeNumber($this->xlsRow,1,$results/$total, $this->xlsPercents);
}
@@ -3059,36 +3052,36 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
case 'pdf':
// add summary to pdf
$array = array(
- array($statlang->gT("Number of records in this query:",'unescaped'), $results),
- array($statlang->gT("Total records in survey:",'unescaped'), $total)
+ array(gT("Number of records in this query:",'unescaped'), $results),
+ array(gT("Total records in survey:",'unescaped'), $total)
);
if($total)
{
- $array[] = array($statlang->gT("Percentage of total:",'unescaped'), $percent."%");
+ $array[] = array(gT("Percentage of total:",'unescaped'), $percent."%");
}
$this->pdf->AddPage('P', ' A4');
- $this->pdf->Bookmark($statlang->gT("Results",'unescaped'), 0, 0);
- $this->pdf->titleintopdf($statlang->gT("Results",'unescaped'),$statlang->gT("Survey",'unescaped')." ".$surveyid);
+ $this->pdf->Bookmark(gT("Results",'unescaped'), 0, 0);
+ $this->pdf->titleintopdf(gT("Results",'unescaped'),gT("Survey",'unescaped')." ".$surveyid);
$this->pdf->tableintopdf($array);
break;
case 'html':
- $statisticsoutput .= " \n
\n"
- ."\t
".$statlang->gT("Results")."
\n"
- ."\t
".$statlang->gT("Number of records in this query:").'
'
+ $sOutputHTML .= " \n
\n"
+ ."\t
".gT("Results")."
\n"
+ ."\t
".gT("Number of records in this query:").'
'
."
$results
\n"
- ."\t
".$statlang->gT("Total records in survey:").'
'
+ ."\t
".gT("Total records in survey:").'
'
."
$total
\n";
//only calculate percentage if $total is set
if ($total)
{
$percent=sprintf("%01.2f", ($results/$total)*100);
- $statisticsoutput .= "\t
".$statlang->gT("Percentage of total:").'
'
+ $sOutputHTML .= "\t
".gT("Percentage of total:").'
'
."
$percent%
\n";
}
- $statisticsoutput .="
\n";
+ $sOutputHTML .="
\n";
break;
default:
@@ -3115,21 +3108,21 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
if($outputType=='html' && $browse === true && Permission::model()->hasSurveyPermission($surveyid,'responses','read'))
{
//add a buttons to browse results
- $statisticsoutput .= CHtml::form(array("admin/responses/sa/browse/surveyid/{$surveyid}"), 'post',array('target'=>'_blank'))."\n"
+ $sOutputHTML .= CHtml::form(array("admin/responses/sa/browse/surveyid/{$surveyid}"), 'post',array('target'=>'_blank'))."\n"
."\t\t
"
."\t\t\n";
}
- } //end if (results > 0)
+ } //end if (results > 0)
/* Show Summary results
- * The $summary array contains each fieldname that we want to display statistics for
- *
- * */
+ * The $summary array contains each fieldname that we want to display statistics for
+ *
+ * */
if (isset($summary) && $summary)
{
@@ -3143,27 +3136,27 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
{
//Step 1: Get information about this response field (SGQA) for the summary
- $outputs=$this->buildOutputList($rt, $language, $surveyid, $outputType, $sql, $statlang);
- $statisticsoutput .= $outputs['statisticsoutput'];
+ $outputs=$this->buildOutputList($rt, $language, $surveyid, $outputType, $sql, $sLanguageCode);
+ $sOutputHTML .= $outputs['statisticsoutput'];
//2. Collect and Display results #######################################################################
if (isset($outputs['alist']) && $outputs['alist']) //Make sure there really is an answerlist, and if so:
{
- $display=$this->displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $statlang);
- $statisticsoutput .= $display['statisticsoutput'];
- $astatdata = array_merge($astatdata, $display['astatdata']);
- } //end if -> collect and display results
+ $display=$this->displayResults($outputs, $results, $rt, $outputType, $surveyid, $sql, $usegraph, $browse, $sLanguageCode);
+ $sOutputHTML .= $display['statisticsoutput'];
+ $aStatisticsData = array_merge($aStatisticsData, $display['astatdata']);
+ } //end if -> collect and display results
//Delete Build Outputs data
unset($outputs);
unset($display);
- } // end foreach -> loop through all questions
+ } // end foreach -> loop through all questions
//output
if($outputType=='html')
- $statisticsoutput .= " \n";
+ $sOutputHTML .= " \n";
- } //end if -> show summary results
+ } //end if -> show summary results
switch($outputType)
{
@@ -3186,12 +3179,12 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
if($pdfOutput=='F')
{ // This is only used by lsrc to send an E-Mail attachment, so it gives back the filename to send and delete afterwards
- $tempfilename = $tempdir."/Survey_".$surveyid.".pdf";
+ $tempfilename = $sTempDir."/Survey_".$surveyid.".pdf";
$this->pdf->Output($tempfilename, $pdfOutput);
return $tempfilename;
}
else
- return $this->pdf->Output($statlang->gT('Survey').'_'.$surveyid."_".$surveyInfo['surveyls_title'].'.pdf', $pdfOutput);
+ return $this->pdf->Output(gT('Survey').'_'.$surveyid."_".$surveyInfo['surveyls_title'].'.pdf', $pdfOutput);
break;
case 'html':
@@ -3204,13 +3197,13 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off"){
$sSSL='s';
}
- $statisticsoutput .= "\n"
- ."";
- return $statisticsoutput;
+ $sOutputHTML .= "\n"
+ ."";
+ return $sOutputHTML;
break;
default:
- return $statisticsoutput;
+ return $sOutputHTML;
break;
}
@@ -3218,30 +3211,30 @@ public function generate_statistics($surveyid, $allfields, $q2show='all', $usegr
}
/**
- * Get the quartile using minitab method
- *
- * L=(1/4)(n+1), U=(3/4)(n+1)
- * Minitab linear interpolation between the two
- * closest data points. Minitab would let L = 2.5 and find the value half way between the
- * 2nd and 3rd data points. In our example, that would be (4+9)/2 =
- * 6.5. Similarly, the upper quartile value would be half way between
- * the 7th and 8th data points, which would be (49+64)/2 = 56.5. If L
- * were 2.25, Minitab would find the value one fourth of the way
- * between the 2nd and 3rd data points and if L were 2.75, Minitab
- * would find the value three fourths of the way between the 2nd and
- * 3rd data points.
- *
- * @staticvar null $sid
- * @staticvar int $recordCount
- * @staticvar null $field
- * @staticvar null $allRows
- * @param 0|1|2|3 $quartile use 0 for return of recordcount, otherwise will return Q1,Q2,Q3
- * @param string $fieldname
- * @param int $surveyid
- * @param string $sql
- * @param bool $excludezeros
- * @return null|float
- */
+ * Get the quartile using minitab method
+ *
+ * L=(1/4)(n+1), U=(3/4)(n+1)
+ * Minitab linear interpolation between the two
+ * closest data points. Minitab would let L = 2.5 and find the value half way between the
+ * 2nd and 3rd data points. In our example, that would be (4+9)/2 =
+ * 6.5. Similarly, the upper quartile value would be half way between
+ * the 7th and 8th data points, which would be (49+64)/2 = 56.5. If L
+ * were 2.25, Minitab would find the value one fourth of the way
+ * between the 2nd and 3rd data points and if L were 2.75, Minitab
+ * would find the value three fourths of the way between the 2nd and
+ * 3rd data points.
+ *
+ * @staticvar null $sid
+ * @staticvar int $recordCount
+ * @staticvar null $field
+ * @staticvar null $allRows
+ * @param 0|1|2|3 $quartile use 0 for return of recordcount, otherwise will return Q1,Q2,Q3
+ * @param string $fieldname
+ * @param int $surveyid
+ * @param string $sql
+ * @param bool $excludezeros
+ * @return null|float
+ */
protected function getQuartile($quartile, $fieldname, $surveyid, $sql, $excludezeros) {
static $sid = null;
static $recordCount = 0;
@@ -3333,7 +3326,7 @@ function _listcolumn($surveyid, $column, $sortby="", $sortmethod="", $sorttype="
if (isset(Yii::app()->session['statistics_selects_'.$surveyid]) && is_array(Yii::app()->session['statistics_selects_'.$surveyid]))
{
foreach(Yii::app()->session['statistics_selects_'.$surveyid] as $sql) {
- $search['condition'] .= " AND $sql";
+ $search['condition'] .= " AND $sql";
}
}