diff options
Diffstat (limited to 'admin/survey/export/latexclasses/Analize/AnalizaCrosstab.php')
-rw-r--r-- | admin/survey/export/latexclasses/Analize/AnalizaCrosstab.php | 293 |
1 files changed, 162 insertions, 131 deletions
diff --git a/admin/survey/export/latexclasses/Analize/AnalizaCrosstab.php b/admin/survey/export/latexclasses/Analize/AnalizaCrosstab.php index 7defd7f..fda4492 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaCrosstab.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaCrosstab.php @@ -2,43 +2,43 @@ global $site_path;
- include_once('../../function.php');
+ /*include_once('../../function.php');
include_once('../survey/definition.php');
-/* include_once('../exportclases/class.pdfIzvozAnalizaFrekvenca.php');
+ include_once('../exportclases/class.pdfIzvozAnalizaFrekvenca.php');
include_once('../exportclases/class.pdfIzvozAnalizaFunctions.php');
require_once('../exportclases/class.enka.pdf.php'); */
- define("ALLOW_HIDE_ZERRO_REGULAR", false); // omogočimo delovanje prikazovanja/skrivanja ničelnih vnosti za navadne odgovore
- define("ALLOW_HIDE_ZERRO_MISSING", true); // omogočimo delovanje prikazovanja/skrivanja ničelnih vnosti za missinge
+ if(!defined("ALLOW_HIDE_ZERRO_REGULAR"))define("ALLOW_HIDE_ZERRO_REGULAR", false); // omogočimo delovanje prikazovanja/skrivanja ničelnih vnosti za navadne odgovore
+ if(!defined("ALLOW_HIDE_ZERRO_MISSING"))define("ALLOW_HIDE_ZERRO_MISSING", true); // omogočimo delovanje prikazovanja/skrivanja ničelnih vnosti za missinge
- define("NUM_DIGIT_AVERAGE", 2); // stevilo digitalnih mest za povprecje
- define("NUM_DIGIT_DEVIATION", 2); // stevilo digitalnih mest za povprecje
+ if(!defined("NUM_DIGIT_AVERAGE"))define("NUM_DIGIT_AVERAGE", 2); // stevilo digitalnih mest za povprecje
+ if(!defined("NUM_DIGIT_DEVIATION"))define("NUM_DIGIT_DEVIATION", 2); // stevilo digitalnih mest za povprecje
- define("M_ANALIZA_DESCRIPTOR", "descriptor");
- define("M_ANALIZA_FREQUENCY", "frequency");
+ if(!defined("M_ANALIZA_DESCRIPTOR"))define("M_ANALIZA_DESCRIPTOR", "descriptor");
+ if(!defined("M_ANALIZA_FREQUENCY"))define("M_ANALIZA_FREQUENCY", "frequency");
- define("FNT_FREESERIF", "freeserif");
- define("FNT_FREESANS", "freesans");
- define("FNT_HELVETICA", "helvetica");
+ if(!defined("FNT_FREESERIF"))define("FNT_FREESERIF", "freeserif");
+ if(!defined("FNT_FREESANS"))define("FNT_FREESANS", "freesans");
+ if(!defined("FNT_HELVETICA"))define("FNT_HELVETICA", "helvetica");
- define("FNT_MAIN_TEXT", FNT_FREESANS);
- define("FNT_QUESTION_TEXT", FNT_FREESANS);
- define("FNT_HEADER_TEXT", FNT_FREESANS);
+ if(!defined("FNT_MAIN_TEXT"))define("FNT_MAIN_TEXT", FNT_FREESANS);
+ if(!defined("FNT_QUESTION_TEXT"))define("FNT_QUESTION_TEXT", FNT_FREESANS);
+ if(!defined("FNT_HEADER_TEXT"))define("FNT_HEADER_TEXT", FNT_FREESANS);
- define("FNT_MAIN_SIZE", 10);
- define("FNT_QUESTION_SIZE", 9);
- define("FNT_HEADER_SIZE", 10);
+ if(!defined("FNT_MAIN_SIZE"))define("FNT_MAIN_SIZE", 10);
+ if(!defined("FNT_QUESTION_SIZE"))define("FNT_QUESTION_SIZE", 9);
+ if(!defined("FNT_HEADER_SIZE"))define("FNT_HEADER_SIZE", 10);
- define("RADIO_BTN_SIZE", 3);
- define("CHCK_BTN_SIZE", 3);
- define("LINE_BREAK", 6);
+ if(!defined("RADIO_BTN_SIZE"))define("RADIO_BTN_SIZE", 3);
+ if(!defined("CHCK_BTN_SIZE"))define("CHCK_BTN_SIZE", 3);
+ if(!defined("LINE_BREAK"))define("LINE_BREAK", 6);
- define ('PDF_MARGIN_HEADER', 8);
- define ('PDF_MARGIN_FOOTER', 12);
- define ('PDF_MARGIN_TOP', 18);
- define ('PDF_MARGIN_BOTTOM', 18);
- define ('PDF_MARGIN_LEFT', 15);
- define ('PDF_MARGIN_RIGHT', 15);
+ if(!defined("PDF_MARGIN_HEADER"))define ('PDF_MARGIN_HEADER', 8);
+ if(!defined("PDF_MARGIN_FOOTER"))define ('PDF_MARGIN_FOOTER', 12);
+ if(!defined("PDF_MARGIN_TOP"))define ('PDF_MARGIN_TOP', 18);
+ if(!defined("PDF_MARGIN_BOTTOM"))define ('PDF_MARGIN_BOTTOM', 18);
+ if(!defined("PDF_MARGIN_LEFT"))define ('PDF_MARGIN_LEFT', 15);
+ if(!defined("PDF_MARGIN_RIGHT"))define ('PDF_MARGIN_RIGHT', 15);
/**
* @desc Class za generacijo izvoza v Latex
@@ -71,6 +71,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ protected $spaceBetweenTables = ' \newline \vspace*{1 cm} \newline';
public $crosstabClass = null; //crosstab class
+ protected $crosstabVars = null;
protected $sessionData;
protected $counter;
@@ -170,7 +171,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $this->pdf->SetSubject('An Order');
// set default header data
- $this->pdf->SetHeaderData(null, null, "www.1ka.si", $this->encodeText(SurveyInfo::getInstance()->getSurveyAkronim()));
+ $this->pdf->SetHeaderData(null, null, "www.1ka.si", LatexDocument::encodeText(SurveyInfo::getInstance()->getSurveyAkronim()));
//set auto page breaks
$this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
@@ -213,8 +214,8 @@ class AnalizaCrosstab extends LatexAnalysisElement{ /* print_r($crosstabClass);
echo "</br>"; */
- $grid1 = $spr1['grids'][$v_first['grd']];
- $grid2 = $spr2['grids'][$v_second['grd']];
+ $grid1 = isset($spr1['grids'][$v_first['grd']])?$spr1['grids'][$v_first['grd']]:array();
+ $grid2 = isset($spr2['grids'][$v_second['grd']])?$spr2['grids'][$v_second['grd']]:array();
#število vrstic in število kolon
$cols = count($crosstabs['options1']);
@@ -317,13 +318,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $this->crosstabClass->crossChkSR +
$this->crosstabClass->crossChkAR;
- //echo "steviloVmesnihVrstic: ".$steviloVmesnihVrstic."</br>";
- //echo "steviloVmesnihStolpcevPodvrstica2: ".$steviloVmesnihStolpcevPodvrstica2."</br>";
- //echo "steviloVmesnihStolpcevPodvrstica3: ".$steviloVmesnihStolpcevPodvrstica3."</br>";
$podVrstice = 0;
- //if($steviloVmesnihStolpcevPodvrstica2||$steviloVmesnihStolpcevPodvrstica3){
if($steviloVmesnihStolpcevPodvrstica2&&$steviloVmesnihStolpcevPodvrstica3){
//echo "1 </br>";
if($steviloVmesnihStolpcevPodvrstica2 >= $steviloVmesnihStolpcevPodvrstica3){
@@ -462,18 +459,15 @@ class AnalizaCrosstab extends LatexAnalysisElement{ for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){
//ce je prvi stolpec
if($i == 0){
- //$parameterTabular .= ($export_format == 'pdf' ? 'P|' : 'l|');
$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|');
}else{
- //$parameterTabular .= ($export_format == 'pdf' ? ' >{\hsize='.$sirinaOstalihStolpcev.'\hsize \centering\arraybackslash}X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
- //$parameterTabular .= ($export_format == 'pdf' ? 'c|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/ //pred spremembo je bilo to
}
}
//Priprava parametrov za tabelo - konec
//zacetek latex tabele z obrobo za prvo tabelo
- $pdfTable = 'tabularx';
+ $pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
@@ -494,10 +488,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $steviloArrayrulewidth = ($steviloMultiCol1-1);
if($export_format=='pdf'){
- //$tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}elseif($export_format=='rtf'){
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}
###########
@@ -524,9 +517,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //prva vrstica - konec ##############################################################################
// druga vrstica ####################################################################################
- $tabela .= $this->encodeText($sub_q2); //prvi stolpec 2. vrstice
- //echo "testiram, kjer ssem: ".$this->encodeText($sub_q2)."</br>";
- //echo "testiram, kjer ssem: ".$steviloTabColSep."</br>";
+ $tabela .= LatexDocument::encodeText($sub_q2); //prvi stolpec 2. vrstice
$drugaVrstica = array();
if (count($crosstabs['options1']) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
foreach ($crosstabs['options1'] as $ckey1 =>$crossVariabla) {
@@ -536,21 +527,25 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if ($crossVariabla['type'] != 't') {
$text .= ' ( '.$ckey1.' )';
}
- $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, $this->encodeText($text));
+ $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, LatexDocument::encodeText($text));
}
}
- //echo "test: ".$podVrstice."</br>";
if($podVrstice){ //ce je potrebno multicol prikazovanje
//spremenljivke za pravilno sirino
$colNum = $steviloVmesnihStolpcevPodvrstic;
- $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
- $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ if($steviloVmesnihStolpcevPodvrstica2){
+ $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
+ }
+ if($steviloVmesnihStolpcevPodvrstica3){
+ $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ }
+
//spremenljivke za pravilno sirino - konec
- $tabela .= $this->MultiColCellLatex($colNum, $this->encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vestice
+ $tabela .= $this->MultiColCellLatex($colNum, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vestice
}else{
$tabela .= " & ";
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vestice
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vestice
}
$tabela .= $this->texNewLine; /*nova vrstica*/
@@ -560,15 +555,20 @@ class AnalizaCrosstab extends LatexAnalysisElement{ // druga vrstica - konec #########################################################################
+ $tabela1 = ''; //za belezenje 1. vrstice s frekvencami
+ $tabela2 = ''; //za belezenje 2. vrstice z odstotki
+ $tabela3 = ''; //za belezenje 3. vrstice z residuali
+ $colNum = isset($colNum)?$colNum:0;
//izpis vmesnih vrstic tabele ####################################################################
if (count($crosstabs['options2']) > 0) {
+
//POSAMEZNA VMESNA VRSTICA
foreach ($crosstabs['options2'] as $ckey2 =>$crossVariabla2) {
//priprava besedila za prvo celico 1. stolpca
$text = $crossVariabla2['naslov'];
if($export_format != 'xls'){
- $text = $this->snippet($this->encodeText($text), 25);
+ $text = $this->snippet(LatexDocument::encodeText($text), 25);
}
if ($crossVariabla2['type'] !== 't') {
$text .= ' ('.$ckey2.')';
@@ -577,7 +577,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis prve celice 1. stolpca
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($text));
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($text));
}else{
$tabela .= $text;
}
@@ -585,45 +585,54 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabela1 = ''; //za belezenje 1. vrstice s frekvencami
$tabela2 = ''; //za belezenje 2. vrstice z odstotki
$tabela3 = ''; //za belezenje 3. vrstice z residuali
-
+ $colNum = isset($colNum)?$colNum:0;
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
-
if ($this->crosstabClass->crossChk0) {
# frekvence crostabov
- $crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ //$crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ if(array_key_exists($ckey1, $crosstabs_value)&&array_key_exists($ckey2, $crosstabs_value)){
+ $crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ }else{
+ $crossChk0 = 0;
+ }
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum);
}
if ($this->crosstabClass->crossChk1) {
#procent vrstica
- $crossChk1 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
- $tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2);
+ if(array_key_exists($ckey1, $crosstabs_value)){
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2);
+ }
+
}
if ($this->crosstabClass->crossChk2) {
#procent stolpec
- $crossChk2 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2);
}
if ($this->crosstabClass->crossChk3) {
#procent skupni
- $crossChk3 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ if(array_key_exists($ckey1, $crosstabs_value)){
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ }
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2);
}
# residuali
if ($this->crosstabClass->crossChkEC) {
- $crossChkEC = $this->encodeText($this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], 3, ''));
+ $crossChkEC = LatexDocument::encodeText($this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkEC, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkRE) {
- $crossChkRE = $this->encodeText($this->formatNumber($crosstabs['res'][$ckey1][$ckey2], 3, ''));
+ $crossChkRE = LatexDocument::encodeText($this->formatNumber($crosstabs['res'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkRE, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkSR) {
- $crossChkSR = $this->encodeText($this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], 3, ''));
+ $crossChkSR = LatexDocument::encodeText($this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkSR, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkAR) {
- $crossChkAR = $this->encodeText($this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], 3, ''));
+ $crossChkAR = LatexDocument::encodeText($this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkAR, $podVrstice, $colNum3);
}
}
@@ -631,21 +640,25 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //se zadnji stolpec - vedno risemo
if ($this->crosstabClass->crossChk0) {
# suma po vrsticah
- $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
+ if(array_key_exists($ckey2, $crosstabs['sumaVrstica'])){
+ $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
+ }else{
+ $crossChk0 = null;
+ }
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po vrsticah v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -691,35 +704,40 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis celice v prvem stolpcu
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols);
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols);
}else{
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']);
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']);
}
//izpis celice v prvem stolpcu - konec
+ $tabelaZadnja1 = ''; //belezi kodo za 1. podvrstico zadnje vrstice
+ $tabelaZadnja2 = ''; //belezi kodo za 2. podvrstico zadnje vrstice
if (count($crosstabs['options1']) > 0){
- $tabelaZadnja1 = ''; //belezi kodo za 1. podvrstico zadnje vrstice
- $tabelaZadnja2 = ''; //belezi kodo za 2. podvrstico zadnje vrstice
+
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
# prikazujemo eno od treh možnosti
if ($this->crosstabClass->crossChk0) {
# suma po stolpcih
- $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ if(array_key_exists($ckey1, $crosstabs['sumaStolpec'])){
+ $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ }else{
+ $crossChk0 = null;
+ }
$tabelaZadnja1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3){
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -734,15 +752,15 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -851,7 +869,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //Priprava parametrov za tabelo - konec
//zacetek latex tabele z obrobo za prvo tabelo
- $pdfTable = 'tabularx';
+ $pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
@@ -887,16 +905,16 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $steviloTabColSep = ($steviloMultiCol1-1)*2;
$steviloArrayrulewidth = ($steviloMultiCol1-1);
if($export_format=='pdf'){
- //$tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ //$tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}elseif($export_format=='rtf'){
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}
}else{
- $tabela .= " & ".$this->encodeText($sub_q1)." ";
+ $tabela .= " & ".LatexDocument::encodeText($sub_q1)." ";
}
###########
- //echo "testiram, kjer ssem: ".$this->encodeText($sub_q1)."</br>";
+ //echo "testiram, kjer ssem: ".LatexDocument::encodeText($sub_q1)."</br>";
if($cols[$t]!=0 &&($t == ($steviloTabel-1))){
if($steviloVmesnihStolpcevPodvrstic==1){
@@ -923,14 +941,11 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //echo "$tabela</br>";
// druga vrstica ####################################################################################
- $tabela .= $this->encodeText($sub_q2); //prvi stolpec 2. vrstice
- //echo "testiram, kjer ssem: ".$this->encodeText($sub_q2)."</br>";
- //echo "testiram, kjer ssem: ".$steviloTabColSep."</br>";
+ $tabela .= LatexDocument::encodeText($sub_q2); //prvi stolpec 2. vrstice
$drugaVrstica = array();
//echo count($crosstabsOptions1All[$t])."</br>";
- //if (count($crosstabs['options1']) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
- if (count($crosstabsOptions1All[$t]) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
+ if (isset($crosstabsOptions1All[$t])&&count($crosstabsOptions1All[$t]) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
foreach ($crosstabsOptions1All[$t] as $ckey1 =>$crossVariabla) {
#ime variable
$text = $crossVariabla['naslov'];
@@ -938,9 +953,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if ($crossVariabla['type'] != 't') {
$text .= ' ( '.$ckey1.' )';
}
- $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, $this->encodeText($text));
+ $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, LatexDocument::encodeText($text));
//echo "steviloVmesnihStolpcevPodvrstic $t: $steviloVmesnihStolpcevPodvrstic</br>";
- //echo $this->encodeText($text)."</br>";
+ //echo LatexDocument::encodeText($text)."</br>";
}
if($niSodo && $t == ($steviloTabel-2) && $reziduali){ //ce ni sodo in je predzadnja podtabela in so reziduali, dodaj se vse potrebno za prazen stolpec
//if($niSodo && $t == ($steviloTabel-2)){ //ce ni sodo in je predzadnja podtabela, dodaj se vse potrebno za prazen stolpec
@@ -953,18 +968,22 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if($podVrstice){ //ce je potrebno multicol prikazovanje
//spremenljivke za pravilno sirino
$colNum = $steviloVmesnihStolpcevPodvrstic;
- $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
- $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ if($steviloVmesnihStolpcevPodvrstica2){
+ $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
+ }
+ if($steviloVmesnihStolpcevPodvrstica3){
+ $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ }
//spremenljivke za pravilno sirino - konec
if($t == ($steviloTabel-1)){ //ce je zadnji stolpec v podtabeli
- $tabela .= $this->MultiColCellLatex($colNum, $this->encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vrstice
+ $tabela .= $this->MultiColCellLatex($colNum, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vrstice
}
//}else{
}elseif(($t == ($steviloTabel-1))){ //ce je zadnja podtabela
//}elseif(($t == ($steviloTabel-1)) && $niSodo == 1){
$tabela .= " & ";
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vrstice
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vrstice
}
$tabela .= $this->texNewLine; /*nova vrstica*/
@@ -985,7 +1004,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //priprava besedila za prvo celico 1. stolpca
$text = $crossVariabla2['naslov'];
if($export_format != 'xls'){
- $text = $this->snippet($this->encodeText($text), 25);
+ $text = $this->snippet(LatexDocument::encodeText($text), 25);
}
if ($crossVariabla2['type'] !== 't') {
$text .= ' ('.$ckey2.')';
@@ -994,7 +1013,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis prve celice 1. stolpca
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($text));
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($text));
}else{
$tabela .= $text;
}
@@ -1004,11 +1023,12 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabela3 = ''; //za belezenje 3. vrstice z residuali
//foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
+ if(isset($crosstabsOptions1All[$t]))
foreach ($crosstabsOptions1All[$t] as $ckey1 => $crossVariabla1) {
if ($this->crosstabClass->crossChk0) {
# frekvence crostabov
- $crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ $crossChk0 = (isset($crosstabs_value[$ckey1][$ckey2])&&(int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum);
/* if($niSodo && $t == ($steviloTabel-2)){ //ce ni sodo in je predzadnja podtabela, dodaj se vse potrebno za prazen stolpec
$tabela1 .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, '');
@@ -1017,35 +1037,35 @@ class AnalizaCrosstab extends LatexAnalysisElement{ }
if ($this->crosstabClass->crossChk1) {
#procent vrstica
- $crossChk1 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage((isset($crosstabs['sumaVrstica'][$ckey2])?$crosstabs['sumaVrstica'][$ckey2]:null), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:null)), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2);
}
if ($this->crosstabClass->crossChk2) {
#procent stolpec
- $crossChk2 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage((isset($crosstabs['sumaStolpec'][$ckey1])?$crosstabs['sumaStolpec'][$ckey1]:null), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:null)), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2);
}
if ($this->crosstabClass->crossChk3) {
#procent skupni
- $crossChk3 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage((isset($crosstabs['sumaSkupna'])?$crosstabs['sumaSkupna']:null), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:null)), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2);
}
# residuali
if ($this->crosstabClass->crossChkEC) {
- $crossChkEC = $this->encodeText($this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], 3, ''));
+ $crossChkEC = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['exC'][$ckey1][$ckey2])?$crosstabs['exC'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkEC, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkRE) {
- $crossChkRE = $this->encodeText($this->formatNumber($crosstabs['res'][$ckey1][$ckey2], 3, ''));
+ $crossChkRE = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['res'][$ckey1][$ckey2])?$crosstabs['res'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkRE, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkSR) {
- $crossChkSR = $this->encodeText($this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], 3, ''));
+ $crossChkSR = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['stR'][$ckey1][$ckey2])?$crosstabs['stR'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkSR, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkAR) {
- $crossChkAR = $this->encodeText($this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], 3, ''));
+ $crossChkAR = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['adR'][$ckey1][$ckey2])?$crosstabs['adR'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkAR, $podVrstice, $colNum3);
}
//echo "tabela 3: $tabela3 </br>";
@@ -1056,7 +1076,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabela1 .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, '');
}
- if(!$crosstabsOptions1All[$t]){
+ /* if(!$crosstabsOptions1All[$t]){
if($tabela1){
//$tabela1 .= ' & ';
}
@@ -1066,34 +1086,40 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if($tabela3!=''){
//$tabela3 .= ' & ';
}
- }
+ } */
//se zadnji stolpec - risemo, ko je zadnja tabela
if($t == ($steviloTabel-1)){
if ($this->crosstabClass->crossChk0) {
# suma po vrsticah
- $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
- if(!$crosstabsOptions1All[$t]){
+ //$crossChk0 = isset($crosstabs['sumaVrstica'][$ckey2])?(int)$crosstabs['sumaVrstica'][$ckey2]:0;
+ if(isset($crosstabs['sumaVrstica'][$ckey2])&&array_key_exists($ckey2, $crosstabs['sumaVrstica'])){
+ $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
+ }else{
+ $crossChk0 = 0;
+ }
+
+ if(!isset($crosstabsOptions1All[$t])){
$tabela1 .= ' & ';
}
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
- if(!$crosstabsOptions1All[$t]){
+ if(!isset($crosstabsOptions1All[$t])){
$tabela2 .= ' & ';
}
# suma po vrsticah v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crossChk0 / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crossChk0 / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
}
@@ -1160,9 +1186,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis celice v prvem stolpcu
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols[$t]);
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols[$t]);
}else{
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']);
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']);
}
//izpis celice v prvem stolpcu - konec
@@ -1172,26 +1198,32 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabelaZadnja1 = ''; //belezi kodo za 1. podvrstico zadnje vrstice
$tabelaZadnja2 = ''; //belezi kodo za 2. podvrstico zadnje vrstice
//foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
+ if(isset($crosstabsOptions1All[$t]))
foreach ($crosstabsOptions1All[$t] as $ckey1 => $crossVariabla1) {
# prikazujemo eno od treh možnosti
if ($this->crosstabClass->crossChk0) {
# suma po stolpcih
- $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ //$crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ if(isset($crosstabs['sumaStolpec'][$ckey1])&&array_key_exists($ckey1, $crosstabs['sumaStolpec'])){
+ $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ }else{
+ $crossChk0 = 0;
+ }
$tabelaZadnja1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3){
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -1212,19 +1244,19 @@ class AnalizaCrosstab extends LatexAnalysisElement{ }
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
- if (!$crosstabsOptions1All[$t]){
+ if (!isset($crosstabsOptions1All[$t])){
$tabelaZadnja2 .= " & ";
}
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -1264,7 +1296,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ // skupni sestevki po stolpcih - ZADNJA VRSTICA - konec #############################################################################
$stevec++;
- $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}");
+ $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
}
}
}
@@ -1272,13 +1304,12 @@ class AnalizaCrosstab extends LatexAnalysisElement{ /*zakljucek latex tabele*/
if($presirokaTabela == 0){ //ce ni presiroka tabela
- $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}");
+ $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
}
/*zaljucek latex tabele - konec */
- //echo "showChart: ".$this->sessionData['showChart']."</br>";
// Izris grafa (ce je vklopljena nastavitev)
- if($this->sessionData['showChart'] == '1' && $creport == false){
+ if((isset($this->sessionData['showChart'])?$this->sessionData['showChart']:0) == '1' && $creport == false){
$tabela .= $this->displayCrosstabChart();
}
}
@@ -1294,18 +1325,18 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $chartID = implode('_', $this->crosstabClass->variabla1[0]).'_'.implode('_', $this->crosstabClass->variabla2[0]);
$chartID .= '_counter_'.$this->counter;
- $settings = $this->sessionData[$chartID];
- $imgName = $settings['name'];
+ $settings = isset($this->sessionData[$chartID])?$this->sessionData[$chartID]:array();
+ $imgName = isset($settings['name']) ? $settings['name'] : $chartID;
// Naslov posameznega grafa
- if($settings['type'] == 1 || $settings['type'] == 4){
+ /* if($settings['type'] == 1 || $settings['type'] == 4){
$title = $this->crosstabVars[0].'/'.$this->crosstabVars[1];
}
else{
$title = $this->crosstabVars[0];
- }
+ } */
- $boldedTitle = $this->returnBold($this->encodeText($title)).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico
+ $boldedTitle = $this->returnBold(LatexDocument::encodeText(/* $title */)).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico
copy('pChart/Cache/'.$imgName,'pChart/Cache/'.$imgName.'.png');
$texImageOnly = " \\includegraphics[scale=0.75]{".$imgName."} "; //latex za sliko
|