From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- admin/survey/export/class.ExportController.php | 8 +- admin/survey/export/export_definitions.php | 37 +- .../export/latexclasses/Analize/AnalizaBreak.php | 219 +-- .../export/latexclasses/Analize/AnalizaCReport.php | 62 +- .../export/latexclasses/Analize/AnalizaCharts.php | 22 +- .../latexclasses/Analize/AnalizaCrosstab.php | 293 ++-- .../export/latexclasses/Analize/AnalizaDesc.php | 46 +- .../export/latexclasses/Analize/AnalizaFreq.php | 85 +- .../export/latexclasses/Analize/AnalizaMean.php | 76 +- .../latexclasses/Analize/AnalizaMultiCrosstab.php | 362 ++--- .../export/latexclasses/Analize/AnalizaSums.php | 748 +++++------ .../export/latexclasses/Analize/AnalizaTTest.php | 141 +- .../latexclasses/Vprasanja/BesediloLatex.php | 55 +- .../export/latexclasses/Vprasanja/DatumLatex.php | 27 +- .../latexclasses/Vprasanja/GridMultipleLatex.php | 180 ++- .../export/latexclasses/Vprasanja/HeatmapLatex.php | 59 +- .../latexclasses/Vprasanja/KalkulacijaLatex.php | 2 +- .../export/latexclasses/Vprasanja/KvotaLatex.php | 4 +- .../latexclasses/Vprasanja/LokacijaLatex.php | 4 +- .../latexclasses/Vprasanja/MultiGridLatex.php | 895 +++++-------- .../export/latexclasses/Vprasanja/NagovorLatex.php | 13 +- .../Vprasanja/RadioCheckboxSelectLatex.php | 231 ++-- .../latexclasses/Vprasanja/RazvrscanjeLatex.php | 132 +- .../export/latexclasses/Vprasanja/SNImena.php | 4 +- .../export/latexclasses/Vprasanja/SteviloLatex.php | 127 +- .../export/latexclasses/Vprasanja/VsotaLatex.php | 41 +- .../export/latexclasses/class.LatexAnalysis.php | 26 +- .../latexclasses/class.LatexAnalysisElement.php | 598 +++++---- .../export/latexclasses/class.LatexDocument.php | 686 +++++++--- .../latexclasses/class.LatexEditsAnalysis.php | 263 +++- .../export/latexclasses/class.LatexStatus.php | 494 +++---- .../export/latexclasses/class.LatexSurvey.php | 682 ++++++++-- .../latexclasses/class.LatexSurveyElement.php | 1416 ++++---------------- .../latexTemplatePdfAnalysisAndOtherLandscape.cls | 26 +- .../textemp/latexTemplatePdfAnalysisPortrait.cls | 22 +- .../textemp/latexTemplatePdfSurvey.cls | 155 +-- admin/survey/export/xmlClasses/class.XmlSurvey.php | 4 +- .../export/xmlClasses/class.XmlSurveyElement.php | 3 +- 38 files changed, 3877 insertions(+), 4371 deletions(-) (limited to 'admin/survey/export') diff --git a/admin/survey/export/class.ExportController.php b/admin/survey/export/class.ExportController.php index 9cffefd..e3318e8 100644 --- a/admin/survey/export/class.ExportController.php +++ b/admin/survey/export/class.ExportController.php @@ -136,7 +136,7 @@ class ExportController{ case 'html': // Ustvarimo latex dokument $document = new LatexDocument($this->anketa); - $document->createDocument($export_type['export_type'], $export_type['export_subtype'], $export_format, $_GET['sprID']); + $document->createDocument($export_type['export_type'], $export_type['export_subtype'], $export_format, (isset($_GET['sprID'])?$_GET['sprID']:null)); break; case 'xml': @@ -292,7 +292,7 @@ class ExportController{ // Nastavimo tip izvoza private function getExportType(){ global $site_path, $global_user_id, $admin_type, $lang; - + if(isset($_GET['a'])) switch ( $_GET['a'] ) { case A_REPORT_VPRASALNIK_PDF: case A_REPORT_VPRASALNIK_RTF: @@ -349,6 +349,7 @@ class ExportController{ $export_subtype = 'activity'; break; } + if(isset($_GET['m'])) switch ( $_GET['m'] ) { // Kakšna je razlika med tema dvema izvozoma?? @@ -477,7 +478,7 @@ class ExportController{ // Nastavimo format izvoza private function getExportFormat(){ global $site_path, $global_user_id, $admin_type, $lang; - + if(isset($_GET['a'])) switch ( $_GET['a'] ) { case A_REPORT_VPRASALNIK_PDF: case A_REPORT_PDF_RESULTS: @@ -507,6 +508,7 @@ class ExportController{ $export_format = 'xml'; break; } + if(isset($_GET['m'])) switch ( $_GET['m'] ) { // Kakšna je razlika med tema dvema izvozoma?? diff --git a/admin/survey/export/export_definitions.php b/admin/survey/export/export_definitions.php index 252cab7..10b304e 100644 --- a/admin/survey/export/export_definitions.php +++ b/admin/survey/export/export_definitions.php @@ -1,19 +1,19 @@ \ No newline at end of file diff --git a/admin/survey/export/latexclasses/Analize/AnalizaBreak.php b/admin/survey/export/latexclasses/Analize/AnalizaBreak.php index 3317de4..86064ab 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaBreak.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaBreak.php @@ -2,41 +2,41 @@ global $site_path; - include_once('../../function.php'); - include_once('../survey/definition.php'); +/* include_once('../../function.php'); + include_once('../survey/definition.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); /** Class za generacijo latex @@ -346,7 +346,7 @@ class AnalizaBreak 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; @@ -359,14 +359,14 @@ class AnalizaBreak extends LatexAnalysisElement { // PRVA VRSTICA $prvaVrstica = array(); - $prvaVrstica[] = $this->encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); - //$prvaVrstica[] = $this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')'); - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).')').'}'; + $prvaVrstica[] = LatexDocument::encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); + //$prvaVrstica[] = LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')'); + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).')').'}'; if($this->export_format == 'pdf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).')').'}'; }elseif($this->export_format == 'rtf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; } @@ -380,19 +380,19 @@ class AnalizaBreak extends LatexAnalysisElement { if ($tip != 1 && $tip != 3) { foreach ($spremenljivka['grids'] AS $gkey => $grid) { foreach ($grid['variables'] AS $vkey => $variable) { - $text = $this->encodeText($variable['naslov'].' ('.$variable['variable'].')'); + $text = LatexDocument::encodeText($variable['naslov'].' ('.$variable['variable'].')'); $drugaVrstica[]=$text; - $tretjaVrstica[] = $this->encodeText($lang['srv_analiza_crosstab_average']); + $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_crosstab_average']); } } } else if (count($spremenljivka['options']) < 15) { //echo "options :".count($spremenljivka['options'])."
"; foreach ($spremenljivka['options'] AS $okey => $option) { - //$this->pdf->MultiCell($singleWidth, $height, $this->encodeText($option.' ('.$okey.')'), 1, 'C', 0, 0, 0 ,0, true); - $text = $this->encodeText($option.' ('.$okey.')'); + //$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($option.' ('.$okey.')'), 1, 'C', 0, 0, 0 ,0, true); + $text = LatexDocument::encodeText($option.' ('.$okey.')'); $drugaVrstica[]=$text; - $tretjaVrstica[] = $this->encodeText($lang['srv_analiza_crosstab_average']); + $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_crosstab_average']); } //$this->pdf->MultiCell($singleWidth, $height, 'povprečje', 1, 'C', 0, 1, 0 ,0, true); } @@ -413,16 +413,16 @@ class AnalizaBreak extends LatexAnalysisElement { // VRSTICE S PODATKI foreach ($frequencys AS $fkey => $fkeyFrequency) { $podatkiVrstica = array(); - $podatkiVrstica[]=$this->encodeText($forSpremenljivka['options'][$fkey]); //naslov horizontalne vrstice + $podatkiVrstica[]=LatexDocument::encodeText($forSpremenljivka['options'][$fkey]); //naslov horizontalne vrstice foreach ($spremenljivka['grids'] AS $gkey => $grid) { foreach ($grid['variables'] AS $vkey => $variable) { if ($variable['other'] != 1) { $sequence = $variable['sequence']; if (($tip == 1 || $tip == 3) && count($spremenljivka['options']) < 15) { foreach ($spremenljivka['options'] AS $okey => $option) { - //$this->pdf->MultiCell($singleWidth, $height, $this->encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']), 1, 'C', 0, 0, 0 ,0, true); - $podatkiVrstica[]=$this->encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']); - //echo "podatkiVrstica 1 :".$this->encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt'])."
"; + //$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']), 1, 'C', 0, 0, 0 ,0, true); + $podatkiVrstica[]=LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']); + //echo "podatkiVrstica 1 :".LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt'])."
"; } } $podatkiVrstica[]=$this->formatNumber($means[$fkey][$sequence],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); @@ -435,7 +435,7 @@ class AnalizaBreak extends LatexAnalysisElement { //Izpis vrstic tabele - konec ################## /*zakljucek latex tabele*/ - $tabela .= ($this->export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($this->export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ //echo "tabela :".$tabela."
"; }elseif($presirokaTabela == 1){ //ce tabela je presiroka @@ -477,7 +477,7 @@ class AnalizaBreak 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; @@ -490,11 +490,11 @@ class AnalizaBreak extends LatexAnalysisElement { // PRVA VRSTICA $prvaVrstica = array(); - $prvaVrstica[] = $this->encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); + $prvaVrstica[] = LatexDocument::encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); if($this->export_format == 'pdf'){ - $prvaVrstica[] = '\multicolumn{'.($steviloPodstolpcev-1).'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).')').'}'; + $prvaVrstica[] = '\multicolumn{'.($steviloPodstolpcev-1).'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).')').'}'; }elseif($this->export_format == 'rtf'){ - $prvaVrstica[] = '\multicolumn{'.($steviloPodstolpcev-1).'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; + $prvaVrstica[] = '\multicolumn{'.($steviloPodstolpcev-1).'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; } // DRUGA IN TRETJA VRSTICA @@ -508,10 +508,10 @@ class AnalizaBreak extends LatexAnalysisElement { if ($tip != 1 && $tip != 3) { for($s=$indeksPodatkov; $s<($steviloPodstolpcev-1+$indeksPodatkovOld); $s++){ $grid = $spremenljivka['grids'][$s]; - $text = $this->encodeText($grid['variables'][0]['naslov'].' ('.$grid['variables'][0]['variable'].')'); + $text = LatexDocument::encodeText($grid['variables'][0]['naslov'].' ('.$grid['variables'][0]['variable'].')'); //echo "grid podatek: ".$text."
"; $drugaVrstica[] = $text; - $tretjaVrstica[] = $this->encodeText($lang['srv_analiza_crosstab_average']); + $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_crosstab_average']); $indeksPodatkov = $s; } $indeksPodatkov = $indeksPodatkov + 1; @@ -521,10 +521,10 @@ class AnalizaBreak extends LatexAnalysisElement { //echo "options :".count($spremenljivka['options'])."
"; //echo "znotraj
"; foreach ($spremenljivka['options'] AS $okey => $option) { - //$this->pdf->MultiCell($singleWidth, $height, $this->encodeText($option.' ('.$okey.')'), 1, 'C', 0, 0, 0 ,0, true); - $text = $this->encodeText($option.' ('.$okey.')'); + //$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($option.' ('.$okey.')'), 1, 'C', 0, 0, 0 ,0, true); + $text = LatexDocument::encodeText($option.' ('.$okey.')'); $drugaVrstica[]=$text; - $tretjaVrstica[] = $this->encodeText($lang['srv_analiza_crosstab_average']); + $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_crosstab_average']); } //$this->pdf->MultiCell($singleWidth, $height, 'povprečje', 1, 'C', 0, 1, 0 ,0, true); } @@ -552,8 +552,8 @@ class AnalizaBreak extends LatexAnalysisElement { for($fkey=1; $fkey<=($steviloVrsticSPodatki); $fkey++){ //izpis vsake vrstice posebej //echo "indeks freq: ".$fkey."
"; $podatkiVrstica = array(); - $podatkiVrstica[] = $this->encodeText($forSpremenljivka['options'][$fkey]); //naslov horizontalne vrstice - //echo "debug text: ".$this->encodeText($forSpremenljivka['options'][$fkey])."
"; + $podatkiVrstica[] = LatexDocument::encodeText($forSpremenljivka['options'][$fkey]); //naslov horizontalne vrstice + //echo "debug text: ".LatexDocument::encodeText($forSpremenljivka['options'][$fkey])."
"; //foreach ($spremenljivka['grids'] AS $gkey => $grid) { for($s1=$indeksPodatkov1; $s1<($steviloPodstolpcev-1+$indeksPodatkovOld1); $s1++){ @@ -564,8 +564,8 @@ class AnalizaBreak extends LatexAnalysisElement { //echo "sdvsdv
"; /* if (($tip == 1 || $tip == 3) && count($spremenljivka['options']) < 15) { foreach ($spremenljivka['options'] AS $okey => $option) { - $podatkiVrstica[] = $this->encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']); - //echo "podatki Vrstica 1 :".$this->encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt'])."
"; + $podatkiVrstica[] = LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']); + //echo "podatki Vrstica 1 :".LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt'])."
"; } } */ $podatkiVrstica[] = $this->formatNumber($means[$fkey][$sequence],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); @@ -582,7 +582,7 @@ class AnalizaBreak extends LatexAnalysisElement { //Izpis vrstic tabele - konec ################## /*zakljucek latex tabele*/ - $tabela .= ($this->export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($this->export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ //echo "tabela :".$tabela."
"; @@ -601,12 +601,12 @@ class AnalizaBreak extends LatexAnalysisElement { foreach ($frequencys AS $fkey => $frequency) { /* $this->pdf->setFont('','B','6'); - $this->pdf->MultiCell(200, 5, $this->encodeText('Tabela za: ('.$forSpremenljivka['variable'].') = '.$forSpremenljivka['options'][$fkey]), 0, 'L', 0, 1, 0 ,0, true); */ + $this->pdf->MultiCell(200, 5, LatexDocument::encodeText('Tabela za: ('.$forSpremenljivka['variable'].') = '.$forSpremenljivka['options'][$fkey]), 0, 'L', 0, 1, 0 ,0, true); */ $text = $spremenljivka['naslov'].' ('.$spremenljivka['variable'].')'; $height = $this->getCellHeight($text, 260); - //$this->pdf->MultiCell(260, $height, $this->encodeText($text), 1, 'C', 0, 1, 0 ,0, true); + //$this->pdf->MultiCell(260, $height, LatexDocument::encodeText($text), 1, 'C', 0, 1, 0 ,0, true); //$this->pdf->setFont('','','6'); @@ -617,7 +617,7 @@ class AnalizaBreak extends LatexAnalysisElement { //$this->pdf->MultiCell(60, $height, '', 1, 'C', 0, 0, 0 ,0, true); foreach ($spremenljivka['grids'][0]['variables'] AS $vkey => $variable) { - //$this->pdf->MultiCell($singleWidth, $height, $this->encodeText($variable['naslov']), 1, 'C', 0, 0, 0 ,0, true); + //$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($variable['naslov']), 1, 'C', 0, 0, 0 ,0, true); } //$this->pdf->MultiCell(1, $height,'', 0, 'C', 0, 1, 0 ,0, true); @@ -626,7 +626,7 @@ class AnalizaBreak extends LatexAnalysisElement { $text = '('.$grid['variable'].') '.$grid['naslov']; /* $height = $this->getCellHeight($text, 60); - $this->pdf->MultiCell(60, $height, $this->encodeText($text), 1, 'C', 0, 0, 0 ,0, true); */ + $this->pdf->MultiCell(60, $height, LatexDocument::encodeText($text), 1, 'C', 0, 0, 0 ,0, true); */ foreach ($grid['variables'] AS $vkey => $variable) { $sequence = $variable['sequence']; @@ -680,7 +680,8 @@ class AnalizaBreak extends LatexAnalysisElement { foreach ($spremenljivka['grids'] AS $gkey => $grid) { // Izrisujemo samo 1 graf v creportu - if($_GET['m'] == 'analysis_creport'){ + $tmp_m = isset($_GET['m'])?$_GET['m'] : ''; + if($tmp_m == 'analysis_creport'){ if($spremenljivka['break_sub_table']['key'] == $gkey){ //$this->displayChart($forSpr,$frequencys,$spremenljivka,$type = 'number'); @@ -713,25 +714,25 @@ class AnalizaBreak extends LatexAnalysisElement { $drugaVrstica[] = ''; foreach ($spremenljivka['grids'] AS $gkey => $grid) { foreach ($grid['variables'] AS $vkey => $variable) { - $drugaVrstica[] = $this->encodeText($variable['naslov'].' ('.$variable['variable'].')'); + $drugaVrstica[] = LatexDocument::encodeText($variable['naslov'].' ('.$variable['variable'].')'); } } // PRVA VRSTICA $prvaVrstica = array(); - $prvaVrstica[] = $this->encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); - //$prvaVrstica[] = $this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')'); //\multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{X|} + $prvaVrstica[] = LatexDocument::encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); + //$prvaVrstica[] = LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')'); //\multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{X|} $steviloPodstolpcev = count($drugaVrstica) - 1; - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'} //{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|} - //{'.$this->encodeText($this->snippet($spremenljivka['naslov']).'('.$this->snippet($spremenljivka['variable']).')').'}'; + //{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).'('.$this->snippet($spremenljivka['variable']).')').'}'; if($this->export_format == 'pdf'){ $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'} {>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|} - {'.$this->encodeText($this->snippet($spremenljivka['naslov']).'('.$this->snippet($spremenljivka['variable']).')').'}'; + {'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).'('.$this->snippet($spremenljivka['variable']).')').'}'; }elseif($this->export_format == 'rtf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].')').'}'; } // TRETJA VRSTICA @@ -739,7 +740,7 @@ class AnalizaBreak extends LatexAnalysisElement { $tretjaVrstica[] = ''; foreach ($spremenljivka['grids'] AS $gkey => $grid) { foreach ($grid['variables'] AS $vkey => $variable) { - $tretjaVrstica[] = $this->encodeText($lang['srv_analiza_crosstab_average']); + $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_crosstab_average']); } } @@ -766,7 +767,7 @@ class AnalizaBreak 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; @@ -794,7 +795,7 @@ class AnalizaBreak extends LatexAnalysisElement { //VRSTICE S PODATKI - priprava in izpis podatkov foreach ($frequencys AS $fkey => $fkeyFrequency) { $podatkiVrstica = array(); - $podatkiVrstica[]=$this->encodeText($forSpremenljivka['options'][$fkey]); + $podatkiVrstica[]=LatexDocument::encodeText($forSpremenljivka['options'][$fkey]); foreach ($spremenljivka['grids'] AS $gkey => $grid) { foreach ($grid['variables'] AS $vkey => $variable) { @@ -813,7 +814,7 @@ class AnalizaBreak extends LatexAnalysisElement { // dodamo še skupno sumo in povprečje $sumaVrstica = array(); - $sumaVrstica[]=$this->encodeText($lang['srv_analiza_crosstab_skupaj']); + $sumaVrstica[]=LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']); foreach ($spremenljivka['grids'] AS $gkey => $grid) { foreach ($grid['variables'] AS $vkey => $variable) { @@ -832,7 +833,7 @@ class AnalizaBreak extends LatexAnalysisElement { //Izpis vrstic tabele - konec /*zakljucek latex tabele*/ - $tabela .= ($this->export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($this->export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ } @@ -845,7 +846,7 @@ class AnalizaBreak extends LatexAnalysisElement { foreach ($spremenljivka['grids'] AS $gkey => $grid) { //izpis opisnega besedila pred tabelo - $tabela .= $this->encodeText('Tabela za: '.$spremenljivka['naslov'].' ('.$spremenljivka['variable'].') = '.$grid['naslov'].' ('.$grid['variable'].')'); + $tabela .= LatexDocument::encodeText('Tabela za: '.$spremenljivka['naslov'].' ('.$spremenljivka['variable'].') = '.$grid['naslov'].' ('.$grid['variable'].')'); //$tabela .= $this->texNewLine; //Priprava parametrov za tabelo @@ -867,7 +868,7 @@ class AnalizaBreak 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; @@ -880,20 +881,20 @@ class AnalizaBreak extends LatexAnalysisElement { // PRVA VRSTICA $prvaVrstica = array(); - $prvaVrstica[] = $this->encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; + $prvaVrstica[] = LatexDocument::encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; if($this->export_format == 'pdf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; }elseif($this->export_format == 'rtf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; } // DRUGA VRSTICA $drugaVrstica = array(); $drugaVrstica[]=''; foreach ($grid['variables'] AS $vkey => $variable) { - $text = $this->encodeText($variable['naslov'].' ('.$variable['variable'].')'); + $text = LatexDocument::encodeText($variable['naslov'].' ('.$variable['variable'].')'); $drugaVrstica[]=$text; } @@ -901,7 +902,7 @@ class AnalizaBreak extends LatexAnalysisElement { $tretjaVrstica = array(); $tretjaVrstica[] = ''; foreach ($grid['variables'] AS $vkey => $variable) { - $tretjaVrstica[] = $this->encodeText($lang['srv_analiza_crosstab_average']); + $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_crosstab_average']); } //Izpis vrstic tabele @@ -920,9 +921,9 @@ class AnalizaBreak extends LatexAnalysisElement { // VRSTICE Z VSEBINO foreach ($forSpremenljivka['options'] AS $okey => $option) { $podatkiVrstica = array(); - $podatkiVrstica[]=$this->encodeText($option); + $podatkiVrstica[]=LatexDocument::encodeText($option); //$height = $this->getCellHeight($option, 60); - //$this->pdf->MultiCell(60, $height, $this->encodeText($option), 1, 'C', 0, 0, 0 ,0, true); + //$this->pdf->MultiCell(60, $height, LatexDocument::encodeText($option), 1, 'C', 0, 0, 0 ,0, true); foreach ($grid['variables'] AS $vkey => $variable) { $sequence = $variable['sequence']; @@ -939,7 +940,7 @@ class AnalizaBreak extends LatexAnalysisElement { // dodamo še skupno sumo in povprečje $sumaVrstica = array(); - $sumaVrstica[]=$this->encodeText($lang['srv_analiza_crosstab_skupaj']); + $sumaVrstica[]=LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']); foreach ($grid['variables'] AS $vkey => $variable) { $sequence = $variable['sequence']; @@ -955,7 +956,7 @@ class AnalizaBreak extends LatexAnalysisElement { //Izpis vrstic tabele - konec /*zakljucek latex tabele*/ - $tabela .= ($this->export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($this->export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ } } @@ -996,7 +997,7 @@ class AnalizaBreak extends LatexAnalysisElement { foreach ($spremenljivka['grids'] AS $gkey => $grid) { //izpis opisnega besedila pred tabelo - $tabela .= $this->encodeText('Tabela za: '.$spremenljivka['naslov'].' ('.$spremenljivka['variable'].') = '.$grid['naslov'].' ('.$grid['variable'].')'); + $tabela .= LatexDocument::encodeText('Tabela za: '.$spremenljivka['naslov'].' ('.$spremenljivka['variable'].') = '.$grid['naslov'].' ('.$grid['variable'].')'); //Priprava parametrov za tabelo $steviloStolpcevParameterTabular = $steviloPodstolpcev+1; @@ -1019,7 +1020,7 @@ class AnalizaBreak 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; @@ -1033,20 +1034,20 @@ class AnalizaBreak extends LatexAnalysisElement { // PRVA VRSTICA $prvaVrstica = array(); - $prvaVrstica[] = $this->encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; - //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$this->snippet($grid['naslov']).' ('.$this->snippet($grid['variable']).')').'}'; + $prvaVrstica[] = LatexDocument::encodeText($forSpremenljivka['naslov'].' ('.$forSpremenljivka['variable'].')'); + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; + //$prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$this->snippet($grid['naslov']).' ('.$this->snippet($grid['variable']).')').'}'; if($this->export_format == 'pdf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$this->snippet($grid['naslov']).' ('.$this->snippet($grid['variable']).')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{>{\hsize=\dimexpr '.($steviloPodstolpcev).'\hsize + '.($steviloPodstolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($this->snippet($spremenljivka['naslov']).' ('.$this->snippet($spremenljivka['variable']).') - '.$this->snippet($grid['naslov']).' ('.$this->snippet($grid['variable']).')').'}'; }elseif($this->export_format == 'rtf'){ - $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.$this->encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; + $prvaVrstica[] = '\multicolumn{'.$steviloPodstolpcev.'}{c|}{'.LatexDocument::encodeText($spremenljivka['naslov'].' ('.$spremenljivka['variable'].') - '.$grid['naslov'].' ('.$grid['variable'].')').'}'; } // DRUGA VRSTICA $drugaVrstica = array(); $drugaVrstica[]=''; foreach ($grid['variables'] AS $vkey => $variable) { - $text = $this->encodeText($variable['naslov'].' ('.$variable['variable'].')'); + $text = LatexDocument::encodeText($variable['naslov'].' ('.$variable['variable'].')'); $drugaVrstica[]=$text; } @@ -1062,10 +1063,10 @@ class AnalizaBreak extends LatexAnalysisElement { // VRSTICE Z VSEBINO foreach ($forSpremenljivka['options'] AS $okey => $option) { $podatkiVrstica = array(); - $podatkiVrstica[]=$this->encodeText($option); + $podatkiVrstica[]=LatexDocument::encodeText($option); // Izrisemo vrstico - //$this->pdf->MultiCell(60, $height, $this->encodeText($option), 1, 'C', 0, 0, 0 ,0, true); + //$this->pdf->MultiCell(60, $height, LatexDocument::encodeText($option), 1, 'C', 0, 0, 0 ,0, true); foreach ($grid['variables'] AS $vkey => $variable) { $sequence = $variable['sequence']; if (count($texts[$okey][$sequence]) > 0) { @@ -1075,8 +1076,8 @@ class AnalizaBreak extends LatexAnalysisElement { $text .= $units['text']."; "; } $text = substr($text,0,-2); - $podatkiVrstica[]=$this->encodeText($text); - //$this->pdf->MultiCell($singleWidth, $height, $this->encodeText($text), 1, 'C', 0, 0, 0 ,0, true); + $podatkiVrstica[]=LatexDocument::encodeText($text); + //$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($text), 1, 'C', 0, 0, 0 ,0, true); } else{ //$this->pdf->MultiCell($singleWidth, $height, '', 1, 'C', 0, 0, 0 ,0, true); @@ -1088,7 +1089,7 @@ class AnalizaBreak extends LatexAnalysisElement { //Izpis vrstic tabele - konec /*zakljucek latex tabele*/ - $tabela .= ($this->export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($this->export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ } return $tabela; @@ -1125,7 +1126,7 @@ class AnalizaBreak extends LatexAnalysisElement { if ($spremenljivka['tip'] != 6) { $text .= ' ('.$grid['variable'].')'; } - $tabela .= $this->encodeText($text); + $tabela .= LatexDocument::encodeText($text); } $seq2 = $grid['variables'][0]['sequence']; @@ -1205,10 +1206,10 @@ class AnalizaBreak extends LatexAnalysisElement { } } - $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 $boldedSubTitle = ''; if($spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 16 || $spremenljivka['tip'] == 6){ - $boldedSubTitle = $this->returnBold($this->encodeText($subtitle)).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico + $boldedSubTitle = $this->returnBold(LatexDocument::encodeText($subtitle)).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico } if($imgName){ @@ -1217,7 +1218,7 @@ class AnalizaBreak extends LatexAnalysisElement { $texImageOnly = $lang['srv_export_no_chart']; } - $texImage .= $this->returnCentered($boldedTitle.$boldedSubTitle.$texImageOnly); //vrni sredinsko poravnana naslov in slika + $texImage = $this->returnCentered($boldedTitle.$boldedSubTitle.$texImageOnly); //vrni sredinsko poravnana naslov in slika return $texImage; } @@ -1246,7 +1247,7 @@ class AnalizaBreak extends LatexAnalysisElement { //izrisemo frekvence if($frekvence == 1){ - $this->pdf->MultiCell($width, $height, $this->encodeText($data[$i]), 1, 'C', 0, 1, 0 ,0, true); + $this->pdf->MultiCell($width, $height, LatexDocument::encodeText($data[$i]), 1, 'C', 0, 1, 0 ,0, true); $i++; } @@ -1256,10 +1257,10 @@ class AnalizaBreak extends LatexAnalysisElement { $singleWidth = round($width/$numColumnPercent); for($j=1; $j<$numColumnPercent; $j++){ - $this->pdf->MultiCell($singleWidth, $height, $this->encodeText($data[$i]), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($data[$i]), 1, 'C', 0, 0, 0 ,0, true); $i++; } - $this->pdf->MultiCell($width - (($numColumnPercent-1)*$singleWidth), $height, $this->encodeText($data[$i]), 1, 'C', 0, 1, 0 ,0, true); + $this->pdf->MultiCell($width - (($numColumnPercent-1)*$singleWidth), $height, LatexDocument::encodeText($data[$i]), 1, 'C', 0, 1, 0 ,0, true); $i++; } @@ -1269,10 +1270,10 @@ class AnalizaBreak extends LatexAnalysisElement { $singleWidth = round($width/$numColumnResidual); for($j=1; $j<$numColumnResidual; $j++){ - $this->pdf->MultiCell($singleWidth, $height, $this->encodeText($data[$i]), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($data[$i]), 1, 'C', 0, 0, 0 ,0, true); $i++; } - $this->pdf->MultiCell($width - (($numColumnResidual-1)*$singleWidth), $height, $this->encodeText($data[$i]), 1, 'C', 0, 1, 0 ,0, true); + $this->pdf->MultiCell($width - (($numColumnResidual-1)*$singleWidth), $height, LatexDocument::encodeText($data[$i]), 1, 'C', 0, 1, 0 ,0, true); $i++; } diff --git a/admin/survey/export/latexclasses/Analize/AnalizaCReport.php b/admin/survey/export/latexclasses/Analize/AnalizaCReport.php index 03291c7..df423ec 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaCReport.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaCReport.php @@ -7,14 +7,14 @@ /* 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"); @@ -150,6 +150,7 @@ class AnalizaCReport extends LatexAnalysisElement{ // Izpisemo sumarnik element function displaySum($element=null){ + global $global_user_id; $sumLatex = ''; $spid = $element['spr1']; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; @@ -256,6 +257,7 @@ class AnalizaCReport extends LatexAnalysisElement{ // Izpisemo frekvence element function displayFreq($element=null){ + global $global_user_id; $freqLatex = ''; $spid = $element['spr1']; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; @@ -329,7 +331,7 @@ class AnalizaCReport 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; @@ -346,15 +348,15 @@ class AnalizaCReport extends LatexAnalysisElement{ /*priprava polja z naslovi stolpcev*/ $text = array(); - $text[] = $this->encodeText($lang['srv_analiza_opisne_variable']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_variable_text1']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_variable']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_variable_text1']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_m']); - $text[] = $this->encodeText($lang['srv_analiza_num_units']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_povprecje1']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_odklon']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_min']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_max']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_m']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_num_units']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_povprecje1']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_min']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_max']); /*priprava polja z naslovi stolpcev - konec*/ $descLatex .= $this->tableRow($text); @@ -369,7 +371,7 @@ class AnalizaCReport extends LatexAnalysisElement{ $show_enota = false; /* preverimo ali imamo samo eno variablo in če iammo enoto*/ - if ((int)$spremenljivka['enota'] != 0 || $spremenljivka['cnt_all'] > 1 ) { + if (isset($spremenljivka['enota'])&&(int)$spremenljivka['enota'] != 0 || $spremenljivka['cnt_all'] > 1 ) { $show_enota = true; } @@ -405,7 +407,7 @@ class AnalizaCReport extends LatexAnalysisElement{ ? false : true; if ($do_show) { - $descLatex .= $this->displayDescriptivesVariablaRow($spremenljivka,$grid,$variable,$_css); + $descLatex .= $this->displayDescriptivesVariablaRow($spremenljivka,$grid,$variable); } $grid['new_grid'] = false; @@ -415,7 +417,7 @@ class AnalizaCReport extends LatexAnalysisElement{ } // end if $spremenljivka['tip'] != 'm' /*zakljucek latex tabele*/ - $descLatex .= ($this->export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $descLatex .= ($this->export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ //echo "
Tex celotne tabele: ".$descLatex."
"; return $descLatex; @@ -880,7 +882,7 @@ class AnalizaCReport extends LatexAnalysisElement{ function displayText($text=''){ global $lang; $texTitle = ''; - $texTitle .= $this->encodeText($text).$this->texNewLine; + $texTitle .= LatexDocument::encodeText($text).$this->texNewLine; return $texTitle; } @@ -961,7 +963,7 @@ class AnalizaCReport extends LatexAnalysisElement{ # za multicheckboxe popravimo naslov, na podtip $sub_q1 = null; $sub_q2 = null; - if ($spr1['tip'] == '6' || $spr1['tip'] == '7' || $spr1['tip'] == '16' || $spr1['tip'] == '17' || $spr1['tip'] == '18' || $spr1['tip'] == '19' || $spr1['tip'] == '20' || $spr1['tip'] == '21' ) { + /* if ($spr1['tip'] == '6' || $spr1['tip'] == '7' || $spr1['tip'] == '16' || $spr1['tip'] == '17' || $spr1['tip'] == '18' || $spr1['tip'] == '19' || $spr1['tip'] == '20' || $spr1['tip'] == '21' ) { foreach ($spr1['grids'] AS $grid) { foreach ($grid['variables'] AS $variable) { if ($variable['sequence'] == $v_first['seq']) { @@ -977,12 +979,12 @@ class AnalizaCReport extends LatexAnalysisElement{ } } } - } + } */ if ($sub_q1 == null) { $sub_q1 .= strip_tags($spr1['naslov']); $sub_q1 .= ($show_variables_values == true ? ' ('.strip_tags($spr1['variable']).')' : ''); } - if ($spr2['tip'] == '6' || $spr2['tip'] == '7' || $spr2['tip'] == '16' || $spr2['tip'] == '17' || $spr2['tip'] == '18' || $spr2['tip'] == '19' || $spr2['tip'] == '20' || $spr2['tip'] == '21') { + /* if ($spr2['tip'] == '6' || $spr2['tip'] == '7' || $spr2['tip'] == '16' || $spr2['tip'] == '17' || $spr2['tip'] == '18' || $spr2['tip'] == '19' || $spr2['tip'] == '20' || $spr2['tip'] == '21') { foreach ($spr2['grids'] AS $grid) { foreach ($grid['variables'] AS $variable) { if ($variable['sequence'] == $v_second['seq']) { @@ -998,7 +1000,7 @@ class AnalizaCReport extends LatexAnalysisElement{ } } } - } + } */ if ($sub_q2 == null) { $sub_q2 .= strip_tags($spr2['naslov']); $sub_q2 .= ($show_variables_values == true ? ' ('.strip_tags($spr2['variable']).')' : ''); @@ -1077,7 +1079,7 @@ class AnalizaCReport extends LatexAnalysisElement{ $variables = $breakClass->getVariableList(2); foreach ($variables as $variable) { - if($breakData1[0] == $variable['sequence']){ + if(isset($variable['sequence'])&&$breakData1[0] == $variable['sequence']){ $label1 = ( (int)$variable['sub'] == 0 ? '' : ( (int)$variable['sub'] == 1 ? '  ' : '    ' )) . $variable['variableNaslov']; $label1 = (strlen($label1) > 60) ? substr($label1, 0, 57).'...' : $label1; @@ -1089,7 +1091,7 @@ class AnalizaCReport extends LatexAnalysisElement{ $variables = $this->getBreakDependentVariableList($breakClass); foreach ($variables as $variable) { - if($breakData2[0] == $variable['sequence']){ + if(isset($variable['sequence'])&&$breakData2[0] == $variable['sequence']){ //$label2 = $variable['variableNaslov']; $label2 = (strlen($variable['variableNaslov']) > 60) ? substr($variable['variableNaslov'], 0, 57).'...' : $variable['variableNaslov']; @@ -1105,7 +1107,7 @@ class AnalizaCReport extends LatexAnalysisElement{ //TODO: Potrebno je v LATEX določiti ali je stran obrnjena landscape $width = $this->landscapeTest() ? 270 : 165; - $boldedTitle = $this->returnBold($this->encodeText($this->encodeText($title . $subtitle))); + $boldedTitle = $this->returnBold(LatexDocument::encodeText(LatexDocument::encodeText($title . $subtitle))); $texTitle .= $this->returnCentered($boldedTitle); return $texTitle; @@ -1150,13 +1152,13 @@ class AnalizaCReport extends LatexAnalysisElement{ # zloopamo skozi header in dodamo variable (potrebujemo posamezne sekvence) foreach ($breakClass->_HEADERS AS $skey => $spremenljivka) { - $tip = $spremenljivka['tip']; + $tip = isset($spremenljivka['tip'])?$spremenljivka['tip']:null; $_dropdown_condition = (is_numeric($tip) && $tip != 5 && $tip != 8 && $tip != 9) ? true : false; if ($_dropdown_condition) { $cnt_all = (int)$spremenljivka['cnt_all']; - if ( $cnt_all == '1' || in_array($tip, array(1,2,3,4,7,17,18,21,22)) || ($tip == 6 && $spremenljivka['enota'] == 2) ) { + if ( $cnt_all == '1' || in_array($tip, array(1,2,3,4,7,17,18,21,22)) || ($tip == 6 && isset($spremenljivka['enota']) && $spremenljivka['enota'] == 2) ) { # pri tipu radio ali select dodamo tisto variablo ki ni polje "drugo" if ($tip == 1 || $tip == 3 ) { @@ -1223,7 +1225,7 @@ class AnalizaCReport extends LatexAnalysisElement{ # imamo več gridov - tabele foreach($spremenljivka['grids'] AS $gid => $grid) { $sub = 0; - if ($grid['variable'] != '') { + if (isset($grid['variable']) && $grid['variable'] != '') { $sub++; $variablesList[] = array( 'tip'=>$tip, @@ -1277,7 +1279,7 @@ class AnalizaCReport extends LatexAnalysisElement{ $texTitle = ''; if($text != ''){ - $texTitle .= $this->encodeText($text).$this->texNewLine; + $texTitle .= LatexDocument::encodeText($text).$this->texNewLine; } return $texTitle; } diff --git a/admin/survey/export/latexclasses/Analize/AnalizaCharts.php b/admin/survey/export/latexclasses/Analize/AnalizaCharts.php index bd632fa..a7a03ee 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaCharts.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaCharts.php @@ -9,14 +9,14 @@ 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"); @@ -129,7 +129,7 @@ class AnalizaCharts extends LatexAnalysisElement { $this->pdf->Output($fileName, 'I'); } - function displayCharts(){ + function displayCharts($exportClass){ global $site_path; global $lang; @@ -147,7 +147,7 @@ class AnalizaCharts extends LatexAnalysisElement { foreach (SurveyAnalysis::$_HEADERS AS $spid => $spremenljivka) { // preverjamo ali je meta - if (($spremenljivka['tip'] != 'm' + if ((isset($spremenljivka['tip'])&&$spremenljivka['tip'] != 'm' && in_array($spremenljivka['tip'], SurveyAnalysis::$_FILTRED_TYPES )) && (!isset($_spid) || (isset($_spid) && $_spid == $spid)) && ($this->spremenljivka == $spid || $this->spremenljivka == null) ) { @@ -156,7 +156,7 @@ class AnalizaCharts extends LatexAnalysisElement { if ($vars_count == 0 || ($vars_count > 0 && isset(SurveyAnalysis::$_FILTRED_VARIABLES[$spid]) ) ) { // Ce imamo radio tip in manj kot 5 variabel po defaultu prikazemo piechart - $vars = count($spremenljivka['options']); + $vars = (isset($spremenljivka['options']) && is_countable($spremenljivka['options'])) ? count($spremenljivka['options']) : 0; $type = 0; if( ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3) && $vars < 5 ) $type = 2; @@ -180,7 +180,7 @@ class AnalizaCharts extends LatexAnalysisElement { //izpis naslova/podnaslova tabele $stevilcenje = ($exportClass->numbering == 1 ? $spremenljivka['variable'].' - ' : ''); $title = $stevilcenje . $spremenljivka['naslov']; - $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 if($spremenljivka['tip'] == 2){ $boldedSubTitle = $lang['srv_info_checkbox']; } @@ -219,7 +219,7 @@ class AnalizaCharts extends LatexAnalysisElement { //izpis naslova/podnaslova tabele $stevilcenje = ($exportClass->numbering == 1 ? $spremenljivka['variable'].' - ' : ''); $title = $stevilcenje . $spremenljivka['naslov']; - $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 if($spremenljivka['tip'] == 2){ $boldedSubTitle = $lang['srv_info_checkbox']; } 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 "
"; */ - $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."
"; - //echo "steviloVmesnihStolpcevPodvrstica2: ".$steviloVmesnihStolpcevPodvrstica2."
"; - //echo "steviloVmesnihStolpcevPodvrstica3: ".$steviloVmesnihStolpcevPodvrstica3."
"; $podVrstice = 0; - //if($steviloVmesnihStolpcevPodvrstica2||$steviloVmesnihStolpcevPodvrstica3){ if($steviloVmesnihStolpcevPodvrstica2&&$steviloVmesnihStolpcevPodvrstica3){ //echo "1
"; 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)."
"; - //echo "testiram, kjer ssem: ".$steviloTabColSep."
"; + $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."
"; 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)."
"; + //echo "testiram, kjer ssem: ".LatexDocument::encodeText($sub_q1)."
"; if($cols[$t]!=0 &&($t == ($steviloTabel-1))){ if($steviloVmesnihStolpcevPodvrstic==1){ @@ -923,14 +941,11 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //echo "$tabela
"; // druga vrstica #################################################################################### - $tabela .= $this->encodeText($sub_q2); //prvi stolpec 2. vrstice - //echo "testiram, kjer ssem: ".$this->encodeText($sub_q2)."
"; - //echo "testiram, kjer ssem: ".$steviloTabColSep."
"; + $tabela .= LatexDocument::encodeText($sub_q2); //prvi stolpec 2. vrstice $drugaVrstica = array(); //echo count($crosstabsOptions1All[$t])."
"; - //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
"; - //echo $this->encodeText($text)."
"; + //echo LatexDocument::encodeText($text)."
"; } 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
"; @@ -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']."
"; // 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 diff --git a/admin/survey/export/latexclasses/Analize/AnalizaDesc.php b/admin/survey/export/latexclasses/Analize/AnalizaDesc.php index 8433e9b..b7c427b 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaDesc.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaDesc.php @@ -8,14 +8,14 @@ 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"); @@ -163,7 +163,7 @@ class AnalizaDesc 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); @@ -211,7 +211,7 @@ class AnalizaDesc 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; @@ -226,16 +226,16 @@ class AnalizaDesc extends LatexAnalysisElement{ /*priprava polja z naslovi stolpcev*/ $text = array(); - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_variable']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_variable_text1']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_variable']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_variable_text1']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_m']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_num_units']).'}'; - //$text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_povprecje1']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_povprecje_odstotek1']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_odklon']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_min']).'}'; - $text[] = '\textbf{'.$this->encodeText($lang['srv_analiza_opisne_max']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_m']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_num_units']).'}'; + //$text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_povprecje1']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_povprecje_odstotek1']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_min']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($lang['srv_analiza_opisne_max']).'}'; /*priprava polja z naslovi stolpcev - konec*/ $tabela .= $this->tableRow($text); @@ -249,14 +249,14 @@ class AnalizaDesc extends LatexAnalysisElement{ /*izpis ostalih vrstic*/ foreach (SurveyAnalysis::$_HEADERS AS $spid => $spremenljivka) { /* preverjamo ali je meta*/ - if ($spremenljivka['tip'] != 'm' + if (isset($spremenljivka['tip'])?$spremenljivka['tip']:'' != 'm' && ( count(SurveyAnalysis::$_FILTRED_VARIABLES) == 0 || (count(SurveyAnalysis::$_FILTRED_VARIABLES) > 0 && isset(SurveyAnalysis::$_FILTRED_VARIABLES[$spid]) )) && in_array($spremenljivka['tip'], SurveyAnalysis::$_FILTRED_TYPES) && ($this->spremenljivka == $spid || $this->spremenljivka == null) ) { $show_enota = false; /* preverimo ali imamo samo eno variablo in če iammo enoto*/ - if ((int)$spremenljivka['enota'] != 0 || $spremenljivka['cnt_all'] > 1 ) { + if ((int)(isset($spremenljivka['enota'])?$spremenljivka['enota']:0) != 0 || isset($spremenljivka['cnt_all'])?$spremenljivka['cnt_all']:0 > 1 ) { $show_enota = true; } @@ -292,12 +292,11 @@ class AnalizaDesc extends LatexAnalysisElement{ if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable ){ /* dodamo ostale vrstice*/ - $do_show = ($variable['other'] !=1 && ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3 || $spremenljivka['tip'] == 5 || $spremenljivka['tip'] == 8 )) + $do_show = (isset($variable['other'])?$variable['other']:0 !=1 && ($spremenljivka['tip'] == 1 || $spremenljivka['tip'] == 3 || $spremenljivka['tip'] == 5 || $spremenljivka['tip'] == 8 )) ? false : true; if ($do_show) { - //self::displayDescriptivesVariablaRow($spremenljivka,$grid,$variable,$_css); - $tabela .= $this->displayDescriptivesVariablaRow($spremenljivka,$grid,$variable,$_css); + $tabela .= $this->displayDescriptivesVariablaRow($spremenljivka,$grid,$variable,isset($_css)?$_css:null); } $grid['new_grid'] = false; @@ -310,9 +309,8 @@ class AnalizaDesc extends LatexAnalysisElement{ /*zakljucek latex tabele*/ - $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele - konec */ - //echo "
Tex celotne tabele: ".$tabela."
"; return $tabela; } } diff --git a/admin/survey/export/latexclasses/Analize/AnalizaFreq.php b/admin/survey/export/latexclasses/Analize/AnalizaFreq.php index 8945266..8926858 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaFreq.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaFreq.php @@ -8,39 +8,39 @@ 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); - define ('MEJA_DOLZINA_VPRASANJA', 132); + if(!defined("MEJA_DOLZINA_VPRASANJA"))define ('MEJA_DOLZINA_VPRASANJA', 132); /** * @desc Class za generacijo izvoza v Latex @@ -69,7 +69,6 @@ class AnalizaFreq extends LatexAnalysisElement{ protected $texBigSkip = '\bigskip'; protected $spaceBetweenTables = ' \newline \vspace*{1 cm} \newline'; - /** * @desc konstruktor */ @@ -169,7 +168,9 @@ class AnalizaFreq extends LatexAnalysisElement{ case 5: # nagovor //pdfIzvozAnalizaSums::sumNagovor($spid,'freq'); - $tabela .= $this->sumNagovor($spid,'freq'); + //$tabela .= $this->sumNagovor($spid,'freq'); + $analizaSums = new AnalizaSums; + $tabela .= $analizaSums->sumNagovor($spid,'freq'); //$tabela .= $this->spaceBetweenTables; break; } @@ -212,7 +213,7 @@ class AnalizaFreq 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; @@ -228,14 +229,14 @@ class AnalizaFreq extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloOstalihStolpcev.'}{>{\hsize=\dimexpr '.($steviloOstalihStolpcev+1).'\hsize + '.($steviloOstalihStolpcev+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); - if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloOstalihStolpcev.'}{>{\hsize=\dimexpr '.($steviloOstalihStolpcev+1).'\hsize + '.($steviloOstalihStolpcev+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); + if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloOstalihStolpcev."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } @@ -273,9 +274,9 @@ class AnalizaFreq extends LatexAnalysisElement{ $maxAnswer = (SurveyDataSettingProfiles :: getSetting('numOpenAnswers') > 0) ? SurveyDataSettingProfiles :: getSetting('numOpenAnswers') : 30; $counter = 0; $_kumulativa = 0; - //SurveyAnalysis::$_FREQUENCYS[$_sequence] - if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { - foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { + $surveyAnalisysFreqValid = isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']:0; + if (is_countable($surveyAnalisysFreqValid) && count($surveyAnalisysFreqValid)> 0 ) { + foreach ($surveyAnalisysFreqValid AS $vkey => $vAnswer) { if ($vAnswer['cnt'] > 0 /*&& $counter < $maxAnswer*/ || true) { # izpisujemo samo tiste ki nisno 0 if (in_array($spremenljivka['tip'],array(4,7,8,19,20,21))) { // text, number, datum, mtext, mnumber, text* $options['isTextAnswer'] = true; @@ -297,7 +298,7 @@ class AnalizaFreq extends LatexAnalysisElement{ if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { $_Z_MV = !$this->hideEmpty; if($_Z_MV){ //ce je potrebno izpisati tudi manjkajoce - $tex .= $this->encodeText($lang['srv_anl_missing1']); + $tex .= LatexDocument::encodeText($lang['srv_anl_missing1']); } foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 @@ -319,7 +320,7 @@ class AnalizaFreq extends LatexAnalysisElement{ } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec # izpišemo še tekstovne odgovore za polja drugo @@ -347,9 +348,9 @@ class AnalizaFreq extends LatexAnalysisElement{ $options[$_oKey] = $_option; } - $text[] = $this->encodeText($variable['variable']); + $text[] = LatexDocument::encodeText($variable['variable']); - $text[] = $this->encodeText($variable['naslov']); + $text[] = LatexDocument::encodeText($variable['naslov']); $text[] = ''; $text[] = ''; diff --git a/admin/survey/export/latexclasses/Analize/AnalizaMean.php b/admin/survey/export/latexclasses/Analize/AnalizaMean.php index e2bceba..138afcc 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaMean.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaMean.php @@ -7,14 +7,14 @@ /* 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"); @@ -125,11 +125,6 @@ class AnalizaMean extends LatexAnalysisElement{ $singleWidth = round( 180 / $cols / 2 ); // visina prve vrstice -/* $firstHeight = 0; - for ($i = 0; $i < $cols; $i++) { - $label1 = $this->meansClass->getSpremenljivkaTitle($_means[$i]['v1']); - $firstHeight = ($firstHeight > $this->getCellHeight($this->encodeText($label1), $singleWidth*2)) ? $firstHeight : $this->getCellHeight($this->encodeText($label1), $singleWidth*2); - } */ //Priprava parametrov za tabelo $steviloStolpcevParameterTabular = 3; @@ -152,7 +147,7 @@ class AnalizaMean 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; @@ -167,11 +162,10 @@ class AnalizaMean extends LatexAnalysisElement{ //prva vrstica tabele $label2 = $this->meansClass->getSpremenljivkaTitle($_means[0]['v2']); - //$this->pdf->MultiCell(80, $firstHeight, $this->encodeText($label2), 'TLR', 'C', 0, 0, 0 ,0, true); $prva = ''; for ($i = 0; $i < $cols; $i++) { $label1 = $this->meansClass->getSpremenljivkaTitle($_means[$i]['v1']); - //$this->pdf->MultiCell($singleWidth*2, $firstHeight, $this->encodeText($label1), 1, 'C', 0, 0, 0 ,0, true); + //$this->pdf->MultiCell($singleWidth*2, $firstHeight, LatexDocument::encodeText($label1), 1, 'C', 0, 0, 0 ,0, true); $prva .= $label1.' '; } @@ -188,28 +182,18 @@ class AnalizaMean extends LatexAnalysisElement{ $steviloArrayrulewidth = ($steviloPodStolpcev1-1); if($export_format=='pdf'){ - $tabela .= $this->encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{>{\hsize=\dimexpr".$steviloPodStolpcev1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}".$poravnava."|}{".$this->encodeText($prva)."} ".$this->texNewLine; + $tabela .= LatexDocument::encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{>{\hsize=\dimexpr".$steviloPodStolpcev1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}".$poravnava."|}{".LatexDocument::encodeText($prva)."} ".$this->texNewLine; }elseif($export_format=='rtf'){ - $tabela .= $this->encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{".$poravnava."|}{".$this->encodeText($prva)."} ".$this->texNewLine; + $tabela .= LatexDocument::encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{".$poravnava."|}{".LatexDocument::encodeText($prva)."} ".$this->texNewLine; } ############ - - //$tabela .= $this->encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{>{\hsize=\dimexpr".$steviloPodStolpcev1."\hsize+".$steviloPodStolpcev1."\\tabcolsep+\arrayrulewidth\\relax}".$poravnava."|}{".$this->encodeText($prva)."} ".$this->texNewLine; - //$tabela .= $this->encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($prva)."} ".$this->texNewLine; - //$tabela .= $this->encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{".$poravnava."|}{".$this->encodeText($prva)."} ".$this->texNewLine; - //$tabela .= $this->encodeText($label2)." & \multicolumn{".$steviloPodStolpcev1."}{C|}{".$this->encodeText($prva)."} ".$this->texNewLine; - //$tabela .= $this->encodeText($label2).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1).'\hsize + '.($steviloPodStolpcev1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($prva).'} '.$this->texNewLine; - + //prva vrstica tabele - konec //druga vrstica tabele - //$this->pdf->MultiCell(80, 7, $this->encodeText(''), 'BLR', 'C', 0, 0, 0 ,0, true); - //echo "stolpci: ".$cols."
"; - //echo "vrstice: ".$rows."
"; $druga = array(); $steviloPodStolpcev = $steviloPodStolpcev1 + 1; - //$tabela .= "\\cline{2-".$steviloPodStolpcev."} & "; //horizontalna vrstica od 2 do zadnje celice if($export_format != 'xls'){ $tabela .= "\\cline{2-".$steviloPodStolpcev."} "; //horizontalna vrstica od 2 do zadnje celice } @@ -219,12 +203,9 @@ class AnalizaMean extends LatexAnalysisElement{ $brezHline = $this->getBrezHline($export_format); for ($i = 0; $i < $cols; $i++) { - $druga[] = $this->encodeText($lang['srv_means_label']); - $druga[] = $this->encodeText($lang['srv_means_label4']); - //$this->pdf->MultiCell($singleWidth, 7, $this->encodeText($lang['srv_means_label']), 1, 'C', 0, 0, 0 ,0, true); - //$this->pdf->MultiCell($singleWidth, 7, $this->encodeText($lang['srv_means_label4']), 1, 'C', 0, 0, 0 ,0, true); + $druga[] = LatexDocument::encodeText($lang['srv_means_label']); + $druga[] = LatexDocument::encodeText($lang['srv_means_label4']); } - //$this->pdf->MultiCell(1, 7, $this->encodeText(''), 0, 'C', 0, 1, 0 ,0, true); $tabela .= $this->tableRow($druga, $brezHline)." "; //druga vrstica tabele - konec @@ -236,24 +217,19 @@ class AnalizaMean extends LatexAnalysisElement{ $variabla = $crossVariabla2['naslov']; # če ni tekstovni odgovor dodamo key if ($crossVariabla2['type'] !== 't' ) { - if ($crossVariabla2['vr_id'] == null) { + if ((isset($crossVariabla2['vr_id'])?$crossVariabla2['vr_id']:null) == null) { $variabla .= ' ( '.$ckey2.' )'; } else { $variabla .= ' ( '.$crossVariabla2['vr_id'].' )'; } } - //$this->pdf->MultiCell(80, 7, $this->encodeText($variabla), 1, 'C', 0, 0, 0 ,0, true); - $dataVrstica[] = $this->encodeText($variabla); + $dataVrstica[] = LatexDocument::encodeText($variabla); # celice z vsebino - for ($i = 0; $i < $cols; $i++) { - //$dataVrstica[] = $this->encodeText($this->meansClass->formatNumber($_means[$i]['result'][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); - $dataVrstica[] = $this->encodeText(self::formatNumber($_means[$i]['result'][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); - $dataVrstica[] = $this->encodeText((int)$_means[$i]['sumaVrstica'][$ckey2]); - //$this->pdf->MultiCell($singleWidth, 7, $this->encodeText($this->meansClass->formatNumber($_means[$i]['result'][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))), 1, 'C', 0, 0, 0 ,0, true); - //$this->pdf->MultiCell($singleWidth, 7, $this->encodeText((int)$_means[$i]['sumaVrstica'][$ckey2]), 1, 'C', 0, 0, 0 ,0, true); + for ($i = 0; $i < $cols; $i++) { + $dataVrstica[] = LatexDocument::encodeText(self::formatNumber(isset($_means[$i]['result'][$ckey2])?$_means[$i]['result'][$ckey2]:0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); + $dataVrstica[] = LatexDocument::encodeText((int)isset($_means[$i]['sumaVrstica'][$ckey2])?$_means[$i]['sumaVrstica'][$ckey2]:0); } - //$this->pdf->MultiCell(1, 7, $this->encodeText(''), 0, 'C', 0, 1, 0 ,0, true); $tabela .= $this->tableRow($dataVrstica, $brezHline)." "; } } @@ -261,21 +237,19 @@ class AnalizaMean extends LatexAnalysisElement{ //SKUPAJ $skupajVrstica = array(); - //$this->pdf->MultiCell(80, 7, $this->encodeText($lang['srv_means_label3']), 1, 'C', 0, 0, 0 ,0, true); - $skupajVrstica[] = $this->encodeText($lang['srv_means_label3']); + $skupajVrstica[] = LatexDocument::encodeText($lang['srv_means_label3']); for ($i = 0; $i < $cols; $i++) { - //$skupajVrstica[] = $this->encodeText($this->meansClass->formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); - $skupajVrstica[] = $this->encodeText(self::formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); - //$this->pdf->MultiCell($singleWidth, 7, $this->encodeText($this->meansClass->formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))), 1, 'C', 0, 0, 0 ,0, true); - $skupajVrstica[] = $this->encodeText((int)$_means[$i]['sumaSkupna']); - //$this->pdf->MultiCell($singleWidth, 7, $this->encodeText((int)$_means[$i]['sumaSkupna']), 1, 'C', 0, 0, 0 ,0, true); + //$skupajVrstica[] = LatexDocument::encodeText($this->meansClass->formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); + $skupajVrstica[] = LatexDocument::encodeText(self::formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))); + //$this->pdf->MultiCell($singleWidth, 7, LatexDocument::encodeText($this->meansClass->formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'))), 1, 'C', 0, 0, 0 ,0, true); + $skupajVrstica[] = LatexDocument::encodeText((int)$_means[$i]['sumaSkupna']); + //$this->pdf->MultiCell($singleWidth, 7, LatexDocument::encodeText((int)$_means[$i]['sumaSkupna']), 1, 'C', 0, 0, 0 ,0, true); } - //$this->pdf->MultiCell(1, 7, $this->encodeText(''), 0, 'C', 0, 1, 0 ,0, true); $tabela .= $this->tableRow($skupajVrstica, $brezHline)." "; //SKUPAJ - konec //zaljucek latex tabele z obrobo za prvo tabelo - $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec return $tabela; } diff --git a/admin/survey/export/latexclasses/Analize/AnalizaMultiCrosstab.php b/admin/survey/export/latexclasses/Analize/AnalizaMultiCrosstab.php index 02f6eb9..ce2126a 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaMultiCrosstab.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaMultiCrosstab.php @@ -7,14 +7,14 @@ 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"); @@ -84,12 +84,8 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { global $global_user_id; // preverimo ali imamo stevilko ankete - //if ( is_numeric($anketa) ){ if ( is_numeric($anketa['id']) ){ - //$this->anketa['id'] = $anketa; $this->anketa = $anketa; - // create new PDF document - //$this->pdf = new enka_TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); } else{ $this->pi['msg'] = "Anketa ni izbrana!"; @@ -142,14 +138,8 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $this->multiCrosstabClass->getSelectedVars(); // Izpisemo naslov tabele - //echo "naslov tabele: ".$this->encodeText($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['title'])."
"; - $tabela .= '\textbf{'.$this->encodeText($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['title']).'}'.$this->texBigSkip.$this->texNewLine; - //echo $tabela."
"; -/* $this->pdf->setFont('','B','10'); - $this->pdf->MultiCell(150, 5, $this->encodeText($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['title']), 0, 'L', 0, 1, 0 ,0, true); - $this->pdf->ln(5); - $this->pdf->setFont('','','6'); */ - + $tabela .= '\textbf{'.LatexDocument::encodeText($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['title']).'}'.$this->texBigSkip.$this->texNewLine; + // TABELA @@ -198,17 +188,16 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { foreach($this->multiCrosstabClass->selectedVars['ver'] as $var){ $cntVerVars++; } - //echo "cntVerVars: ".$cntVerVars."
"; + $tretjaVrsticaVert = array(); + $cetrtaVrsticaVert = array(); if($this->multiCrosstabClass->colSpan == 0){ - //$this->cellWidth = $dataWidth/2; - //$this->pdf->MultiCell($metaWidth, 0, '', 'B', 'L', 0, 1, 0 ,0, true); + $steviloPodstolpcev = 1; $steviloPodstolpcevV1[] = $steviloPodstolpcev; } // Imamo 2 nivoja elseif($this->multiCrosstabClass->colLevel2){ - //echo "vertikalno izbrane sprem. 1. vrstica, ko imamo 2 nivoja
"; $this->cellWidth = $dataWidth / $this->multiCrosstabClass->colSpan; @@ -223,7 +212,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { foreach($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options'] as $option){ foreach($parentVar['sub'] as $var){ foreach($this->multiCrosstabClass->variablesList[$var['spr']]['options'] as $suboption){ - //$this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->snippet($suboption, 25), 1, 'C', 0, 0, 0 ,0, true, $stretch=0, $ishtml=false, $autopadding=false, $maxh=0); if($export_format != 'xls'){ $cetrtaVrsticaVertText = $this->snippet($suboption, 25); $cetrtaVrsticaVertTmpText = $this->snippet($suboption, 25); @@ -241,25 +229,19 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } } else{ - //$this->pdf->MultiCell($this->cellWidth*count($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options']), $lineHeight, '', 0, 'C', 0, 0, 0 ,0, true); - foreach($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options'] as $option){ - //$this->pdf->MultiCell($this->cellWidth, $lineHeight*2, $this->snippet($option, 25), 1, 'C', 0, 0, 0 ,0, true); - - /* $cetrtaVrsticaVert[] = $this->snippet($option, 25); - $cetrtaVrsticaVertTmp[] = $this->snippet($suboption, 25); */ if($export_format != 'xls'){ $cetrtaVrsticaVertText = $this->snippet($option, 25); - $cetrtaVrsticaVertTmpText = $this->snippet($suboption, 25); + //$cetrtaVrsticaVertTmpText = $this->snippet($suboption, 25); }else{ $cetrtaVrsticaVertText = $option; - $cetrtaVrsticaVertTmpText = $suboption; + //$cetrtaVrsticaVertTmpText = $suboption; } $cetrtaVrsticaVert[] = $cetrtaVrsticaVertText; - $cetrtaVrsticaVertTmp[] = $cetrtaVrsticaVertTmpText; + //$cetrtaVrsticaVertTmp[] = $cetrtaVrsticaVertTmpText; $indeksMultiRow[] = 0; } - $steviloPodstolpcev = count($cetrtaVrsticaVertTmp); + //$steviloPodstolpcev = count($cetrtaVrsticaVertTmp); $steviloPodstolpcevV3[] = count($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options']); } if($steviloPodstolpcev!=0){ @@ -271,7 +253,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Izrisemo VERTIKALNO izbrane spremenljivkec - 1. vrstica - //$this->pdf->MultiCell($metaWidth, $lineHeight, '', 0, 'L', 0, 0, 0 ,0, true); if(count($this->multiCrosstabClass->selectedVars['ver'])){ $prvaVrsticaVert = array(); @@ -283,43 +264,36 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $rowspan = 1; $width = $this->cellWidth * count($this->multiCrosstabClass->variablesList[$var['sub'][0]['spr']]['options']) * count($this->multiCrosstabClass->variablesList[$var['spr']]['options']); if($export_format != 'xls'){ - $naslov = $this->encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25)); + $naslov = LatexDocument::encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25)); }else{ - $naslov = $this->encodeText($this->multiCrosstabClass->variablesList[$var['spr']]['naslov']); + $naslov = LatexDocument::encodeText($this->multiCrosstabClass->variablesList[$var['spr']]['naslov']); } } else{ $rowspan = 2; $width = $this->cellWidth * count($this->multiCrosstabClass->variablesList[$var['spr']]['options']); if($export_format != 'xls'){ - $naslov = '\multirow{2}{*}{ '.$this->encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25)).' }'; + $naslov = '\multirow{2}{*}{ '.LatexDocument::encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25)).' }'; }else{ - $naslov = $this->encodeText($this->multiCrosstabClass->variablesList[$var['spr']]['naslov']); + $naslov = LatexDocument::encodeText($this->multiCrosstabClass->variablesList[$var['spr']]['naslov']); } } - //$this->pdf->MultiCell($width, $lineHeight*$rowspan, $this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25), 1, 'C', 0, 0, 0 ,0, true); - - //$naslov = $this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25); - //$naslov = $this->encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25)); $prvaVrsticaVert[] = $naslov; //echo "naslov: ".$naslov."
"; } } - //$this->pdf->MultiCell(1, $lineHeight, '', 0, 'L', 0, 1, 0 ,0, true); + // Izris vrstic za 2. nivo - 3. in 4. vrstica - //$this->pdf->MultiCell($metaWidth, $lineHeight, '', 0, 'L', 0, 0, 0 ,0, true); + if(count($this->multiCrosstabClass->selectedVars['ver'])){ - $tretjaVrsticaVert = array(); foreach($this->multiCrosstabClass->selectedVars['ver'] as $parentVar){ // ce imamo childe na 2. nivoju if(count($parentVar['sub']) > 0){ - //$tretjaVrsticaVert = array(); foreach($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options'] as $option){ $width = $this->cellWidth * count($this->multiCrosstabClass->variablesList[$parentVar['sub'][0]['spr']]['options']); foreach($parentVar['sub'] as $var){ - //$this->pdf->MultiCell($width, $lineHeight, $this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25), 1, 'C', 0, 0, 0 ,0, true); if($export_format != 'xls'){ $tretjaVrsticaVert[] = $this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25); }else{ @@ -331,9 +305,7 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } } else{ - //$this->pdf->MultiCell($this->cellWidth*count($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options']), $lineHeight, '', 0, 'C', 0, 0, 0 ,0, true); - //$tretjaVrsticaVert[] = ''; $tretjaVrsticaVert[] = '\multirow{2}{*}{}'; @@ -343,7 +315,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } // Izrisemo VARIABLE za spremenljivko - 2. vrstica - //$this->pdf->MultiCell($metaWidth, $lineHeight, '', 0, 'L', 0, 0, 0 ,0, true); if(count($this->multiCrosstabClass->selectedVars['ver'])){ $drugaVrsticaVert = array(); @@ -378,16 +349,13 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } } } - //$this->pdf->MultiCell(1, $lineHeight, '', 0, 'L', 0, 1, 0 ,0, true); } // Imamo samo 1 nivo else{ // Izrisemo VERTIKALNO izbrane spremenljivkec - 1. vrstica - //echo "Samo 1 nivo
"; // Izracunamo sirine celic $this->cellWidth = $dataWidth / $this->multiCrosstabClass->fullColSpan; - //$this->pdf->MultiCell($metaWidth, $lineHeight, '', 0, 'C', 0, 0, 0 ,0, true); if(count($this->multiCrosstabClass->selectedVars['ver'])){ $prvaVrsticaVert = array(); @@ -403,22 +371,12 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } } - //$prvaVrsticaVert[] = $this->snippet($naslov, 35); - - //$sprWidth = count($this->multiCrosstabClass->variablesList[$var['spr']]['options']) * $this->cellWidth; - //if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['sums'] == 1 && !$this->multiCrosstabClass->rowLevel2) - //$sprWidth += $this->cellWidth; - //$this->pdf->MultiCell($sprWidth, $lineHeight, $this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 35), 1, 'C', 0, 0, 0 ,0, true); - + //$prvaVrsticaVert[] = $this->snippet($naslov, 35); } - - //$this->pdf->MultiCell(1, $lineHeight, '', 0, 'C', 0, 1, 0 ,0, true); - //$tabela .= $this->tableRow($prvaVrsticaVert); - //echo $tabela; + } // Nimamo nobene vertikalne spremenljivke in 2 horizontalni elseif($this->multiCrosstabClass->rowLevel2){ - //$this->pdf->MultiCell($dataWidth, $lineHeight, '', 0, 'C', 0, 0, 0 ,0, true); echo "Nimamo nobene vertikalne spremenljivke in 2 horizontalni
"; } @@ -429,22 +387,12 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Iracunamo visino najvisje celice $cellHeight = $lineHeight; -/* foreach($this->multiCrosstabClass->selectedVars['ver'] as $var){ - - foreach($this->multiCrosstabClass->variablesList[$var['spr']]['options'] as $option){ - $height = $this->getCellHeight($this->snippet($option, 25), $this->cellWidth); - $cellHeight = ($height > $cellHeight) ? $height : $cellHeight; - } - } */ - - //$this->pdf->MultiCell($metaWidth, $cellHeight, '', 'B', 'C', 0, 0, 0 ,0, true); - foreach($this->multiCrosstabClass->selectedVars['ver'] as $var){ $steviloPodstolpcev = 0; // Loop cez variable spremenljivke foreach($this->multiCrosstabClass->variablesList[$var['spr']]['options'] as $option){ - //$this->pdf->MultiCell($this->cellWidth, $cellHeight, $this->snippet($option, 25), 1, 'C', 0, 0, 0 ,0, true); + if($export_format != 'xls'){ $drugaVrsticaVert[] = $this->snippet($option, 25); }else{ @@ -456,16 +404,10 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Suma (ce jo imamo vklopljeno) if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['sums'] == 1 && !$this->multiCrosstabClass->rowLevel2){ - //$this->pdf->MultiCell($this->cellWidth, $cellHeight, $lang['srv_analiza_crosstab_skupaj'], 1, 'C', 0, 0, 0 ,0, true); $drugaVrsticaVert[] = $lang['srv_analiza_crosstab_skupaj']; $steviloPodstolpcev++; } - -/* if($colspan<4){ - $steviloPodstolpcevV2[] = $steviloPodstolpcev; - }elseif($steviloPodstolpcev!=0&&$colspan==4){ - $steviloPodstolpcevV2[] = $steviloPodstolpcev; - } */ + if($steviloPodstolpcev!=0){ $steviloPodstolpcevV1[] = $steviloPodstolpcev; } @@ -473,7 +415,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { //$steviloPodstolpcevV2[] = $steviloPodstolpcev; } //$tabela .= $this->tableRow($drugaVrsticaVert); - //$this->pdf->MultiCell(1, $cellHeight, '', 0, 'C', 0, 1, 0 ,0, true); } } @@ -501,7 +442,7 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { /*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -512,8 +453,7 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $tabela .= "\\cline{".($colspan+1)."-".$steviloStolpcevParameterTabular."}"; //prekinjena horizontalna vrstica na vrhu tabele } - $tabela .= $this->MultiColCellLatex($colspan, '', 1); //prazne celice v prvi vrstici - //$tabela .= $this->tableRow($prvaVrsticaVert, 1, 0, 0, $steviloPodstolpcevV1); //izpis prve vrstice tabele + $tabela .= $this->MultiColCellLatex($colspan, '', 1, $export_format); //prazne celice v prvi vrstici $tabela .= $this->tableRow($prvaVrsticaVert, 1, 0, 0, '', $export_format, $steviloPodstolpcevV1); //izpis prve vrstice tabele //prekinjena horizontalna vrstica po prvi vrstici @@ -523,9 +463,8 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { //prekinjena horizontalna vrstica po prvi vrstici - konec if(count($drugaVrsticaVert)){ - $tabela .= $this->MultiColCellLatex($colspan, '', 1); //prazne celice v drugi vrstici + $tabela .= $this->MultiColCellLatex($colspan, '', 1, $export_format); //prazne celice v drugi vrstici if(count($steviloPodstolpcevV2)){ - //$tabela .= $this->tableRow($drugaVrsticaVert, 1, 0, 0, $steviloPodstolpcevV2); $tabela .= $this->tableRow($drugaVrsticaVert, 1, 0, 0, '', $export_format, $steviloPodstolpcevV2); }else{ $tabela .= $this->tableRow($drugaVrsticaVert, 1); @@ -538,10 +477,9 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { //prekinjena horizontalna vrstica po drugi vrstici - konec } - if(count($tretjaVrsticaVert)){ - $tabela .= $this->MultiColCellLatex($colspan, '', 1); //prazne celice v drugi vrstici + if(is_countable($tretjaVrsticaVert) && count($tretjaVrsticaVert)){ + $tabela .= $this->MultiColCellLatex($colspan, '', 1, $export_format); //prazne celice v drugi vrstici if(count($steviloPodstolpcevV3)){ - //$tabela .= $this->tableRow($tretjaVrsticaVert, 1, 0, 0, $steviloPodstolpcevV3); $tabela .= $this->tableRow($tretjaVrsticaVert, 1, 0, 0, '', $export_format, $steviloPodstolpcevV3); }else{ $tabela .= $this->tableRow($tretjaVrsticaVert, 1); @@ -552,7 +490,7 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } if(count($cetrtaVrsticaVert)){ - $tabela .= $this->MultiColCellLatex($colspan, '', 1); //prazne celice v drugi vrstici + $tabela .= $this->MultiColCellLatex($colspan, '', 1, $export_format); //prazne celice v drugi vrstici $tabela .= $this->tableRow($cetrtaVrsticaVert, 1); } @@ -572,7 +510,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $order0 = 0; foreach($this->multiCrosstabClass->variablesList[$parentVar['spr']]['options'] as $option){ - //echo "option hor 2. nivoja: ".$option."
"; $cnt2 = 0; // ce imamo childe na 2. nivoju @@ -605,17 +542,14 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { if($cnt == 0){ if($export_format != 'xls'){ - $tabela .= $this->encodeText($this->snippet($this->multiCrosstabClass->variablesList[$parentVar['spr']]['naslov'], 25))." & "; + $tabela .= LatexDocument::encodeText($this->snippet($this->multiCrosstabClass->variablesList[$parentVar['spr']]['naslov'], 25))." & "; }else{ - $tabela .= $this->encodeText($this->multiCrosstabClass->variablesList[$parentVar['spr']]['naslov'])." & "; + $tabela .= LatexDocument::encodeText($this->multiCrosstabClass->variablesList[$parentVar['spr']]['naslov'])." & "; } - //$this->pdf->MultiCell($width, $this->cellHeight, $this->snippet($this->multiCrosstabClass->variablesList[$parentVar['spr']]['naslov'], 25), 'LR', 'C', 0, 0, 0 ,0, true); - //echo "naslov : ".$this->snippet($this->multiCrosstabClass->variablesList[$parentVar['spr']]['naslov'], 25)."
"; + } else{ $tabela .= " & "; - //$this->pdf->MultiCell($width, $this->cellHeight, '', 'LR'.$border1, 'C', 0, 0, 0 ,0, true); - //echo "naslov :
"; } @@ -623,54 +557,42 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { //if($cnt2 == floor(count($this->multiCrosstabClass->variablesList[$var['spr']]['options'])/2)){ if($cnt2 == 0){ if($export_format != 'xls'){ - $tabela .= $this->encodeText($this->snippet($option, 25))." & "; + $tabela .= LatexDocument::encodeText($this->snippet($option, 25))." & "; }else{ - $tabela .= $this->encodeText($option)." & "; + $tabela .= LatexDocument::encodeText($option)." & "; } - //echo "variabla : ".$this->snippet($option, 25)."
"; - //$this->pdf->MultiCell($width, $this->cellHeight, $this->snippet($option, 25), 'LR', 'C', 0, 0, 0 ,0, true); } else{ $tabela .= " & "; - //echo "variabla :
"; - //$this->pdf->MultiCell($width, $this->cellHeight, '', 'LR'.$border2, 'C', 0, 0, 0 ,0, true); } //if($cnt3 == floor(count($this->multiCrosstabClass->variablesList[$var['spr']]['options'])/2)){ if($cnt3 == 0){ if($export_format != 'xls'){ - $tabela .= $this->encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25))." & "; + $tabela .= LatexDocument::encodeText($this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25))." & "; }else{ - $tabela .= $this->encodeText($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'])." & "; + $tabela .= LatexDocument::encodeText($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'])." & "; } - //echo "variabla cnt3: ".$this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25)."
"; - //$this->pdf->MultiCell($width, $this->cellHeight, $this->snippet($this->multiCrosstabClass->variablesList[$var['spr']]['naslov'], 25), 'LR', 'C', 0, 0, 0 ,0, true); } else{ - $tabela .= " & "; - //echo "variabla cnt3:
"; - //$this->pdf->MultiCell($width, $this->cellHeight, '', 'LR'.$border2, 'C', 0, 0, 0 ,0, true); + $tabela .= " & "; } // Variabla 2 if($export_format != 'xls'){ - $tabela .= $this->encodeText($this->snippet($suboption, 25))." & "; + $tabela .= LatexDocument::encodeText($this->snippet($suboption, 25))." & "; }else{ - $tabela .= $this->encodeText($suboption)." & "; + $tabela .= LatexDocument::encodeText($suboption)." & "; } - //$this->pdf->MultiCell($width, $this->cellHeight, $this->snippet($suboption, 25), 1, 'C', 0, 0, 0 ,0, true); - //echo "option variabla 2: ".$this->snippet($suboption, 25)."
"; // Celice s podatki $vrsticaPodatki = $this->displayDataCells($parentVar, $order0, $var, $cnt3); - //print_r($vrsticaPodatki); + ################# izpis celic s podatki $tabela .= $this->displayDataCellLatex($vrsticaPodatki, $this->tableSettingsNumerus, $this->tableSettingsAvgVar, $this->tableSettingsDelezVar, $colspan, $steviloStolpcevParameterTabular, $export_format); ################# izpis celic s podatki - konec // Celice s podatki - konec - //$this->pdf->MultiCell(1, $this->cellHeight, '', 0, 'C', 0, 1, 0 ,0, true); - $cnt++; $cnt2++; $cnt3++; @@ -753,11 +675,9 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { }else{ $naslovVarHor = ''; } - //echo "naslovVarHor: ".$naslovVarHor."
"; $tabela .= $naslovVarHor." & "; // Variabla - //$this->pdf->MultiCell($width, $this->cellHeight, $this->snippet($option, 25), '1', 'C', 0, 0, 0 ,0, true); //echo "variabla: ".$this->snippet($option, 25)."
"; if($export_format != 'xls'){ $tabela .= $this->snippet($option, 25)." & "; @@ -766,8 +686,8 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } // Celice s podatki - //echo "celica s podatki: ".$var."
"; // Ce nimamo nobenega krizanja izpisemo prazne + $spr2=isset($spr2)?$spr2:''; if($spr2 == '' && $this->multiCrosstabClass->colSpan == 0){ //$tabela .= " & "; $tabela .= $this->texNewLine; @@ -778,7 +698,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $tabela .= $this->displayDataCellLatex($vrsticaPodatki, $this->tableSettingsNumerus, $this->tableSettingsAvgVar, $this->tableSettingsDelezVar, $colspan, $steviloStolpcevParameterTabular, $export_format); ################# izpis celic s podatki - konec } - //$this->pdf->MultiCell(1, $this->cellHeight, '', 0, 'C', 0, 1, 0 ,0, true); if($export_format != 'xls'){ $tabela .= "\\cline{".($colspan)."-".$steviloStolpcevParameterTabular."}"; //prekinjena horizontalna vrstica @@ -788,11 +707,8 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } // Vrstica za sumo (ce jo imamo vklopljeno) if($suma){ - - //$this->pdf->MultiCell($width, $this->cellHeight, '', 'BLR', 'C', 0, 0, 0 ,0, true); - //$this->pdf->MultiCell($width, $this->cellHeight, $lang['srv_analiza_crosstab_skupaj'], '1', 'C', 0, 0, 0 ,0, true); - $tabela .= " & ".$this->encodeText($lang['srv_analiza_crosstab_skupaj'])." & "; - //$tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj'])." & "; + + $tabela .= " & ".LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])." & "; $vrsticaPodatkiSumNum = array(); $vrsticaPodatkiSumPer = array(); @@ -876,7 +792,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } if($this->tableSettingsDelezVar!= ''){ $color = 'red'; - //$tabela .= $this->tableRow($vrsticaPodatkiSumDelez,1); $tabela .= $this->tableRow($vrsticaPodatkiSumDelez,1,0,0,$color, $export_format); } } @@ -898,7 +813,7 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } //zaljucek latex tabele z obrobo za drugo tabelo - $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za drugo tabelo - konec //echo "tabela: ".$tabela; return $tabela; @@ -1434,27 +1349,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { function displaySumsCell($spr1=null, $spr2=null, $val=null, $orientation=null){ $celicaSums = array(); - //echo "Orientacija skupaj: ".$orientation."
"; -/* $startX = $this->pdf->getX(); - $startY = $this->pdf->getY(); */ - - // Nastavimo visino posamezne vrstice -/* $cellSpan = 0; - if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1) - $cellSpan++; - if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1) - $cellSpan++; - if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['avgVar'] != '') - $cellSpan++; - if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['delezVar'] != '') - $cellSpan++; - $cellSpan = ($cellSpan > 0) ? $cellSpan : 1; - $lineHeight = $this->cellHeight / $cellSpan; */ - - // Nastavimo barvo texta -/* $this->pdf->SetTextColor(160, 0, 0); - $this->pdf->setFont('','B','6'); */ - $crosstabs = $this->multiCrosstabClass->crosstabData[$spr1['spr'].'-'.$spr2['spr']]; // Celica s skupno sumo @@ -1463,16 +1357,11 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ $celicaSums['numerus'] = $crosstabs['sumaSkupna']; -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $crosstabs['sumaSkupna'], 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ - //$celicaSums['percent'] = $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['percent'] = $this->encodeText($this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + $celicaSums['percent'] = LatexDocument::encodeText($this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); } // Povprecje @@ -1490,13 +1379,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $avg = $tempAvg / $crosstabs['sumaSkupna']; } $celicaSums['avg'] = $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')); -/* $this->pdf->SetFillColor(220, 220, 255); - $this->pdf->SetTextColor(0, 0, 230); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ } // Delez @@ -1511,15 +1393,7 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } } } - //$celicaSums['delez'] = $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['delez'] = $this->encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->SetFillColor(255, 220, 220); - $this->pdf->SetTextColor(230, 0, 0); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + $celicaSums['delez'] = LatexDocument::encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); } } // Suma na koncu vrstice @@ -1530,16 +1404,13 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $crosstabs['sumaVrstica'][$val], 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + $celicaSums['numerus'] = $crosstabs['sumaVrstica'][$val]; } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ - //$celicaSums['percent'] = $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['percent'] = $this->encodeText($this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + + $celicaSums['percent'] = LatexDocument::encodeText($this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); } } else{ @@ -1547,15 +1418,11 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ $celicaSums['numerus'] = '0'; -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, '0', 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ - //$celicaSums['percent'] = $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['percent'] = $this->encodeText($this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + + $celicaSums['percent'] = LatexDocument::encodeText($this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); } } @@ -1574,13 +1441,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $celicaSums['avg'] = $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')); -/* $this->pdf->SetFillColor(220, 220, 255); - $this->pdf->SetTextColor(0, 0, 230); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ } // Delez @@ -1593,17 +1453,9 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $delez += $tempDelez; } } + + $celicaSums['delez'] = LatexDocument::encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - //$celicaSums['delez'] = $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['delez'] = $this->encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - -/* $this->pdf->SetFillColor(255, 220, 220); - $this->pdf->SetTextColor(230, 0, 0); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ } } // Suma za stolpce @@ -1614,15 +1466,13 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ $celicaSums['numerus'] = $crosstabs['sumaStolpec'][$val]; -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $crosstabs['sumaStolpec'][$val], 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ - //$celicaSums['percent'] = $this->formatNumber($this->multiCrosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs['sumaStolpec'][$val]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['percent'] = $this->encodeText($this->formatNumber($this->multiCrosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs['sumaStolpec'][$val]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($this->multiCrosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs['sumaStolpec'][$val]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + + $celicaSums['percent'] = LatexDocument::encodeText($this->formatNumber($this->multiCrosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs['sumaStolpec'][$val]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + } } else{ @@ -1630,16 +1480,13 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ $celicaSums['numerus'] = '0'; -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, '0', 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ - //$celicaSums['percent'] = $this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['percent'] = $this->encodeText($this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + + $celicaSums['percent'] = LatexDocument::encodeText($this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + } } @@ -1658,13 +1505,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { } $celicaSums['avg'] = $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')); -/* $this->pdf->SetFillColor(220, 220, 255); - $this->pdf->SetTextColor(0, 0, 230); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ } // Delez @@ -1677,33 +1517,21 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { $delez += $tempDelez[$val]; } } - //$celicaSums['delez'] = $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $celicaSums['delez'] = $this->encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->SetFillColor(255, 220, 220); - $this->pdf->SetTextColor(230, 0, 0); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + + $celicaSums['delez'] = LatexDocument::encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + } } - -/* $this->pdf->SetTextColor(0, 0, 0); - $this->pdf->setFont('','','6'); - $this->pdf->setXY($startX + $this->cellWidth, $startY); */ + return $celicaSums; } // Izpis celice z vrednostmi - //function displayDataCell($crosstab, $percent, $avg, $delez){ function displayDataCell($crosstab=null, $percent=null, $avg=null, $delez=null, $cnt=null){ - //$podatekCelice = ''; $podatekCelice = array(); - //$startX = $this->pdf->getX(); - //$startY = $this->pdf->getY(); + $lineHeight = ($this->cellSpan > 1) ? 5 : 6; @@ -1711,68 +1539,41 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $crosstab, 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ - //$podatekCelice = $crosstab; $podatekCelice['numerus'][$cnt] = $crosstab; - //echo "Crosstab ce crosstab > 0: ".$crosstab."
"; } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ - //$podatekCelice = $this->formatNumber($percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - //$podatekCelice['percent'][$cnt] = $this->formatNumber($percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $podatekCelice['percent'][$cnt] = $this->encodeText($this->formatNumber($percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - //echo "Procenti ce crosstab > 0: ".$podatekCelice."
"; + + $podatekCelice['percent'][$cnt] = LatexDocument::encodeText($this->formatNumber($percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); } } else{ // Numerus if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['numerus'] == 1){ -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, '0', 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + $podatekCelice['numerus'][$cnt] = '0'; } // Procenti if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['percent'] == 1){ -/* $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ - //$podatekCelice = $this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - //$podatekCelice['percent'][$cnt] = $this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - $podatekCelice['percent'][$cnt] = $this->encodeText($this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + + $podatekCelice['percent'][$cnt] = LatexDocument::encodeText($this->formatNumber(0, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); } } // Povprecje if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['avgVar'] > 0){ - //$podatekCelice = $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')); - //echo "Povprecje: ".$podatekCelice."
"; + $podatekCelice['avg'][$cnt] = $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')); -/* $this->pdf->SetFillColor(220, 220, 255); - $this->pdf->SetTextColor(0, 0, 230); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($avg, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE')), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + } // Delez if($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['delezVar'] > 0){ - //$podatekCelice = $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'); - //echo "Delez: ".$podatekCelice."
"; - $podatekCelice['delez'][$cnt] = $this->encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); -/* $this->pdf->SetFillColor(255, 220, 220); - $this->pdf->SetTextColor(230, 0, 0); - $this->pdf->MultiCell($this->cellWidth, $lineHeight, $this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%'), 1, 'C', 1, 0, 0 ,0, true); - $this->pdf->SetFillColor(250, 250, 250); - $this->pdf->SetTextColor(0, 0, 0); - - $this->pdf->setXY($this->pdf->getX() - $this->cellWidth, $this->pdf->getY() + $lineHeight); */ + + $podatekCelice['delez'][$cnt] = LatexDocument::encodeText($this->formatNumber($delez*100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + } - //$this->pdf->setXY($startX + $this->cellWidth, $startY); return $podatekCelice; } @@ -1858,13 +1659,6 @@ class AnalizaMultiCrosstab extends LatexAnalysisElement { return $result; } -/* function encodeText($text){ - // popravimo sumnike ce je potrebno - $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); - $text = str_replace(array("š","š","č"),array("š","š","č"),$text); - - return strip_tags($text); - } */ /*Skrajsa tekst in doda '...' na koncu*/ function snippet($text='', $length=64, $tail="..."){ diff --git a/admin/survey/export/latexclasses/Analize/AnalizaSums.php b/admin/survey/export/latexclasses/Analize/AnalizaSums.php index ca37139..2979f0d 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaSums.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaSums.php @@ -1,5 +1,7 @@ "; switch ($spremenljivka['tip']) { case 1: # radio - prikaže navpično @@ -203,11 +204,11 @@ class AnalizaSums extends LatexAnalysisElement{ break; case 21: # besedilo* - # varabla tipa »besedilo« je v sumarniku IDENTIČNA kot v FREKVENCAH. + # varabla tipa »besedilo« je v sumarniku IDENTIČNA kot v FREKVENCAH. if ($spremenljivka['cnt_all'] == 1) { // če je enodimenzionalna prikažemo kot frekvence - // predvsem zaradi vprašanj tipa: language, email... - $tabela .= self::sumTextVertical($spid,'sums', $export_format); + // predvsem zaradi vprašanj tipa: language, email... + $tabela .= self::sumTextVertical($spid,'sums', $export_format, $spremenljivka['tip']); } else { $tabela .= self::sumMultiText($spid,'sums', $export_format); } @@ -294,7 +295,7 @@ class AnalizaSums extends LatexAnalysisElement{ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -308,15 +309,15 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{>{\hsize=\dimexpr 6\hsize+\arrayrulewidth}X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{>{\hsize=\dimexpr 6\hsize+\arrayrulewidth}X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ @@ -381,7 +382,7 @@ class AnalizaSums extends LatexAnalysisElement{ if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { $_Z_MV = !$this->hideEmpty; if($_Z_MV){ //ce je potrebno izpisati tudi manjkajoce - $tex .= $this->encodeText($lang['srv_anl_missing1']); + $tex .= LatexDocument::encodeText($lang['srv_anl_missing1']); } foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { //echo "iAnswer cnt: ".$iAnswer['cnt']."
"; @@ -409,7 +410,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec /* odklon */ @@ -431,7 +432,7 @@ class AnalizaSums extends LatexAnalysisElement{ if ($show_valid_percent == 1 && SurveyAnalysis::$_HEADERS[$spid]['skala'] != 1) { $brezHline = 1; //zacetek latex tabele za drugo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -445,12 +446,12 @@ class AnalizaSums extends LatexAnalysisElement{ //$text[] = ''; //$text[] = ''; - $text[] = $this->encodeText($lang['srv_analiza_opisne_povprecje1']); - $text[] = $this->encodeText(self::formatNumber($avg,NUM_DIGIT_AVERAGE,'')); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_povprecje1']); + $text[] = LatexDocument::encodeText(self::formatNumber($avg,NUM_DIGIT_AVERAGE,'')); - $text[] = $this->encodeText($lang['srv_analiza_opisne_odklon']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']); - $text[] = $this->encodeText(self::formatNumber($div,NUM_DIGIT_AVERAGE,'')); + $text[] = LatexDocument::encodeText(self::formatNumber($div,NUM_DIGIT_AVERAGE,'')); if($export_format == 'pdf'){ @@ -470,7 +471,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //zaljucek latex tabele z obrobo za drugo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za drugo tabelo - konec } @@ -496,7 +497,9 @@ class AnalizaSums extends LatexAnalysisElement{ $tex = ''; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; $_answersOther = array(); - + $_navedbe = array(); + $_valid_cnt = array(); + $_approp_cnt = array(); //TODO: Koda se nikjer ne uporablja //$inline_legenda = count ($spremenljivka['grids']) > 1; //if ($variable['other'] != '1' && $variable['text'] != '1') { @@ -510,17 +513,18 @@ class AnalizaSums extends LatexAnalysisElement{ /* ugotovimo koliko imamo kolon*/ if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { - $_clmn_cnt[$gid] = $grid['cnt_vars']-$grid['cnt_other']; + $_clmn_cnt[$gid] = $grid['cnt_vars']-(isset($grid['cnt_other']) ? $grid['cnt_other'] : 0); if (count ($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; - $_valid_cnt[$gid] = max($_valid_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']); - $_approp_cnt[$gid] = max($_approp_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); + $_valid_cnt[$gid] = max(isset($_valid_cnt[$gid])?$_valid_cnt[$gid]:0, array_key_exists('validCnt', SurveyAnalysis::$_FREQUENCYS[$_sequence])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null); + $_approp_cnt[$gid] = max(isset($_approp_cnt[$gid])?$_approp_cnt[$gid]:0, SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); if ($variable['other'] == true) { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } - $_valid[$gid][$vid] = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']; - $_navedbe[$gid] += SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; + $_valid[$gid][$vid] = array_key_exists('valid', SurveyAnalysis::$_FREQUENCYS[$_sequence])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']:null; + //$_navedbe[$gid] += SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; + $_navedbe[$gid] = isset($_navedbe[$gid])?$_navedbe[$gid]:0 + SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; } } @@ -544,7 +548,7 @@ class AnalizaSums 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; @@ -557,13 +561,13 @@ class AnalizaSums extends LatexAnalysisElement{ //zacetek latex tabele z obrobo za prvo tabelo - konec //prva vrstica - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{8}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{8}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{8}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{8}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } if($export_format != 'xls'){ @@ -571,7 +575,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //druga vrstica - $tex .= " & ".$this->encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{5}{c|}{".$this->encodeText($lang['srv_analiza_opisne_units'])."} & \multicolumn{2}{c|}{".$this->encodeText($lang['srv_analiza_opisne_arguments'])."} ".$this->texNewLine; + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{5}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_units'])."} & \multicolumn{2}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_arguments'])."} ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } @@ -580,13 +584,13 @@ class AnalizaSums extends LatexAnalysisElement{ $text = array(); $text[] = ''; $text[] = ''; - $text[] = $this->encodeText($lang['srv_analiza_opisne_frequency']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_valid']); - $text[] = $this->encodeText('% - '.$lang['srv_analiza_opisne_valid']); - $text[] = $this->encodeText($lang['srv_analiza_num_units_valid']); - $text[] = $this->encodeText('% - '.$lang['srv_analiza_num_units_valid']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_frequency']); - $text[] = $this->encodeText('%'); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_frequency']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid']); + $text[] = LatexDocument::encodeText('% - '.$lang['srv_analiza_opisne_valid']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_num_units_valid']); + $text[] = LatexDocument::encodeText('% - '.$lang['srv_analiza_num_units_valid']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_frequency']); + $text[] = LatexDocument::encodeText('%'); $brezHline = $this->getBrezHline($export_format); //echo "notnot: $brezHline
"; @@ -606,38 +610,38 @@ class AnalizaSums extends LatexAnalysisElement{ $text = array(); - $text[] = $this->encodeText($variable['variable']); - $text[] = $this->encodeText($variable['naslov']); + $text[] = LatexDocument::encodeText($variable['variable']); + $text[] = LatexDocument::encodeText($variable['naslov']); // Frekvence - $text[] = $this->encodeText((int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']); + $text[] = LatexDocument::encodeText((int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']); // Veljavni - $text[] = $this->encodeText((int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt'])); + $text[] = LatexDocument::encodeText((int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt'])); // Procent - veljavni $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; - $text[] = $this->encodeText(self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); $_max_appropriate = max($_max_appropriate, (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); $_max_valid = max ($_max_valid, ((int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']))); // Ustrezni - $text[] = $this->encodeText((int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); + $text[] = LatexDocument::encodeText((int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); // % Ustrezni $valid = (int)(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']+(int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['0']['cnt']); $valid = (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']; $_percent = ($_max_appropriate > 0 ) ? 100*$valid / $_max_appropriate : 0; - $text[] = $this->encodeText(self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); - $text[] = $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']); + $text[] = LatexDocument::encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt']); $_percent = ($_navedbe[$gid] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']['1']['cnt'] / $_navedbe[$gid] : 0; - $text[] = $this->encodeText(self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); $tex .= $this->tableRow($text, $brezHline); //izpis vrstic z odgovori } else { @@ -649,26 +653,26 @@ class AnalizaSums extends LatexAnalysisElement{ $text[] = ''; - $text[] = $this->encodeText($lang['srv_anl_suma_valid']); + $text[] = LatexDocument::encodeText($lang['srv_anl_suma_valid']); $text[] = ''; - $text[] = $this->encodeText($_max_valid); + $text[] = LatexDocument::encodeText($_max_valid); $text[] = ''; - $text[] = $this->encodeText($_max_appropriate); + $text[] = LatexDocument::encodeText($_max_appropriate); $text[] = ''; - $text[] = $this->encodeText($_navedbe[$gid]); + $text[] = LatexDocument::encodeText($_navedbe[$gid]); - $text[] = $this->encodeText(self::formatNumber('100',SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); + $text[] = LatexDocument::encodeText(self::formatNumber('100',SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%')); $tex .= $this->tableRow($text, $brezHline); //izpis vrstice SKUPAJ } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec # izpišemo še tekstovne odgovore za polja drugo @@ -716,7 +720,7 @@ class AnalizaSums extends LatexAnalysisElement{ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -730,7 +734,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele - $tex .= $this->encodeText($spremenljivka['variable'])." & ".$this->encodeText($spremenljivka['naslov'])." ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & ".LatexDocument::encodeText($spremenljivka['naslov'])." ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } @@ -741,8 +745,8 @@ class AnalizaSums extends LatexAnalysisElement{ /* $this->pdf->setFont('','b','6'); $this->pdf->ln(5); - $this->pdf->MultiCell(18, 5, $this->encodeText($spremenljivka['variable']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(162, 5, $this->encodeText($spremenljivka['naslov']), 1, 'L', 0, 1, 0 ,0, true); */ + $this->pdf->MultiCell(18, 5, LatexDocument::encodeText($spremenljivka['variable']), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell(162, 5, LatexDocument::encodeText($spremenljivka['naslov']), 1, 'L', 0, 1, 0 ,0, true); */ //echo "Latex tabele: ".$tex."
"; return $tex; } @@ -756,7 +760,7 @@ class AnalizaSums extends LatexAnalysisElement{ global $lang; $tex = ''; $spremenljivka = SurveyAnalysis::$_HEADERS[$spid]; - + $_approp_cnt = array(); # dodamo opcijo kje izrisujemo legendo # če je besedilo * in je samo ena kategorija je inline legenda false $inline_legenda = (SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1 || in_array($spremenljivka['tip'],array(1,8) ) ) ? false: true; @@ -764,18 +768,18 @@ class AnalizaSums extends LatexAnalysisElement{ # ali izpisujemo enoto: $show_enota = true; - if ((int)$spremenljivka['enota'] == 0 && SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1) { + if ((int)isset($spremenljivka['enota'])?$spremenljivka['enota']:null == 0 && SurveyAnalysis::$_HEADERS[$spid]['cnt_all'] == 1) { $show_enota = false; } # ugotovimo koliko imamo kolon if (count($spremenljivka['grids']) > 0) foreach ($spremenljivka['grids'] AS $gid => $grid) { - $_clmn_cnt[$gid] = $grid['cnt_vars']-$grid['cnt_other']; + $_clmn_cnt[$gid] = $grid['cnt_vars']-(isset($grid['cnt_other']) ? $grid['cnt_other'] : 0); if (count($grid['variables']) > 0) foreach ($grid['variables'] AS $vid => $variable) { $_sequence = $variable['sequence']; - $_approp_cnt[$gid] = max($_approp_cnt[$gid], SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); + $_approp_cnt[$gid] = max(isset($_approp_cnt[$gid])?$_approp_cnt[$gid]:null, SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); # za povprečje $sum_xi_fi=0; @@ -796,7 +800,7 @@ class AnalizaSums extends LatexAnalysisElement{ #povprečje $avg = ($N > 0) ? $sum_xi_fi / $N : 0; - $sum_avg += $avg; + //$sum_avg += $avg; //Pokomentiral, ker te spremenljivke se ne uporablja nikjer - Patrik SurveyAnalysis::$_FREQUENCYS[$_sequence]['validAvg'] = $avg; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMin'] = $min; SurveyAnalysis::$_FREQUENCYS[$_sequence]['validMax'] = $max; @@ -839,7 +843,7 @@ class AnalizaSums 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; @@ -853,15 +857,16 @@ class AnalizaSums extends LatexAnalysisElement{ //prva vrstica $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{p{16cm}|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } @@ -876,20 +881,20 @@ class AnalizaSums extends LatexAnalysisElement{ if ($show_enota) { if ($spremenljivka['tip'] == 20 || $spremenljivka['tip'] == 7) { - $text[] = $this->encodeText($lang['srv_analiza_opisne_subquestion1']);; + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1']);; } else { - $text[] = $this->encodeText($lang['srv_analiza_opisne_variable_text1']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_variable_text1']); } } else { $text[] = ''; } - $text[] = $this->encodeText($lang['srv_analiza_opisne_m']); - $text[] = $this->encodeText($lang['srv_analiza_num_units']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_povprecje1']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_odklon']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_min']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_max']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_m']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_num_units']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_povprecje1']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_min']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_max']); $brezHline = $this->getBrezHline($export_format); $tex .= $this->tableRow($text, $brezHline); @@ -915,13 +920,13 @@ class AnalizaSums extends LatexAnalysisElement{ $text = array(); if ($spremenljivka['tip'] != 7 ) { - $text[] = $this->encodeText($variable['variable']); + $text[] = LatexDocument::encodeText($variable['variable']); } else $text[] = ''; if ($show_enota) { - $text[] = $this->encodeText((count($grid['variables']) > 1 && $spremenljivka['tip'] == 20 ? $grid['naslov'] . ' - ' : '' ).$variable['naslov']); + $text[] = LatexDocument::encodeText((count($grid['variables']) > 1 && $spremenljivka['tip'] == 20 ? $grid['naslov'] . ' - ' : '' ).$variable['naslov']); } else { $text[] = '';; } @@ -947,7 +952,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec # izpišemo še tekstovne odgovore za polja drugo @@ -1013,7 +1018,7 @@ class AnalizaSums 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; @@ -1027,15 +1032,16 @@ class AnalizaSums extends LatexAnalysisElement{ /* prva vrstica */ $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|} {'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|} {'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{p{16cm}|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } @@ -1045,28 +1051,28 @@ class AnalizaSums extends LatexAnalysisElement{ /* $this->pdf->setFont('','b','6'); $this->pdf->ln(5); - $this->pdf->MultiCell(18, 5, $this->encodeText($spremenljivka['variable']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(162, 5, $this->encodeText($spremenljivka['naslov']), 1, 'L', 0, 1, 0 ,0, true); */ + $this->pdf->MultiCell(18, 5, LatexDocument::encodeText($spremenljivka['variable']), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell(162, 5, LatexDocument::encodeText($spremenljivka['naslov']), 1, 'L', 0, 1, 0 ,0, true); */ /* prva vrstica - konec */ /* druga vrstica */ $steviloPodStolpcev2 = count($spremenljivka['options']) + 1; - $tex .= " & ".$this->encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$steviloPodStolpcev2."}{c|}{".$this->encodeText($lang['srv_analiza_opisne_answers'])."} "; + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$steviloPodStolpcev2."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_answers'])."} "; -/* $this->pdf->MultiCell(18, 5, $this->encodeText(''), 1, 'L', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(30, 5, $this->encodeText($lang['srv_analiza_opisne_subquestion']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(72, 5, $this->encodeText($lang['srv_analiza_opisne_answers']), 1, 'C', 0, 0, 0 ,0, true); */ +/* $this->pdf->MultiCell(18, 5, LatexDocument::encodeText(''), 1, 'L', 0, 0, 0 ,0, true); + $this->pdf->MultiCell(30, 5, LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion']), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell(72, 5, LatexDocument::encodeText($lang['srv_analiza_opisne_answers']), 1, 'C', 0, 0, 0 ,0, true); */ $text = array(); if ($additional_field){ - $text[] = $this->encodeText($lang['srv_analiza_opisne_valid']); - $text[] = $this->encodeText($lang['srv_analiza_num_units']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_povprecje1']); - $text[] = $this->encodeText($lang['srv_analiza_opisne_odklon']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_num_units']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_povprecje1']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']); } else{ - $text[] = $this->encodeText($lang['srv_analiza_opisne_valid']); - $text[] = $this->encodeText($lang['srv_analiza_num_units']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid']); + $text[] = LatexDocument::encodeText($lang['srv_analiza_num_units']); } //$tex .= $this->tableRow($text); //izpis ostalega dela vrstice $arrayText, $brezHline=0, $brezNoveVrstice=0, $nadaljevanjeVrstice=0 @@ -1114,7 +1120,7 @@ class AnalizaSums extends LatexAnalysisElement{ $tex .= $this->dynamicCells($textDynamicCells, $count); //izpis celic z odgovori v stolpcih (npr. Sploh ne velja, ...) - $tex .= " & ".$this->encodeText($lang['srv_anl_suma1']); //Skupaj + $tex .= " & ".LatexDocument::encodeText($lang['srv_anl_suma1']); //Skupaj /*zadnji stolpci po Skupaj*/ if ($additional_field){ @@ -1151,7 +1157,7 @@ class AnalizaSums extends LatexAnalysisElement{ if ($variable['other'] != true) { // Ce gre za dvojno tabelo naredimo vrstico s naslovom podtabele - if($spremenljivka['tip'] == 6 && $spremenljivka['enota'] == 3){ + if(isset($spremenljivka['tip'])&&$spremenljivka['tip'] == 6 && isset($spremenljivka['enota'])&&$spremenljivka['enota'] == 3){ // Če začnemo z drugo podtabelo izpišemo vrstico z naslovom if($podtabela != $grid['part']){ @@ -1160,9 +1166,9 @@ class AnalizaSums extends LatexAnalysisElement{ $subtitle = $subtitle == '' ? $lang['srv_grid_subtitle_def'].' '.$grid['part'] : $subtitle; /* $this->pdf->setFont('','b','6'); - $this->pdf->MultiCell(180, $height_title, $this->encodeText($subtitle), 1, 'C', 0, 1, 0 ,0, true); + $this->pdf->MultiCell(180, $height_title, LatexDocument::encodeText($subtitle), 1, 'C', 0, 1, 0 ,0, true); $this->pdf->setFont('','','6'); */ - $tex .= $this->encodeText($subtitle); + $tex .= LatexDocument::encodeText($subtitle); $podtabela = $grid['part']; } @@ -1171,7 +1177,7 @@ class AnalizaSums extends LatexAnalysisElement{ if($variable['naslov'] == '') $variable['naslov'] = ''; - /*$linecount = $this->pdf->getNumLines($this->encodeText($variable['naslov']), 30); + /*$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($variable['naslov']), 30); $linecount == 1 ? $height = 4.7 : $height = 4.7 + ($linecount-1)*3.3;*/ //ce smo na prelomu strani @@ -1181,10 +1187,10 @@ class AnalizaSums extends LatexAnalysisElement{ $arrayParams['border'] .= 'T'; } */ -/* $this->pdf->MultiCell(18, $height, $this->encodeText($variable['variable']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(30, $height, $this->encodeText($variable['naslov']), 1, 'C', 0, 0, 0 ,0, true); */ - $tex .= $this->encodeText($variable['variable']); - $tex .= " & ".$this->encodeText($variable['naslov']); +/* $this->pdf->MultiCell(18, $height, LatexDocument::encodeText($variable['variable']), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell(30, $height, LatexDocument::encodeText($variable['naslov']), 1, 'C', 0, 0, 0 ,0, true); */ + $tex .= LatexDocument::encodeText($variable['variable']); + $tex .= " & ".LatexDocument::encodeText($variable['naslov']); # za odklon in povprečje @@ -1203,7 +1209,7 @@ class AnalizaSums extends LatexAnalysisElement{ $N += $fi; } - $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'] * 100 / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; + $_percent = ((isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null) > 0 ) ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'] * 100 / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $text[] = SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'][$key]['cnt'].' ('.self::formatNumber($_percent,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').')'; @@ -1214,20 +1220,16 @@ class AnalizaSums extends LatexAnalysisElement{ $tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...) // suma - $tex .= " & ".$this->encodeText((int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'].' ('.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').')'); + $tex .= " & ".LatexDocument::encodeText((int)(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:0).' ('.self::formatNumber(100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%').')'); // zamenjano veljavni ustrezni if ($additional_field){ -/* $this->pdf->MultiCell(15, $height, $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(15, $height, $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']), 1, 'C', 0, 0, 0 ,0, true); */ - $tex .= " & ".$this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']); - $tex .= " & ".$this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); + $tex .= " & ".LatexDocument::encodeText(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:0); + $tex .= " & ".LatexDocument::encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); } else{ -/* $this->pdf->MultiCell(30, $height, $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(30, $height, $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']), 1, 'C', 0, 1, 0 ,0, true); */ - $tex .= " & ".$this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']); - $tex .= " & ".$this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); + $tex .= " & ".LatexDocument::encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']); + $tex .= " & ".LatexDocument::encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']); } # za odklon in povprečje @@ -1245,8 +1247,8 @@ class AnalizaSums extends LatexAnalysisElement{ } $div = (($N -1) > 0) ? sqrt($sum_pow_xi_fi_avg / ($N -1)) : 0; - $tex .= " & ".$this->encodeText(self::formatNumber($avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); - $tex .= " & ".$this->encodeText(self::formatNumber($div,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); + $tex .= " & ".LatexDocument::encodeText(self::formatNumber($avg,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); + $tex .= " & ".LatexDocument::encodeText(self::formatNumber($div,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); } /*zakljucek vrstice*/ @@ -1265,7 +1267,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec # izpišemo še tekstovne odgovore za polja drugo @@ -1315,7 +1317,7 @@ class AnalizaSums extends LatexAnalysisElement{ //Priprava parametrov za tabelo - konec //zacetek latex tabele z obrobo za tabelo z imenom vprasanja/spremenljivke in besedilom vprasanja - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -1329,15 +1331,15 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovna vrstica tabele*/ //prva vrstica tabele - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{>{\hsize=\dimexpr 6\hsize+\arrayrulewidth}X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - $tex .= $this->encodeText($spremenljivka['variable']).' & '.$this->encodeText($spremenljivka['naslov']).' '.$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{>{\hsize=\dimexpr 6\hsize+\arrayrulewidth}X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable']).' & '.LatexDocument::encodeText($spremenljivka['naslov']).' '.$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } //zaljucek latex tabele z obrobo za tabelo z imenom vprasanja/spremenljivke in besedilom vprasanja - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec #Priprava prve tabele, z imenom vprasanja/spremenljivke in besedilom vprasanja - konec ############################################# @@ -1365,7 +1367,7 @@ class AnalizaSums 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; @@ -1419,7 +1421,7 @@ class AnalizaSums extends LatexAnalysisElement{ if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { $_Z_MV = !$this->hideEmpty; if($_Z_MV){ //ce je potrebno izpisati tudi manjkajoce - $tex .= $this->encodeText($lang['srv_anl_missing1']); + $tex .= LatexDocument::encodeText($lang['srv_anl_missing1']); } foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 @@ -1440,7 +1442,7 @@ class AnalizaSums extends LatexAnalysisElement{ } } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec #Priprava druge tabele, z odgovori - konec ############################################# @@ -1456,7 +1458,7 @@ class AnalizaSums extends LatexAnalysisElement{ return $tex; } - function sumTextVertical($spid=null, $_from=null, $export_format='') { + function sumTextVertical($spid=null, $_from=null, $export_format='', $spremTip=null) { //echo "sumTextVertical
"; global $lang; $tex = ''; @@ -1468,7 +1470,13 @@ class AnalizaSums extends LatexAnalysisElement{ $options=array('inline_legenda' => $inline_legenda, 'isTextAnswer' => false, 'isOtherAnswer' => false, 'textAnswerExceed' => false, 'exportFormat' => $export_format); //Priprava parametrov za tabelo - $steviloStolpcevParameterTabular = 6; + if($spremTip==21){ + $steviloStolpcevParameterTabular = 2; + }else{ + $steviloStolpcevParameterTabular = 6; + } + + $steviloOstalihStolpcev = $steviloStolpcevParameterTabular - 1; /*stevilo stolpcev brez prvega stolpca, ki ima fiksno sirino*/ $sirinaOstalihStolpcev = 0.9/$steviloOstalihStolpcev; $parameterTabular = '|'; @@ -1477,17 +1485,19 @@ class AnalizaSums extends LatexAnalysisElement{ //ce je prvi stolpec if($i == 0){ $parameterTabular .= ($export_format == 'pdf' ? 'P|' : 'l|'); - //$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|'); }else{ + if($spremTip!=21){ //ce ni samo besedilo $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*/ + }else{ + $parameterTabular .= ($export_format == 'pdf' ? '>{\hsize='.$sirinaOstalihStolpcev.'\hsize }X|' : 'l|'); + } } } //Priprava parametrov za tabelo - konec //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -1501,15 +1511,19 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{>{\hsize=\dimexpr 6\hsize+\arrayrulewidth}X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); - //echo $dolzinaVprasanja."
"; - if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); + if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli + if($spremTip==21){ + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & ".LatexDocument::encodeText($spremenljivka['naslov'])." ".$this->texNewLine; + }else{ + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + } }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + if($spremTip==21){ + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & ".LatexDocument::encodeText($spremenljivka['naslov'])." ".$this->texNewLine; + }else{ + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{5}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + } } @@ -1518,10 +1532,11 @@ class AnalizaSums extends LatexAnalysisElement{ } //druga vrstica tabele z naslovi stolpcev - $tex .= $this->tableHeader($export_format); + if($spremTip!=21){ //ce ni samo besedilo + $tex .= $this->tableHeader($export_format); + } /*Naslovni vrstici tabele - konec*/ - $_answersOther = array(); $_grids_count = count($spremenljivka['grids']); if ($_grids_count > 0) @@ -1539,58 +1554,55 @@ class AnalizaSums extends LatexAnalysisElement{ $maxAnswer = (SurveyDataSettingProfiles :: getSetting('numOpenAnswers') > 0) ? SurveyDataSettingProfiles :: getSetting('numOpenAnswers') : 30; $counter = 0; $_kumulativa = 0; - //SurveyAnalysis::$_FREQUENCYS[$_sequence] - if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { + $freq_seq = array_key_exists('valid', SurveyAnalysis::$_FREQUENCYS[$_sequence])?SurveyAnalysis::$_FREQUENCYS[$_sequence]:null; + if (is_countable($freq_seq)&&count($freq_seq)> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { - if (/*$vAnswer['cnt'] > 0 &&*/ $counter < $maxAnswer) { # izpisujemo samo tiste ki nisno 0 + if ($counter < $maxAnswer) { # izpisujemo samo tiste ki nisno 0 # ali prikažemo vse odgovore ali pa samo toliko koliko je nastavljeno v TEXT_ANSWER_LIMIT $textAnswerExceed = ($counter >= TEXT_ANSWER_LIMIT && count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']) > TEXT_ANSWER_LIMIT+2) ? true : false; # ali začnemo skrivati tekstovne odgovore $options['isTextAnswer']=true; $options['textAnswerExceed'] = $textAnswerExceed; - /*$counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,$options);*/ - $tex .= self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,$options); + $tex .= self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,$options, $spremTip); } $counter++; } # izpišemo sumo veljavnih - /*$counter = self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,$options);*/ - $tex .= self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,$options); - } - if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { - $_Z_MV = !$this->hideEmpty; - if($_Z_MV){ //ce je potrebno izpisati tudi manjkajoce - $tex .= $this->encodeText($lang['srv_anl_missing1']); + if($spremTip!=21){ //ce ni samo besedilo + $tex .= self::outputSumaValidAnswerVertical($counter,$_sequence,$spid,$options); } - foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { - if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 - /*$counter = self::outputInvalidAnswerVertical($counter,$ikey,$iAnswer,$_sequence,$spid,$options);*/ - $tex .= self::outputInvalidAnswerVertical($counter,$ikey,$iAnswer,$_sequence,$spid,$options); + } + if($spremTip!=21){ //ce ni samo besedilo + if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { + $_Z_MV = !$this->hideEmpty; + if($_Z_MV){ //ce je potrebno izpisati tudi manjkajoce + $tex .= LatexDocument::encodeText($lang['srv_anl_missing1']); } + foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { + if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 + $tex .= self::outputInvalidAnswerVertical($counter,$ikey,$iAnswer,$_sequence,$spid,$options); + } + } + # izpišemo sumo veljavnih + $tex .= self::outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$options); } - # izpišemo sumo veljavnih - /*$counter = self::outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$options);*/ - $tex .= self::outputSumaInvalidAnswerVertical($counter,$_sequence,$spid,$options); + #izpišemo še skupno sumo + $tex .= self::outputSumaVertical($counter,$_sequence,$spid,$options); } - #izpišemo še skupno sumo - /*$counter = self::outputSumaVertical($counter,$_sequence,$spid,$options);*/ - $tex .= self::outputSumaVertical($counter,$_sequence,$spid,$options); } else { $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); } } } //zaljucek latex tabele z obrobo za prvo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec - + # izpišemo še tekstovne odgovore za polja drugo if (count($_answersOther) > 0 && self::$_FILTRED_OTHER) { foreach ($_answersOther AS $oAnswers) { - /*self::outputOtherAnswers($oAnswers);*/ $tex .= self::outputOtherAnswers($oAnswers, $parameterTabular, $export_format); } } - return $tex; } @@ -1616,7 +1628,7 @@ class AnalizaSums extends LatexAnalysisElement{ $_answers = SurveyAnalysis::getAnswers($spremenljivka,$num_show_records); $_all_valid_answers_cnt = $_answers['validCnt']; - $_valid_answers = $_answers['valid']; + $_valid_answers = isset($_answers['valid'])?$_answers['valid']:null; $_answersOther = array(); @@ -1639,7 +1651,7 @@ class AnalizaSums extends LatexAnalysisElement{ $text[] = $_col['naslov']; } else { - $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); + $_answersOther[] = array('spid'=>$spid,'gid'=>isset($gid)?$gid:0,'vid'=>isset($vid)?$vid:0,'sequence'=>$_sequence); } $count++; @@ -1666,7 +1678,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -1683,15 +1695,12 @@ class AnalizaSums extends LatexAnalysisElement{ /*prva vrstica*/ $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{p{16cm}|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } if($export_format != 'xls'){ @@ -1701,17 +1710,7 @@ class AnalizaSums extends LatexAnalysisElement{ if ($_grids_count > 0) { $height = 0; -/* // Testiramo visino vrstice glede na najdaljsi text - foreach ($text AS $string){ - $singleWidth = ($count > 0) ? round(162 / $count): 162; - //$height = ($this->getCellHeight($string, $singleWidth) > $height) ? $this->getCellHeight($string, $singleWidth) : $height; - $height = 1; - } */ - - /*$this->pdf->MultiCell(18, $height, $this->encodeText(''), 1, 'C', 0, 0, 0 ,0, true);*/ - - /*$this->dynamicCells($text, $count, 162, $height);*/ - /*$this->pdf->ln($height);*/ + /*druga vrstica*/ $brezHline3 = 1; $brezNoveVrstice3 = 1; @@ -1743,7 +1742,7 @@ class AnalizaSums extends LatexAnalysisElement{ $_max_i = 0; foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki - $_max_i = max($_max_i,min($num_show_records,SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])); + $_max_i = max($_max_i,min($num_show_records,(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null))); } # za barvanje @@ -1759,7 +1758,7 @@ class AnalizaSums extends LatexAnalysisElement{ # tabela z navedbami $index=0; # odvisno ali imamo odgovor - if (count($_valid_answers) > 0) { + if (is_countable($_valid_answers) && count($_valid_answers) > 0) { $text2 = '('; foreach ($_valid_answers AS $answer) { @@ -1771,7 +1770,7 @@ class AnalizaSums extends LatexAnalysisElement{ if($enota == 3) $text2 .= $_ans."), ("; else - $answers[$count][$index]='('.$this->encodeText($_ans).')'; + $answers[$count][$index]='('.LatexDocument::encodeText($_ans).')'; } $index++; @@ -1790,40 +1789,38 @@ class AnalizaSums extends LatexAnalysisElement{ $last = $_max_i; } - if($enota != 3){ - for($i=0; $i 0) ? round(162 / $count): 162; - //$height = ($this->getCellHeight($answers[$j][$i], $singleWidth) > $height) ? $this->getCellHeight($answers[$j][$i], $singleWidth) : $height; - $height = 1; - $row[$j] = $answers[$j][$i]; - } - - - //$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...) - $tex .= $this->sumLokacijaRowOutput($row, $count, $height, $grid['variable']); - /*$this->sumLokacijaRowOutput($row, $count, $height, $grid['variable']);*/ - - $tex .= $this->texNewLine; //nova vrstica - if($export_format != 'xls'){ - $tex .= $this->horizontalLineTex; /*horizontalna crta*/ - } - } - } - else{ - // Testiramo visino vrstice glede na najdaljsi text - foreach ($text AS $string){ - $singleWidth = ($count > 0) ? round(162 / $count): 162; - //$height = ($this->getCellHeight($string, $singleWidth) > $height) ? $this->getCellHeight($string, $singleWidth) : $height; - $height = 1; - } - - //$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...) - $tex .= $this->sumLokacijaRowOutput($text, $count, $height, $grid['variable']); - /*$this->sumLokacijaRowOutput($text, $count, $height, $grid['variable']);*/ - } + if($enota != 3){ + for($i=0; $i 0) ? round(162 / $count): 162; + //$height = ($this->getCellHeight($answers[$j][$i], $singleWidth) > $height) ? $this->getCellHeight($answers[$j][$i], $singleWidth) : $height; + $height = 1; + $row[$j] = $answers[$j][$i]; + } + + + //$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...) + $tex .= $this->sumLokacijaRowOutput($row, $count, $height, $variable['variable']); + + $tex .= $this->texNewLine; //nova vrstica + if($export_format != 'xls'){ + $tex .= $this->horizontalLineTex; /*horizontalna crta*/ + } + } + } + else{ + // Testiramo visino vrstice glede na najdaljsi text + foreach ($text AS $string){ + $singleWidth = ($count > 0) ? round(162 / $count): 162; + //$height = ($this->getCellHeight($string, $singleWidth) > $height) ? $this->getCellHeight($string, $singleWidth) : $height; + $height = 1; + } + + //$tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...) + $tex .= $this->sumLokacijaRowOutput($text, $count, $height, $variable['variable']); + } /*zakljucek vrstice s podatki*/ /* $tex .= $this->texNewLine; //nova vrstica $tex .= $this->horizontalLineTex; //horizontalna crta */ @@ -1832,7 +1829,7 @@ class AnalizaSums extends LatexAnalysisElement{ //zaljucek latex tabele z obrobo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo - konec } //echo "tex: ".$tex."
"; @@ -1847,10 +1844,10 @@ class AnalizaSums extends LatexAnalysisElement{ * @param type $height - izracunana najvisja visina celice v vrstici * @param type $variable - array variabel/stolpcev */ - function sumLokacijaRowOutput($text='', $count, $height=null, $variable='') { + function sumLokacijaRowOutput($text='', $count=null, $height=null, $variable='') { $texSumLokacijaRowOutput = ''; - $texSumLokacijaRowOutput .= " & ".$this->encodeText($variable); -/* $this->pdf->MultiCell(18, $height, $this->encodeText($variable), 1, 'C', 0, 0, 0 ,0, true); + $texSumLokacijaRowOutput .= " & ".LatexDocument::encodeText($variable); +/* $this->pdf->MultiCell(18, $height, LatexDocument::encodeText($variable), 1, 'C', 0, 0, 0 ,0, true); $this->dynamicCells($text, $count, 162, $height); $this->pdf->ln($height); */ $texSumLokacijaRowOutput .= $this->dynamicCells($text, $count); @@ -1862,7 +1859,7 @@ class AnalizaSums extends LatexAnalysisElement{ * * @param unknown_type $spid */ - function sumMultiText($spid=null, $_from, $export_format='') { + function sumMultiText($spid=null, $_from=null, $export_format='') { //echo "sumMultiText
"; global $lang; $tex = ''; @@ -1914,7 +1911,7 @@ class AnalizaSums extends LatexAnalysisElement{ $text[] = $_col['naslov']; } else { - $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); + $_answersOther[] = array('spid'=>$spid,'gid'=>isset($gid)?$gid:0,'vid'=>isset($vid)?$vid:0,'sequence'=>$_sequence); } $count++; @@ -1941,7 +1938,7 @@ class AnalizaSums extends LatexAnalysisElement{ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -1956,16 +1953,17 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{p{16cm}|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } @@ -1974,7 +1972,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //druga vrstica - $tex .= " & ".$this->encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$count."}{c|}{".$this->encodeText($lang['srv_analiza_opisne_arguments'])."} ".$this->texNewLine; + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$count."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_arguments'])."} ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } @@ -2021,7 +2019,7 @@ class AnalizaSums extends LatexAnalysisElement{ $_max_i = 0; foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki - $_max_i = max($_max_i,min($num_show_records,SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])); + $_max_i = max($_max_i,min($num_show_records,(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null))); } # za barvanje @@ -2066,8 +2064,8 @@ class AnalizaSums extends LatexAnalysisElement{ $height = 1; } - $tex .= $this->encodeText($grid['variable']); - $tex .= " & ".$this->encodeText($grid['naslov']); + $tex .= LatexDocument::encodeText(isset($grid['variable'])?$grid['variable']:''); + $tex .= " & ".LatexDocument::encodeText($grid['naslov']); $tex .= " & ".$this->dynamicCells($text, $count); //izpis celic z izracuni odgovorov v stolpcih (npr. Sploh ne velja, ...) @@ -2082,7 +2080,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*izpis vrstic s podatki - konec*/ //zaljucek latex tabele z obrobo za drugo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za drugo tabelo - konec } @@ -2123,7 +2121,7 @@ class AnalizaSums extends LatexAnalysisElement{ $text[] = $_col['naslov']; } else { - $_answersOther[] = array('spid'=>$spid,'gid'=>$gid,'vid'=>$vid,'sequence'=>$_sequence); + $_answersOther[] = array('spid'=>$spid,'gid'=>isset($gid)?$gid:0,'vid'=>isset($vid)?$vid:0,'sequence'=>$_sequence); } $count++; @@ -2149,7 +2147,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -2164,16 +2162,16 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } if($export_format != 'xls'){ @@ -2181,7 +2179,7 @@ class AnalizaSums extends LatexAnalysisElement{ } //druga vrstica - $tex .= " & ".$this->encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$count."}{c|}{".$this->encodeText($lang['srv_analiza_sums_average'])."} ".$this->texNewLine; + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$count."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_sums_average'])."} ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } @@ -2214,8 +2212,8 @@ class AnalizaSums extends LatexAnalysisElement{ foreach ($spremenljivka['grids'] AS $gid => $grid) { $_variables_count = count($grid['variables']); - $tex .= $this->encodeText($grid['variable']); - $tex .= " & ".$this->encodeText($grid['naslov']); + $tex .= LatexDocument::encodeText($grid['variable']); + $tex .= " & ".LatexDocument::encodeText($grid['naslov']); if ($_variables_count > 0) { @@ -2225,7 +2223,7 @@ class AnalizaSums extends LatexAnalysisElement{ $_sequence = $variable['sequence']; # id kolone z podatki if ($variable['other'] != true) { # tabela z navedbami - $text[] = self::formatNumber(SurveyAnalysis::$_FREQUENCYS[$_sequence]['average'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); + $text[] = self::formatNumber((isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['average'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['average']:null),SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),''); $count++; } //$count++; @@ -2241,7 +2239,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*izpis vrstic s podatki - konec*/ //zaljucek latex tabele z obrobo za drugo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za drugo tabelo - konec } @@ -2263,7 +2261,7 @@ class AnalizaSums extends LatexAnalysisElement{ # ugotovimo koliko imamo kolon $gid=0; - $_clmn_cnt = SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_vars']-SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_other']; + $_clmn_cnt = SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_vars']-(isset(SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_other'])?SurveyAnalysis::$_HEADERS[$spid]['grids'][$gid]['cnt_other']:null); # tekst vprašanja /*Priprava parametrov za tabelo in polja za 3. vrstico */ @@ -2304,7 +2302,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*Priprava parametrov za tabelo in polja za 3. vrstico - konec*/ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -2319,15 +2317,15 @@ class AnalizaSums extends LatexAnalysisElement{ /* prva vrstica */ $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + //$tex .= LatexDocument::encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.LatexDocument::encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); //echo $dolzinaVprasanja."
"; if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } if($export_format != 'xls'){ @@ -2338,13 +2336,13 @@ class AnalizaSums extends LatexAnalysisElement{ /* druga vrstica*/ //$steviloPodStolpcev2 = count($spremenljivka['options']) + 1; $steviloPodStolpcev2 = $count; - $tex .= " & ".$this->encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$steviloPodStolpcev2."}{c|}{".$this->encodeText($lang['srv_analiza_opisne_answers'])."} "; + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_subquestion1'])." & \multicolumn{".$steviloPodStolpcev2."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_answers'])."} "; - $tex .= " & ".$this->encodeText($lang['srv_analiza_opisne_valid']); - $tex .= " & ".$this->encodeText($lang['srv_analiza_num_units']); + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_opisne_valid']); + $tex .= " & ".LatexDocument::encodeText($lang['srv_analiza_num_units']); $steviloPodStolpcev3 = $count+1; - $tex .= " & \multicolumn{".$steviloPodStolpcev3."}{c|}{".$this->encodeText($lang['srv_analiza_opisne_arguments'])."} "; + $tex .= " & \multicolumn{".$steviloPodStolpcev3."}{c|}{".LatexDocument::encodeText($lang['srv_analiza_opisne_arguments'])."} "; $tex .= $this->texNewLine; //nova vrstica if($export_format != 'xls'){ @@ -2389,7 +2387,7 @@ class AnalizaSums extends LatexAnalysisElement{ } $this->dynamicCells($text, $count, 44, $height); */ - $tex .= " & ".$this->encodeText($lang['srv_anl_suma1']); //Skupaj + $tex .= " & ".LatexDocument::encodeText($lang['srv_anl_suma1']); //Skupaj $tex .= $this->texNewLine; if($export_format != 'xls'){ @@ -2401,12 +2399,12 @@ class AnalizaSums extends LatexAnalysisElement{ foreach (SurveyAnalysis::$_HEADERS[$spid]['grids'] AS $gid => $grids) { $_cnt = 0; - $height = 1;//$height = $this->getCellHeight($this->encodeText($grids['naslov']), 18); + $height = 1;//$height = $this->getCellHeight(LatexDocument::encodeText($grids['naslov']), 18); $height = ($height < 8 ? 8 : $height); # vodoravna vrstice s podatki - $tex .= $this->encodeText($grids['variable']); - $tex .= " & ".$this->encodeText($grids['naslov']); + $tex .= LatexDocument::encodeText($grids['variable']); + $tex .= " & ".LatexDocument::encodeText($grids['naslov']); $_arguments = 0; @@ -2472,7 +2470,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*vrstice s podatki - konec*/ /*zaljucek latex tabele z obrobo za prvo tabelo*/ - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); /*zaljucek latex tabele z obrobo za prvo tabelo - konec*/ # izpišemo še tekstovne odgovore za polja drugo @@ -2494,10 +2492,11 @@ class AnalizaSums extends LatexAnalysisElement{ */ function outputGridLabelVertical($gid=null, $grid=null, $vid=null, $variable=null, $spid=null, $_options=array()) { //echo "outputGridLabelVertical
"; + $counter = 0; $text = array(); - $text[] = $this->encodeText($variable['variable']); - $text[] = $this->encodeText(($grid['naslov'] != '' ? $grid['naslov']. ' - ' : '').$variable['naslov']); + $text[] = LatexDocument::encodeText($variable['variable']); + $text[] = LatexDocument::encodeText(($grid['naslov'] != '' ? $grid['naslov']. ' - ' : '').$variable['naslov']); $text[] = ''; $text[] = ''; @@ -2548,7 +2547,7 @@ class AnalizaSums extends LatexAnalysisElement{ if (count($grid['variables']) > 0 ) foreach ($grid['variables'] AS $vid => $variable ){ $_sequence = $variable['sequence']; # id kolone z podatki - $only_valid += (int)SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']; + $only_valid += (int)(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:null); } } } @@ -2602,14 +2601,13 @@ class AnalizaSums extends LatexAnalysisElement{ //$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*/ } } /*Priprava parametrov za tabelo in ostala polja za nadaljnji izpis - konec*/ //zacetek latex tabele z obrobo za prvo tabelo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -2624,15 +2622,11 @@ class AnalizaSums extends LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele $steviloPodStolpcev1 = $steviloStolpcevParameterTabular - 1; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; - //$tex .= $this->encodeText($spremenljivka['variable']).' & \multicolumn{'.$steviloPodStolpcev1.'}{>{\hsize=\dimexpr '.($steviloPodStolpcev1+1).'\hsize + '.($steviloPodStolpcev1+1).'\tabcolsep + \arrayrulewidth}X|}{'.$this->encodeText($spremenljivka['naslov']).'} '.$this->texNewLine; - $dolzinaVprasanja = strlen($this->encodeText($spremenljivka['naslov'])); - //echo $dolzinaVprasanja."
"; + $dolzinaVprasanja = strlen(LatexDocument::encodeText($spremenljivka['naslov'])); if($dolzinaVprasanja > MEJA_DOLZINA_VPRASANJA){ //ce je dolzina vprasanja daljsa od ene vrstice v tabeli - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{X|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; }else{ - $tex .= $this->encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".$this->encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; + $tex .= LatexDocument::encodeText($spremenljivka['variable'])." & \multicolumn{".$steviloPodStolpcev1."}{l|}{".LatexDocument::encodeText($spremenljivka['naslov'])."} ".$this->texNewLine; } @@ -2659,7 +2653,7 @@ class AnalizaSums extends LatexAnalysisElement{ /*Konec naslovnih vrstic*/ //tretja vrstica - $tex .= " \multicolumn{".$steviloStolpcevParameterTabular."}{|c|}{".$this->encodeText($lang['srv_analiza_heatmap_clicked_coords'])."} ".$this->texNewLine; + $tex .= " \multicolumn{".$steviloStolpcevParameterTabular."}{|c|}{".LatexDocument::encodeText($lang['srv_analiza_heatmap_clicked_coords'])."} ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } @@ -2670,13 +2664,13 @@ class AnalizaSums extends LatexAnalysisElement{ //cetrta vrstica $cetrtaVrstica = array(); - $cetrtaVrstica[] = $this->encodeText($lang['coordinates']); - $cetrtaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_valid_heatmap']); - $cetrtaVrstica[] = $this->encodeText($lang['srv_analiza_num_units_valid_heatmap']); - $cetrtaVrstica[] = $this->encodeText($lang['srv_means_label']); - $cetrtaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_odklon']); - $cetrtaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_min']); - $cetrtaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_max']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['coordinates']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid_heatmap']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_num_units_valid_heatmap']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_means_label']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_odklon']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_min']); + $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_max']); $tex .= $this->tableRow($cetrtaVrstica, $brezHline); //cetrta vrstica - konec @@ -2684,24 +2678,24 @@ class AnalizaSums extends LatexAnalysisElement{ //peta vrstica x $petaVrstica = array(); $petaVrstica[] = 'x'; - $petaVrstica[] = $this->encodeText($validHeatmapRegion); - $petaVrstica[] = $this->encodeText($ustrezniHeatmapRegion); - $petaVrstica[] = $this->encodeText($povprecjeHeatmapClicksX); - $petaVrstica[] = $this->encodeText($stdevHeatmapClicksX); - $petaVrstica[] = $this->encodeText($minHeatmapClicksX); - $petaVrstica[] = $this->encodeText($maxHeatmapClicksX); + $petaVrstica[] = LatexDocument::encodeText($validHeatmapRegion); + $petaVrstica[] = LatexDocument::encodeText($ustrezniHeatmapRegion); + $petaVrstica[] = LatexDocument::encodeText($povprecjeHeatmapClicksX); + $petaVrstica[] = LatexDocument::encodeText($stdevHeatmapClicksX); + $petaVrstica[] = LatexDocument::encodeText($minHeatmapClicksX); + $petaVrstica[] = LatexDocument::encodeText($maxHeatmapClicksX); $tex .= $this->tableRow($petaVrstica, $brezHline); //peta vrstica x - konec //sesta vrstica y $sestaVrstica = array(); $sestaVrstica[] = 'y'; - $sestaVrstica[] = $this->encodeText($validHeatmapRegion); - $sestaVrstica[] = $this->encodeText($ustrezniHeatmapRegion); - $sestaVrstica[] = $this->encodeText($povprecjeHeatmapClicksY); - $sestaVrstica[] = $this->encodeText($stdevHeatmapClicksY); - $sestaVrstica[] = $this->encodeText($minHeatmapClicksY); - $sestaVrstica[] = $this->encodeText($maxHeatmapClicksY); + $sestaVrstica[] = LatexDocument::encodeText($validHeatmapRegion); + $sestaVrstica[] = LatexDocument::encodeText($ustrezniHeatmapRegion); + $sestaVrstica[] = LatexDocument::encodeText($povprecjeHeatmapClicksY); + $sestaVrstica[] = LatexDocument::encodeText($stdevHeatmapClicksY); + $sestaVrstica[] = LatexDocument::encodeText($minHeatmapClicksY); + $sestaVrstica[] = LatexDocument::encodeText($maxHeatmapClicksY); $tex .= $this->tableRow($sestaVrstica, $brezHline); //sesta vrstica y - konec //vrstici s podatki za x in y koordinati - konec @@ -2712,7 +2706,7 @@ class AnalizaSums extends LatexAnalysisElement{ if($RegionPresent){ //ce imamo obmocja //7. vrstica - naslovna za obmocja - $tex .= " \multicolumn{".$steviloStolpcevParameterTabular."}{|c|}{".$this->encodeText($lang['srv_analiza_heatmap_clicked_regions'])."} ".$this->texNewLine; + $tex .= " \multicolumn{".$steviloStolpcevParameterTabular."}{|c|}{".LatexDocument::encodeText($lang['srv_analiza_heatmap_clicked_regions'])."} ".$this->texNewLine; if($export_format != 'xls'){ $tex .= $this->horizontalLineTex; /*obroba*/ } @@ -2720,13 +2714,13 @@ class AnalizaSums extends LatexAnalysisElement{ //8. vrstica $osmaVrstica = array(); - $osmaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_frequency_heatmap']);//od tretjega stolpca dalje, ker prva dva sta za naslov Obmocja kot multicolumn - $osmaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_valid_heatmap']); - $osmaVrstica[] = $this->encodeText('% - '.$lang['srv_analiza_opisne_valid_heatmap']); - $osmaVrstica[] = $this->encodeText($lang['srv_analiza_num_units_valid_heatmap']); - $osmaVrstica[] = $this->encodeText('% - '.$lang['srv_analiza_num_units_valid_heatmap']); + $osmaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_frequency_heatmap']);//od tretjega stolpca dalje, ker prva dva sta za naslov Obmocja kot multicolumn + $osmaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid_heatmap']); + $osmaVrstica[] = LatexDocument::encodeText('% - '.$lang['srv_analiza_opisne_valid_heatmap']); + $osmaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_num_units_valid_heatmap']); + $osmaVrstica[] = LatexDocument::encodeText('% - '.$lang['srv_analiza_num_units_valid_heatmap']); - $tex .= " \multicolumn{2}{|c|}{".$this->encodeText($lang['srv_hot_spot_regions_menu'])."} "; + $tex .= " \multicolumn{2}{|c|}{".LatexDocument::encodeText($lang['srv_hot_spot_regions_menu'])."} "; $tex .= $this->tableRow($osmaVrstica, 0, 0, 1); //echo $tex; //8. vrstica - konec @@ -2739,58 +2733,45 @@ class AnalizaSums extends LatexAnalysisElement{ if ($_grids_count > 0) { $_row = $spremenljivka['grids'][0]; $indeks = 0; - //$veljavnaSkupnaFreq = 0; if (count($_row['variables'])>0){ foreach ($_row['variables'] AS $rid => $_col ){ $_sequence = $_col['sequence']; # id kolone z podatki if ($_col['other'] != true) { if($indeks != 0){ - //echo "_col: ".strip_tags ($_col['naslov'])."
"; //od 9. vrstice dalje, kjer so po vrsticah obmocja in njihovi podatki $devetaVrstica = array(); //1. stolpcev z imenom obmocja - //echo $_col['naslov']; - //$devetaVrstica[] = $this->encodeText($_col['naslov']); - $devetaVrstica[] = " \multicolumn{2}{|c|}{".$this->encodeText($_col['naslov'])."} "; - //$tex .= " \multicolumn{2}{|c|}{".$this->encodeText($_col['naslov'])."} "; + $devetaVrstica[] = " \multicolumn{2}{|c|}{".LatexDocument::encodeText($_col['naslov'])."} "; //1. stolpcev z imenom obmocja - konec //2. stolpec - Frekvenca $freqHeatmapRegion = SurveyAnalysis::freqHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers, $indeks, $export); - $veljavnaSkupnaFreq = $veljavnaSkupnaFreq + $freqHeatmapRegion; - //echo ''.$freqHeatmapRegion.''; - //$devetaVrstica[] = $this->encodeText($freqHeatmapRegion); + $veljavnaSkupnaFreq = isset($veljavnaSkupnaFreq)?$veljavnaSkupnaFreq:0 + $freqHeatmapRegion; $devetaVrstica[] = $freqHeatmapRegion; //2. stolpec - Frekvenca - konec //3. stolpec - Veljavni - //$validHeatmapRegion = self::validHeatmapRegion($spremenljivka['grids'], $spid, $_valid_answers); - //echo ''.$validHeatmapRegion.''; - $devetaVrstica[] = $this->encodeText($validHeatmapRegion); + $devetaVrstica[] = LatexDocument::encodeText($validHeatmapRegion); //3. stolpec - Veljavni - konec //4. stolpec - % Veljavni $_procentValidHeatmapRegion = ($validHeatmapRegion > 0 ) ? 100*$freqHeatmapRegion / $validHeatmapRegion : 0; $_procentValidHeatmapRegion = self::formatNumber($_procentValidHeatmapRegion, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); - //echo ''.$_procentValidHeatmapRegion.''; - $devetaVrstica[] = $this->encodeText($_procentValidHeatmapRegion); + $devetaVrstica[] = LatexDocument::encodeText($_procentValidHeatmapRegion); //4. stolpec - % Veljavni - konec //5. stolpec - Ustrezni $ustrezniHeatmapRegion = SurveyAnalysis::ustrezniHeatmapRegion($spid, $_valid_answers, $_sequence); //vsi mozni kliki - //echo ''.$ustrezniHeatmapRegion.''; - $devetaVrstica[] = $this->encodeText($ustrezniHeatmapRegion); + $devetaVrstica[] = LatexDocument::encodeText($ustrezniHeatmapRegion); //5. stolpec - Ustrezni - konec //6. stolpec - % Ustrezni $_procentUstrezniHeatmapRegion = ($ustrezniHeatmapRegion > 0 ) ? 100*$freqHeatmapRegion / $ustrezniHeatmapRegion : 0; $_procentUstrezniHeatmapRegion = self::formatNumber($_procentUstrezniHeatmapRegion, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'),'%'); - //echo ''.$_procentUstrezniHeatmapRegion.''; - $devetaVrstica[] = $this->encodeText($_procentUstrezniHeatmapRegion); + $devetaVrstica[] = LatexDocument::encodeText($_procentUstrezniHeatmapRegion); //6. stolpec - % Ustrezni - konec $tex .= $this->tableRow($devetaVrstica, $brezHline); - //echo $tex; //od 9. vrstice dalje, kjer so po vrsticah obmocja in njihovi podatki - konec //*********** Izris veljavnih in manjkajocih vrednosti @@ -2798,14 +2779,10 @@ class AnalizaSums extends LatexAnalysisElement{ $options['isTextAnswer'] = false; $manjkajoci = $ustrezniHeatmapRegion - $validHeatmapRegion; - //10. vrstica - //$validHeatmapRegion - //echo $validHeatmapRegion; - //echo "validHeatmapRegion: ".$validHeatmapRegion."
"; - //$counter = SurveyAnalysis::outputSumaValidAnswerHeatmap($counter,$_sequence,$spid,$options, $validHeatmapRegion); + //10. vrstica $desetaVrstica = array(); - $desetaVrstica[] = $this->encodeText($lang['srv_analiza_opisne_valid']); - $desetaVrstica[] = $this->encodeText($lang['srv_analiza_manjkajocevrednosti']); + $desetaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_opisne_valid']); + $desetaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_manjkajocevrednosti']); $desetaVrstica[] = $validHeatmapRegion; $desetaVrstica[] = " \multicolumn{4}{|c|}{ } "; $tex .= $this->tableRow($desetaVrstica, $brezHline); @@ -2813,8 +2790,8 @@ class AnalizaSums extends LatexAnalysisElement{ //11. vrstica $enajstaVrstica = array(); - $enajstaVrstica[] = $this->encodeText($lang['srv_anl_missing1']); - $enajstaVrstica[] = $this->encodeText($lang['srv_analiza_manjkajocevrednosti']); + $enajstaVrstica[] = LatexDocument::encodeText($lang['srv_anl_missing1']); + $enajstaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_manjkajocevrednosti']); $enajstaVrstica[] = $manjkajoci; $enajstaVrstica[] = " \multicolumn{4}{|c|}{ } "; $tex .= $this->tableRow($enajstaVrstica, $brezHline); @@ -2822,30 +2799,12 @@ class AnalizaSums extends LatexAnalysisElement{ //12. vrstica $dvanajstaVrstica = array(); - $dvanajstaVrstica[] = " \multicolumn{2}{|c|}{".$this->encodeText($lang['srv_anl_suma_valid'])." } "; + $dvanajstaVrstica[] = " \multicolumn{2}{|c|}{".LatexDocument::encodeText($lang['srv_anl_suma_valid'])." } "; $dvanajstaVrstica[] = $ustrezniHeatmapRegion; $dvanajstaVrstica[] = " \multicolumn{4}{|c|}{ } "; $tex .= $this->tableRow($dvanajstaVrstica, $brezHline); //12. vrstica - konec -/* if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { - foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { - if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki niso 0 - //$counter = SurveyAnalysis::outputInvalidAnswerHeatmap($counter,$ikey,$iAnswer,$_sequence,$spid,$options, $manjkajoci); - //$_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$iAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; - $_invalid = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ) ? 100*$iAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; - echo "_invalid: ".$_invalid."
"; - //echo "_percent: ".$_percent."
"; - } - } - # izpišemo sumo neveljavnih - //$counter = SurveyAnalysis::outputSumaInvalidAnswerHeatmap($counter,$_sequence,$spid,$options, $manjkajoci); - echo "manjkajoci: ".$manjkajoci."
"; - } */ - #izpišemo še skupno sumo - //$counter = SurveyAnalysis::outputSumaHeatmap($counter,$_sequence,$spid,$options, $ustrezniHeatmapRegion); - //$ustrezniHeatmapRegion - //echo "ustrezniHeatmapRegion: ".$ustrezniHeatmapRegion."
"; $veljavnaSkupnaFreq = 0; } //*********** Izris veljavnih in manjkajocih vrednosti - konec @@ -2871,7 +2830,7 @@ class AnalizaSums extends LatexAnalysisElement{ //zaljucek latex tabele z obrobo za drugo tabelo - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za drugo tabelo - konec /* if (count($spremenljivka['grids']) > 0) { @@ -2892,31 +2851,31 @@ class AnalizaSums extends LatexAnalysisElement{ if($arrayText[0] == '') $arrayText[0] = ''; - /*$linecount = $this->pdf->getNumLines($this->encodeText($arrayText[1]), 30); + /*$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($arrayText[1]), 30); $linecount == 1 ? $height = 1 : $height = 4.7 + ($linecount-1)*3.3;*/ $text = array(); for($i=0; $i<$count-1; $i++){ //for($i=0; $i<$count; $i++){ if($arrayText[$i] == '') $arrayText[$i] = ''; - /*$this->pdf->MultiCell($singleWidth, $height, $this->encodeText($arrayText[$i]), 1, 'C', 0, 0, 0 ,0, true);*/ + /*$this->pdf->MultiCell($singleWidth, $height, LatexDocument::encodeText($arrayText[$i]), 1, 'C', 0, 0, 0 ,0, true);*/ - /*$texDynamicCells .= $this->encodeText($arrayText[$i]);*/ - $text[$i] = $this->encodeText($arrayText[$i]); + /*$texDynamicCells .= LatexDocument::encodeText($arrayText[$i]);*/ + $text[$i] = LatexDocument::encodeText($arrayText[$i]); } //zadnje polje izrisemo druge sirine ker se drugace zaradi zaokrozevanja tabela porusi /*$lastWidth = ($lastWidth < 4) ? 4 : $lastWidth;*/ if($count > 0){ - /*$this->pdf->MultiCell($lastWidth, $height, $this->encodeText($arrayText[$count-1]), 1, 'C', 0, 0, 0 ,0, true);*/ + /*$this->pdf->MultiCell($lastWidth, $height, LatexDocument::encodeText($arrayText[$count-1]), 1, 'C', 0, 0, 0 ,0, true);*/ - /*$texDynamicCells .= $this->encodeText($arrayText[$count-1]);*/ - $text[$count-1] = $this->encodeText($arrayText[$count-1]); + /*$texDynamicCells .= LatexDocument::encodeText($arrayText[$count-1]);*/ + $text[$count-1] = LatexDocument::encodeText($arrayText[$count-1]); }else{ - /*$this->pdf->MultiCell($lastWidth, $height, $this->encodeText(''), 1, 'C', 0, 0, 0 ,0, true);*/ + /*$this->pdf->MultiCell($lastWidth, $height, LatexDocument::encodeText(''), 1, 'C', 0, 0, 0 ,0, true);*/ - /*$texDynamicCells .= $this->encodeText('');*/ - $text[$count-1] = $this->encodeText(''); + /*$texDynamicCells .= LatexDocument::encodeText('');*/ + $text[$count-1] = LatexDocument::encodeText(''); } $brezHline = 1; @@ -2929,7 +2888,7 @@ class AnalizaSums extends LatexAnalysisElement{ function getCellHeight($string='', $width=null){ // Star nacin - //$linecount = $this->pdf->getNumLines($this->encodeText($string), $width); + //$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($string), $width); //$height = ( $linecount == 1 ? 4.7 : (4.7 + ($linecount-1)*3.5) ); $this->pdf->startTransaction(); @@ -2945,6 +2904,7 @@ class AnalizaSums extends LatexAnalysisElement{ static function HeatmapRegionPresence($spremenljivkaGrids=null, $spid=null, $_valid_answers=null){ $HeatmapRegionPresence = false; + $num_show_records = SurveyAnalysis::getNumRecords(); foreach ($spremenljivkaGrids AS $gid => $grid){ $_variables_count = count($grid['variables']); if ($_variables_count > 0){ diff --git a/admin/survey/export/latexclasses/Analize/AnalizaTTest.php b/admin/survey/export/latexclasses/Analize/AnalizaTTest.php index a0f832b..8e1bb58 100644 --- a/admin/survey/export/latexclasses/Analize/AnalizaTTest.php +++ b/admin/survey/export/latexclasses/Analize/AnalizaTTest.php @@ -2,41 +2,41 @@ global $site_path; - include_once('../../function.php'); - include_once('../survey/definition.php'); +/* include_once('../../function.php'); + include_once('../survey/definition.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 - - define("M_ANALIZA_DESCRIPTOR", "descriptor"); - define("M_ANALIZA_FREQUENCY", "frequency"); - - define("FNT_FREESERIF", "freeserif"); - define("FNT_FREESANS", "freesans"); - define("FNT_HELVETICA", "helvetica"); - - define("FNT_MAIN_TEXT", FNT_FREESANS); - define("FNT_QUESTION_TEXT", FNT_FREESANS); - define("FNT_HEADER_TEXT", FNT_FREESANS); - - define("FNT_MAIN_SIZE", 10); - define("FNT_QUESTION_SIZE", 9); - define("FNT_HEADER_SIZE", 10); - - define("RADIO_BTN_SIZE", 3); - define("CHCK_BTN_SIZE", 3); - 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("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 + + if(!defined("M_ANALIZA_DESCRIPTOR"))define("M_ANALIZA_DESCRIPTOR", "descriptor"); + if(!defined("M_ANALIZA_FREQUENCY"))define("M_ANALIZA_FREQUENCY", "frequency"); + + if(!defined("FNT_FREESERIF"))define("FNT_FREESERIF", "freeserif"); + if(!defined("FNT_FREESANS"))define("FNT_FREESANS", "freesans"); + if(!defined("FNT_HELVETICA"))define("FNT_HELVETICA", "helvetica"); + + 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); + + 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); + + 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); + + 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); /** Class za generacijo izvoza v Latex @@ -76,8 +76,6 @@ class AnalizaTTest extends LatexAnalysisElement{ { $this->anketa['id'] = $anketa; $this->anketa['podstran'] = $podstran; - // create new PDF document - //$this->pdf = new enka_TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); } else { @@ -106,12 +104,7 @@ class AnalizaTTest extends LatexAnalysisElement{ { return $this->pi['canCreate']; } - function getFile($fileName=null) - { - //Close and output PDF document - ob_end_clean(); - $this->pdf->Output($fileName, 'I'); - } + function init() @@ -125,35 +118,7 @@ class AnalizaTTest extends LatexAnalysisElement{ $language_meta['a_meta_language'] = 'sl'; $language_meta['w_page'] = $lang['page']; - //set some language-dependent strings - $this->pdf->setLanguageArray($language_meta); - - //set margins - $this->pdf->setPrintHeaderFirstPage(true); - $this->pdf->setPrintFooterFirstPage(true); - $this->pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); - $this->pdf->SetHeaderMargin(PDF_MARGIN_HEADER); - $this->pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - - // set header and footer fonts - $this->pdf->setHeaderFont(Array(FNT_HEADER_TEXT, "I", FNT_HEADER_SIZE)); - $this->pdf->setFooterFont(Array(FNT_HEADER_TEXT, 'I', FNT_HEADER_SIZE)); - - - // set document information - $this->pdf->SetAuthor('An Order Form'); - $this->pdf->SetTitle('An Order'); - $this->pdf->SetSubject('An Order'); - - // set default header data - $this->pdf->SetHeaderData(null, null, "www.1ka.si", $this->encodeText(SurveyInfo::getInstance()->getSurveyAkronim())); - //set auto page breaks - $this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - - $this->pdf->SetFont(FNT_MAIN_TEXT, '', FNT_MAIN_SIZE); - //set image scale factor - $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); return true; } @@ -210,7 +175,7 @@ class AnalizaTTest 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; @@ -239,8 +204,8 @@ class AnalizaTTest extends LatexAnalysisElement{ $poravnava = "c"; - $tabela .= " & \multicolumn{".$steviloOstalihStolpcev."}{".$poravnava."|}{".$this->returnBold($this->encodeText($sprLabel1))."} ".$this->texNewLine; - //$tabela .= ' & \multicolumn{'.$steviloOstalihStolpcev.'}{>{\hsize=\dimexpr '.($steviloOstalihStolpcev).'\hsize + '.($steviloOstalihStolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->returnBold($this->encodeText($sprLabel1)).'} '.$this->texNewLine; + $tabela .= " & \multicolumn{".$steviloOstalihStolpcev."}{".$poravnava."|}{".$this->returnBold(LatexDocument::encodeText($sprLabel1))."} ".$this->texNewLine; + //$tabela .= ' & \multicolumn{'.$steviloOstalihStolpcev.'}{>{\hsize=\dimexpr '.($steviloOstalihStolpcev).'\hsize + '.($steviloOstalihStolpcev).'\tabcolsep + \arrayrulewidth}X|}{'.$this->returnBold(LatexDocument::encodeText($sprLabel1)).'} '.$this->texNewLine; // prva vrstica - konec // druga vrstica @@ -248,7 +213,7 @@ class AnalizaTTest extends LatexAnalysisElement{ $tabela .= "\\cline{2-".$steviloStolpcevParameterTabular."} "; //horizontalna vrstica od 2 do zadnje celice } $druga = array(); - $druga[] = $this->returnBold($this->encodeText($sprLabel2)); + $druga[] = $this->returnBold(LatexDocument::encodeText($sprLabel2)); $druga[] = 'n'; $druga[] = 'x'; $druga[] = 's$^2$'; @@ -269,7 +234,7 @@ class AnalizaTTest extends LatexAnalysisElement{ //tretja vrstica $tretja = array(); - $tretja[] = $this->encodeText($label1); //1. stolpec + $tretja[] = LatexDocument::encodeText($label1); //1. stolpec $tretja[] = $this->formatNumber($ttest[1]['n'], 0); $tretja[] = $this->formatNumber($ttest[1]['x'], 3); $tretja[] = $this->formatNumber($ttest[1]['s2'], 3); @@ -285,9 +250,9 @@ class AnalizaTTest extends LatexAnalysisElement{ //cetrta vrstica $cetrta = array(); if($export_format != 'xls'){ - $cetrta[] = '\cline{1-'.$zadnjiStolpecDvojnihVrstic.'} '.$this->encodeText($label2); //1. stolpec, //crta samo do dolocenega stolpca + $cetrta[] = '\cline{1-'.$zadnjiStolpecDvojnihVrstic.'} '.LatexDocument::encodeText($label2); //1. stolpec, //crta samo do dolocenega stolpca }else{ - $cetrta[] = $this->encodeText($label2); //1. stolpec, //crta samo do dolocenega stolpca + $cetrta[] = LatexDocument::encodeText($label2); //1. stolpec, //crta samo do dolocenega stolpca } $cetrta[] = $this->formatNumber($ttest[2]['n'], 0); $cetrta[] = $this->formatNumber($ttest[2]['x'], 3); @@ -304,7 +269,7 @@ class AnalizaTTest extends LatexAnalysisElement{ // vrstici s podatki - konec //zaljucek latex tabele z obrobo za prvo tabelo - $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele z obrobo za prvo tabelo - konec } @@ -341,9 +306,9 @@ class AnalizaTTest extends LatexAnalysisElement{ if($creport==false){ // Naslov posameznega grafa $title = $lang['srv_chart_ttest_title'].':'.$this->texNewLine; - $title .= $this->encodeText($this->ttestVars[0]); - $title .= $this->encodeText('/'); - $title .= $this->encodeText($this->ttestVars[1]); + $title .= LatexDocument::encodeText($this->ttestVars[0]); + $title .= LatexDocument::encodeText('/'); + $title .= LatexDocument::encodeText($this->ttestVars[1]); $boldedTitle = $this->returnBold($title).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico }else{ $boldedTitle = ''; @@ -375,11 +340,6 @@ class AnalizaTTest extends LatexAnalysisElement{ return $text; } - function drawLine() - { - $cy = $this->pdf->getY(); - $this->pdf->Line(15, $cy , 195, $cy , $this->currentStyle); - } function setUserId($usrId=null) {$this->anketa['uid'] = $usrId;} function getUserId() {return ($this->anketa['uid'])?$this->anketa['uid']:false;} @@ -394,20 +354,7 @@ class AnalizaTTest extends LatexAnalysisElement{ return $result; } - - function getCellHeight($string='', $width=null){ - - $this->pdf->startTransaction(); - // get the number of lines calling you method - $linecount = $this->pdf->MultiCell($width, 0, $string, 0, 'L', 0, 0, '', '', true, 0, false, true, 0); - // restore previous object - $this->pdf = $this->pdf->rollbackTransaction(); - - $height = ($linecount <= 1) ? 4.7 : $linecount * ($this->pdf->getFontSize() * $this->pdf->getCellHeightRatio()) + 2; - return $height; - } - } ?> \ No newline at end of file diff --git a/admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php b/admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php index 0e68338..83fcee1 100644 --- a/admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php @@ -10,8 +10,8 @@ *****************************************/ -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip class BesediloLatex extends LatexSurveyElement { @@ -19,6 +19,7 @@ class BesediloLatex extends LatexSurveyElement protected $texBigSkip = '\bigskip'; protected $export_subtype; protected $path2SignatureImages; + protected $path2HeatmapImages; protected $texGapBeforeTable = '\vspace*{-\baselineskip}'; public function __construct() @@ -41,6 +42,7 @@ class BesediloLatex extends LatexSurveyElement } public function export($spremenljivke=null, $export_format='', $questionText=null, $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $anketa=null, $export_subtype='', $preveriSpremenljivko=null, $export_data_type=null, $loop_id=null){ + //$time_start = microtime(true); global $site_path; $this->path2HeatmapImages = $site_path.'main/survey/uploads/'; @@ -62,7 +64,7 @@ class BesediloLatex extends LatexSurveyElement $tex = ''; $podatekVBazi = 0; - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); //poberi simbol checkbox za other in missing moznosti odgovora + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); //poberi simbol checkbox za other in missing moznosti odgovora //nastavitve text box-a iz baze########################## $steviloOken = $spremenljivke['text_kosov']; @@ -212,7 +214,7 @@ class BesediloLatex extends LatexSurveyElement //Ureditev dodajanja manjsega razmika med besedilom vprasanja in tabelo - konec #ZACETEK TABELE //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); } //echo "ni vodoravno ob vprašanju
"; @@ -220,22 +222,22 @@ class BesediloLatex extends LatexSurveyElement }elseif($postavitev==0&&$polozajBesedila==3){ // #ZACETEK TABELE //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //echo "je vodoravno ob vprašanju zgoraj
"; }elseif($postavitev==0&&$polozajBesedila==2){ //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //echo "je vodoravno ob vprašanju spodaj
"; }elseif($postavitev==0&&$steviloOken>1){ //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //echo "stevilo oken večje in ob vprašanju
"; } } - //echo "tex koda: ".$tex."
"; + // iz baze preberemo vse moznosti - ko nimamo izpisa z odgovori respondenta $sqlVrednosti = sisplet_query("SELECT id, naslov, naslov2, variable, other FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red"); - + //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ # po potrebi se prevede besedilo, ki se pojavi pred textbox-om @@ -264,7 +266,9 @@ class BesediloLatex extends LatexSurveyElement //priprava besedila za izpis $stringNaslov = $rowVrednost['naslov']; - $stringNaslov = Common::getInstance()->dataPiping($stringNaslov, $usr_id, $loop_id); + if($userAnswer){ //ce je kaj v bazi oz. se izpisujejo odgovori respondenta + $stringNaslov = Common::getInstance()->dataPiping($stringNaslov, $usr_id, $loop_id); + } //priprava besedila za izpis - konec //ce ni other ali missing @@ -281,11 +285,9 @@ class BesediloLatex extends LatexSurveyElement $besedilo .= $textSignature; //}elseif($spremenljivke['upload'] == 1){ }elseif($spremenljivke['upload']){ - //$besedilo .= $textUpload; - $besedilo .= $this->encodeText($textUpload); + $besedilo .= LatexDocument::encodeText($textUpload); }else{ - //$besedilo .= $userAnswer['text']; - $besedilo .= $this->encodeText($userAnswer['text']); + $besedilo .= LatexDocument::encodeText(isset($userAnswer['text'])?$userAnswer['text']:''); } if($export_format=='pdf'){ @@ -310,7 +312,7 @@ class BesediloLatex extends LatexSurveyElement } array_push($textBoxes, $dataTextBox); //filanje polja s praznimi text box-i - array_push($besedila, $this->encodeText($stringNaslov)); //filanje polja z besedili + array_push($besedila, LatexDocument::encodeText($stringNaslov)); //filanje polja z besedili if($okvir == 0){ if($spremenljivke['tip'] == 21){ //ce je ta novo besedilo, ki je v uporabi @@ -320,7 +322,7 @@ class BesediloLatex extends LatexSurveyElement //izpis besedila if($polozajBesedila!=0){ //ce je prisotno dodatno besedilo ob okvirju - $tex .= $this->encodeText($stringNaslov)." "; + $tex .= LatexDocument::encodeText($stringNaslov)." "; } $tex .= ' '.$dataTextBox; }elseif($spremenljivke['tip'] == 4){ //ce je ta staro besedilo, ki ni vec v uporabi vsaj 9 let (2020) @@ -338,7 +340,7 @@ class BesediloLatex extends LatexSurveyElement } //izpis besedila - $tex .= $this->encodeText($stringNaslov)." "; + $tex .= LatexDocument::encodeText($stringNaslov)." "; //izpis text box-a dolocene sirine in visine z besedilom odgovora $tex .= ' '.$dataTextBox; @@ -353,10 +355,12 @@ class BesediloLatex extends LatexSurveyElement 'vrstni_red'=>$rowVrednost['vrstni_red'], 'value'=>$text[$rowVrednost['vrstni_red']], ); */ + $vrstniRedTmp = isset($rowVrednost['vrstni_red'])?$rowVrednost['vrstni_red']:null; + echo $vrstniRedTmp; $array_others[$rowVrednost['id']] = array( - 'naslov'=>$this->encodeText($stringNaslov), - 'vrstni_red'=>$rowVrednost['vrstni_red'], - 'value'=>$text[$rowVrednost['vrstni_red']], + 'naslov'=>LatexDocument::encodeText($stringNaslov), + 'vrstni_red'=>$vrstniRedTmp, + //'value'=>$text[$vrstniRedTmp] - pokomentiral, ker ne vem, zakaj je tako, saj drugače PHP javlja warning ); } @@ -392,20 +396,20 @@ class BesediloLatex extends LatexSurveyElement if($postavitev!=0){ if($steviloOken>1){ //ce je stevilo oken vec kot 1, zakljuci tabelo //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); #KONEC TABELE } }elseif($postavitev==0&&$polozajBesedila==3){ //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); #KONEC TABELE }elseif($postavitev==0&&$polozajBesedila==2){ //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); #KONEC TABELE }elseif($postavitev==0&&$steviloOken>1){ //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); #KONEC TABELE } } @@ -453,6 +457,9 @@ class BesediloLatex extends LatexSurveyElement } //echo "tex koda: ".$tex." in indeks $indeksZaWhile
"; + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time besedilo 1: '.$execution_time.' sec
'; */ return $tex; } diff --git a/admin/survey/export/latexclasses/Vprasanja/DatumLatex.php b/admin/survey/export/latexclasses/Vprasanja/DatumLatex.php index 7110873..006863f 100644 --- a/admin/survey/export/latexclasses/Vprasanja/DatumLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/DatumLatex.php @@ -36,6 +36,7 @@ class DatumLatex extends LatexSurveyElement public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype='', $preveriSpremenljivko=null, $loop_id=null){ + //$time_start = microtime(true); // Ce je spremenljivka v loopu $this->loop_id = $loop_id; @@ -65,19 +66,25 @@ class DatumLatex extends LatexSurveyElement //$sqlUserAnswer = sisplet_query("SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' AND loop_id $loop_id"); //$sqlUserAnswerString = "SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' "; $sqlUserAnswerString = "SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' "; - //echo $sqlUserAnswerString; + //$sqlUserAnswerString = "SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND loop_id = $loop_id"; + if($loop_id){ + $sqlUserAnswerString = $sqlUserAnswerString." AND loop_id = '$loop_id'"; + } + + //echo $sqlUserAnswerString."
"; + $sqlUserAnswer = sisplet_query($sqlUserAnswerString); $userAnswer = mysqli_fetch_assoc($sqlUserAnswer); //echo "userAnswer: ".$userAnswer['text']."
"; //ureditev polja s podatki trenutnega uporabnika - konec ############################################## //ureditev besedila odgovora respondenta v doloceno barvo - $besedilo = '\\textcolor{crta}{'; - $besedilo .= $userAnswer['text']; + $besedilo = '\\textcolor{crta}{'; + $besedilo .= isset($userAnswer['text'])?$userAnswer['text']:null; $besedilo .= '}'; //ureditev besedila odgovora respondenta v doloceno barvo - konec - if($userAnswer['text']==''){ //ce ni izpisa odgovorov respondentov, priprava izpis s tabelo + if(isset($userAnswer['text'])?$userAnswer['text']:null==''){ //ce ni izpisa odgovorov respondentov, priprava izpis s tabelo $answerTextBox = $this->LatexTextBox($export_format, $textboxHeight, $textboxWidth, $besedilo, $textboxAllignment, $noBorders); //parametri tabele @@ -91,12 +98,12 @@ class DatumLatex extends LatexSurveyElement //IZRIS #ZACETEK TABELE //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); $tex .= $answerTextBox; //izris znotraj tabele //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); #KONEC TABELE $tex .= $this->texBigSkip; }else{ //ce je izpis odgovorov respondentov @@ -114,11 +121,11 @@ class DatumLatex extends LatexSurveyElement $array_others[$rowVrednost['id']] = array( 'naslov'=>$rowVrednost['naslov'], 'vrstni_red'=>$rowVrednost['vrstni_red'], - 'value'=>$text[$rowVrednost['vrstni_red']], + //'value'=>$text[$rowVrednost['vrstni_red']], ); } } - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); //poberi simbol checkbox za other in missing moznosti odgovora + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); //poberi simbol checkbox za other in missing moznosti odgovora //priprava missing-ov - konec // Izris polj drugo - ne vem... @@ -133,7 +140,9 @@ class DatumLatex extends LatexSurveyElement } //IZRIS - KONEC - + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time datum: '.$execution_time.' sec'; */ return $tex; } } diff --git a/admin/survey/export/latexclasses/Vprasanja/GridMultipleLatex.php b/admin/survey/export/latexclasses/Vprasanja/GridMultipleLatex.php index 3b67102..96dbff8 100644 --- a/admin/survey/export/latexclasses/Vprasanja/GridMultipleLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/GridMultipleLatex.php @@ -10,9 +10,9 @@ *****************************************/ -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip -define("RADIO_BTN_SIZE", 0.13); + if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm + if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip + if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13); class GridMultipleLatex extends LatexSurveyElement { @@ -29,6 +29,9 @@ class GridMultipleLatex extends LatexSurveyElement private static $_instance; protected $texBigSkip = '\bigskip '; protected $loop_id = null; // id trenutnega loopa ce jih imamo + protected $usr_id = null; + protected $language; + protected $prevod; public static function getInstance() { @@ -38,28 +41,40 @@ class GridMultipleLatex extends LatexSurveyElement return new GridMultipleLatex(); } - public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype='', $preveriSpremenljivko=null, $export_data_type='', $loop_id=null){ + public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype='', $preveriSpremenljivko=null, $export_data_type='', $loop_id=null, $language=null){ + //$time_start = microtime(true); // Ce je spremenljivka v loopu $this->loop_id = $loop_id; + $this->usr_id = $usr_id; + + $this->language = $language; + + //preverjanje, ali je prevod + if(isset($_GET['language'])){ + $this->language = isset($_GET['language'])?$_GET['language']:null; + $this->prevod = 1; + }else{ + $this->prevod = 0; + } + //preverjanje, ali je prevod - konec + + //echo "tip izpisa: $export_data_type
"; //$export_data_type: 1 - Razsirjen, 2 - Skrcen $presirokaTabela = 0; //preveri, ce je kaj v bazi $questionText=0; $userDataPresent=0; $izpisOdgovorov = 0; + $userAnswer = null; if($usr_id){ //ce je prisotne id uporabnika, je izpis odgovorov in je potrebno narediti naslednje stvari - //$userAnswer = $this->GetUsersDataKombinirana($spremenljivke, $db_table, $usr_id, $questionText, $this->loop_id, $export_data_type); $userAnswer = $this->GetUsersDataKombinirana($spremenljivke, $db_table, $usr_id, $presirokaTabela, $this->loop_id, $export_data_type); foreach($userAnswer as $value){ if($value!=''){ $userDataPresent=1; } - //echo "Value: ".$value."
"; } $izpisOdgovorov = 1; } - //echo "Usr_id: ".$usr_id.'
'; - //echo "Stevilo odgovorov: ".count($userAnswer).'
'; if($userDataPresent!=0||$export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ //ce je kaj v bazi ali je prazen vprasalnik ali je potrebno pokazati tudi ne odgovorjena vprasanja @@ -82,10 +97,10 @@ class GridMultipleLatex extends LatexSurveyElement } //poizvedba vseh potrebnih podatkov dodanih moznosti v kombinirani tabeli - $sqlMultiple = sisplet_query("SELECT g.*, s.tip, s.enota, s.dostop FROM srv_grid g, srv_grid_multiple m, srv_spremenljivka s WHERE s.id=g.spr_id AND g.spr_id=m.spr_id AND m.spr_id IN (".implode($multipleSprId, ',').") ORDER BY m.vrstni_red, g.vrstni_red"); + $sqlMultiple = sisplet_query("SELECT g.*, s.tip, s.enota, s.dostop FROM srv_grid g, srv_grid_multiple m, srv_spremenljivka s WHERE s.id=g.spr_id AND g.spr_id=m.spr_id AND m.spr_id IN (".implode(',', $multipleSprId).") ORDER BY m.vrstni_red, g.vrstni_red"); //echo "SELECT g.*, s.tip, s.enota, s.dostop FROM srv_grid g, srv_grid_multiple m, srv_spremenljivka s WHERE s.id=g.spr_id AND g.spr_id=m.spr_id AND m.spr_id IN (".implode($multipleSprId, ',').") ORDER BY m.vrstni_red, g.vrstni_red"; //poizvedba podnaslovov v kombinirani tabeli - $sqlMultiplePodNaslovi = sisplet_query("SELECT naslov FROM srv_spremenljivka WHERE id IN (".implode($multipleSprId, ',').")"); + $sqlMultiplePodNaslovi = sisplet_query("SELECT naslov FROM srv_spremenljivka WHERE id IN (".implode(',', $multipleSprId).")"); //novo za kombinirano tabelo - konec $spremenljivkaParams = new enkaParameters($spremenljivke['params']); @@ -114,14 +129,14 @@ class GridMultipleLatex extends LatexSurveyElement if($usr_id){ $multipleVredIdDrugo = array(); //polje za shranjevanje vre_id, kjer je prisotna moznost Drugo: //poizvedba vrednosti polj, kjer se pojavijo polja Drugo: - $sqlMultipleVredIdZaDrugo = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id IN (".implode($multipleSprId, ',').") AND other = 1"); + $sqlMultipleVredIdZaDrugo = sisplet_query("SELECT id FROM srv_vrednost WHERE spr_id IN (".implode(',', $multipleSprId).") AND other = 1"); while ($rowsqlMultipleVredIdZaDrugo = mysqli_fetch_array($sqlMultipleVredIdZaDrugo)) { $multipleVredIdDrugo[] = $rowsqlMultipleVredIdZaDrugo['id']; } if(!empty($multipleVredIdDrugo)){ $multipleBesediloDrugo = array(); //polje za shranjevanje vnesenega besedila iz strani respondenta, kjer je prisotna moznost Drugo: - $sqlStavekMultipleBesediloDrugo = "SELECT text FROM srv_data_text_active WHERE vre_id IN (".implode($multipleVredIdDrugo, ',').") AND usr_id=".$usr_id." "; + $sqlStavekMultipleBesediloDrugo = "SELECT text FROM srv_data_text_active WHERE vre_id IN (".implode(',', $multipleVredIdDrugo).") AND usr_id=".$usr_id." "; $sqlMultipleBesediloDrugo = sisplet_query($sqlStavekMultipleBesediloDrugo); while ($rowsqlMultipleBesediloDrugo = mysqli_fetch_array($sqlMultipleBesediloDrugo)) { $multipleBesediloDrugo[] = $rowsqlMultipleBesediloDrugo['text']; @@ -133,13 +148,27 @@ class GridMultipleLatex extends LatexSurveyElement //ce je prisoten id uporabnika - ureditev belezenja vnesenega odgovora pod Drugo: - konec //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti - navpicni odgovori - while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ - $stringTitleRow = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); + while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ + $stringTitleRow = ''; + /* $stringTitleRow = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); # po potrebi prevedemo naslov $naslov = $this->srv_language_vrednost($rowVrednost['id']); if ($naslov != '') { //$rowVrednost['naslov'] = $naslov; $stringTitleRow = $naslov; + } */ + + if($this->prevod){ //ce je prevod ankete + # po potrebi prevedemo naslov + $rowl = $this->srv_language_vrednost($rowVrednost['id']); + if ($rowl != '') { + $stringTitleRow = ((( $rowl['naslov'] ) ? $rowl['naslov'] : ( ( $rowl['naslov2'] ) ? $rowl['naslov2'] : $rowl['variable'] ) )); //prevod naslova v ustreznem jeziku; + } + if($stringTitleRow == ''){ //ce ni prevoda, prevzemi izvirno + $stringTitleRow = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); + } + }else{ + $stringTitleRow = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); } $besediloDrugo = ''; @@ -148,13 +177,15 @@ class GridMultipleLatex extends LatexSurveyElement if($rowVrednost['other'] && $usr_id){ //zabelezi besedilo, ki je trenuten uporabnik za trenuten odgovor zapisal pod Drugo: $besediloDrugo = $multipleBesediloDrugo[$indeksBesediloDrugo]; - $this->encodeText($besediloDrugo); + LatexDocument::encodeText($besediloDrugo); $besediloDrugo = ' \\textcolor{crta}{\footnotesize{'.$besediloDrugo.'}} '; $indeksBesediloDrugo++; //povecaj indeks za izpis vnesenega besedila v Drugo: } //ce je drugo vnesen kot odgovor in je prisoten id uporabnika - konec - - array_push($navpicniOdgovori, $this->encodeText($stringTitleRow)." ".$besediloDrugo); //filanje polja z navpicnimi odgovori (po vrsticah) + if($usr_id){ + $stringTitleRow = Common::getInstance()->dataPiping($stringTitleRow, $usr_id, $loop_id); + } + array_push($navpicniOdgovori, LatexDocument::encodeText($stringTitleRow, 0, 1)." ".$besediloDrugo); //filanje polja z navpicnimi odgovori (po vrsticah) } //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti - navpicni odgovori - konec @@ -164,19 +195,19 @@ class GridMultipleLatex extends LatexSurveyElement $steviloSkupinRoletSeznamov = 0; //belezi stevilo enot z roletami ali seznamov (pomembno za pravilen izris, za presiroko tabelo) $steviloOdgovorovRoletSeznamov = 0; //belezi stevilo posameznih odgovorov, ki sestavljajo razlicne rolete ali sezname $sprIdRoletSeznamov = 0; - $sprIdRoletSeznamovTmp = 0; + $sprIdRoletSeznamovTmp = 0; //pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - vodoravni odgovori while ($colVrednost = mysqli_fetch_assoc($sqlStolpciVrednosti)){ - - #staro, izpis naslovov stolpcev tabele z isto velikostjo pisave, kot vse ostalo - /* $stringTitleCol = $colVrednost['naslov']; - array_push($vodoravniOdgovori, $this->encodeText($stringTitleCol, 0, 1) ); //filanje polja z vodoravnimi odgovori (po stolpcih) */ - #staro - konec - - $stringTitleCol = $this->encodeText($colVrednost['naslov'], 0, 1); - $stringTitleCol = '\footnotesize{'.$stringTitleCol.'}'; //zmanjsanje pisave za naslove stolpcev tabele - array_push($vodoravniOdgovori, $stringTitleCol); //filanje polja z vodoravnimi odgovori (po stolpcih) + $stringTitleCol = ''; + $rowl = $this->srv_language_grid($colVrednost['variable'],$colVrednost['spr_id']); + if ($rowl !=null && strip_tags($rowl['naslov']) != '') $colVrednost['naslov'] = $rowl['naslov']; + $stringTitleCol = $colVrednost['naslov']; + if($usr_id){ + $stringTitleCol = Common::getInstance()->dataPiping($stringTitleCol, $usr_id, $loop_id); + } + $stringTitleCol = '\footnotesize{'.LatexDocument::encodeText($stringTitleCol, 0, 1).'}'; //zmanjsanje pisave za naslove stolpcev tabele + array_push($vodoravniOdgovori, $stringTitleCol); //filanje polja z vodoravnimi odgovori (po stolpcih) $rowMultiple = mysqli_fetch_array($sqlMultiple); array_push($vodoravniOdgovoriTip, $rowMultiple['tip']); //filanje polja s tipi spremenljivk @@ -187,38 +218,25 @@ class GridMultipleLatex extends LatexSurveyElement if(($rowMultiple['enota'] == 2 || $rowMultiple['enota'] == 6)){ $sprIdRoletSeznamov = $rowMultiple['spr_id']; } - - /* echo "enota ".$rowMultiple['enota']."
"; - echo "spr ".$rowMultiple['spr_id']."
"; */ - //if(($rowMultiple['enota'] == 2 || $rowMultiple['enota'] == 6)){ //ce je roleta ali seznam IN je izpis odgovorov + //if(($rowMultiple['enota'] == 2 || $rowMultiple['enota'] == 6)&&$izpisOdgovorov){ //ce je roleta ali seznam IN je izpis odgovorov if((($rowMultiple['enota'] == 2 || $rowMultiple['enota'] == 6)&&$izpisOdgovorov) || ($izpisOdgovorov&&$rowMultiple['tip']==6&&$export_data_type==2)){ //(ce je roleta ALI seznam IN je izpis odgovorov) ALI (je izpis odgovorov IN je radio button) if($sprIdRoletSeznamovTmp != $sprIdRoletSeznamov){ $steviloSkupinRoletSeznamov++; } $steviloOdgovorovRoletSeznamov++; - //echo "spr: $sprIdRoletSeznamov
"; } - $sprIdRoletSeznamovTmp = $sprIdRoletSeznamov; + $sprIdRoletSeznamovTmp = $sprIdRoletSeznamov; } //pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - vodoravni odgovori - konec $vodoravniOdgovoriVsi = $vodoravniOdgovori; - /* echo "stevilo skupin rolet/seznamov ".($steviloSkupinRoletSeznamov)."
"; - echo "stevilo odgovorov v roletah ali seznamu ".($steviloOdgovorovRoletSeznamov)."
"; */ - -/* echo "vodoravniOdgovoriSprId: "; - print_r($vodoravniOdgovoriSprId); - echo "
"; - echo "Enote: "; - print_r($vodoravniOdgovoriEnota); - echo "
"; */ //ureditev polja z nadnaslovi kombinirane tabele while ($rowMultiplePodNaslovi = mysqli_fetch_array($sqlMultiplePodNaslovi)){ - array_push($podNaslovi, $this->encodeText($rowMultiplePodNaslovi['naslov'])); + array_push($podNaslovi, LatexDocument::encodeText($rowMultiplePodNaslovi['naslov'], 0, 1)); } //ureditev polja z nadnaslovi kombinirane tabele - konec @@ -228,10 +246,8 @@ class GridMultipleLatex extends LatexSurveyElement $steviloPodstolpcev = $numColSql - $steviloOdgovorovRoletSeznamov + $steviloSkupinRoletSeznamov; $mejaZaVelikeTabele = 7; $velikostTabele = $steviloPodstolpcev-1; - //echo "velikost tabele: ".($velikostTabele)."
"; + if($velikostTabele > $mejaZaVelikeTabele){ //ce imamo veliko tabelo, jo je potrebno razbiti na vec tabel, ker drugace je presiroka - //echo "tabela je prevelika, ima ".($velikostTabele)." stolpcev
"; - $presirokaTabela = 1; $steviloTabelCelih = intval($velikostTabele / $mejaZaVelikeTabele); $steviloTabelMod = $velikostTabele % $mejaZaVelikeTabele; @@ -240,11 +256,6 @@ class GridMultipleLatex extends LatexSurveyElement $delnaTabela = 1; } $steviloTabel = $steviloTabelCelih + $delnaTabela; - - //echo "stevilo podtabel celih ".($steviloTabelCelih)."
"; - //echo "stevilo podtabel mod ".($steviloTabelMod)."
"; - //echo "stevilo podtabel za izpis: ".($steviloTabel)."
"; - //echo "stevilo podatkov za izpis: ".($steviloPodatkovZaIzpis)."
"; }else{ $presirokaTabela = 0; @@ -273,11 +284,6 @@ class GridMultipleLatex extends LatexSurveyElement $valueTmp = null; foreach($vodoravniOdgovoriSprId as $value){ //parametri tabele ZA OSTALE STOLPCE+pridobitev stevila stolpcev+priprava polj in spremenljivk ############### - //echo $vodoravniOdgovoriEnota[$indeksParameterTabular-1]."
"; - //echo "value: ".$value."
"; - //echo "valueTmp: ".$valueTmp."
"; - //echo "indeksParameterTabular: ".$indeksParameterTabular."
"; - //echo "Stevilo vodoravniOdgovoriSprId: ".count($vodoravniOdgovoriSprId)."
"; if($izpisOdgovorov == 0 || ($izpisOdgovorov == 1 && $vodoravniOdgovoriEnota[$indeksParameterTabular-1]==0 && $export_data_type == 1) || ($izpisOdgovorov == 1 && $vodoravniOdgovoriEnota[$indeksParameterTabular-1]==0 && $vodoravniOdgovoriTip[$indeksParameterTabular-1]!=6 && $export_data_type == 2)){ //ce je prazen vprasalnik ALI (je izpis odgovorov IN ni roleta/seznam IN je Razsirjen izvoz) ALI (je izpis odgovorov IN ni roleta/seznam IN ni radio button IN je skrcen izvoz) if($indeksParameterTabular==1){ //ce je prvi podstolpec @@ -345,8 +351,6 @@ class GridMultipleLatex extends LatexSurveyElement $indeksVodoravniOdgovori++; } //parametri tabele ZA OSTALE STOLPCE+pridobitev stevila stolpcev+priprava polj in spremenljivk - konec ########################################## - //echo "Parametri tabel: ".$parameterTabular."
"; - //brisanje odvecnih elementov polja in ponovna indeksacija polja foreach($toDelete as $value){ unset($vodoravniOdgovoriPrva[$value]); //brisanje ustreznih elementov polja @@ -371,20 +375,17 @@ class GridMultipleLatex extends LatexSurveyElement }else{ $numColSqlPrva = $numColSql; } - //echo "stevilo stolpcev prva vrstica $numColSqlPrva
"; //dodatna priprava polj in spremenljivk, ce enota je razlicna od nula oz. izris ni klasicna tabela - konec ############################# //ureditev parametrov za tabelo, pridobitev stevila stolpcev za vsak tip dodanega vprasanja (podstolpec), priprava polj in spremenljivk, ce enota je razlicna od nula oz. izris ni klasicna tabela - konec ######## //IZRIS TABELE - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); //zacetek tabele + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //zacetek tabele #nadnaslovi nad prvo vrstico ######################################################### if($spremenljivke['grid_subtitle1']==1){ //ce so podnaslovi for($n=0;$n'; - //$tex .= ' & \multicolumn{'.$steviloPodStolpcev[$n].'}{c}{'.$podNaslovi[$n].'}'; $tex .= ' & \multicolumn{'.$steviloPodStolpcev[$n].'}{C}{'.$podNaslovi[$n].'}'; } } @@ -398,20 +399,20 @@ class GridMultipleLatex extends LatexSurveyElement $tex .= $texNewLine; - //print_r($userAnswer); - #izris vrstic tabele $fillablePdf = 0; //echo "stevilo stolpcev tabele $numColSql
"; - $tex .= $this->LatexVrsticeMultigrid($numRowsSql, $export_format, $enota, $simbolTex, $navpicniOdgovori, 0, $fillablePdf, $numColSql, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, 0, 0, $vodoravniOdgovoriTip, $vodoravniOdgovoriEnota, $vodoravniOdgovoriSprId, $userAnswer, $export_subtype, $preveriSpremenljivko, $userDataPresent, $presirokaTabela, $export_data_type); + $tex .= $this->LatexVrsticeMultigrid($numRowsSql, $export_format, $enota, null, $navpicniOdgovori, 0, $fillablePdf, $numColSql, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, 0, 0, $vodoravniOdgovoriTip, $vodoravniOdgovoriEnota, $vodoravniOdgovoriSprId, $userAnswer, $export_subtype, $preveriSpremenljivko, $userDataPresent, $presirokaTabela, $export_data_type, $this->usr_id, $this->loop_id); #izris vrstic tabele - konec - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); //zakljucek tabele + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); //zakljucek tabele //IZRIS TABELE - KONEC $tex .= $this->texBigSkip; $tex .= $this->texBigSkip; - + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time kombinirana tabela: '.$execution_time.' sec'; */ return $tex; }elseif($presirokaTabela == 1){ //ce je tabela presiroka ################################################# @@ -419,7 +420,6 @@ class GridMultipleLatex extends LatexSurveyElement //za vsako spremenljivko oz. podtabelo foreach($multipleSprId AS $sprId){ - //echo "$sprId
"; #pobiranje podatkov o odgovorih respondenta za vsako podtabelo posebej if($usr_id){ //ce je prisotne id uporabnika, je izpis odgovorov in je potrebno narediti naslednje stvari @@ -429,13 +429,10 @@ class GridMultipleLatex extends LatexSurveyElement if($value!=''){ $userDataPresent=1; } - //echo "Value: ".$value."
"; } $izpisOdgovorov = 1; } - //echo "podatek je: ".$userDataPresent."
"; - /* print_r($userAnswer); - echo "
"; */ + #pobiranje podatkov o odgovorih respondenta za vsako podtabelo posebej - konec $vodoravniOdgovoriTip = array(); @@ -452,9 +449,12 @@ class GridMultipleLatex extends LatexSurveyElement array_push($vodoravniOdgovoriTip, $rowMultiple['tip']); //filanje polja s tipi spremenljivk array_push($vodoravniOdgovoriSprId, $rowMultiple['spr_id']); //filanje polja z id spremenljivk array_push($vodoravniOdgovoriEnota, $rowMultiple['enota']); //filanje polja z enoto spremenljivk - //print_r($vodoravniOdgovoriTip); - $stringTitleCol = $this->encodeText($rowMultiple['naslov'], 0, 1); - $stringTitleCol = '\footnotesize{'.$stringTitleCol.'}'; //zmanjsanje pisave za naslove stolpcev tabele + + $stringTitleCol = $rowMultiple['naslov']; + if($usr_id){ + $stringTitleCol = Common::getInstance()->dataPiping($stringTitleCol, $usr_id, $loop_id); + } + $stringTitleCol = '\footnotesize{'.LatexDocument::encodeText($stringTitleCol, 0, 1).'}'; //zmanjsanje pisave za naslove stolpcev tabele //if(($vodoravniOdgovoriEnota[0] == 2 || $vodoravniOdgovoriEnota[0] == 6) && $izpisOdgovorov && $export_data_type == 1){ //(ce je roleta ALI seznam) IN je izpis odgovorov IN razsirjen izvoz if(($vodoravniOdgovoriEnota[0] == 2 || $vodoravniOdgovoriEnota[0] == 6) && $izpisOdgovorov && $export_data_type == 1 || ($izpisOdgovorov && $export_data_type == 2 && $vodoravniOdgovoriTip[0] == 6 )){ //(ce je roleta ALI seznam) IN je izpis odgovorov IN razsirjen izvoz ALI (je izpis odgovorov IN skrcen izvoz IN radio button) @@ -462,48 +462,25 @@ class GridMultipleLatex extends LatexSurveyElement }else{ array_push($vodoravniOdgovori, $stringTitleCol); //filanje polja z vodoravnimi odgovori (po stolpcih) } - //array_push($vodoravniOdgovori, $stringTitleCol); //filanje polja z vodoravnimi odgovori (po stolpcih) - //echo $rowMultiple['naslov']."
"; } //poizvedba podnaslovov v podtabeli kombinirane tabele $sqlMultiplePodNaslovi = sisplet_query("SELECT naslov FROM srv_spremenljivka WHERE id =".$sprId); //ureditev polja z nadnaslovi kombinirane tabele while ($rowMultiplePodNaslovi = mysqli_fetch_array($sqlMultiplePodNaslovi)){ - array_push($podNaslovi, $this->encodeText($rowMultiplePodNaslovi['naslov'])); + array_push($podNaslovi,LatexDocument::encodeText($rowMultiplePodNaslovi['naslov'], 0, 1)); } //ureditev polja z nadnaslovi kombinirane tabele - konec $enota = $vodoravniOdgovoriEnota[0]; - /* print_r($vodoravniOdgovoriTip); - echo "
"; - print_r($vodoravniOdgovoriSprId); - echo "
";*/ - /* print_r($vodoravniOdgovoriEnota); - echo "
"; */ - /* print_r($vodoravniOdgovori); - echo "
"; */ //ureditev parametrov tabele - /* echo "enota:".$vodoravniOdgovoriEnota[0]."
"; - echo "izpisOdgovorov:".$izpisOdgovorov."
"; - echo "tip:".$vodoravniOdgovoriTip[0]."
"; - echo "export_data_type:".$export_data_type."
"; */ - //if(($enota == 2 || $enota == 6) && $izpisOdgovorov && $export_data_type == 1){ //(ce je roleta ALI seznam) IN je izpis odgovorov IN razsirjen izvoz if(($enota == 2 || $enota == 6) && $izpisOdgovorov && $export_data_type == 1 || ($izpisOdgovorov && $export_data_type == 2 && $vodoravniOdgovoriTip[0] == 6 )){ //(ce je roleta ALI seznam) IN je izpis odgovorov IN razsirjen izvoz ALI (je izpis odgovorov IN skrcen izvoz IN radio button) $steviloStolpcev = 1 + 1; }else{ $steviloStolpcev = count($vodoravniOdgovoriSprId) + 1; } - //echo "stevilo stolpcev: $steviloStolpcev
"; - - /* if((($vodoravniOdgovoriEnota[0] == 2 || $vodoravniOdgovoriEnota[0] == 6)&&$izpisOdgovorov&&$export_data_type == 1) || ($izpisOdgovorov&&$export_data_type == 2&&$vodoravniOdgovoriTip[$indeksParameterTabular-1]==6)){ //(ce je roleta ali izberite iz seznama IN je izpis odgovorov IN razsirjen izvoz) ALI (je izpis odgovorov IN skrcen izvoz IN radio button) - - } */ - - - //echo "stevilo stolpcev: $steviloStolpcev
"; $parameterTabular = ''; $parameterTabular .= ($export_format == 'pdf' ? 'A' : 'l'); //leva poravnava stolpca fiksne sirine ZA PRVI STOLPEC (parameteri tabele) @@ -511,7 +488,6 @@ class GridMultipleLatex extends LatexSurveyElement for($i=1; $i<$steviloStolpcev;$i++){ $parameterTabular .= ($export_format == 'pdf' ? 'C' : 'c'); //sredinska poravnava stolpca } - //echo "parametri tabele: $parameterTabular
"; //ureditev parametrov tabele - konec @@ -522,8 +498,6 @@ class GridMultipleLatex extends LatexSurveyElement $steviloPodStolpcev = $steviloStolpcev - 1; if($spremenljivke['grid_subtitle1']==1){ //ce so podnaslovi for($n=0;$n"; - //$tex .= ' & \multicolumn{'.$steviloPodStolpcev.'}{c}{'.$podNaslovi[$n].'}'; $tex .= ' & \multicolumn{'.$steviloPodStolpcev.'}{C}{'.$podNaslovi[$n].'}'; } } @@ -540,7 +514,7 @@ class GridMultipleLatex extends LatexSurveyElement #izris vrstic tabele $fillablePdf = 0; //echo "stevilo stolpcev tabele $steviloStolpcev
"; - $tex .= $this->LatexVrsticeMultigrid($numRowsSql, $export_format, $enota, $simbolTex, $navpicniOdgovori, 0, $fillablePdf, $steviloStolpcev, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, 0, 0, $vodoravniOdgovoriTip, $vodoravniOdgovoriEnota, $vodoravniOdgovoriSprId, $userAnswer, $export_subtype, $preveriSpremenljivko, $userDataPresent, $presirokaTabela, $export_data_type); + $tex .= $this->LatexVrsticeMultigrid($numRowsSql, $export_format, $enota, null, $navpicniOdgovori, 0, $fillablePdf, $steviloStolpcev, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, 0, 0, $vodoravniOdgovoriTip, $vodoravniOdgovoriEnota, $vodoravniOdgovoriSprId, $userAnswer, $export_subtype, $preveriSpremenljivko, $userDataPresent, $presirokaTabela, $export_data_type, $this->usr_id, $this->loop_id); #izris vrstic tabele - konec $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); //zakljucek tabele diff --git a/admin/survey/export/latexclasses/Vprasanja/HeatmapLatex.php b/admin/survey/export/latexclasses/Vprasanja/HeatmapLatex.php index 94e86fb..f65b419 100644 --- a/admin/survey/export/latexclasses/Vprasanja/HeatmapLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/HeatmapLatex.php @@ -9,9 +9,10 @@ * Datum: 09/2017 *****************************************/ //use enkaParameters; -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip -define("RADIO_BTN_SIZE", 0.13); + +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip +if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13); class HeatmapLatex extends LatexSurveyElement { @@ -74,15 +75,19 @@ class HeatmapLatex extends LatexSurveyElement //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ $stringTitleRow = $rowVrednost['naslov']; //odgovori na levi strani - array_push($navpicniOdgovori, $this->encodeText($stringTitleRow) ); //filanje polja z navpicnimi odgovori (po vrsticah) + if($usr_id){ + $stringTitleRow = Common::getInstance()->dataPiping($stringTitleRow, $usr_id, $loop_id); + } + array_push($navpicniOdgovori, LatexDocument::encodeText($stringTitleRow) ); //filanje polja z navpicnimi odgovori (po vrsticah) } //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti - konec //$tex .= $this->IzrisVsotaTabela($spremenljivke, $numRowsSql, $navpicniOdgovori, $texNewLine, $texNewLineAfterTable, $export_format, 0); - $imageName = $this->getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); - //echo("iz heatmap ime slike: ".$imageName."
"); + //html slike + //$imageName = ($spremenljivkaParams->get('hotspot_image') ? $spremenljivkaParams->get('hotspot_image') : ""); + $imageName = LatexDocument::getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); $path2Images = $this->path2Images; $imageNameTest = $path2Images.$imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku @@ -92,7 +97,7 @@ class HeatmapLatex extends LatexSurveyElement $imageName = $path2Images.$imageName; - if(filesize($imageNameTest) > 0){ + if(filesize(file_exists($imageNameTest)) > 0){ $image = PIC_SIZE."{".$imageName."}"; //priprave slike predefinirane dimenzije }else{ //$image = 'ni slike'; @@ -110,22 +115,29 @@ class HeatmapLatex extends LatexSurveyElement if($whileIndeks == 0){ //ce so prisotna imena obmocij, izpisi besedilo "Obmocja na sliki" $tex .= $lang['srv_export_hotspot_regions_names'].': '.$texNewLine; //izpis besedila "Obmocja na sliki" } - $tex .= $rowHotSpotRegions['region_name'].''.$texNewLine; - if($rowHotSpotRegions['region_name']){ - array_push($obmocjaNaSliki, $rowHotSpotRegions['region_name']); - //array_push($coordsObmocijNaSliki, $rowHotSpotRegions['region_coords']); - $coordsObmocijNaSliki[$rowHotSpotRegions['region_name']]=$rowHotSpotRegions['region_coords']; - $point[$rowHotSpotRegions['region_name']] = 0; + + $regionName = $rowHotSpotRegions['region_name']; + if($usr_id){ + $regionName = Common::getInstance()->dataPiping($regionName, $usr_id, $loop_id); + } + $regionName = LatexDocument::encodeText($regionName); + $tex .= $regionName.''.$texNewLine; + //echo "ime: $regionName
"; + + if($regionName){ + array_push($obmocjaNaSliki, $regionName); + $coordsObmocijNaSliki[$regionName]=$rowHotSpotRegions['region_coords']; + $point[$regionName] = 0; } $whileIndeks++; } $tex .= $texNewLine; - //ureditev missing-ov - if(count($missingOdgovori)!=0){ //ce so missing-i + //ureditev missing-ov - pokomentiranje missing-ov ob preurejanju kode za PHP8 - Patrik +/* if(count($missingOdgovori)!=0){ //ce so missing-i $vodoravniOdgovori = $this->AddMissingsToAnswers($vodoravniOdgovori, $missingOdgovori); - } + } */ //ureditev missing-ov - konec @@ -152,6 +164,7 @@ class HeatmapLatex extends LatexSurveyElement $textboxHeightOdgovori = 0; //visina okvirja z odgovorom $noBordersOdgovori = 0; $parameterTabular = 'l'; + $textboxAllignment = null; //za ureditev stevila tock v izbranih obmocjih $dataPointValue = array(); $data = array(); @@ -221,7 +234,7 @@ class HeatmapLatex extends LatexSurveyElement $point[$obmocjaNaSliki[$o]]++; } } - //echo "stevilo tock znotraj obmocja: ".$point["Besedilo"]."
"; + //echo "stevilo tock znotraj obmocja: ".$point["Besedilo"]."
"; } #pridobitev podatkov o obmocjih in podatka o prisotnosti tocke v obmocju - konec //echo $answer."
"; @@ -230,13 +243,13 @@ class HeatmapLatex extends LatexSurveyElement //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //izpis latex kode za prazen okvir oz. okvir z odgovori respondenta $tex .= $this->LatexTextBox($export_format, $textboxHeightOdgovori, $textboxWidthOdgovori, $answer, $textboxAllignment, $noBordersOdgovori); //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); //$tex .= $texNewLine; } @@ -256,13 +269,13 @@ class HeatmapLatex extends LatexSurveyElement } //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //izpis latex kode za prazen okvir oz. okvir z odgovori respondenta $tex .= $this->LatexTextBox($export_format, $textboxHeightOdgovori, $textboxWidthOdgovori, $answerRegions, $textboxAllignment, $noBordersOdgovori); //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); //$tex .= $texNewLine; } @@ -298,8 +311,8 @@ class HeatmapLatex extends LatexSurveyElement #funkcija, ki skrbi za pretvorbo stringa koordinat obmocja v polja function convertPolyString($polypoints=null){ $poly = []; - //$tmpX; - //$tmpY; + $tmpX = null; + $tmpY = null; $j = 0; $poly = explode(",", $polypoints); diff --git a/admin/survey/export/latexclasses/Vprasanja/KalkulacijaLatex.php b/admin/survey/export/latexclasses/Vprasanja/KalkulacijaLatex.php index d025c58..00bf512 100644 --- a/admin/survey/export/latexclasses/Vprasanja/KalkulacijaLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/KalkulacijaLatex.php @@ -9,7 +9,7 @@ * Datum: 05/2018 *****************************************/ - define("NAGOVOR_LINE_WIDTH", 0.5); + if (!defined("NAGOVOR_LINE_WIDTH")) define("NAGOVOR_LINE_WIDTH", 0.5); class KalkulacijaLatex extends LatexSurveyElement { diff --git a/admin/survey/export/latexclasses/Vprasanja/KvotaLatex.php b/admin/survey/export/latexclasses/Vprasanja/KvotaLatex.php index f20eef4..41fe2a4 100644 --- a/admin/survey/export/latexclasses/Vprasanja/KvotaLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/KvotaLatex.php @@ -9,7 +9,7 @@ * Datum: 05/2018 *****************************************/ - define("NAGOVOR_LINE_WIDTH", 0.5); + if (!defined("NAGOVOR_LINE_WIDTH")) define("NAGOVOR_LINE_WIDTH", 0.5); class KvotaLatex extends LatexSurveyElement { @@ -71,7 +71,7 @@ class KvotaLatex extends LatexSurveyElement //ime spremenljivke if($rowKvota['spr_id']>0){ //ce je spr_id vecji od 0 $rowVariableName = Cache::srv_spremenljivka($rowKvota['spr_id']); //pridobitev imena spremenljivke iz njenega id - $tex .= $lang['srv_vprasanje_tip_25'].'('.$rowVariableName['variable'].$this->encodeText('_').$rowVariableVrednostVrstniRed['vrstni_red'].')'; + $tex .= $lang['srv_vprasanje_tip_25'].'('.$rowVariableName['variable'].LatexDocument::encodeText('_').$rowVariableVrednostVrstniRed['vrstni_red'].')'; }else{ //drugace, ko je spr_id manjsi od 0, je negativne vrednosti, so zapisani statusi in tipi odgovorov switch ( $rowKvota['spr_id'] ){ case -1: diff --git a/admin/survey/export/latexclasses/Vprasanja/LokacijaLatex.php b/admin/survey/export/latexclasses/Vprasanja/LokacijaLatex.php index 90a40c1..ba2405a 100644 --- a/admin/survey/export/latexclasses/Vprasanja/LokacijaLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/LokacijaLatex.php @@ -111,13 +111,13 @@ class LokacijaLatex extends LatexSurveyElement #priprava odgovora respondenta - konec ####################################################################################### //zacetek tabele - $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tex .= $this->StartLatexTable($export_format, $parameterTabular, 'xltabular', 'tabular', 1, 1); //izpis latex kode za prazen okvir oz. okvir z odgovori respondenta $tex .= $this->LatexTextBox($export_format, $textboxHeightOdgovori, $textboxWidthOdgovori, $answer, $textboxAllignment, $noBordersOdgovori); //zakljucek tabele - $tex .= $this->EndLatexTable($export_format, 'tabularx', 'tabular'); + $tex .= $this->EndLatexTable($export_format, 'xltabular', 'tabular'); //$tex .= $texNewLine; } } diff --git a/admin/survey/export/latexclasses/Vprasanja/MultiGridLatex.php b/admin/survey/export/latexclasses/Vprasanja/MultiGridLatex.php index 11f4be2..e7d8347 100644 --- a/admin/survey/export/latexclasses/Vprasanja/MultiGridLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/MultiGridLatex.php @@ -10,15 +10,16 @@ *****************************************/ -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip -define("RADIO_BTN_SIZE", 0.13); -define("U_SHAPE_WIDTH_U", 4); -define("U_SHAPE_WIDTH_OKVIR", 3.62); -define("U_SHAPE_WIDTH_TEXT_U", 2.2); -define("U_SHAPE_WIDTH_TEXT_OKVIR", 1.81); -define("MAXSTEVILOSTOLPCEV", 21); //max Stevilo Stolpcev za prvo vrstico pod Drsnikom, zaradi tezav z izrisom, ce je teh vec kot toliko -define("VAS_SIZE", 0.04); //VAS_SIZE +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip + +if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13); +if (!defined('U_SHAPE_WIDTH_U')) define("U_SHAPE_WIDTH_U", 4); +if (!defined('U_SHAPE_WIDTH_OKVIR')) define("U_SHAPE_WIDTH_OKVIR", 3.62); +if (!defined('U_SHAPE_WIDTH_TEXT_U')) define("U_SHAPE_WIDTH_TEXT_U", 2.2); +if (!defined('U_SHAPE_WIDTH_TEXT_OKVIR')) define("U_SHAPE_WIDTH_TEXT_OKVIR", 1.81); +if (!defined('MAXSTEVILOSTOLPCEV')) define("MAXSTEVILOSTOLPCEV", 21); //max Stevilo Stolpcev za prvo vrstico pod Drsnikom, zaradi tezav z izrisom, ce je teh vec kot toliko +if (!defined('VAS_SIZE')) define("VAS_SIZE", 0.04); //VAS_SIZE class MultiGridLatex extends LatexSurveyElement { @@ -40,11 +41,13 @@ class MultiGridLatex extends LatexSurveyElement protected $textRVreId = array(); //belezi vre_id navpicnih odgovorov, ki so bili izbrani in morajo biti na desni strani povleci-spusti protected $navpicniOdgovoriVreId = array(); //belezi vre_id navpicnih odgovorov protected $loop_id = null; // id trenutnega loopa ce jih imamo + protected $usr_id = null; protected $path2ImagesMulti; - + protected $language; - + protected $prevod; + public function __construct() { global $site_path; @@ -68,7 +71,9 @@ class MultiGridLatex extends LatexSurveyElement #funkcija za izvoz vprasalnika za posameznega respondenta public function exportData($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype=''){ global $lang; - //echo "exportData"; + + + // iz baze preberemo vse moznosti - ko nimamo izpisa z odgovori respondenta //$sqlVrednosti = sisplet_query("SELECT id, naslov, naslov2, variable, other, spr_id FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red"); $sqlVrednosti = sisplet_query("SELECT id, naslov, naslov2, variable, other, spr_id FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' AND hidden='0' ORDER BY vrstni_red"); @@ -97,7 +102,6 @@ class MultiGridLatex extends LatexSurveyElement $texNewLineAfterTable = $texNewLine." ".$texNewLine." ".$texNewLine; if($spremenljivke['enota']==10){ //ce je image hotspot $indeksZaWhile = 1; - //echo "Indeks je ena ce je hotspot
"; } $indeksDvojnaTabela1 = 1; $indeksDvojnaTabela2 = 1; @@ -110,10 +114,10 @@ class MultiGridLatex extends LatexSurveyElement while ($colVrednost = mysqli_fetch_assoc($sqlStolpciVrednosti)){ if($colVrednost['other'] != 0){ $stringMissingOdgovor = $colVrednost['naslov']; - array_push($missingOdgovori, $this->encodeText($stringMissingOdgovor) ); //filanje polja z missing odgovori + array_push($missingOdgovori, LatexDocument::encodeText($stringMissingOdgovor, 0, 1) ); //filanje polja z missing odgovori }else{ $stringTitleCol = $colVrednost['naslov']; - array_push($vodoravniOdgovori, $this->encodeText($stringTitleCol) ); //filanje polja z vodoravnimi odgovori (po stolpcih) + array_push($vodoravniOdgovori, LatexDocument::encodeText($stringTitleCol, 0, 1) ); //filanje polja z vodoravnimi odgovori (po stolpcih) } } //pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - konec @@ -135,7 +139,7 @@ class MultiGridLatex extends LatexSurveyElement while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ $indeksZaWhile = 1; //navpicni odgovori - $stringCell_title = $this->encodeText(( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) ); + $stringCell_title = LatexDocument::encodeText(( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ), 0, 1 ); // še dodamo textbox če je polje other $_txt = ''; @@ -143,18 +147,10 @@ class MultiGridLatex extends LatexSurveyElement //$sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id='".$usr_id."' AND loop_id $loop_id"); $sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id); $row4 = mysqli_fetch_assoc($sqlOtherText); - $_txt = ' '.$row4['text']; - //if($_txt!=' '){ - //$stringCell_title .= $_txt.':'; - //} + if(isset($row4)){ + $_txt = ' '.$row4['text']; + } } - //echo "zacetek funkcije
"; - //if($spremenljivke['enota']!=10){ //ce ni image hotspot -/* if($spremenljivke['enota']!=10&&$indeksZaWhile==1){ //ce ni image hotspot - $indeksZaWhile = 1; - echo "Indeks je ena ce ni hotspot
"; - } */ - //echo "odgovor: ".$stringCell_title."
"; $IndeksZaMissing=1; @@ -166,21 +162,15 @@ class MultiGridLatex extends LatexSurveyElement $userAnswer = mysqli_fetch_assoc($sqlUserAnswer); if((count($missingOdgovori))&&($spremenljivke['tip']==19||$spremenljivke['tip']==20)){ //ce so missing-i - //echo "missing
"; $sqlUserAnswerMissing = $this->GetUsersDataGrid($spremenljivkeData, $db_table, $rowVrednost, $rowVsehVrednosti, $usr_id,0); $userAnswerMissing = mysqli_fetch_assoc($sqlUserAnswerMissing); - //echo "userAnswer Missing: ".$userAnswerMissing['grd_id'].'
'; } - //echo "rowVsehVrednosti['id']: ".$rowVsehVrednosti['id'].'
'; - //echo "userAnswer: ".$userAnswer['text'].'
'; - //echo "userAnswer: ".$userAnswer['grd_id'].'
'; - //echo "rowVrednost['spr_id']: ".$rowVrednost['spr_id'].'
'; - if($rowVsehVrednosti['id'] == $userAnswer['grd_id']){ //ce je podatek + if($rowVsehVrednosti['id'] == isset($userAnswer['grd_id'])){ //ce je podatek if($indeksDvojnaTabela1==1&&$spremenljivke['enota']==3&&in_array($spremenljivke['tip'], array(6, 16))){ //samo prvic izpisi nadnaslov 1, ce je dvojna tabela //naslov prvega dela grida za dvojno tabelo - $tex1 .= $this->encodeText($spremenljivke['grid_subtitle1']).$texNewLine; + $tex1 .= LatexDocument::encodeText($spremenljivke['grid_subtitle1'], 0, 1).$texNewLine; } if($spremenljivke['tip']==6||$spremenljivke['tip']==16){ if(($vNovoVrstico==1&&$spremenljivke['tip']==16)||$spremenljivke['tip']==6){ @@ -192,32 +182,24 @@ class MultiGridLatex extends LatexSurveyElement if($spremenljivke['tip']==16&&$indeksZaWhile!=1){ $tex1 .= ', '; } - $tex1 .= ' '.$this->encodeText($rowVsehVrednosti['naslov']); + $tex1 .= ' '.LatexDocument::encodeText($rowVsehVrednosti['naslov'], 0, 1); //$tex1 .= ' \\textcolor{crta}{'.$this->encodeText($rowVsehVrednosti['naslov']).'}'; } - //echo "Sprememba indeksa
"; $indeksZaWhile++; - $podatek = 1; - //echo "Zgornji: ".$indeksZaWhile."
"; - //echo "Zgornji: ".$indeksZaWhile." za ".$this->encodeText($rowVsehVrednosti['naslov'])."
"; - //echo "tex: ".$tex1."
"; + $podatek = 1; }else{ $podatek = 0; } - - //echo $this->encodeText($this->userAnswer['text']).'
'; if($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je grid stevilk ali besedil - //echo "Indeks missing: ".$IndeksZaMissing."
"; if(($IndeksZaMissing > ($numColSql-count($missingOdgovori)))&&(count($missingOdgovori))){ - //echo "userAnswer Missing je prisoten in njegov grd_id je: ".$userAnswerMissing['grd_id'].'
'; - $okvirZOdgovori = $this->getAnswerSymbol($export_format, $fillablePdf, 6, $spremenljivke['grids'], count($missingOdgovori), $userAnswerMissing['grd_id']); + $okvirZOdgovori = $this->getAnswerSymbol(null, $export_format, $fillablePdf, 6, $spremenljivke['grids'], count($missingOdgovori), $userAnswerMissing['grd_id']); }else{ - $okvirZOdgovori = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], count($missingOdgovori),$this->encodeText($userAnswer['text'])); + $user_answer_var = isset($userAnswer['text'])?$userAnswer['text']:''; + $okvirZOdgovori = $this->getAnswerSymbol(null, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], count($missingOdgovori), $user_answer_var); } //$okvirZOdgovori = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], count($missingOdgovori),$this->encodeText($userAnswer['text'])); - //echo "okvirZOdgovori: ".$okvirZOdgovori."
"; array_push($odgovoriRespondent, $okvirZOdgovori); } @@ -238,11 +220,7 @@ class MultiGridLatex extends LatexSurveyElement $tex2 = ''; $tex .= $tex1.$tex2; //zdruzitev obeh delov latex kode - //echo "tex: ".$tex." za ".$spremenljivke['variable']."
"; if($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je grid stevilk ali besedil - //echo "stevilo odgovorov: ".count($odgovoriRespondent)."
"; - //echo "stevilo odgovorov missing: ".count($userAnswerMissing)."
"; - //echo "stevilo odgovorov : ".count($userAnswer)."
"; return $odgovoriRespondent; }else{ return $tex; @@ -252,18 +230,23 @@ class MultiGridLatex extends LatexSurveyElement #funkcija za izvoz vprasalnika za posameznega respondenta - konec - //public function export($spremenljivke, $export_format, $questionText, $fillablePdf, $texNewLine, $export_subtype){ public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype='', $preveriSpremenljivko=null, $skipEmptySub=null, $export_data_type='', $skipEmpty=null, $loop_id=null, $language=null){ - //echo $export_data_type."
"; + $time_start = microtime(true); + $this->exportDataType = $export_data_type; global $lang; $this->language = $language; - + //preverjanje, ali je prevod + $this->prevod = $this->language?1:0; + //preverjanje, ali je prevod - konec + $this->preveriSpremenljivko = $preveriSpremenljivko; - $this->skipEmpty =$skipEmpty; + $this->skipEmpty = $skipEmpty; $this->skipEmptySub = $skipEmptySub; // Ce je spremenljivka v loopu $this->loop_id = $loop_id; + $this->usr_id = $usr_id; + // iz baze preberemo vse moznosti - ko nimamo izpisa z odgovori respondenta //$sqlVrednosti = sisplet_query("SELECT id, naslov, naslov2, variable, other, spr_id FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red"); @@ -276,9 +259,9 @@ class MultiGridLatex extends LatexSurveyElement $tex = ''; - if($export_subtype!='q_empty'&&$export_data_type!=1){ //ce ni prazen vprasalnik in izpis ni Dolg, dodaj prazno vrstico + //if($export_subtype!='q_empty'&&$export_data_type!=1){ //ce ni prazen vprasalnik in izpis ni Dolg, dodaj prazno vrstico //$tex .= '\\\\'; - } + //} $navpicniOdgovori = array(); $navpicniOdgovori = []; @@ -289,188 +272,128 @@ class MultiGridLatex extends LatexSurveyElement $missingOdgovori = array(); $missingOdgovori = []; $userAnswerData = array(); - //$textRVreId = array(); - + $indeksOdgovorovTextR = 0; $texNewLineAfterTable = $texNewLine." ".$texNewLine." ".$texNewLine; $indeksZaWhile = 1; $indeksOdgovorov = 0; - //echo "Funkcija export
"; - $nacinVnosa = $spremenljivke['ranking_k']; //nacin vnosa 0-Stevilo, 1-Drsnik + //$sqlVsehVrednsti = sisplet_query("SELECT id, naslov FROM srv_grid WHERE spr_id='".$spremenljivke['id']."' ORDER BY 'vrstni_red'"); + //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ - //$prop['full'] = ( isset($userAnswer[$rowVrednost['id']]) ); - - //$stringTitleRow = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); - - #ce je respondent odgovarjal v drugem jeziku ######################## - $rowl = $this->srv_language_vrednost($rowVrednost['id']); - if (strip_tags($rowl['naslov']) != '') $rowVrednost['naslov'] = $rowl['naslov']; - if (strip_tags($rowl['naslov2']) != '') $rowVrednost['naslov2'] = $rowl['naslov2']; - #ce je respondent odgovarjal v drugem jeziku - konec ################ - - $stringTitleRow = $rowVrednost['naslov']; //odgovori na levi strani (za tabela diferencial) - $stringTitleRow2 = $rowVrednost['naslov2']; //odgovori na desni strani (za tabela diferencial) - - array_push($navpicniOdgovori, $this->encodeText($stringTitleRow, $rowVrednost['id']) ); //filanje polja z navpicnimi odgovori (po vrsticah) - array_push($navpicniOdgovori2, $this->encodeText($stringTitleRow2, $rowVrednost['id']) ); //filanje polja z navpicnimi odgovori2 (po vrsticah) if($spremenljivke['enota']==9){ //ce je povleci-spusti array_push($this->navpicniOdgovoriVreId, $rowVrednost['id'] ); //filanje polja z vre_id navpicnih odgovorov (po vrsticah), potrebno za povleci-spusti - //array_push($this->navpicniOdgovoriVreId, $rowVrednost['spr_id'] ); //filanje polja z vre_id navpicnih odgovorov (po vrsticah), potrebno za povleci-spusti } $indeksZaWhile++; - //echo "rowVrednost['id']: ".$rowVrednost['id'].'
'; $indeksZaWhileVsehVrednosti = 1; $indeksEnaMoznostProtiDrugi = 0; //belezi stevilo odgovorov v eni vrstici za enota=4 - $sqlVsehVrednsti = sisplet_query("SELECT id, naslov FROM srv_grid WHERE spr_id='".$spremenljivke['id']."' ORDER BY 'vrstni_red'"); - //echo "začne drugi while
"; + $sqlVsehVrednsti = sisplet_query("SELECT id, naslov FROM srv_grid WHERE spr_id='".$spremenljivke['id']."' ORDER BY 'vrstni_red'"); while ($rowVsehVrednosti = mysqli_fetch_assoc($sqlVsehVrednsti)){ - //$indeksZaWhile = $this->GetUsersDataGrid($spremenljivke, $this->db_table, $rowVrednost, $rowVsehVrednosti, $this->usr_id, 1); - //$sqlUserAnswer = $this->GetUsersDataGrid($spremenljivke, $db_table, $rowVrednost, $rowVsehVrednosti, $usr_id, 0); $sqlUserAnswer = $this->GetUsersDataGrid($spremenljivke, $db_table, $rowVrednost, $rowVsehVrednosti, $usr_id, 0, $this->loop_id); - $userAnswer = mysqli_fetch_assoc($sqlUserAnswer); - //echo "userAnswer: ".$userAnswer['grd_id'].'
'; - //echo "userAnswerVreId: ".$userAnswer['vre_id'].'
'; - //echo "text: ".$userAnswer['text'].'
'; - -/* if($spremenljivke['enota']==4&&$userAnswer['grd_id']){ - $userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id']; - echo "userAnswerData: ".$userAnswerData[$indeksOdgovorov].'
'; - //echo 'je 4
'; - $indeksOdgovorov++; */ if($spremenljivke['enota']==4){ //ce je ena moznost proti drugi - //echo 'je 4 '.$indeksOdgovorov.'
'; if($userAnswer['grd_id']){ //ce je podatek, ga zabelezi $userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id']; - //echo "userAnswerData s podatkom: ".$userAnswerData[$indeksOdgovorov].'
'; - //echo 'je 4 '.$indeksOdgovorov.'
'; $indeksOdgovorov++; }else{ //drugace if($indeksEnaMoznostProtiDrugi>=1){ $userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id']; - //echo "rabim prazno polje
"; - //echo "userAnswerData brez podatka: ".$userAnswerData[$indeksOdgovorov].'
'; - //echo 'je 4 '.$indeksOdgovorov.'
'; $indeksOdgovorov++; } - //echo "indeks se spremeni
"; $indeksEnaMoznostProtiDrugi++; } - //echo "indeksEnaMoznostProtiDrugi: ".$indeksEnaMoznostProtiDrugi.'
'; - //echo "userAnswerData: ".$userAnswerData[$indeksOdgovorov].'
'; - }elseif($spremenljivke['enota']!=4){ - $userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id']; - $userAnswerDataText[$indeksOdgovorov] = $userAnswer['text']; + }elseif($spremenljivke['enota']!=4){ + $userAnswerData[$indeksOdgovorov] = isset($userAnswer['grd_id']) ? $userAnswer['grd_id'] : null; + $userAnswerDataText[$indeksOdgovorov] = isset($userAnswer['text']) ? $userAnswer['text'] : ''; if($spremenljivke['enota']==9){ //povleci spusti - $this->textRVreId[$indeksOdgovorov] = $userAnswer['vre_id']; + $this->textRVreId[$indeksOdgovorov] = isset($userAnswer['vre_id']) ? $userAnswer['vre_id'] : null; if(isset($userAnswer['vre_id'])){ //$sqlTextRString = 'SELECT naslov FROM srv_vrednost WHERE id='.$userAnswer['vre_id'].' '; - $sqlTextRString = 'SELECT naslov FROM srv_vrednost WHERE id='.$userAnswer['vre_id'].' AND hidden="0" '; - //echo $sqlTextRString."
"; + $sqlTextRString = 'SELECT naslov FROM srv_vrednost WHERE id='.(isset($userAnswer['vre_id']) ? $userAnswer['vre_id'] : null).' AND hidden="0" '; $sqlTextR = sisplet_query($sqlTextRString); $rowTextR = mysqli_fetch_assoc($sqlTextR); - //echo $rowTextR['naslov']."
"; - //echo $indeksOdgovorovTextR.'
'; - - //$this->textRArray[$indeksOdgovorovTextR] = $rowTextR['naslov']; - - //$this->textRArrayIndex[$userAnswer['grd_id']] = array($this->textRArray[$indeksOdgovorovTextR]); - //echo "this->textRArray indeks ".$userAnswer['grd_id']." ".$this->textRArrayIndex[$userAnswer['grd_id']][$indeksOdgovorovTextR].'
'; $this->textRArray[$indeksOdgovorovTextR][$userAnswer['grd_id']]=$rowTextR['naslov']; - //echo "this->textRArray: ".$this->textRArray[$indeksOdgovorovTextR][$userAnswer['grd_id']].'
'; - //echo "this->textRArray indeks ".$indeksOdgovorov." ".$textRVreId[$indeksOdgovorov].'
'; $indeksOdgovorovTextR++; } } $indeksOdgovorov++; - } - //echo "rowVrednost['spr_id']: ".$rowVrednost['spr_id'].'
'; - //echo "rowVrednost['id']: ".$rowVrednost['id'].'
'; - //echo "rowVsehVrednosti['id']: ".$rowVsehVrednosti['id'].'
'; - if($rowVsehVrednosti['id'] == $userAnswer['grd_id']){ + } + if( ($userAnswer!=null && ($rowVsehVrednosti['id'] == $userAnswer['grd_id'])) || $rowVrednost['other'] ){ $indeksZaWhileVsehVrednosti++; } if($indeksZaWhileVsehVrednosti!=1){ $userDataPresent = 1; + }else{ + $userDataPresent = 0; } - //echo "userAnswerData: ".$userAnswerData[$indeksOdgovorov].'
'; - //echo "enota: ".$spremenljivke['enota'].'
'; - //echo "indeksOdgovorov: ".$indeksOdgovorov.'
'; - //$indeksOdgovorov++; } + + #ce je respondent odgovarjal v drugem jeziku ######################## + $rowl = $this->srv_language_vrednost($rowVrednost['id']); + if ($rowl!=null && strip_tags($rowl['naslov']) != '' && !$userDataPresent) $rowVrednost['naslov'] = $rowl['naslov']; + if ($rowl!=null && strip_tags($rowl['naslov2']) != '' && !$userDataPresent) $rowVrednost['naslov2'] = $rowl['naslov2']; + #ce je respondent odgovarjal v drugem jeziku - konec ################ + + if($usr_id){ + $stringTitleRow = Common::getInstance()->dataPiping($rowVrednost['naslov'], $usr_id, $loop_id); //odgovori na levi strani (za tabela diferencial) + $stringTitleRow2 = Common::getInstance()->dataPiping($rowVrednost['naslov2'], $usr_id, $loop_id); //odgovori na desni strani (za tabela diferencial) + }else{ + $stringTitleRow = $rowVrednost['naslov']; + $stringTitleRow2 = $rowVrednost['naslov2']; + } + + array_push($navpicniOdgovori, LatexDocument::encodeText($stringTitleRow, $rowVrednost['id'], 1) ); //filanje polja z navpicnimi odgovori (po vrsticah) + array_push($navpicniOdgovori2, LatexDocument::encodeText($stringTitleRow2, $rowVrednost['id'], 1) ); //filanje polja z navpicnimi odgovori2 (po vrsticah) + } //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti - konec - - /* echo "userDataPresent: ".$userDataPresent."
"; - echo "preveriSpremenljivko: ".$preveriSpremenljivko."
"; */ - + $this->userDataPresent = $userDataPresent; - if($userDataPresent!=0||$export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ //ce je kaj v bazi ali je prazen vprasalnik ali je potrebno pokazati tudi ne odgovorjena vprasanja - //echo count($userAnswerData)." za ".$spremenljivke['id']."
"; + //if($userDataPresent!=0||$export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ //ce je kaj v bazi ali je prazen vprasalnik ali je potrebno pokazati tudi ne odgovorjena vprasanja //pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - while ($colVrednost = mysqli_fetch_assoc($sqlStolpciVrednosti)){ + while ($colVrednost = mysqli_fetch_assoc($sqlStolpciVrednosti)){ + #ce je respondent odgovarjal v drugem jeziku ######################## + $rowl = $this->srv_language_grid($colVrednost['id'],$spremenljivke['id']); + if ($rowl!=null && strip_tags($rowl['naslov']) != '' && !$userDataPresent) $colVrednost['naslov'] = $rowl['naslov']; + #ce je respondent odgovarjal v drugem jeziku - konec ################ if($colVrednost['other'] != 0){ $stringMissingOdgovor = $colVrednost['naslov']; - array_push($missingOdgovori, $this->encodeText($stringMissingOdgovor) ); //filanje polja z missing odgovori - }else{ - #ce je respondent odgovarjal v drugem jeziku ######################## - $rowl = $this->srv_language_grid($colVrednost['id'],$spremenljivke['id']); - if (strip_tags($rowl['naslov']) != '') $colVrednost['naslov'] = $rowl['naslov']; - #ce je respondent odgovarjal v drugem jeziku - konec ################ - + array_push($missingOdgovori, LatexDocument::encodeText($stringMissingOdgovor, 0, 1) ); //filanje polja z missing odgovori + }else{ $stringTitleCol = $colVrednost['naslov']; $stringTitleCol = str_replace('
','',$stringTitleCol); //odstranitev odvecnih
iz naslova stolpcev - array_push($vodoravniOdgovori, $this->encodeText($stringTitleCol) ); //filanje polja z vodoravnimi odgovori (po stolpcih) + if($usr_id){ + $stringTitleCol = Common::getInstance()->dataPiping($stringTitleCol, $usr_id, $loop_id); + } + array_push($vodoravniOdgovori, LatexDocument::encodeText($stringTitleCol, 0, 1) ); //filanje polja z vodoravnimi odgovori (po stolpcih) } } - //pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - konec + //pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - konec - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){ //ce je dolg izvoz - //pridobitev ustreznega simbola (ali podatkov) za izris odgovorov - if($spremenljivke['tip']==6){ //grid radio - //if($spremenljivke['enota']!=11){ //ce ni VAS - if($spremenljivke['enota']!=11 && $spremenljivke['enota']!=12){ //ce ni VAS in ni slikovni tip - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); - //$tex .= '{\ChoiceMenu[radio,radiosymbol=\ding{108},name=myGroupOfRadiobuttons]{}{='.$stringTitle.'}}'.$stringTitle.' '.$this->texNewLine; - //echo "simbol radio grid: ".$symbol."
"; - }else{ //drugace, ce je VAS - //$symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0, $spremenljivke['enota']); - //echo "simbol VAS: ".$symbol."
"; - //echo "simbol radio grid: ".$spremenljivke['enota']."
"; - } - $internalCellHeight = '1 cm'; //visina praznega okvirja @povleci-spusti - }else if($spremenljivke['tip']==16){ //grid checkbox - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); - $internalCellHeight = '3 cm'; //visina praznega okvirja @povleci-spusti - }else if($spremenljivke['tip']==19||$spremenljivke['tip']==20){//multi text ali multinumber + //na novo + $fillablePdf = 0; + if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){ //ce je dolg izvoz ALI ( je izvoz praznega vprasalnika ali vprasalnika s komentarji) + $internalCellHeight = '3 cm'; + if($spremenljivke['tip'] == 19 || $spremenljivke['tip'] == 20){ // ce je multitext ali multinumber + //pridobitev ustreznega simbola (ali podatkov) za izris odgovorov if($export_subtype=='q_empty'||$export_subtype=='q_comment'){ //ce je prazen vprasalnik ali vprasalnik s komentarji - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], count($missingOdgovori), 0); - //$internalCellHeight = '3 cm'; //visina praznega okvirja @povleci-spusti + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], count($missingOdgovori), 0); }else{ //ce je vprasalnik s podatki $symbol = $this->exportData($spremenljivke, $export_format, $questionText, $fillablePdf, $texNewLine, $usr_id, $db_table, $export_subtype); } - } - $this->internalCellHeight = $internalCellHeight; - //pridobitev ustreznega simbola (ali podatkov) za izris odgovorov - konec - } - - $fillablePdf = 0; - if((($spremenljivke['enota']==0)&&($spremenljivke['tip']==6||$spremenljivke['tip']==16))||($spremenljivke['tip']==19||$spremenljivke['tip']==20)){ //klasicna tabela ali multitext ali multinumber - - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - if($spremenljivke['tip']==20){ //ce je tip vprasanja stevilo + //pridobitev ustreznega simbola (ali podatkov) za izris odgovorov - konec + + if($spremenljivke['tip'] == 20){ //ce je tip vprasanja stevilo if(($nacinVnosa == 0)){ //ce je nacin vnosa Stevilo $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerDataText, $export_subtype); }else if($nacinVnosa == 1 && $export_format=='pdf'){ //ce so drsniki in je pdf @@ -478,170 +401,104 @@ class MultiGridLatex extends LatexSurveyElement }else if($nacinVnosa == 1 && $export_format=='rtf'){ //ce so drsniki in je rtf $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerDataText, $export_subtype); } - }else{ + }else{ //drugace (ce je multitext) $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); } - - }elseif($export_data_type==0||$export_data_type==2){ //ce je Skrcen izvoz - //$tex .= "Navaden ali Kratek izvoz ".$texNewLine; - //echo "export_data_type $export_data_type
"; - - $navpicniOdgovori2 = 0; - //if($spremenljivke['tip']==20){ //ce je tip vprasanja stevilo - if($spremenljivke['tip']==20 || $spremenljivke['tip']==19){ //ce je tip vprasanja multi stevilo ali multi besedilo - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerDataText, $export_subtype); - }else{ //ce je grid en in vec odgovorov - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - //$tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerDataText, $export_subtype); + }elseif($spremenljivke['tip'] == 6 || $spremenljivke['tip'] == 16){ //klasicna tabela + //pridobitev ustreznega simbola (ali podatkov) za izris odgovorov + if($spremenljivke['tip'] == 6){ //grid radio + if($spremenljivke['enota'] != 11 && $spremenljivke['enota'] != 12){ //ce ni VAS in ni slikovni tip + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); + }elseif($spremenljivke['enota'] == 11){ // ce je VAS + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0, $spremenljivke['enota'], 1, '', $spremenljivke['id']); + //$symbol = []; + //$symbol = array("\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas1}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas3}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas4}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas5}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas7}"); + } + $internalCellHeight = '1 cm'; //visina praznega okvirja @povleci-spusti + }else if($spremenljivke['tip'] == 16){ //grid checkbox + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0); + $internalCellHeight = '3 cm'; //visina praznega okvirja @povleci-spusti } - } - }elseif($spremenljivke['enota']==1){ //tabela diferencial - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - $navpicniOdgovori2 = 0; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - }elseif($spremenljivke['enota']==2 || $spremenljivke['enota']==6){ //roleta ali izberite s seznama - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - }elseif($spremenljivke['enota']==4){ //ena moznost proti drugi - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - //$tex .= "Navaden ali Kratek izvoz ".$texNewLine; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - }elseif($spremenljivke['enota']==5){ //maxdiff - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - //$tex .= "Navaden ali Kratek izvoz ".$texNewLine; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - }elseif($spremenljivke['enota']==8){ //tabela da/ne - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - //$tex .= "Navaden ali Kratek izvoz ".$texNewLine; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - - } - }elseif($spremenljivke['enota']==10){ //image hotspot - //if($export_subtype=='q_empty'){ //ce je prazen vprasalnik - //if($export_subtype=='q_empty'||$export_subtype=='q_comment'){ //ce je prazen vprasalnik - if($export_data_type==1||$export_subtype=='q_empty'||$export_subtype=='q_comment'){ //ce je prazen vprasalnik - $imageName = $this->getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); - $imageNameTest = $this->path2ImagesMulti.$imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku - //echo("za image hot spot grid: ".$imageNameTest."
"); - if(filesize($imageNameTest) > 0){ - $image = PIC_SIZE."{".$this->path2ImagesMulti."".$imageName."}"; //priprave slike predefinirane dimenzije + //pridobitev ustreznega simbola (ali podatkov) za izris odgovorov - konec + + $enote_brez_navp_odgov_2 = array(0, 2, 6, 5, 8, 3, 11, 12); //grid en in vec odgovorov, roleta, izberite s seznama, maxdiff, tabela da/ne, dvojna tabela, VAS, slikovni tip + if( in_array($spremenljivke['enota'], $enote_brez_navp_odgov_2) ){ + $navpicniOdgovori2 = 0; + } + if($spremenljivke['enota']==10){ //image hotspot + $imageName = LatexDocument::getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); + $imageNameTest = $this->path2ImagesMulti.$imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku + if(filesize($imageNameTest) > 0){ + $image = PIC_SIZE."{".$this->path2ImagesMulti."".$imageName."}"; //priprave slike predefinirane dimenzije + }else{ + $image = $lang['srv_pc_unavailable']; + } + + $tex .= $texNewLine; //prazna vrstica po vprasanju + $tex .= $image."".$texNewLine; //izris slike + + //iz baze poberi imena obmocij + $sqlHotSpotRegions = sisplet_query("SELECT region_name FROM srv_hotspot_regions WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red"); + + //izris imen obmocij po $sqlHotSpotRegions + $tex .= $lang['srv_export_hotspot_regions_names'].': '.$texNewLine; + while ($rowHotSpotRegions = mysqli_fetch_assoc($sqlHotSpotRegions)) + { + $tex .= $rowHotSpotRegions['region_name'].''.$texNewLine; + } + + //ureditev missing-ov + if(count($missingOdgovori)!=0){ //ce so missing-i + $vodoravniOdgovori = $this->AddMissingsToAnswers($vodoravniOdgovori, $missingOdgovori); + } + //ureditev missing-ov - konec + + //izris moznih odgovorov + $tex .= $lang['srv_drag_drop_answers'].': '.$texNewLine; + for($i=0; $i<$numColSql; $i++){ + $tex .= $vodoravniOdgovori[$i].$texNewLine; + } + if(($export_subtype=='q_data'||$export_subtype=='q_data_all')){ //ce je izpis respodenta + $tex .= $this->texNewLine; + $tex .= $lang['srv_respondent_answer'].": ".$this->texNewLine; + $navpicniOdgovori2 = 0; + $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); + }else{ + //prostor po izpisu, ce ni odgovorov respondenta + $tex .= '\vspace{0.5 cm}'; + $tex .= $texNewLine; + } + }elseif($spremenljivke['enota'] == 9){ //povleci spusti + $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); }else{ - //$image = 'ni slike'; - $image = $lang['srv_pc_unavailable']; - } - - $tex .= $texNewLine; //prazna vrstica po vprasanju - $tex .= $image."".$texNewLine; //izris slike - - //iz baze poberi imena obmocij - $sqlHotSpotRegions = sisplet_query("SELECT region_name FROM srv_hotspot_regions WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red"); - - //izris imen obmocij po $sqlHotSpotRegions - $tex .= $lang['srv_export_hotspot_regions_names'].': '.$texNewLine; - while ($rowHotSpotRegions = mysqli_fetch_assoc($sqlHotSpotRegions)) - { - $tex .= $rowHotSpotRegions['region_name'].''.$texNewLine; + $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); } - - //$tex .= $texNewLine; - - //ureditev missing-ov - if(count($missingOdgovori)!=0){ //ce so missing-i - $vodoravniOdgovori = $this->AddMissingsToAnswers($vodoravniOdgovori, $missingOdgovori); - } - //ureditev missing-ov - konec - - - //izris moznih odgovorov - $tex .= $lang['srv_drag_drop_answers'].': '.$texNewLine; - for($i=0; $i<$numColSql; $i++){ - $tex .= $vodoravniOdgovori[$i].$texNewLine; - } - }/* else{ //ce je vprasalnik s podatki - $tex .= $this->exportData($spremenljivke, $export_format, $questionText, $fillablePdf, $texNewLine, $usr_id, $db_table, $export_subtype); - } */ - if(($export_data_type==1||$export_data_type==0||$export_data_type==2)&&($export_subtype=='q_data'||$export_subtype=='q_data_all')){ //ce je Dolg, Navaden ali Kratek izvoz - if($export_data_type==1){ //ce je Dolg izvoz - $tex .= $this->texNewLine; - $tex .= $lang['srv_respondent_answer'].": ".$this->texNewLine; - } - - $navpicniOdgovori2 = 0; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - - //prostor po izpisu tabele - //$tex .= $texNewLine; - //$tex .= $texNewLine; - - }elseif($spremenljivke['enota']==3){ //dvojna tabela - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - $navpicniOdgovori2 = 0; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); } - }elseif($spremenljivke['enota']==9){ //povleci spusti - - //if($export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ - //if($export_data_type==1||$export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ - if($export_data_type==1||$export_subtype=='q_empty'||$export_subtype=='q_comment'||($preveriSpremenljivko&&$export_data_type==1)){ - $this->exportDataType = $export_data_type; - - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - $navpicniOdgovori2 = 0; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - }elseif($spremenljivke['enota']==11){ //VAS - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Navaden ali Kratek izvoz - $navpicniOdgovori2 = 0; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); - } - }elseif($spremenljivke['enota']==12){ //slikovni tip - if($export_data_type==1||($export_subtype=='q_empty'||$export_subtype=='q_comment')){//ce je dolg izvoz ali(prazen vprasalnik ali vpr. s komentarji) - //izris tabel ustrezne postavitve - $tex .= $this->IzrisTabeleMultiGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $symbol, $texNewLine, $texNewLineAfterTable, $export_format, 0, $missingOdgovori, $userAnswerData, $export_subtype); - }elseif($export_data_type==0||$export_data_type==2){ //ce je Skrcen izvoz - $navpicniOdgovori2 = 0; - $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); + $this->internalCellHeight = $internalCellHeight; + }elseif($export_data_type==0||$export_data_type==2){ //ce je Skrcen izvoz + if($spremenljivke['tip'] == 20 || $spremenljivke['tip'] == 19){ //ce je tip vprasanja multi stevilo ali multi besedilo + $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, 0, $export_format, $fillablePdf, $missingOdgovori, $userAnswerDataText, $export_subtype); + }elseif($spremenljivke['tip'] == 6 || $spremenljivke['tip'] == 16){ //klasicna tabela + $enote_brez_navp_odgov_2 = array(0, 3, 9, 10, 11, 12); //grid en in vec odgovorov, dvojna tabela, povleci-spusti, image hotspot, VAS, slikovni tip + if( in_array($spremenljivke['enota'], $enote_brez_navp_odgov_2) ){ + $navpicniOdgovori2 = 0; + } + $tex .= $this->IzpisOdgovorovGrid($spremenljivke, $numColSql, $numRowsSql, $vodoravniOdgovori, $navpicniOdgovori, $navpicniOdgovori2, $export_format, $fillablePdf, $missingOdgovori, $userAnswerData, $export_subtype); } } - + //na novo - konec + + //$tex .= $texNewLine; //$tex .= $this->texBigSkip; //$tex .= $this->texBigSkip; - if($export_format == 'pdf'){ //ce je pdf - //$tex .= '\\end{absolutelynopagebreak}'; //zakljucimo environment, da med vprasanji ne bo prelomov strani - }else{ //ce je rtf - - } + $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + //echo '
Total Execution Time tabele '.$execution_time.' sec za vprašanje '.strip_tags($spremenljivke['naslov']).'
'; return $tex; - } + //} + } #konec export funkcije @@ -651,8 +508,6 @@ class MultiGridLatex extends LatexSurveyElement global $lang; $skipRow = false; $izpis = ''; - - #missingi################## if(count($missingOdgovori)!=0){ //ce so missingi, jih je potrebno dodati polju z odgovori po stolpcih ($vodoravniOdgovori) for($m=0;$m $vodoravniOdgovor){ //za vsak odgovor v vrstici - echo $vodoravniOdgovor."
"; - //echo $key."
"; - } */ - // - /* foreach($data AS $key => $datum){ //za vsak odgovor v vrstici - echo "Podatek: ".$datum."
"; - //echo $key."
"; - } */ $z = $j = $i = 0; @@ -721,7 +565,6 @@ class MultiGridLatex extends LatexSurveyElement } foreach($navpicniOdgovori AS $key => $navpicniOdgovor){ //za vsak odgovor v vrstici - //echo $navpicniOdgovor.": "; #Ce imamo nastavljeno preskakovanje podvprasanj preverimo ce je kaksen odgovor v vrstici ############################### if($this->skipEmptySub == 1){ $skipRow = true; @@ -729,7 +572,6 @@ class MultiGridLatex extends LatexSurveyElement if(isset($data[$z])){ //ce je podatek $skipRow = false; } - //echo "surov podatek: ".$data[$z]."
"; } } #Ce imamo nastavljeno preskakovanje podvprasanj preverimo ce je kaksen odgovor v vrstici - konec ####################### @@ -758,8 +600,8 @@ class MultiGridLatex extends LatexSurveyElement if($spremenljivke['enota']==4){ //ce je ena proti drugi $steviloStolpcev = 1; } + $indeksOdgovor2 = 0; foreach($navpicniOdgovori AS $key => $navpicniOdgovor){ //za vsak odgovor v vrstici - //echo $navpicniOdgovor.": "; #Ce imamo nastavljeno preskakovanje podvprasanj preverimo ce je kaksen odgovor v vrstici ############################### if($this->skipEmptySub == 1){ $skipRow = true; @@ -767,25 +609,24 @@ class MultiGridLatex extends LatexSurveyElement if(isset($data[$z])){ //ce je podatek $skipRow = false; } - //echo "surov podatek: ".$data[$z]."
"; } } #Ce imamo nastavljeno preskakovanje podvprasanj preverimo ce je kaksen odgovor v vrstici - konec ####################### - $steviloSlikovnihIkon = 0; //belezi stevilo slikovnih ikon if(!$skipRow){ - //$izpis .= ' \hspace*{0.25\textwidth} '; //da je indent do 25 % sirine strani if($spremenljivke['enota']!=4){ - $izpis .= $navpicniOdgovor.": "; + if($spremenljivke['enota']==1){ //ce je diferencial + $izpis .= $navpicniOdgovor."/".$navpicniOdgovori2[$indeksOdgovor2].": "; + }else{ + $izpis .= $navpicniOdgovor.": "; + } } $odgovorPrisoten = 0; //zastavica za ureditev izpisa vejice, ko je vec odgovorov v eni vrstici for($j=$j;$j<($steviloStolpcev*($key+1));$j++){ - //echo $j.' '; - //echo "surov podatek: ".$data[$j]."
"; if($spremenljivke['enota']==4){ //ce je ena proti drugi if($data[$j]==2){ $odgovorEnaProtiDrugi = '\\textcolor{crta}{'.$navpicniOdgovori2[$key].'}'; @@ -793,74 +634,21 @@ class MultiGridLatex extends LatexSurveyElement $odgovorEnaProtiDrugi = '\\textcolor{crta}{'.$navpicniOdgovor.'}'; } $izpis .= $odgovorEnaProtiDrugi; - }/* elseif($spremenljivke['enota']==11){ //ce je VAS - //echo "surov podatek: ".$data[$j]."
"; - //echo "stevilo stolpcev VAS: ".$steviloStolpcev."
"; - //$izpis .= "smily "; - if($data[$j]){ - //$symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0, $spremenljivke['enota'], $data[$j]); - //$VASNumber = $data[$j]; - ########## - switch ($steviloStolpcev) { - case 1: - $VAS = ""; - break; - case 2: - $arrayVAS = ['vas3checked', 'vas5checked']; - break; - case 3: - $arrayVAS = ['vas3checked', 'vas4checked', 'vas5checked']; - break; - case 4: - $arrayVAS = ['vas2checked', 'vas3checked', 'vas5checked', 'vas6checked']; - break; - case 5: - $arrayVAS = [ 'vas2checked', 'vas3checked', 'vas4checked', 'vas5checked', 'vas6checked']; - break; - case 6: - $arrayVAS = ['vas1checked', 'vas2checked', 'vas3checked', 'vas5checked', 'vas6checked', 'vas7checked']; - break; - case 7: - $arrayVAS = ['vas1checked', 'vas2checked', 'vas3checked', 'vas4checked', 'vas5checked', 'vas6checked', 'vas7checked']; - break; - } - - ########## - if($steviloStolpcev > 1){ - $VAS = $arrayVAS[($data[$j]-1)]; - $symbol = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}"; - } - - $izpis .= $symbol; - // echo "symbol za VAS odgovor: ".$symbol."
"; - } - } elseif($spremenljivke['enota']==12){ //ce je slikovni tip - if($data[$j]){ //ce je podatek - $steviloSlikovnihIkon = $data[$j]; - //echo "stevilo slikovnih ikon: ".$steviloSlikovnihIkon."
"; - //echo "_______________________
"; - } - }*/else{ + }else{ if($i==$steviloStolpcev){ $i=0; } - /* echo "tip: ".$spremenljivke['tip']."
"; - echo "enota: ".$spremenljivke['enota']."
"; */ if(isset($data[$j])){ //ce je podatek - //echo $vodoravniOdgovori[$i].", "; - //echo $data[$j].", "; if($odgovorPrisoten==0){ $odgovorPrisoten = 1; }else{ - //}elseif($odgovorPrisoten==1){ $izpis .= ", "; } - //if($spremenljivke['tip']==20){ //ce je tip vprasanja stevilo if($spremenljivke['tip']==20||$spremenljivke['enota']==11||$spremenljivke['enota']==12){ //ce je tip vprasanja stevilo ALI VAS ALI slikovni tip $izpis .= '\\textcolor{crta}{'.$data[$j].'}'; }else{ if($spremenljivke['tip']==19){ //ce je tip vprasanja besedilo - $izpis .= '\\textcolor{crta}{'.$data[$j].'}'; + $izpis .= '\\textcolor{crta}{'.LatexDocument::encodeText($data[$j]).'}'; }else{ $izpis .= '\\textcolor{crta}{'.$vodoravniOdgovori[$i].'}'; } @@ -875,20 +663,18 @@ class MultiGridLatex extends LatexSurveyElement } if($spremenljivke['enota']==12){ //ce je slikovni tip, izpisi ustrezno stevilo simbololov $prviOdgovorSlikovniTip = 1; - //echo "izpis kode: ".$izpis."
"; for($p=0; $p<$steviloSlikovnihIkon; $p++){ $izpis .= ICON_SIZE."{".$this->path2Images."".$this->getCustomRadioSymbol($spremenljivke['id'], $prviOdgovorSlikovniTip)."}"; } $izpis .= $this->texNewLine; } + $indeksOdgovor2++; } } //konec, ce ni dvojna tabela + $izpis .= '\vspace{0.5 cm}'; $izpis .= $this->texNewLine; - /* if($spremenljivke['enota']==3){ - echo $izpis; - } */ return $izpis; } #funkcija, ki skrbi za izpis odgovor za grid vprasanja - konec ######################################################################## @@ -896,19 +682,32 @@ class MultiGridLatex extends LatexSurveyElement #funkcija, ki skrbi za izris Grida radio buttonov ali checkboxov za klasicno postavitev tabele ################################ function IzrisTabeleMultiGrid($spremenljivke=null, $steviloStolpcev=null, $steviloVrstic=null, $vodoravniOdgovori=null, $navpicniOdgovori=null, $navpicniOdgovori2=null, $simbolTex=null, $texNewLine='', $texNewLineAfterTable=null, $typeOfDocument=null, $fillablePdf=null, $missingOdgovori=null, $data=null, $export_subtype=''){ global $lang; - $spremenljivkaParams = new enkaParameters($spremenljivke['params']); $isCheckBox = 0; $enota = $spremenljivke['enota']; + + //ce je prevod, naj pobere prevedene razlicice podnaslovov + $rowl1 = $this->srv_language_grid(1,$spremenljivke['id']); + if ($rowl1) { + if (strip_tags($rowl1['podnaslov']) != ''){ + $spremenljivke['grid_subtitle1'] = $rowl1['podnaslov']; + } + } + + $rowl2 = $this->srv_language_grid(2,$spremenljivke['id']); + if ($rowl2) { + if (strip_tags($rowl2['podnaslov']) != '') $spremenljivke['grid_subtitle2'] = $rowl2['podnaslov']; + } + //ce je prevod, naj pobere prevedene razlicice podnaslovov - konec + $podnaslov1 = $spremenljivke['grid_subtitle1']; //podnaslova @dvojna tabela $podnaslov2 = $spremenljivke['grid_subtitle2']; + $trak = ($spremenljivkaParams->get('diferencial_trak') ? $spremenljivkaParams->get('diferencial_trak') : 0); $customColumnLabelOption = ($spremenljivkaParams->get('custom_column_label_option') ? $spremenljivkaParams->get('custom_column_label_option') : 1); //1 - "vse" labele, 2 - "le koncne" labele, 3 - "koncne in vmesna" labele - - //$radioButtonTex = ($export_format=='pdf'?"{\Large $\ocircle$}" : "\\includegraphics[scale=".RADIO_BTN_SIZE."]{radio}"); - //ce je izbrana oblika traku, poberi potrebne parametre spremenljivke ################## + $trakStartingNumber = null; if($trak == 1){ //stevilo s katerim se zacenja trak $trakStartingNumber = ($spremenljivkaParams->get('diferencial_trak_starting_num') ? $spremenljivkaParams->get('diferencial_trak_starting_num') : 0); @@ -926,101 +725,8 @@ class MultiGridLatex extends LatexSurveyElement } //ce je izbrana oblika traku, poberi potrebne parametre spremenljivke - konec ########## - //echo "Grids: ".$spremenljivke['grids']." "; - //echo "Stevilo stolpcev: ".$steviloStolpcev." "; - - //ureditev stevila stolpcev (za parametre tabele in nadaljnji izris) glede na izbrano postavitev ################################################# - - //if(($enota == 0||$enota == 3)||$spremenljivke['tip']==19||$spremenljivke['tip']==20){ //klasika ali dvojna tabela ali je multitext ali multinumber - //if(($enota == 0||$enota == 3 || $enota == 11)||$spremenljivke['tip']==19||$spremenljivke['tip']==20){ //klasika ali dvojna tabela ali je multitext ali multinumber ali VAS - if(($enota == 0||$enota == 3 || $enota == 11 || $enota == 12)||$spremenljivke['tip']==19||$spremenljivke['tip']==20){ //klasika ali dvojna tabela ali je multitext ali multinumber ali VAS ali slikovni tip - //if($trak == 0 || $enota == 3 || ($trak == 1 && $spremenljivke['tip'] == 16)){ - if(($trak == 0 || $enota == 3 || ($trak == 1 && $spremenljivke['tip'] == 16))||($spremenljivke['tip']==19||$spremenljivke['tip']==20)){ - $steviloStolpcevParameterTabular = $steviloStolpcev = $steviloStolpcev + 1; //ker je prvi stolpec prazen, je potrebno dodati + 1 - }elseif($trak == 1 && $enota == 0 && $spremenljivke['tip'] == 6){ - $steviloStolpcevParameterTabular = $steviloStolpcev + 1; - } - }elseif($enota == 1){ //diferencial - if($trak == 0){ //ce ni na traku - //$steviloStolpcevParameterTabular = $steviloStolpcev = $steviloStolpcev + 2; //ker sta prvi in zadnji stolpec prazna, je potrebno dodati + 2 - if(count($missingOdgovori)!=0){ //ce so missingi - $steviloStolpcevParameterTabular = $steviloStolpcev + 2; //ker sta prvi in zadnji stolpec prazna, je potrebno dodati + 2 - $steviloStolpcev = $steviloStolpcev + 2 - count($missingOdgovori); - }else{ - $steviloStolpcevParameterTabular = $steviloStolpcev = $steviloStolpcev + 2; //ker sta prvi in zadnji stolpec prazna, je potrebno dodati + 2 - } - }else{ //ce je na traku - $steviloStolpcevParameterTabular = $steviloStolpcev + 2; - $steviloStolpcev = $steviloStolpcev + 2 + count($missingOdgovori); - } - }elseif($enota == 2 || $enota == 6){ //roleta ali izberite s seznama - $steviloStolpcevParameterTabular = 2; //pri roleti sta potrebna le dva stolpca - if(count($missingOdgovori)!=0){ //ce so missingi - $steviloStolpcev = $spremenljivke['grids'] + count($missingOdgovori) + 1; //+1, ker se pri izrisu indeks zacne z 1 - } - }elseif($enota == 4){ //ena moznost proti drugi - $steviloStolpcevParameterTabular = 5; - if(count($missingOdgovori)!=0){ - $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular+count($missingOdgovori); - $steviloStolpcev = $steviloStolpcev-count($missingOdgovori); - } - }elseif($enota == 5){ //maxdiff - $steviloStolpcevParameterTabular = 3; - if(count($missingOdgovori)!=0){ - $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular+count($missingOdgovori); - $steviloStolpcev = $steviloStolpcev-count($missingOdgovori); - } - }elseif($enota == 8){ //tabela da/ne - $steviloStolpcevParameterTabular = $steviloStolpcev = 3; - if(count($missingOdgovori)!=0){ - $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular+count($missingOdgovori); - $steviloStolpcev = $steviloStolpcev+count($missingOdgovori); - } - } - //echo $steviloStolpcev.'
'; - //ureditev stevila stolpcev (za parametre tabele in nadaljnji izris) glede na izbrano postavitev - konec ################################################# - - //ureditev parametrov za tabelo ################################################################################################# - $parameterTabular = ''; - for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){ - //ce je prvi stolpec in ni "ena moznost proti drugi" ALI je zadnji stolpec (pred missing-i) in je "diferencial" ali "ena moznost proti drugi" z missing-i - if( ($i == 0 && $enota != 4) || ($i == $spremenljivke['grids']+1 && $enota == 1) || (($i == $spremenljivke['grids']+2 && $enota == 4)&&(count($missingOdgovori)!=0)) ) { - //$parameterTabular .= ($typeOfDocument == 'pdf' ? 'X' : 'l'); //leva poravnava stolpca - //if($enota == 0 || $enota == 1 || $enota == 3){ //ce je "klasicna tabela" ali diferencial ali dvojna tabela - //if($enota == 0 || $enota == 1 || $enota == 3 || $enota == 11){ //ce je "klasicna tabela" ali diferencial ali dvojna tabela ali VAS - if($enota == 0 || $enota == 1 || $enota == 3 || $enota == 11 || $enota == 12){ //ce je "klasicna tabela" ali diferencial ali dvojna tabela ali VAS ali slikovni tip - if($enota == 1){ //ce je diferencial - if($i == 0){ //ce je prvi stolpec - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'A' : 'l'); //leva poravnava stolpca fiksne sirine - }elseif($i == $spremenljivke['grids']+1){ //ce je zadnji stolpec - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'R' : 'r'); //desna poravnava stolpca fiksne sirine - } - }else{ - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'A' : 'l'); //leva poravnava stolpca fiksne sirine - } - }else{ - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'X' : 'l'); //leva poravnava stolpca prilagojena sirini - } - }elseif($i == $spremenljivke['grids']+2 && $enota == 4){ //ce je zadnji stolpec in je "ena moznost proti drugi" brez missing-ov - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'r' : 'r'); //desna poravnava - } - elseif($i == 0 && $enota == 4){ //ce je prvi stolpec in "ena moznost proti drugi" - //$parameterTabular .= ($typeOfDocument == 'pdf' ? 'r' : 'r'); //desna poravnava stolpca - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'l' : 'l'); //leva poravnava prvega stolpca - }elseif($i == (intval($steviloStolpcev/2)) && $enota == 3){ //ce smo na sredini stolpcev in je dvojna tabela - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'C|' : 'c|'); //sredinska poravnava stolpca - }elseif($i == ($steviloStolpcev) && $enota == 5){ //ce je zadnji stolpec in je maxdiff - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'R' : 'r'); //desna za pdf in sredinska poravnava stolpca za rtf - }else{ - $parameterTabular .= ($typeOfDocument == 'pdf' ? 'C' : 'c'); //sredinska poravnava stolpca - } - } - //ureditev parametrov za tabelo - konec ########################################################################################## - //echo 'Param: '.$parameterTabular.' enota param: '.$enota.'
'; - //izpis tabela $tabela = ''; - //echo $enota; #IZPIS ZA POVLECI SPUSTI if($enota == 9){ //ce je povleci spusti @@ -1036,9 +742,9 @@ class MultiGridLatex extends LatexSurveyElement #pred zacetkom tabel za povleci spusti####################################################################### //prva vrstica pred tabelo z odgovori if($typeOfDocument == 'pdf'){ //ce je pdf - $tabela .= '\keepXColumns\begin{tabularx}{0.45\textwidth}{C} '; //izris s tabelo + $tabela .= '\keepXColumns\begin{xltabular}{0.45\textwidth}{C} '; //izris s tabelo $tabela .= $lang['srv_ranking_available_categories'].': '.$texNewLine; - $tabela .= '\rule{0.4\textwidth}{0.7 pt} \end{tabularx}'; + $tabela .= '\rule{0.4\textwidth}{0.7 pt} \end{xltabular}'; }else{ //ce je rtf $tabela .= '\begin{tabular}{l} '; //izris z enostolpicno tabelo $tabela .= $lang['srv_ranking_available_categories'].': '.$texNewLine; //Razpolozljive kategorije @@ -1055,7 +761,7 @@ class MultiGridLatex extends LatexSurveyElement //zacetek tabele if($typeOfDocument == 'pdf'){ //ce je pdf - $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabularL, 'tabularx', 'tabular*', 0.45, 0.2); + $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabularL, 'xltabular', 'tabular*', 0.45, 0.2); } //argumenti za leve okvirje @@ -1065,7 +771,6 @@ class MultiGridLatex extends LatexSurveyElement //izris notranjosti leve tabele - //if($this->exportDataType){ //ce je dolg izpis izvoza odgovorov respondenta/respondentov if($this->exportDataType&&$spremenljivke['tip']==6){ //ce je dolg izpis izvoza odgovorov respondenta/respondentov in je tabela en odgovor //najdi razlike med poljema, kjer se belezijo vre_id odgovorov iz leve in desni strani @ povleci-spusti $navpicniOdgovori = array(); @@ -1079,7 +784,7 @@ class MultiGridLatex extends LatexSurveyElement $sqlTextL = sisplet_query($sqlTextLString); $rowTextL = mysqli_fetch_assoc($sqlTextL); - array_push($navpicniOdgovori, $this->encodeText($rowTextL['naslov'])); + array_push($navpicniOdgovori, LatexDocument::encodeText($rowTextL['naslov'], 0, 1)); } } } @@ -1113,7 +818,7 @@ class MultiGridLatex extends LatexSurveyElement //zakljucek tabele if($typeOfDocument == 'pdf'){ //ce je pdf - $tabela .= $this->EndLatexTable($typeOfDocument, 'tabularx', 'tabular*'); + $tabela .= $this->EndLatexTable($typeOfDocument, 'xltabular', 'tabular*'); } #tabela s kategorijami odgovorov iz levega okvirja - konec ################################################################## @@ -1123,12 +828,11 @@ class MultiGridLatex extends LatexSurveyElement #pred zacetkom "desne" tabele za povleci spusti####################################################################### //prva vrstica pred tabelo z odgovori if($typeOfDocument == 'pdf'){ //ce je pdf - $tabela .= '\keepXColumns\begin{tabularx}{0.45\textwidth}{C} '; //izris s tabelo + $tabela .= '\keepXColumns\begin{xltabular}{0.45\textwidth}{C} '; //izris s tabelo $tabela .= $lang['srv_drag_drop_answers'].': '.$texNewLine; - $tabela .= '\rule{0.4\textwidth}{0.7 pt} \end{tabularx}'; + $tabela .= '\rule{0.4\textwidth}{0.7 pt} \end{xltabular}'; }else{ //ce je rtf $tabela .= '\begin{tabular}{l} '; //izris z enostolpicno tabelo - //$tabela .= $lang['srv_ranking_available_categories'].': '.$texNewLine; //Razpolozljive kategorije $tabela .= $lang['srv_drag_drop_answers'].': '.$texNewLine; //Razpolozljive kategorije $tabela .= '\hline \end{tabular} '; } @@ -1163,13 +867,7 @@ class MultiGridLatex extends LatexSurveyElement $texSmallSkip = ''; $textDV = $vodoravniOdgovori[$i]; //besedilo odgovora v okvirju //izpis latex kode za okvir z odgovorom - //$textRIzpis .= ' '.$textDV.' '.$this->texNewLine.' \hline'; - - //$textRIzpis .= ' '.$textDV; $textNaslovOkvir .= ' '.$textDV; - - //$tabela .= $texNewLine; - //$tabela .= '\indent '; }else{ //drugace, ce je oblika skatle (prazen okvir na vrhu+tekst spodaj) $texSmallSkip = $this->texSmallSkip; } @@ -1183,14 +881,15 @@ class MultiGridLatex extends LatexSurveyElement $jeOdgovor = 1; if(!$izpisano){ foreach($this->textRArray AS $indeksTextRArray => $textR){ - if($this->textRArray[$indeksTextRArray][$datum]){ - $textR = $this->encodeText($textR[$datum]); - $textR = $tableCentering.' '.$textR; - //$textRIzpis .= '\fbox{\parbox{0.2\textwidth}{'.$textR.'}} '.$texSmallSkip.' '.$this->texNewLine; //zacetna varianta - $textIzpis .= ' \vspace{0.5\baselineskip} '; - $textIzpis .= '\fbox{\parbox{0.2\textwidth}{'.$textR.'}} '.$texSmallSkip.' '.$this->texNewLine; - //$textRIzpis .= ' \hline \fbox{\parbox{0.2\textwidth}{'.$textR.'}} '.$texSmallSkip.' '.$this->texNewLine; - $izpisano = 1; + if(array_key_exists($datum, $this->textRArray) && array_key_exists($indeksTextRArray, $this->textRArray)){ + if(isset($this->textRArray[$indeksTextRArray][$datum])){ + //$textR = Common::getInstance()->dataPiping($textR[$datum], $this->usr_id, $this->loop_id); + $textR = LatexDocument::encodeText($textR[$datum]); + $textR = $tableCentering.' '.$textR; + $textIzpis .= ' \vspace{0.5\baselineskip} '; + $textIzpis .= '\fbox{\parbox{0.2\textwidth}{'.$textR.'}} '.$texSmallSkip.' '.$this->texNewLine; + $izpisano = 1; + } } } }else{ @@ -1227,9 +926,8 @@ class MultiGridLatex extends LatexSurveyElement //izpis latex kode za okvir (brez obrobe oz. fbox) z odgovorom //$tabela .= ' \indent \parbox{0.2\textwidth}{ '.$tableCentering.' '.$vodoravniOdgovori[$i].' } '.$texNewLine; $tabela .= ' \parbox{0.2\textwidth}{ '.$tableCentering.' '.$vodoravniOdgovori[$i].' } '.$texNewLine; - $tabela .= '\end{tabularx}'; //konec tabele, ki se je zacela pri izpisu skatle + $tabela .= '\end{xltabular}'; //konec tabele, ki se je zacela pri izpisu skatle } - //echo "TABELA TEX: ".$tabela."
"; }elseif($typeOfDocument == 'rtf'){ if($i != 0){ //ce ni prvi, dodaj prostor $tabela .= ' '.$this->texBigSkip; @@ -1244,7 +942,7 @@ class MultiGridLatex extends LatexSurveyElement if(!$izpisano){ foreach($this->textRArray AS $indeksTextRArray => $textR){ if($this->textRArray[$indeksTextRArray][$datum]){ - $textR = $this->encodeText($textR[$datum]); + $textR = LatexDocument::encodeText($textR[$datum]); $textR = $tableCentering.' '.$textR; $textRIzpis .= '\fbox{\parbox{0.2\textwidth}{'.$textR.'}} '.$this->texNewLine; $izpisano = 1; @@ -1287,16 +985,98 @@ class MultiGridLatex extends LatexSurveyElement } #IZPIS ZA POVLECI SPUSTI - KONEC - - if($enota != 9){ //ce ni povleci spusti + if($enota != 9){ //ce ni povleci spusti + //ureditev stevila stolpcev (za parametre tabele in nadaljnji izris) glede na izbrano postavitev ################################################# + + if(($enota == 0||$enota == 3 || $enota == 11 || $enota == 12)||$spremenljivke['tip']==19||$spremenljivke['tip']==20){ //klasika ali dvojna tabela ali je multitext ali multinumber ali VAS ali slikovni tip + if(($trak == 0 || $enota == 3 || ($trak == 1 && $spremenljivke['tip'] == 16))||($spremenljivke['tip']==19||$spremenljivke['tip']==20)){ + $steviloStolpcevParameterTabular = $steviloStolpcev = $steviloStolpcev + 1; //ker je prvi stolpec prazen, je potrebno dodati + 1 + if(count($missingOdgovori)!=0){ //ce so missingi + $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular + 1; + } + }elseif($trak == 1 && $enota == 0 && $spremenljivke['tip'] == 6){ + $steviloStolpcevParameterTabular = $steviloStolpcev + 1; + } + }elseif($enota == 1){ //diferencial + if($trak == 0){ //ce ni na traku + //$steviloStolpcevParameterTabular = $steviloStolpcev = $steviloStolpcev + 2; //ker sta prvi in zadnji stolpec prazna, je potrebno dodati + 2 + if(count($missingOdgovori)!=0){ //ce so missingi + $steviloStolpcevParameterTabular = $steviloStolpcev + 2; //ker sta prvi in zadnji stolpec prazna, je potrebno dodati + 2 + $steviloStolpcev = $steviloStolpcev + 2 - count($missingOdgovori); + }else{ + $steviloStolpcevParameterTabular = $steviloStolpcev = $steviloStolpcev + 2; //ker sta prvi in zadnji stolpec prazna, je potrebno dodati + 2 + } + }else{ //ce je na traku + $steviloStolpcevParameterTabular = $steviloStolpcev + 2; + $steviloStolpcev = $steviloStolpcev + 2 + count($missingOdgovori); + } + }elseif($enota == 2 || $enota == 6){ //roleta ali izberite s seznama + $steviloStolpcevParameterTabular = 2; //pri roleti sta potrebna le dva stolpca + if(count($missingOdgovori)!=0){ //ce so missingi + $steviloStolpcev = $spremenljivke['grids'] + count($missingOdgovori) + 1; //+1, ker se pri izrisu indeks zacne z 1 + } + }elseif($enota == 4){ //ena moznost proti drugi + $steviloStolpcevParameterTabular = 5; + if(count($missingOdgovori)!=0){ + $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular+count($missingOdgovori); + $steviloStolpcev = $steviloStolpcev-count($missingOdgovori); + } + }elseif($enota == 5){ //maxdiff + $steviloStolpcevParameterTabular = 3; + if(count($missingOdgovori)!=0){ + $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular+count($missingOdgovori); + $steviloStolpcev = $steviloStolpcev-count($missingOdgovori); + } + }elseif($enota == 8){ //tabela da/ne + $steviloStolpcevParameterTabular = $steviloStolpcev = 3; + if(count($missingOdgovori)!=0){ + $steviloStolpcevParameterTabular = $steviloStolpcevParameterTabular+count($missingOdgovori); + $steviloStolpcev = $steviloStolpcev+count($missingOdgovori); + } + } + //ureditev stevila stolpcev (za parametre tabele in nadaljnji izris) glede na izbrano postavitev - konec ################################################# + + //ureditev parametrov za tabelo ################################################################################################# + $parameterTabular = ''; + for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){ + //ce je prvi stolpec in ni "ena moznost proti drugi" ALI je zadnji stolpec (pred missing-i) in je "diferencial" ali "ena moznost proti drugi" z missing-i + if( ($i == 0 && $enota != 4) || ($i == $spremenljivke['grids']+1 && $enota == 1) || (($i == $spremenljivke['grids']+2 && $enota == 4)&&(count($missingOdgovori)!=0)) ) { + if($enota == 0 || $enota == 1 || $enota == 3 || $enota == 11 || $enota == 12){ //ce je "klasicna tabela" ali diferencial ali dvojna tabela ali VAS ali slikovni tip + if($enota == 1){ //ce je diferencial + if($i == 0){ //ce je prvi stolpec + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'A' : 'l'); //leva poravnava stolpca fiksne sirine + }elseif($i == $spremenljivke['grids']+1){ //ce je zadnji stolpec + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'R' : 'r'); //desna poravnava stolpca fiksne sirine + } + }else{ + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'A' : 'l'); //leva poravnava stolpca fiksne sirine + } + }else{ + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'X' : 'l'); //leva poravnava stolpca prilagojena sirini + } + }elseif($i == $spremenljivke['grids']+2 && $enota == 4){ //ce je zadnji stolpec in je "ena moznost proti drugi" brez missing-ov + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'r' : 'r'); //desna poravnava + } + elseif($i == 0 && $enota == 4){ //ce je prvi stolpec in "ena moznost proti drugi" + //$parameterTabular .= ($typeOfDocument == 'pdf' ? 'r' : 'r'); //desna poravnava stolpca + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'l' : 'l'); //leva poravnava prvega stolpca + }elseif($i == (intval($steviloStolpcev/2)) && $enota == 3){ //ce smo na sredini stolpcev in je dvojna tabela + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'C|' : 'c|'); //sredinska poravnava stolpca + }elseif($i == ($steviloStolpcev) && $enota == 5){ //ce je zadnji stolpec in je maxdiff + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'R' : 'r'); //desna za pdf in sredinska poravnava stolpca za rtf + }else{ + $parameterTabular .= ($typeOfDocument == 'pdf' ? 'C' : 'c'); //sredinska poravnava stolpca + } + } + //ureditev parametrov za tabelo - konec ########################################################################################## #ZACETEK MAIN TABELE ######################################################################### - $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabular, 'tabularx', 'tabular', 1, 1); + $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabular, 'xltabular', 'tabular', 1, 1); #nad prvo vrstico, ampak se vedno v tabeli - naslovi trakov, podnaslovi dvojne tabele ################################################ if( ($enota == 3) && ($podnaslov1 || $podnaslov2) ){ //ce je dvojna tabela in sta prisotna podnaslova $tabela .= ' & \multicolumn{'.intval($steviloStolpcev/2).'}{c}{'.$podnaslov1.'} & \multicolumn{'.intval($steviloStolpcev/2).'}{c}{'.$podnaslov2.'} '.$texNewLine; - //$tabela .= ' & \multicolumn{'.intval($steviloStolpcev/2).'}{c}{'.$podnaslov1.'} & \multicolumn{'.intval($steviloStolpcev/2).'}{c}{'.$podnaslov2.'} '; + //$tabela .= ' & \multicolumn{'.intval($steviloStolpcev/2).'}{c}{'.$podnaslov1.'} & \multicolumn{'.intval($steviloStolpcev/2).'}{c}{'.$podnaslov2.'} '; }elseif($trak == 1 && $spremenljivke['tip'] == 6 && ($enota == 0 || $enota == 1)){ //ce imamo obliko traku, uredi nadnaslove traka if($spremenljivke['grids']%$trakNumOfTitles == 0){ //ce je stevilo stolpcev deljivo s trenutnim izbranim stevilom nadnaslovov for($i=0; $i<$trakNumOfTitles; $i++){ @@ -1351,7 +1131,6 @@ class MultiGridLatex extends LatexSurveyElement if($enota == 1){ //ce je diferencial tabela $tabela .= ' & '; } - //echo $tabela; //missingi if(count($missingOdgovori)!=0 && ($enota==0||$enota==1)){ //ce so missingi in (je klasicna tabela ali diferencial) @@ -1363,7 +1142,6 @@ class MultiGridLatex extends LatexSurveyElement } #nad prvo vrstico, ampak se vedno v tabeli - konec####################################################### - //echo $steviloStolpcev."
"; //ureditev missing-ov za tabela da/ne, klasicna ali dvojna tabela ############################# if($enota==8){ //ce je tabela da/ne @@ -1381,21 +1159,17 @@ class MultiGridLatex extends LatexSurveyElement } } } -/* for($m=0;$m'; - } */ + } //ureditev missing-ov za tabela da/ne, klasicna ali dvojna tabela - konec ##################### + #prva vrstica tabele #################################################################################### $tabela .= $this->LatexPrvaVrsticaMultiGrid($steviloStolpcev, $enota, $trak, $customColumnLabelOption, $spremenljivke, $vodoravniOdgovori, $missingOdgovori); #prva vrstica tabele - konec ################################################################################## - - if($enota!=2 && $enota!=6){ //ce ni roleta in izberite s seznama in ena moznost proti drugi + if(($enota!=2 && $enota!=6)||($enota==2&&$spremenljivke['tip']==19)){ //ce ni roleta in izberite s seznama in ena moznost proti drugi $tabela .= $texNewLine; //skok v drugo vrstico, kjer se zacnejo navpicni odgovori } - - //echo "koda za tabelo: ".$tabela."
"; //preureditev stevila stolpcev za pravilen izris#################################### if($enota == 1){ //ce je diferencial tabela @@ -1412,11 +1186,7 @@ class MultiGridLatex extends LatexSurveyElement if(($enota == 0) && count($missingOdgovori)!=0){ //ce je klasicna tabela in so missingi //$steviloStolpcev = $steviloStolpcev + count($missingOdgovori); - } - - //echo $steviloStolpcev.'
'; - //echo $spremenljivke['grids'].'
'; - + } //preureditev stevila stolpcev za pravilen izris - konec ############################ //ureditev missing-ov za roleta in izberite iz seznama ############################## @@ -1426,23 +1196,18 @@ class MultiGridLatex extends LatexSurveyElement } } //ureditev missing-ov za roleta in izberite iz seznama - konec ###################### - - #izris vrstic tabele - $trakStartingNumberTmp = null; - //$tabela .= $this->LatexVrsticeMultigrid($steviloVrstic, $typeOfDocument, $enota, $simbolTex, $navpicniOdgovori, $trakStartingNumberTmp, $fillablePdf, $steviloStolpcev, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, $navpicniOdgovori2, $missingOdgovori, 0, 0, 0, $data, $export_subtype); - $tabela .= $this->LatexVrsticeMultigrid($steviloVrstic, $typeOfDocument, $enota, $simbolTex, $navpicniOdgovori, $trakStartingNumberTmp, $fillablePdf, $steviloStolpcev, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, $navpicniOdgovori2, $missingOdgovori, 0, 0, 0, $data, $export_subtype, $this->preveriSpremenljivko, $this->userDataPresent); + #izris vrstic tabele + $tabela .= $this->LatexVrsticeMultigrid($steviloVrstic, $typeOfDocument, $enota, $simbolTex, $navpicniOdgovori, $trakStartingNumber, $fillablePdf, $steviloStolpcev, $spremenljivke, $trak, $vodoravniOdgovori, $texNewLine, $navpicniOdgovori2, $missingOdgovori, 0, 0, 0, $data, $export_subtype, $this->preveriSpremenljivko, $this->userDataPresent, null, $this->exportDataType, null, null, $this->skipEmpty, $this->skipEmptySub); #izris vrstic tabele - konec -/* if($enota==12||$enota==11){ - echo "tabela tex: ".$tabela."
"; - } */ - $tabela .= $this->EndLatexTable($typeOfDocument, 'tabularx', 'tabular'); //zakljucek tabele + $tabela .= $this->EndLatexTable($typeOfDocument, 'xltabular', 'tabular'); //zakljucek tabele //$tabela .= $texNewLineAfterTable; #KONEC MAIN TABELE ######################################################################### } //prostor po izpisu tabele - $tabela .= $this->texBigSkip; - $tabela .= $this->texBigSkip; + //$tabela .= $this->texBigSkip; + //$tabela .= $this->texBigSkip; + $tabela .= '\vspace{1 cm}'; //izpis tabela - konec @@ -1552,10 +1317,9 @@ class MultiGridLatex extends LatexSurveyElement } } //ureditev parametrov za tabelo - konec - //echo "parameterTabularLabelePrvaPod: ".$parameterTabularLabelePrvaPod."
"; //zacetek tabele - $tex .= ($export_format == 'pdf' ? '{ \begin{tabularx}{1\textwidth}{'.$parameterTabularLabelePrvaPod.'}' : '\begin{tabular}{'.$parameterTabularLabelePrvaPod.'}'); + $tex .= ($export_format == 'pdf' ? '{ \begin{xltabular}{1\textwidth}{'.$parameterTabularLabelePrvaPod.'}' : '\begin{tabular}{'.$parameterTabularLabelePrvaPod.'}'); //prva vrstica, ce so opisne labele #IZRIS OPISNIH LABEL NAD DRSNIKOM ################################################# @@ -1571,13 +1335,13 @@ class MultiGridLatex extends LatexSurveyElement $tex .= ' & '; //labela na levi strani - $tex .= $this->encodeText($MinLabel); + $tex .= LatexDocument::encodeText($MinLabel, 0, 1); //vmesni prazni stolpci $steviloPraznihStolpcev = $steviloStolpcevPrvaVrstica - 2 + 1; for($p=0; $p<$steviloPraznihStolpcev; $p++){ if($p==$steviloPraznihStolpcev-2){ //ce je pred-zadnji stolpec - $tex .= '\multicolumn{2}{c}{'.$this->encodeText($MaxLabel).'}'; //labela na desni v zadnji dveh desnih stolpcih + $tex .= '\multicolumn{2}{c}{'.LatexDocument::encodeText($MaxLabel, 0, 1).'}'; //labela na desni v zadnji dveh desnih stolpcih }elseif($p==$steviloPraznihStolpcev-1){ //ce je zadnji stolpec }else{ //drugace @@ -1587,7 +1351,6 @@ class MultiGridLatex extends LatexSurveyElement } //labela na desni strani - //$tex .= $this->encodeText($MaxLabel); //v novo vrstico po izrisu opisnih label $tex .= $this->texNewLine; @@ -1607,7 +1370,6 @@ class MultiGridLatex extends LatexSurveyElement #IZRIS MOZNIH ODGOVOROV - KONEC $tex .= ' & '; - //echo $userAnswer[$key]."
"; if($export_format == 'pdf'){ //ce je pdf, pokazi drsnike tudi graficno #IZRIS DRSNIKA {dolzina}{pozicija bunkice}#################################### $steviloStolpcevZaSlider = $steviloStolpcevPrvaVrstica - 1; @@ -1694,8 +1456,7 @@ class MultiGridLatex extends LatexSurveyElement } //konec tabele - $tex .= ($export_format == 'pdf' ? "\\end{tabularx} }" : "\\end{tabular} \\noindent"); - //echo $tex; + $tex .= ($export_format == 'pdf' ? "\\end{xltabular} }" : "\\end{tabular} \\noindent"); ################# izpis s samo eno tabelo, saj zaradi ltablex, to ni vec mozno - konec #Konec tabele za izris odgovora in drsnika - konec ################################################################################# @@ -1758,9 +1519,9 @@ class MultiGridLatex extends LatexSurveyElement ############################################################################################################# //se ena tabela, da naredimo dovolj prostora na koncu vprasanja - $tex .= ($export_format == 'pdf' ? '\begin{tabularx}{0.9\textwidth}{X}' : ''); + $tex .= ($export_format == 'pdf' ? '\begin{xltabular}{0.9\textwidth}{X}' : ''); $tex .= $this->texNewLine; - $tex .= ($export_format == 'pdf' ? '\end{tabularx}' : ''); + $tex .= ($export_format == 'pdf' ? '\end{xltabular}' : ''); return $tex; } diff --git a/admin/survey/export/latexclasses/Vprasanja/NagovorLatex.php b/admin/survey/export/latexclasses/Vprasanja/NagovorLatex.php index 23ffe0e..be21419 100644 --- a/admin/survey/export/latexclasses/Vprasanja/NagovorLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/NagovorLatex.php @@ -9,12 +9,14 @@ * Datum: 09/2017 *****************************************/ - define("NAGOVOR_LINE_WIDTH", 0.5); + if (!defined("NAGOVOR_LINE_WIDTH")) define("NAGOVOR_LINE_WIDTH", 0.5); class NagovorLatex extends LatexSurveyElement { var $internalCellHeight; protected $texBigSkip = '\bigskip'; + protected $db_table = ''; + protected $usr_id = null; public function __construct() { @@ -42,12 +44,8 @@ class NagovorLatex extends LatexSurveyElement $this->loop_id = $loop_id; //preveri, ce je kaj v bazi - //$userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id); - $userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id, $this->loop_id); - //echo "userDataPresent za spremenljivko".$spremenljivke['id']." je: ".$userDataPresent."
"; - - //if($userDataPresent||$export_subtype=='q_empty'){ //ce je kaj v bazi ali je prazen vprasalnik - if($userDataPresent||$export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ //ce je kaj v bazi ali je prazen vprasalnik ali je potrebno pokazati tudi ne odgovorjena vprasanja + $tex = ''; + if($export_subtype=='q_empty'||$export_subtype=='q_comment'||$preveriSpremenljivko){ //ce je kaj v bazi ali je prazen vprasalnik ali je potrebno pokazati tudi ne odgovorjena vprasanja global $lang; $spremenljivkaParams = new enkaParameters($spremenljivke['params']); @@ -66,7 +64,6 @@ class NagovorLatex extends LatexSurveyElement }else{ //ce je rtf } - return $tex; } } diff --git a/admin/survey/export/latexclasses/Vprasanja/RadioCheckboxSelectLatex.php b/admin/survey/export/latexclasses/Vprasanja/RadioCheckboxSelectLatex.php index 51b5ddb..df4228f 100644 --- a/admin/survey/export/latexclasses/Vprasanja/RadioCheckboxSelectLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/RadioCheckboxSelectLatex.php @@ -11,8 +11,8 @@ //namespace Export\Latexclasses\Vprasanja; -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip class RadioCheckboxSelectLatex extends LatexSurveyElement { @@ -40,6 +40,7 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement } public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $preveriSpremenljivko=null, $export_data_type=null, $export_subtype=null, $loop_id=null, $language=null){ + //$time_start = microtime(true); global $lang, $site_path; $this->language = $language; @@ -47,7 +48,7 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement //preverjanje, ali je prevod if(isset($_GET['language'])){ - $this->language = $_GET['language']; + $this->language = isset($_GET['language'])?$_GET['language']:null; $this->prevod = 1; }else{ $this->prevod = 0; @@ -73,6 +74,7 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement $indeksOdgovorov = 0; $oznakaVprasanja = $this->UrediOznakoVprasanja($spremenljivke['id']); //uredi oznako vprasanja, ker ne sme biti stevilska $prviOdgovorSlikovniTip = 0; + $vizualnaSkalaNumber = null; if ($usr_id){ $userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id, $this->loop_id); //zgenerira podatke z odgovori respondenta v $this->userAnswer, zabelezi, ce so podatki prisotni @@ -91,24 +93,24 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement #ce je respondent odgovarjal v drugem jeziku ######################## $rowl = $this->srv_language_vrednost($rowVrednost['id']); - if (strip_tags($rowl['naslov']) != '') $rowVrednost['naslov'] = $rowl['naslov']; - if (strip_tags($rowl['naslov2']) != '') $rowVrednost['naslov2'] = $rowl['naslov2']; + if ($rowl!=null && strip_tags($rowl['naslov']) != '') $rowVrednost['naslov'] = $rowl['naslov']; + if ($rowl!=null && strip_tags($rowl['naslov2']) != '') $rowVrednost['naslov2'] = $rowl['naslov2']; #ce je respondent odgovarjal v drugem jeziku - konec ################ - $stringTitle = ( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ); - $stringTitle = Common::getInstance()->dataPiping($stringTitle, $usr_id, $loop_id); - $stringTitle = '\\textcolor{crta}{'.$this->encodeText($stringTitle).'}'; - - //echo $stringTitle."za indeks: ".$indeksZaWhile."
"; - //stetje stevila vrstic - //$stetje_vrstic = $this->pdf->getNumLines($stringTitle, 180*$expand_width); - // še dodamo textbox če je polj other + $stringTitle = ( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ); + if($usr_id){ + $stringTitle = Common::getInstance()->dataPiping($stringTitle, $usr_id, $loop_id); + } + $stringTitle = '\\textcolor{crta}{'.LatexDocument::encodeText($stringTitle, 0, 0, $indeksZaWhile).'}'; //encodeText($text='', $vre_id=0, $no_br = 0, $img_id=0, $variable_name = '') + + // še dodamo textbox če je polje other $_txt = ''; if ( $rowVrednost['other'] == 1 && $usr_id ){ //$sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$this->db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id='".$this->getUserId()."' AND loop_id $loop_id"); - $sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id); - $row4 = mysqli_fetch_assoc($sqlOtherText); - $_txt = ' \\textcolor{crta}{'.$row4['text'].'}'; + $sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : "")); + $row4 = mysqli_fetch_assoc($sqlOtherText); + $_txt = ' \\textcolor{crta}{'.LatexDocument::encodeText($row4['text']).'}'; } //$tex .= ' '.$stringTitle.$_txt.','; if($indeksZaWhile==1){ @@ -150,7 +152,7 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement #za ureditev preloma odgovorov, ce so odgovori ob vprasanju - najprej je potrebno zabeleziti dolzino besedila vprasanja if($spremenljivke['orientation']==0 && $export_format == 'pdf'){ //vodoravno ob vprasanju, ce je pdf - $tex .= '\settowidth{\questionLength}{'.$this->encodeText($questionText).'}'; //v definirano dolzino shranimo trenutno dolzino teksta vprasanja + $tex .= '\settowidth{\questionLength}{'.LatexDocument::encodeText($questionText).'}'; //v definirano dolzino shranimo trenutno dolzino teksta vprasanja $tex .= '\addtolength{\questionTotalLength}{\questionLength}'; //celotni dolzini dodamo dolzino vprasanja //ce je opomba prisotna, daj spremenljivko na 2 @@ -163,40 +165,35 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement #za ureditev preloma odgovorov, ce so odgovori ob vprasanju - konec if($spremenljivke['orientation']==7){ //navpicno - tekst levo - //$tex .= '\begin{tabular}{l l}'.$texNewLine; if($export_format == 'pdf'){ - $tex .= '\begin{tabularx}{.5\textwidth}{l l}'; + $tex .= '\begin{xltabular}{.5\textwidth}{l l}'; }else{ $tex .= '\begin{tabular}{l l}'.$texNewLine; //za omogociti izris odgovorov v tabeli } }elseif($spremenljivke['orientation']==8){ //ce je "povleci-spusti" - $tex .= '\setlength{\parindent}{0.1\textwidth} '; + $tex .= '\setlength{\parindent}{0.04\textwidth} '; //prva vrstica pred tabelo z odgovori if($export_format == 'pdf'){ //ce je pdf $tex .= '\begin{tabular}{l c l} '; //izris z vecstolpicno tabelo - //$tex .= '\begin{tabularx}{.5\textwidth}{l c l} '; //izris z vecstolpicno tabelo $tex .= $lang['srv_ranking_available_categories'].': & \hspace{0.1\textwidth} & '.$lang['srv_drag_drop_answers'].': '.$texNewLine; - $tex .= '\rule{0.4\textwidth}{0.4 pt} & & \rule{0.4\textwidth}{0.4 pt} \end{tabular} '.$texBigSkip; + $tex .= '\rule{0.4\textwidth}{0.4 pt} & & \rule{0.4\textwidth}{0.4 pt} \end{tabular} '; $tex .= $texNewLine; }else{ //ce je rtf $tex .= '\begin{tabular}{l} '; //izris z enostolpicno tabelo $tex .= $lang['srv_ranking_available_categories'].': '.$texNewLine; //Rapolozljive kategorije - //$tex .= '\hline \end{tabular} '.$texBigSkip; $tex .= '\hline \end{tabular} '; } //prva vrstica pred tabelo z odgovori - konec if($export_format == 'pdf'){ //ce je pdf //$tex .= '\begin{tabular}{c c c} '; //izris s tabelo - $tex .= '\begin{tabularx}{.5\textwidth}{c c c} '; //izris s tabelo + $tex .= '\begin{xltabular}{.5\textwidth}{c c c} '; //izris s tabelo } }elseif($spremenljivke['orientation']==10){ //image hot-spot - $imageName = $this->getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); + $imageName = LatexDocument::getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); $imageNameTest = $this->path2ImagesRadio.$imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku - //error_log("za image hot spot ne grid: ".$imageNameTest); - //echo("za image hot spot ne grid: ".$imageNameTest."
"); if(filesize($imageNameTest) > 0){ $image = PIC_SIZE."{".$this->path2ImagesRadio."".$imageName."}"; //priprave slike predefinirane dimenzije }else{ @@ -220,14 +217,15 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement $tex .= $texNewLine.$lang['srv_export_hotspot_chosen_regions_names'].': '.$texNewLine; //besedilo "Izbrana obmocja na sliki" while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ if( isset($this->userAnswer[$rowVrednost['id']]) ){ //ce je podatek prisoten - $stringTitle = ($this->encodeText(( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); - // še dodamo textbox če je polj other + $stringTitle = (LatexDocument::encodeText(( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ), 0, 0, 0, '', 1 )); + // še dodamo textbox če je polje other $_txt = ''; if ( $rowVrednost['other'] == 1 && $usr_id ){ //$sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$this->db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id='".$this->getUserId()."' AND loop_id $loop_id"); - $sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id); + $sqlOtherText = sisplet_query("SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : "")); $row4 = mysqli_fetch_assoc($sqlOtherText); - $_txt = ' '.$row4['text']; + $_txt = ' '.LatexDocument::encodeText($row4['text']); } $tex .= $stringTitle.$_txt.$texNewLine; } @@ -236,30 +234,26 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement }elseif($spremenljivke['orientation']==9 || $spremenljivke['orientation']==11){ //ce je "slikovni tip" ali VAS if($spremenljivke['orientation']==11){ //ce je VAS $spremenljivkaParams = new enkaParameters($spremenljivke['params']); - $vizualnaSkalaNumber = $spremenljivkaParams->get('vizualnaSkalaNumber'); + $vizualnaSkalaNumber = ($spremenljivkaParams->get('vizualnaSkalaNumber') ? $spremenljivkaParams->get('vizualnaSkalaNumber') : '5'); $numRowsSql = $vizualnaSkalaNumber; } - //echo "stevilo zadev: ".$numRowsSql."
"; if($spremenljivke['orientation']==9){ $mejaVAS = 20; }elseif($spremenljivke['orientation']==11){ $mejaVAS = 8; $numRowsSql = mysqli_num_rows($sqlVrednosti); } - //if($numRowsSql<20){ //ce je manj kot x slikovnih tipov, izpisemo s tabelo, drugace simbol in zraven število if($numRowsSql<$mejaVAS){ //ce je manj kot x slikovnih tipov, izpisemo s tabelo, drugace simbol in zraven število $tableParamsSlikovniTip = ''; for($i=0; $i<$numRowsSql;$i++){ $tableParamsSlikovniTip .= ' c '; } - $tex .= '\begin{tabular}{'.$tableParamsSlikovniTip.'} '; //izris s tabelo + $tex .= '\\\\ \begin{tabular}{'.$tableParamsSlikovniTip.'} '; //izris s tabelo } - //echo "parametri tabele: ".$tableParamsSlikovniTip."
"; } if($spremenljivke['orientation']!=10){ //ce ni image hot-spot - //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ $prop['full'] = ( isset($userAnswer[$rowVrednost['id']]) ); @@ -267,57 +261,132 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement if($this->prevod){ //ce je prevod ankete $rowl = $this->srv_language_vrednost($rowVrednost['id']); //pridobi prevod naslova v ustreznem jeziku $stringTitle = ((( $rowl['naslov'] ) ? $rowl['naslov'] : ( ( $rowl['naslov2'] ) ? $rowl['naslov2'] : $rowl['variable'] ) )); //prevod naslova v ustreznem jeziku + if($stringTitle == ''){ //ce ni prevoda, prevzemi izvirno + $stringTitle = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); + } }else{ $stringTitle = ((( $rowVrednost['naslov'] ) ? $rowVrednost['naslov'] : ( ( $rowVrednost['naslov2'] ) ? $rowVrednost['naslov2'] : $rowVrednost['variable'] ) )); } - $stringTitle = Common::getInstance()->dataPiping($stringTitle, $usr_id, $loop_id); - - //echo "naslov: $stringTitle
"; - //echo "jezik: ".$this->language."
"; - if ( $spremenljivke['tip'] == 1 || $spremenljivke['tip'] == 3 ){ - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, $this->userAnswer[$rowVrednost['id']], $spremenljivke['orientation'], $indeksZaWhile, $vizualnaSkalaNumber); - //$tex .= '{\ChoiceMenu[radio,radiosymbol=\ding{108},name=myGroupOfRadiobuttons]{}{='.$stringTitle.'}}'.$stringTitle.' '.$this->texNewLine; - $internalCellHeight = '0.3 cm'; //visina praznega okvirja @povleci-spusti - }else if ( $spremenljivke['tip'] == 2 ){ - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, $this->userAnswer[$rowVrednost['id']]); - $internalCellHeight = '3 cm'; //visina praznega okvirja @povleci-spusti + if($usr_id){ + $stringTitle = Common::getInstance()->dataPiping($stringTitle, $usr_id, $loop_id); + } + + $userAnswerTmp = isset($this->userAnswer[$rowVrednost['id']])?$this->userAnswer[$rowVrednost['id']]:null; + + if ( $spremenljivke['tip'] == 1 || $spremenljivke['tip'] == 3 ){ + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, $userAnswerTmp, $spremenljivke['orientation'], $indeksZaWhile, $vizualnaSkalaNumber); + $internalCellHeight = 1; //visina praznega okvirja @povleci-spusti + + }else if ( $spremenljivke['tip'] == 2 ){ + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, $userAnswerTmp); + $internalCellHeight = 3; //visina praznega okvirja @povleci-spusti } - if($spremenljivke['orientation']==1&&$spremenljivke['tip'] != 3){ //navpicno - $tex .= $symbol.' '.$this->encodeText($stringTitle, $rowVrednost['id']).' '.$texNewLine; - //$test = $symbol.' '.$this->encodeText($stringTitle, $rowVrednost['id']).' '.$texNewLine; - //echo "tukaj! $test
"; - }elseif($spremenljivke['orientation']==7){ //navpicno - tekst levo - $text = $this->encodeText($stringTitle, $rowVrednost['id']).' & '.$symbol.' '.$texNewLine; + if($spremenljivke['orientation'] == 1 && $spremenljivke['tip'] != 3){ //navpicno + $tex .= $symbol.' '.LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' '; + if($rowVrednost['other'] == 1){ //ce je odgovor Drugo:, izpisi se tabelo za drugo + $tex .= '\begin{tabular}{c} '; //izris s tabelo brez obrob + if(isset($this->userAnswer[$rowVrednost['id']])){ + $sqlOtheText1 = "SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : ""); + $sqlOtherText = sisplet_query($sqlOtheText1); + $row4 = mysqli_fetch_assoc($sqlOtherText); + $tex .= '\fbox{\parbox{0.2\textwidth}{ '.LatexDocument::encodeText($row4['text']).' }} '; + }else{ + $tex .= '\fbox{\parbox{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}} }} '; + } + $tex .= ' \end{tabular}'; //za zakljuciti izris odgovorov v tabeli + } + $tex .= $texNewLine; + }elseif($spremenljivke['orientation'] == 7){ //navpicno - tekst levo + + $text = LatexDocument::encodeText($stringTitle,$rowVrednost['id'], 0, 0, '', 1).' & '.$symbol.' '.$texNewLine; $textLength = strlen($text); if($textLength > MAX_STRING_LENGTH){ $tex .= '\vspace{2 mm}'; - $tex .= '\parbox{'.LINE_BREAK_AT.'}{'.$this->encodeText($stringTitle, $rowVrednost['id']).'} & '.$symbol.' '.$texNewLine; //tekst odgovora razbij pri LINE_BREAK_AT (5 cm) in zraven dodaj ustrezni simbol + $tex .= '\parbox{'.LINE_BREAK_AT.'}{'.LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).'} & '.$symbol.' '.$texNewLine; //tekst odgovora razbij pri LINE_BREAK_AT (5 cm) in zraven dodaj ustrezni simbol }else{ - $tex .= $text; - } + $tex .= LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' & '; + if($rowVrednost['other'] == 1){ //ce je odgovor Drugo:, izpisi se tabelo za drugo + $tex .= '\begin{tabular}{c} '; //izris s tabelo brez obrob + if(isset($this->userAnswer[$rowVrednost['id']])){ + $sqlOtheText1 = "SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : ""); + $sqlOtherText = sisplet_query($sqlOtheText1); + $row4 = mysqli_fetch_assoc($sqlOtherText); + $tex .= '\fbox{\parbox{0.2\textwidth}{ '.LatexDocument::encodeText($row4['text']).' }} '; + }else{ + $tex .= '\fbox{\parbox{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}} }} '; + } + $tex .= ' \end{tabular}'; //za zakljuciti izris odgovorov v tabeli + } + $tex .= $symbol.' '.$texNewLine; + } }elseif($spremenljivke['orientation']==0){ //vodoravno ob vprasanju - $tex .= ' '.$symbol.' '.$this->encodeText($stringTitle, $rowVrednost['id']).' '; + $tex .= ' '.$symbol.' '.LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' '; + if($rowVrednost['other'] == 1){ //ce je odgovor Drugo:, izpisi se tabelo za drugo + $tex .= '\begin{tabular}{c} '; //izris s tabelo brez obrob + if(isset($this->userAnswer[$rowVrednost['id']])){ + $sqlOtheText1 = "SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : ""); + $sqlOtherText = sisplet_query($sqlOtheText1); + $row4 = mysqli_fetch_assoc($sqlOtherText); + $tex .= '\fbox{\parbox{0.2\textwidth}{ '.LatexDocument::encodeText($row4['text']).' }} '; + }else{ + $tex .= '\fbox{\parbox{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}} }} '; + } + $tex .= ' \end{tabular}'; //za zakljuciti izris odgovorov v tabeli + } }elseif($spremenljivke['orientation']==2){ //vodoravno pod vprasanjem - $tex .= ' '.$symbol.' '.$this->encodeText($stringTitle, $rowVrednost['id']).' '; - }elseif(($spremenljivke['tip'] == 3&&$spremenljivke['orientation']==1)||$spremenljivke['orientation']==6){ //roleta ali izberite s seznama - if($export_data_type==1&&isset($this->userAnswer[$rowVrednost['id']])){ //ce je dolg izvoz in je podatek za odgovor - $tex .= ' \textbf{'.$this->encodeText($stringTitle, $rowVrednost['id']).'} '.$texNewLine; + $tex .= ' '.$symbol.' '.LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' '; + if($rowVrednost['other'] == 1){ //ce je odgovor Drugo:, izpisi se tabelo za drugo + $tex .= '\begin{tabular}{c} '; //izris s tabelo brez obrob + if(isset($this->userAnswer[$rowVrednost['id']])){ + $sqlOtheText1 = "SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : ""); + $sqlOtherText = sisplet_query($sqlOtheText1); + $row4 = mysqli_fetch_assoc($sqlOtherText); + $tex .= '\fbox{\parbox{0.2\textwidth}{ '.LatexDocument::encodeText($row4['text']).' }} '; + }else{ + $tex .= '\fbox{\parbox{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}} }} '; + } + $tex .= ' \end{tabular}'; //za zakljuciti izris odgovorov v tabeli + } + }elseif(($spremenljivke['tip'] == 3 && $spremenljivke['orientation'] == 1) || $spremenljivke['orientation'] == 6){ //roleta ali izberite s seznama + if($export_data_type == 1 && isset($this->userAnswer[$rowVrednost['id']])){ //ce je dolg izvoz in je podatek za odgovor + $tex .= ' \textbf{'.LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' }'; }else{ - $tex .= $this->encodeText($stringTitle, $rowVrednost['id']).' '.$texNewLine; - } + $tex .= LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' '; + } + if($rowVrednost['other'] == 1){ //ce je odgovor Drugo:, izpisi se tabelo za drugo + $tex .= '\begin{tabular}{c} '; //izris s tabelo brez obrob + if(isset($this->userAnswer[$rowVrednost['id']])){ + $sqlOtheText1 = "SELECT * FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND vre_id='".$rowVrednost['id']."' AND usr_id=".$usr_id . + ($loop_id !== null ? " AND loop_id='$loop_id'" : ""); + $sqlOtherText = sisplet_query($sqlOtheText1); + $row4 = mysqli_fetch_assoc($sqlOtherText); + $tex .= '\fbox{\parbox{0.2\textwidth}{ '.LatexDocument::encodeText($row4['text']).' }} '; + }else{ + $tex .= '\fbox{\parbox{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}} }} '; + } + $tex .= ' \end{tabular}'; //za zakljuciti izris odgovorov v tabeli + if($export_data_type==1&&isset($this->userAnswer[$rowVrednost['id']])){ //ce je dolg izvoz in je podatek za odgovor + $tex .= '}'; + } + + } + $tex .= $texNewLine; }elseif($spremenljivke['orientation']==8){ //povleci-spusti - if(isset($this->userAnswer[$rowVrednost['id']])){ - $textR = $this->encodeText($stringTitle, $rowVrednost['id']); + $textR = LatexDocument::encodeText($stringTitle, $rowVrednost['id']); $textRArray[$indeksZaWhile] = $textR; //rabimo kasneje, za izpis rtf desne strani vprasanja, ce izpisujemo odgovore respondenta $textL = ''; }else{ - $textL = $this->encodeText($stringTitle, $rowVrednost['id']); + $textL = LatexDocument::encodeText($stringTitle, $rowVrednost['id']); $textR = ''; } - + if($export_format == 'pdf'){ //ce je pdf if($textL){ @@ -327,7 +396,8 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement } if($indeksZaWhile == 1&&($export_subtype=='q_empty')){ - $tex .= '& \hspace{1.2 cm} \multirow{'.$numRowsSql.'}{*}{\fbox{\parbox[t]['.$internalCellHeight.']{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}}} } } '; //v prvi vrstici izrisi prazen okvir, ki se razpotegne skozi vse vrstice + $visinaOkvirja = $internalCellHeight; //$visinaOkvirja = $internalCellHeight*$numRowsSql; + $tex .= '& \hspace{1.2 cm} \multirow{'.$numRowsSql.'}{*}{\fbox{\parbox[t]['.$visinaOkvirja.' cm]{0.2\textwidth}{ \hphantom{\hspace{0.2\textwidth}}} } } '; //v prvi vrstici izrisi prazen okvir, ki se razpotegne skozi vse vrstice }elseif($export_subtype=='q_empty'){ $tex .= '& '; //izrisi potrebno praznino za multirow okvir iz prve vrstice }else{ @@ -373,22 +443,21 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement $prviOdgovorSlikovniTip = 1; } - }elseif($spremenljivke['orientation']==11){ //ce je VAS - //$tex .= ' '.$symbol.' '.$this->encodeText($stringTitle, $rowVrednost['id']).' '; + }elseif($spremenljivke['orientation'] == 11){ //ce je VAS if($indeksZaWhile == 1){ - if($numRowsSql<=7){ //ce je manj kot 7 slikovnih tipov, izpisemo s tabelo, drugace simbol in zraven število - $tex .= ' '.$symbol; + if($numRowsSql<=7){ //ce je manj kot 7 VAS, izpisemo s tabelo, drugace simbol in zraven število + $tex .= ' '.$symbol[$indeksZaWhile-1]; } }else{ - if($numRowsSql<=7){ //ce je manj kot 7 slikovnih tipov, izpisemo s tabelo, drugace simbol in zraven število - $tex .= ' & '.$symbol; + if($numRowsSql<=7){ //ce je manj kot 7 VAS, izpisemo s tabelo, drugace simbol in zraven število + $tex .= ' & '.$symbol[$indeksZaWhile-1]; } } if($numRowsSql>7){ $tex .= ' ('.$indeksZaWhile.') '; } }else{ //ce ni urejenega izrisa naj bo default oz. navpicno - $tex .= $symbol.' '.$this->encodeText($stringTitle, $rowVrednost['id']).' '.$texNewLine; + $tex .= $symbol.' '.LatexDocument::encodeText($stringTitle, $rowVrednost['id'], 0, 0, '', 1).' '.$texNewLine; } $oznakaOdgovora++; @@ -407,7 +476,7 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement $tex .= ' & ('.$i.')'; } } - $tex .= ' \end{tabular}'; //zakljuci izris odgovorov v tabeli za "slikovni tip" + $tex .= ' \end{tabular}'.$texBigSkip; //zakljuci izris odgovorov v tabeli za "slikovni tip" } //$tex .= $texNewLine; $tex .= $texNewLine; @@ -415,10 +484,10 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement if($export_format == 'pdf'|| $spremenljivke['orientation']==7){ //ce je pdf //if($spremenljivke['orientation']==7 && $export_format == 'pdf'){ if($export_format == 'pdf'){ - $tex .= '\end{tabularx}'; //za zakljuciti izrisa odgovorov v tabeli//tabularx + $tex .= '\end{xltabular}'; //za zakljuciti izrisa odgovorov v tabeli//tabularx $tex .= $this->texBigSkip; $tex .= $this->texBigSkip; - $tex .= ' \noindent '; + //$tex .= ' \noindent '; }else{ $tex .= ' \end{tabular}'; //za zakljuciti izris odgovorov v tabeli $tex .= $texNewLine; @@ -483,6 +552,10 @@ class RadioCheckboxSelectLatex extends LatexSurveyElement //$tex .= '\\end{absolutelynopagebreak}'; //zakljucimo environment, da med vprasanji ne bo prelomov strani } + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time radio: '.floatval($execution_time).' sec
'; */ + return $tex; } } \ No newline at end of file diff --git a/admin/survey/export/latexclasses/Vprasanja/RazvrscanjeLatex.php b/admin/survey/export/latexclasses/Vprasanja/RazvrscanjeLatex.php index c93ceb0..96c1557 100644 --- a/admin/survey/export/latexclasses/Vprasanja/RazvrscanjeLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/RazvrscanjeLatex.php @@ -10,9 +10,9 @@ *****************************************/ -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip -define("RADIO_BTN_SIZE", 0.13); +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip +if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13); class RazvrscanjeLatex extends LatexSurveyElement { @@ -27,6 +27,7 @@ class RazvrscanjeLatex extends LatexSurveyElement private static $_instance; protected $texBigSkip = ' \bigskip '; protected $loop_id = null; // id trenutnega loopa ce jih imamo + protected $path2ImagesRadio = null; public static function getInstance() { @@ -38,8 +39,11 @@ class RazvrscanjeLatex extends LatexSurveyElement public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype='', $preveriSpremenljivko=null, $export_data_type=null, $loop_id=null){ + //$time_start = microtime(true); + global $lang, $site_path; // Ce je spremenljivka v loopu $this->loop_id = $loop_id; + $this->path2ImagesRadio = $site_path.'uploadi/editor/'; //preveri, ce je kaj v bazi //$userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id); @@ -80,7 +84,7 @@ class RazvrscanjeLatex extends LatexSurveyElement if($userDataPresent){ //ce so prisotni podatki respondenta //preverjanje podatkov trenutnega uporabnika ###################################################### //$sqlUserAnswer = sisplet_query("SELECT vrstni_red FROM srv_data_rating WHERE spr_id=".$spremenljivke['id']." AND usr_id='".$this->getUserId()."' AND vre_id='".$rowVrednost['id']."' AND loop_id $loop_id"); - $sqlUserAnswer = sisplet_query("SELECT vrstni_red FROM srv_data_rating WHERE spr_id=".$spremenljivke['id']." AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' "); + $sqlUserAnswer = sisplet_query("SELECT vrstni_red FROM srv_data_rating WHERE spr_id=".$spremenljivke['id']." AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' ".($loop_id !== null ? " AND loop_id='$loop_id'" : "")); $userAnswer = mysqli_fetch_assoc($sqlUserAnswer); @@ -95,7 +99,7 @@ class RazvrscanjeLatex extends LatexSurveyElement } if($jeOdgovor==0||$tipRazvrscanja==1){ //ce ni odgovor respondenta, bo naslov na levi strani; ali je Ostevilcevanje - array_push($navpicniOdgovori, $this->encodeText($stringTitleRow, $rowVrednost['id']) ); //filanje polja z navpicnimi odgovori (po vrsticah) + array_push($navpicniOdgovori, LatexDocument::encodeText($stringTitleRow, $rowVrednost['id']) ); //filanje polja z navpicnimi odgovori (po vrsticah) } } //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti - konec @@ -103,18 +107,18 @@ class RazvrscanjeLatex extends LatexSurveyElement if($userDataPresent&&$tipRazvrscanja!=1){ //ce so prisotni podatki respondenta in ni Ostevilcevanje #ureditev polja s podatki trenutnega uporabnika ###################################################### //$sqlOdgovoriRespondentaString = "SELECT v.naslov, v.id from srv_vrednost v, srv_data_rating r WHERE r.spr_id=v.spr_id AND r.usr_id=".$usr_id." AND r.vre_id=v.id AND r.spr_id=".$spremenljivke['id']." ORDER BY r.vrstni_red"; - $sqlOdgovoriRespondentaString = "SELECT v.naslov, v.id from srv_vrednost v, srv_data_rating r WHERE r.spr_id=v.spr_id AND r.usr_id=".$usr_id." AND r.vre_id=v.id AND r.spr_id=".$spremenljivke['id']." AND hidden='0' ORDER BY r.vrstni_red"; + $sqlOdgovoriRespondentaString = "SELECT v.naslov, v.id from srv_vrednost v, srv_data_rating r WHERE ".($loop_id !== null ? " r.loop_id='$loop_id' AND " : "")."r.spr_id=v.spr_id AND r.usr_id=".$usr_id." AND r.vre_id=v.id AND r.spr_id=".$spremenljivke['id']." AND hidden='0' ORDER BY r.vrstni_red"; //echo $sqlOdgovoriRespondentaString."
"; $sqlOdgovoriRespondenta = sisplet_query($sqlOdgovoriRespondentaString); //pregled vseh odgovorov respondenta razvrsceni kot morajo biti while ($rowOdgovoriRespondenta = mysqli_fetch_assoc($sqlOdgovoriRespondenta)){ - $odgovorRespondenta = $this->encodeText($rowOdgovoriRespondenta['naslov'], $rowOdgovoriRespondenta['id']); + $odgovorRespondenta = LatexDocument::encodeText($rowOdgovoriRespondenta['naslov'], $rowOdgovoriRespondenta['id']); array_push($odgovoriRespondenta, $odgovorRespondenta); //filanje polja z odgovori respondenta } + //pregled vseh odgovorov respondenta razvrsceni kot morajo biti #ureditev polja s podatki trenutnega uporabnika - konec ############################################## } - //izris tabel dolocenega razvrscanja if($export_data_type==2){ //ce je kratek izpis izvoza $tex .= $this->IzrisRazvrscanjaKratko($spremenljivke, $steviloDesnihOkvirjev, $numRowsSql, $navpicniOdgovori, $texNewLine, $texNewLineAfterTable, $export_format, 0, $tipRazvrscanja, $odgovoriRespondenta, $export_subtype); @@ -123,6 +127,8 @@ class RazvrscanjeLatex extends LatexSurveyElement $tex .= $this->IzrisRazvrscanjaTabele($spremenljivke, $steviloDesnihOkvirjev, $numRowsSql, $navpicniOdgovori, $texNewLine, $texNewLineAfterTable, $export_format, 0, $tipRazvrscanja, $odgovoriRespondenta, $export_subtype); }elseif($tipRazvrscanja==1){ //ce je Ostevilcevanje $tex .= $this->IzrisRazvrscanja($spremenljivke, $numRowsSql, $navpicniOdgovori, $odgovoriRespondenta, $texNewLine, $export_format, 0); + }elseif($tipRazvrscanja==3){ //ce je Image hotspot + $tex .= $this->IzrisRazvrscanjaImageHotSpot($spremenljivke, $export_data_type, $odgovoriRespondenta, $texNewLine); } } //izris tabel dolocenega razvrscanja - konec @@ -135,8 +141,11 @@ class RazvrscanjeLatex extends LatexSurveyElement }else{ $tex .= $this->texBigSkip; } - } - + } + //echo "latex koda: $tex"; + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time razvrščanje: '.$execution_time.' sec'; */ return $tex; } } @@ -154,9 +163,9 @@ class RazvrscanjeLatex extends LatexSurveyElement $tabela .= '\setlength{\parindent}{0.1\textwidth} '; //prva vrstica pred tabelo z odgovori if($typeOfDocument == 'pdf'){ //ce je pdf - $tabela .= '\begin{tabularx}{\textwidth}{l c l} '; //izris s tabelo tabularx + $tabela .= '\begin{xltabular}{\textwidth}{l c l} '; //izris s tabelo xltabular $tabela .= $lang['srv_ranking_available_categories'].': & \hspace{0.1\textwidth} & '.$lang['srv_ranking_ranked_categories1'].': '.$texNewLine; - $tabela .= '\rule{0.4\textwidth}{0.7 pt} & & \rule{0.4\textwidth}{0.4 pt} \end{tabularx} '; + $tabela .= '\rule{0.4\textwidth}{0.7 pt} & & \rule{0.4\textwidth}{0.4 pt} \end{xltabular} '; }else{ //ce je rtf $tabela .= '\begin{tabular}{l c l} '; //izris s tabelo $tabela .= $lang['srv_ranking_available_categories'].': & & '.$lang['srv_ranking_ranked_categories1'].': '.$texNewLine; @@ -180,7 +189,7 @@ class RazvrscanjeLatex extends LatexSurveyElement ################################################# //zacetek tabele - $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabularL, 'tabularx', 'tabular', 1, 0.2); + $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabularL, 'xltabular', 'tabular', 1, 0.2); //argumenti za leve okvirje $textboxWidthL = 0.25; @@ -201,17 +210,12 @@ class RazvrscanjeLatex extends LatexSurveyElement $textboxHeightL = 0; } - //echo "textboxHeightL: ".$textboxHeightL."
"; -/* echo "odgovori respondenta: ".count($odgovoriRespondenta)."
"; - echo "navpični odgovori: ".count($navpicniOdgovori)."
"; - echo "stevilo Odgovorov: ".$steviloOdgovorov."
"; - echo "stevilo desnih okvirjev: ".$steviloDesnihOkvirjev."
"; */ //izris notranjosti tabele for ($i = 1; $i <= $steviloOdgovorov; $i++){ - - $textL = $tableCentering.' '.$navpicniOdgovori[$i-1]; //odgovor znotraj okvirja - + if(array_key_exists($i-1, $navpicniOdgovori)){ + $textL = $tableCentering.' '.$navpicniOdgovori[$i-1]; //odgovor znotraj okvirja + } if($tipRazvrscanja==2){ //ce je postavitev Premikanje $tabela .= $indeksZaStevilaL.'. '; //pred okvirjem s kategorijo odgovora dodaj stevilko s piko @@ -222,7 +226,7 @@ class RazvrscanjeLatex extends LatexSurveyElement //izpis latex kode za okvir z odgovorom if($tipRazvrscanja==0||($tipRazvrscanja==2&&count($odgovoriRespondenta)==0)){ //ce je Prestavljanje ali Premikanje in ni podatkov respondenta - if($navpicniOdgovori[$i-1]!=''){ //ce so prisotni odgovori + if(array_key_exists($i-1, $navpicniOdgovori)&&($navpicniOdgovori[$i-1]!='')){ //ce so prisotni odgovori $textVOkvirju = $textL; } }elseif($tipRazvrscanja==2&&count($odgovoriRespondenta)!=0){ //ce je postavitev Premikanje in imamo odgovore respondenta @@ -232,7 +236,7 @@ class RazvrscanjeLatex extends LatexSurveyElement //echo "text V Okvirju: ".$textVOkvirju."
"; //izpis latex kode za okvir z odgovorom - if($tipRazvrscanja==0&&$navpicniOdgovori[$i-1]!=''){ + if($tipRazvrscanja==0&&(array_key_exists($i-1, $navpicniOdgovori)&&$navpicniOdgovori[$i-1]!='')){ if($typeOfDocument == 'pdf'){ //ce je pdf $tabela .= $this->LatexTextBox($typeOfDocument, $textboxHeightL, $textboxWidthL, $textVOkvirju, $textboxAllignmentL, 0); }else{ @@ -245,13 +249,6 @@ class RazvrscanjeLatex extends LatexSurveyElement $tabela .= $textVOkvirju; } } -/* if(($tipRazvrscanja==0&&$navpicniOdgovori[$i-1]!='')||($tipRazvrscanja==2||$tipRazvrscanja==1)){ - if($typeOfDocument == 'pdf'){ //ce je pdf - $tabela .= $this->LatexTextBox($typeOfDocument, $textboxHeightL, $textboxWidthL, $textVOkvirju, $textboxAllignmentL, 0); - }else{ - $tabela .= $textVOkvirju; - } - } */ if($typeOfDocument == 'pdf'){ $tabela .= ' \bigskip '; @@ -271,7 +268,7 @@ class RazvrscanjeLatex extends LatexSurveyElement $textboxAllignmentDE = 'c'; //allignment desnega okvirja, ki je empty if($indeksZaStevilaD <= $steviloDesnihOkvirjev){ //ce se ni preseglo zeleno stevilo desnih okvirjev $tabela .= $indeksZaStevilaD.'. '; - $odgovorZaIzpis = $odgovoriRespondenta[$i-1]; + $odgovorZaIzpis = isset($odgovoriRespondenta[$i-1])?$odgovoriRespondenta[$i-1]:null; if($typeOfDocument == 'pdf'){ //echo "odgovori respondenta na desni: ".$odgovoriRespondenta[$i-1]."
"; if($odgovorZaIzpis){ //ce je odgovor respondenta @@ -307,7 +304,7 @@ class RazvrscanjeLatex extends LatexSurveyElement } //zakljucek tabele - $tabela .= $this->EndLatexTable($typeOfDocument, 'tabularx', 'tabular'); + $tabela .= $this->EndLatexTable($typeOfDocument, 'xltabular', 'tabular'); ################################################# if($tipRazvrscanja==2){ //ce je postavitev Premikanje @@ -320,8 +317,6 @@ class RazvrscanjeLatex extends LatexSurveyElement return $tabela; } #funkcija, ki skrbi za izris ustreznih tabel za razvrscanje (postavitev: Prestavljanje in Premikanje) - konec ################################ - - #funkcija, ki skrbi za izris ustreznih tabel za razvrscanje (postavitev: Prestavljanje in Premikanje) ################################ @@ -331,18 +326,22 @@ class RazvrscanjeLatex extends LatexSurveyElement $textboxWidth = 0.1; $textboxHeight = '0.2cm'; $textboxAllignment = 'c'; //dummy spremenljivka + $odgovorRespondenta = null; if($typeOfDocument == 'rtf'){ //ce je rtf, zacetek tabele, kjer sta dva stolpca (prazen okvir + okvir z odgovorom) //$tex .= '\begin{tabular}{l l} '; //izris z enostolpicno tabelo $tex .= '\begin{tabular}{c l} '; //izris z enostolpicno tabelo } - for ($i = 1; $i <= $steviloVrstic; $i++){ $tex .= ' \noindent '; //da ni premika besedila v desno //izpis latex kode za prazen okvir oz. okvirjem z ustreznim stevilskim odgovorom //$tex .= $this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, $odgovoriRespondenta[$i-1], $textboxAllignment, 0); - $tex .= $this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, '\\textcolor{crta}{'.$odgovoriRespondenta[$i-1].'}', $textboxAllignment, 0); + if(array_key_exists($i-1, $odgovoriRespondenta)){ + $odgovorRespondenta = $odgovoriRespondenta[$i-1]; + } + //$tex .= $this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, '\\textcolor{crta}{'.$odgovoriRespondenta[$i-1].'}', $textboxAllignment, 0); + $tex .= $this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, '\\textcolor{crta}{'.$odgovorRespondenta.'}', $textboxAllignment, 0); if($typeOfDocument == 'rtf'){ //ce je rtf $tex .= ' & '; //meja med stolpcema tabele 1. prazen okvir (okvir s stevilskim odgovorom), 2. navpicni odgovor @@ -369,18 +368,19 @@ class RazvrscanjeLatex extends LatexSurveyElement $indeksZaStevila=1; $steviloOdgovorov=count($navpicniOdgovori); $steviloOdgovorov=count($odgovoriRespondenta); - $tex = ''; - + //izpis stevil in odgovorov for ($i = 1; $i <= $steviloOdgovorov; $i++){ - if($tipRazvrscanja==0||$tipRazvrscanja==2){ //ce je Prestavljanje ali Premikanje + $navpicniOdgovor = null; + if(array_key_exists(($i-1), $navpicniOdgovori)){ + $navpicniOdgovor = $navpicniOdgovori[$i-1]; + } + if($tipRazvrscanja==0||$tipRazvrscanja==2||$tipRazvrscanja==3){ //ce je Prestavljanje ali Premikanje ali image hotspot $tex .= $indeksZaStevila.'. '; //stevilka pred odgovorom - //$tex .= $odgovoriRespondenta[$i-1]; //odgovor $tex .= '\\textcolor{crta}{'.$odgovoriRespondenta[$i-1].'}'; //odgovor - }elseif($tipRazvrscanja==1){ //ce je Ostevilcevanje - $tex .= $navpicniOdgovori[$i-1].': '; - //$tex .= $odgovoriRespondenta[$i-1]; //odgovor + }elseif($tipRazvrscanja==1){ //ce je Ostevilcevanje + $tex .=$navpicniOdgovor.': '; $tex .= '\\textcolor{crta}{'.$odgovoriRespondenta[$i-1].'}'; //odgovor } $tex .= '; '; @@ -393,5 +393,51 @@ class RazvrscanjeLatex extends LatexSurveyElement return $tex; } #funkcija, ki skrbi za izris razvrscanje za kratek izpis izvoza - konec ################################ + + #funkcija, ki skrbi za izris razvrscanje za kratek izpis izvoza ################################ + function IzrisRazvrscanjaImageHotSpot($spremenljivke=null, $export_data_type=null, $odgovoriRespondenta=null, $texNewLine=''){ + global $lang; + $indeksZaStevila=1; + + $steviloOdgovorov=count($odgovoriRespondenta); + $tex = ''; + $imageName = LatexDocument::getImageName('hotspot', $spremenljivke['id'], 'hotspot_image='); + $imageNameTest = $this->path2ImagesRadio.$imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku + + //echo("za image hot spot ne grid: ".$imageNameTest."
"); + if(filesize($imageNameTest) > 0){ + $image = PIC_SIZE."{".$this->path2ImagesRadio."".$imageName."}"; //priprave slike predefinirane dimenzije + }else{ + $image = $lang['srv_pc_unavailable']; + } + + $tex .= $image."".$texNewLine; //izris slike + + //iz baze poberi imena obmocij + $sqlHotSpotRegions = sisplet_query("SELECT region_name FROM srv_hotspot_regions WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red"); + + //izris imen obmocij po $sqlHotSpotRegions + $tex .= $lang['srv_export_hotspot_regions_names'].': '.$texNewLine; //besedilo "Obmocja na sliki" + while ($rowHotSpotRegions = mysqli_fetch_assoc($sqlHotSpotRegions)) + { + $tex .= $rowHotSpotRegions['region_name'].''.$texNewLine; + } + + if(count($odgovoriRespondenta)){ + $tex .= $lang['srv_ranking_ranked_categories1'].": ".$texNewLine; + //izpis odgovorov + for ($i = 1; $i <= $steviloOdgovorov; $i++){ + $tex .= '\\textcolor{crta}{'.$odgovoriRespondenta[$i-1].'}'; //odgovor + $tex .= ' \\\\ '; + $indeksZaStevila++; + } + } + + $tex .= ' \\\\ '; + $tex .= ' \\\\ '; + + return $tex; + } + #funkcija, ki skrbi za izris razvrscanje za kratek izpis izvoza - konec ################################ } \ No newline at end of file diff --git a/admin/survey/export/latexclasses/Vprasanja/SNImena.php b/admin/survey/export/latexclasses/Vprasanja/SNImena.php index e7d7ef1..bf7ae8c 100644 --- a/admin/survey/export/latexclasses/Vprasanja/SNImena.php +++ b/admin/survey/export/latexclasses/Vprasanja/SNImena.php @@ -9,7 +9,7 @@ * Datum: 05/2018 *****************************************/ - define("NAGOVOR_LINE_WIDTH", 0.5); + if (!defined("NAGOVOR_LINE_WIDTH")) define("NAGOVOR_LINE_WIDTH", 0.5); class SNImenaLatex extends LatexSurveyElement { @@ -60,7 +60,7 @@ class SNImenaLatex extends LatexSurveyElement $sqlUserAnswerString = "SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND loop_id $loop_id "; $sqlUserAnswer = sisplet_query($sqlUserAnswerString); while($userAnswer = mysqli_fetch_array($sqlUserAnswer)){ - array_push($textVOkvirju, $this->encodeText($userAnswer['text'])); + array_push($textVOkvirju, LatexDocument::encodeText($userAnswer['text'])); } $steviloOkvirjev=count($textVOkvirju); } diff --git a/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php b/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php index b6def64..539148e 100644 --- a/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/SteviloLatex.php @@ -10,9 +10,9 @@ *****************************************/ -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip -define("MAXSTEVILOSTOLPCEV", 21); //max Stevilo Stolpcev za prvo vrstico pod Drsnikom, zaradi tezav z izrisom, ce je teh vec kot toliko +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip +if (!defined('MAXSTEVILOSTOLPCEV')) define("MAXSTEVILOSTOLPCEV", 21); //max Stevilo Stolpcev za prvo vrstico pod Drsnikom, zaradi tezav z izrisom, ce je teh vec kot toliko class SteviloLatex extends LatexSurveyElement { @@ -39,9 +39,10 @@ class SteviloLatex extends LatexSurveyElement } public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype=null, $preveriSpremenljivko=null, $export_data_type=null, $loop_id=null){ + //$time_start = microtime(true); // Ce je spremenljivka v loopu $this->loop_id = $loop_id; - + //preveri, ce je kaj v bazi //$userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id); $userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id, $this->loop_id); @@ -57,7 +58,7 @@ class SteviloLatex extends LatexSurveyElement $tex = ''; - $symbol = $this->getAnswerSymbol($export_format, $fillablePdf, 2, 10, 0, 0); //poberi simbol checkbox za other in missing moznosti odgovora + $symbol = $this->getAnswerSymbol($export_subtype, $export_format, $fillablePdf, 2, 10, 0, 0); //poberi simbol checkbox za other in missing moznosti odgovora //nastavitve iz baze ########################## $steviloOken = $spremenljivke['size']; //stevilo oken @@ -102,10 +103,11 @@ class SteviloLatex extends LatexSurveyElement /* if($postavitev!=0){ $tex .= $texNewLine; } */ - + //ureditev polja s podatki trenutnega uporabnika ###################################################### //$sqlUserAnswer = sisplet_query("SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' AND loop_id $loop_id"); - $sqlUserAnswer = sisplet_query("SELECT text, text2 FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' "); + $sqlUserAnswer = sisplet_query("SELECT text, text2 FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."'" . + ($loop_id !== null ? " AND loop_id='$loop_id'" : "")); $userAnswer = mysqli_fetch_assoc($sqlUserAnswer); //echo "userAnswer: ".$userAnswer['text']."
"; //ureditev polja s podatki trenutnega uporabnika - konec ############################################## @@ -152,12 +154,16 @@ class SteviloLatex extends LatexSurveyElement //echo "parametri tabele: ".$parameterTabular."
"; //ureditev parametrov za tabelo - konec###################### - if($userAnswer['text']){ - $okvir = 0; - }elseif($userAnswer['text'] == ''){ //ce nimamo odgovora - $okvir = 1; //rabimo okvir + if(isset($userAnswer['text'])){ + if($userAnswer['text']){ + $okvir = 0; + }elseif($userAnswer['text'] == ''){ //ce nimamo odgovora + $okvir = 1; //rabimo okvir + } + }else{ + $okvir = 1; } - + #ZACETEK TABELE //zacetek tabele if($polozajEnota!=0){ //ce je prisotno besedilo za enoto @@ -169,7 +175,8 @@ class SteviloLatex extends LatexSurveyElement } $izpisStevilk = 0; //belezi, ali se je stevilo ali stevila ze izpisalo - + $txtTmp = []; //polje, ki belezi vnesene odgovore okvirjev + //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ # po potrebi se prevede besedilo, ki se pojavi pred textbox-om @@ -181,11 +188,10 @@ class SteviloLatex extends LatexSurveyElement //ce ni other ali missing if( (int)$rowVrednost['other'] == 0 && $rowVrednost['naslov']){ //in se ni se izpisalo stevila - - $drugoStevilo = $userAnswer['text2']; //belezi drugo mozno stevilo + + $drugoStevilo = isset($userAnswer['text2'])?$userAnswer['text2']:null; //belezi drugo mozno stevilo if($izpisStevilk == 0 && $okvir == 0){ //ce ni bilo se izpisano nobeno stevilo in ne rabimo tabele za izpis - $txtTmp = []; if($export_format=='pdf'){ if($polozajEnota==0){ //ce ni besedila za enoto, rabimo odstavek za pravilen izpis $txtTmp1 = " \par { "; @@ -219,10 +225,9 @@ class SteviloLatex extends LatexSurveyElement array_push($txtTmp, $txtTmp2); //filanje polja z besedili } } - if($okvir == 1){ //ce rabimo okvir, izpisi - //$dataTextBox = $this->LatexTextBox($export_format, $textboxHeight, $textboxWidth, $txtTmp, $textboxAllignment, 0); if($polozajEnota==0){ //ce ni besedila za enoto, rabimo odstavek za pravilen izpis + $dataTextBox = ""; if($steviloOken>1){ $dataTextBox = " \par { "; } @@ -241,28 +246,27 @@ class SteviloLatex extends LatexSurveyElement } - - if($polozajEnota==0){ //ce polozaja besedila enote je na NE + if($polozajEnota==0){ //ce polozaj besedila enote je na NE if($indeksZaWhile!=1){ - //if($okvir == 1){ //ce rabimo prazen okvir, izpisi if($okvir == 1 && $textboxWidth<0.49){ //ce rabimo prazen okvir, izpisi $tex .= ' & '; //skoci v nov stolpec }else{ - $tex .= ' \\\\ '; //pojdi v novo vrstico + //$tex .= ' \\\\ '; //pojdi v novo vrstico + $tex .= ' & '; //pojdi v nov stolpec } } if($okvir == 1){ //ce rabimo prazen okvir, izpisi //izpis praznega text box-a dolocene sirine in visine - //$tex .= ' & '.$dataTextBox; $tex .= ' '.$dataTextBox; }else{ //ce je podatek ob levi enoti - //$tex .= ' & '.$txtTmp[$indeksZaWhile-1]; - $tex .= ' '.$txtTmp[$indeksZaWhile-1]; + $tmp_indeks = $indeksZaWhile-1; + if (array_key_exists($tmp_indeks , $txtTmp)) { + $tex .= ' '.$txtTmp[$indeksZaWhile-1]; + } } } - //if($polozajEnota==1){ //ce je polozaj besedila enote na LEVI elseif($polozajEnota==1){ //ce je polozaj besedila enote na LEVI if($indeksZaWhile!=1){ if($okvir == 1 && $textboxWidth<0.30){ //ce rabimo prazen okvir in je njegova sirina manjsa od 30, izpisi @@ -274,8 +278,10 @@ class SteviloLatex extends LatexSurveyElement //izpis besedila enote $stringEnota = $rowVrednost['naslov']; - $stringEnota = Common::getInstance()->dataPiping($stringEnota, $usr_id, $loop_id); - $tex .= $this->encodeText($stringEnota); + if($usr_id){ + $stringEnota = Common::getInstance()->dataPiping($stringEnota, $usr_id, $loop_id); + } + $tex .= LatexDocument::encodeText($stringEnota); if($okvir == 1){ //ce rabimo prazen okvir, izpisi //izpis praznega text box-a dolocene sirine in visine @@ -288,8 +294,6 @@ class SteviloLatex extends LatexSurveyElement $tex .= ' & '.$txtTmp[$indeksZaWhile-1]; } - //echo "tex koda: ".$tex."
"; - }elseif($polozajEnota==2){ //ce je polozaj besedila enote na DESNI //if($indeksZaWhile!=1&&$export_format=='rtf'){//ce je drugi okvir in je rtf if($indeksZaWhile!=1){//ce je drugi okvir @@ -320,8 +324,10 @@ class SteviloLatex extends LatexSurveyElement } $stringEnota = $rowVrednost['naslov']; - $stringEnota = Common::getInstance()->dataPiping($stringEnota, $usr_id, $loop_id); - $tex .= ' '.$this->encodeText($stringEnota); + if($usr_id){ + $stringEnota = Common::getInstance()->dataPiping($stringEnota, $usr_id, $loop_id); + } + $tex .= ' '.LatexDocument::encodeText($stringEnota); if($indeksZaWhile==1&&$export_format=='pdf'){ //ce je prvi okvir in je pdf //$tex .= ' \hspace{0.5cm} '; //dodaj še nekaj prostora, za prvim okvirjem, da bo dovolj prostora @@ -336,11 +342,14 @@ class SteviloLatex extends LatexSurveyElement } elseif((int)$rowVrednost['other'] != 0) { //drugace, ce imamo missinge ali podobne, jih zabelezi v polju - // imamo polje drugo - ne vem, zavrnil... + $rowVrednostNaslov= array_key_exists('naslov', $rowVrednost)?$rowVrednost['naslov']:null; + $rowVrednostVrstni_red= array_key_exists('vrstni_red', $rowVrednost)?$rowVrednost['vrstni_red']:null; + + // imamo polje drugo - ne vem, zavrnil... $array_others[$rowVrednost['id']] = array( - 'naslov'=>$rowVrednost['naslov'], - 'vrstni_red'=>$rowVrednost['vrstni_red'], - 'value'=>$text[$rowVrednost['vrstni_red']], + 'naslov'=>$rowVrednostNaslov, + 'vrstni_red'=>$rowVrednostVrstni_red, + //'value'=>$text[$rowVrednost['vrstni_red']], //- pokomentiral, ker ne vem, zakaj je tako, saj drugače PHP javlja warning ); } @@ -373,13 +382,6 @@ class SteviloLatex extends LatexSurveyElement #KONEC TABELE } //echo "tex koda: ".$tex."
"; - -/* $tex .= $this->texNewLine; - $tex .= $this->texNewLine; - if($okvir == 1){ //ce je prazen vprasalnik, dodaj se dve prazni vrstici - $tex .= $this->texNewLine; - $tex .= $this->texNewLine; - } */ }elseif($nacinVnosa==1&&$export_format=='pdf'){ //ce je drsnik in je izvoz v pdf @@ -446,7 +448,7 @@ class SteviloLatex extends LatexSurveyElement $array_others[$rowVrednost['id']] = array( 'naslov'=>$rowVrednost['naslov'], 'vrstni_red'=>$rowVrednost['vrstni_red'], - 'value'=>$text[$rowVrednost['vrstni_red']], + //'value'=>$text[$rowVrednost['vrstni_red']], // - pokomentiral, ker ne vem, zakaj je tako, saj drugače PHP javlja warning ); } } @@ -461,6 +463,7 @@ class SteviloLatex extends LatexSurveyElement for($i=1; $i<=$slider_NumofDescrLabels; $i++){ $slider_CustomDescriptiveLabelsTmp = ($spremenljivkaParams->get('slider_Labela_opisna_'.$i) ? $spremenljivkaParams->get('slider_Labela_opisna_'.$i) : ''); $slider_CustomDescriptiveLabelsTmp = preg_replace("/\s| /",' ',$slider_CustomDescriptiveLabelsTmp); //za odstranitev morebitnih presledkov, ki lahko delajo tezave pri polju za drsnik + $slider_CustomDescriptiveLabels = ''; if($i == 1){ $slider_CustomDescriptiveLabels = $slider_CustomDescriptiveLabelsTmp; }else{ @@ -479,14 +482,14 @@ class SteviloLatex extends LatexSurveyElement $parameterTabularLabeleNad = 'lR'; //leva (l) pa desna poravnava, ki se prilagaja (R) //zacetek tabele - $tex .= ($export_format == 'pdf' ? '\keepXColumns \begin{tabularx}{0.9\textwidth}{'.$parameterTabularLabeleNad.'}' : '\begin{tabular*}{3 cm}{c}'); + $tex .= ($export_format == 'pdf' ? '\keepXColumns \begin{xltabular}{0.9\textwidth}{'.$parameterTabularLabeleNad.'}' : '\begin{tabular*}{3 cm}{c}'); //vrstice in stolpci v tabeli - $tex .= $this->encodeText($MinLabel).' & '.$this->encodeText($MaxLabel); //izpis naslovov label v eni vrstici + $tex .= LatexDocument::encodeText($MinLabel).' & '.LatexDocument::encodeText($MaxLabel); //izpis naslovov label v eni vrstici //vrstice in stolpci v tabeli - konec //konec tabele - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular*} \\noindent"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular*} \\noindent"); //$tex .= $texNewLine; //v novo vrstico po izrisu label $tex .= '\par'; //odstavek @@ -538,7 +541,7 @@ class SteviloLatex extends LatexSurveyElement //zacetek tabele //$tex .= ($export_format == 'pdf' ? '\begin{tabularx}{0.9\textwidth}{'.$parameterTabularLabelePrvaPod.'}' : '\begin{tabular}{'.$parameterTabularLabelePrvaPod.'}'); - $tex .= ($export_format == 'pdf' ? '\keepXColumns \begin{tabularx}{0.9\textwidth}{'.$parameterTabularLabelePrvaPod.'}' : '\begin{tabular}{'.$parameterTabularLabelePrvaPod.'}'); + $tex .= ($export_format == 'pdf' ? '\keepXColumns \begin{xltabular}{0.9\textwidth}{'.$parameterTabularLabelePrvaPod.'}' : '\begin{tabular}{'.$parameterTabularLabelePrvaPod.'}'); // \keepXColumns //izris vrstice in stolpcev v tabeli for($i=0; $i<$steviloStolpcevPrvaVrstica; $i++){ @@ -563,6 +566,7 @@ class SteviloLatex extends LatexSurveyElement } }else{ //za vse ostale stolpce med prvi in zadnjim if($slider_VmesneNumLabel&&$steviloStolpcevPrvaVrsticaOrig<=MAXSTEVILOSTOLPCEV){ //ce so vmesne labele stevilske in je stevilo stolpcev manjsi od maximalnega dovoljenega za ustrezen izris + $vmesnoStevilo=0; if($i==1){ $vmesnoStevilo=$slider_MinNumLabel+$slider_handle_step; }else{ @@ -578,7 +582,7 @@ class SteviloLatex extends LatexSurveyElement //izris vrstice in stolpcev v tabeli - konec //konec tabele - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular} \\noindent"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular} \\noindent"); #IZRIS PRVE VRSTICE POD DRSNIKOM - KONEC ###################################### //echo $tex; @@ -588,6 +592,7 @@ class SteviloLatex extends LatexSurveyElement //ureditev parametrov za tabeli $parameterTabularLabeleDrugaPod=''; $prazniStolpciZaGraficneOznake = ''; + $parameterTabularLabeleTretjaPod = ''; for($i=0; $i<$slider_StevLabelPodrocij; $i++){ $parameterTabularLabeleDrugaPod .= ($export_format == 'pdf' ? '|C|' : '|c|'); //sredinska poravnava $parameterTabularLabeleTretjaPod .= ($export_format == 'pdf' ? 'C' : 'c'); //sredinska poravnava @@ -599,19 +604,19 @@ class SteviloLatex extends LatexSurveyElement //ureditev parametrov za tabeli - konec //zacetek tabele z graficnimi oznakami - $tex .= ($export_format == 'pdf' ? '\begin{tabularx}{0.9\textwidth}{'.$parameterTabularLabeleDrugaPod.'}' : '\begin{tabular}{'.$parameterTabularLabeleDrugaPod.'}'); + $tex .= ($export_format == 'pdf' ? '\begin{xltabular}{0.9\textwidth}{'.$parameterTabularLabeleDrugaPod.'}' : '\begin{tabular}{'.$parameterTabularLabeleDrugaPod.'}'); //izris prazne vrstice z graficnimi oznakami label (crta horizontal) $tex .= $prazniStolpciZaGraficneOznake; //izris prazne vrstice z graficnimi oznakami label (crta horizontal) - konec //konec tabele z graficnimi oznakami - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular} \\noindent"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular} \\noindent"); $tex .= $texNewLine; //zacetek tabele z naslovi label - $tex .= ($export_format == 'pdf' ? '\begin{tabularx}{0.9\textwidth}{'.$parameterTabularLabeleTretjaPod.'}' : '\begin{tabular}{'.$parameterTabularLabeleTretjaPod.'}'); + $tex .= ($export_format == 'pdf' ? '\begin{xltabular}{0.9\textwidth}{'.$parameterTabularLabeleTretjaPod.'}' : '\begin{tabular}{'.$parameterTabularLabeleTretjaPod.'}'); //izris naslovov label $slider_Labela_podrocja = []; //polje, ki hrani vpisane naslove labele podrocij @@ -628,7 +633,7 @@ class SteviloLatex extends LatexSurveyElement //izris naslovov label - konec //konec tabele z naslovi label - $tex .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular} \\noindent"); + $tex .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular} \\noindent"); } #IZRIS DRUGE VRSTICE POD DRSNIKOM - LABELE PODROCIJ ########################### //echo $tex; @@ -653,7 +658,6 @@ class SteviloLatex extends LatexSurveyElement } if($nacinVnosa==1){ //ce je drsnik - //if($export_data_type==1||$export_data_type==0){ //ce je dolg ali navaden izpis izvoza, ko se izrisuje drsnik if(($export_data_type==1||$export_data_type==0)&&(count($array_others)==0)){ //ce je dolg ALI navaden izpis izvoza IN ni missing, ko se izrisuje drsnik $tex .= $this->texBigSkip; $tex .= $this->texBigSkip." "; @@ -669,18 +673,9 @@ class SteviloLatex extends LatexSurveyElement //$tex .= $this->texNewLine; } } - - -/* $tex .= $texNewLine; - $tex .= $texNewLine; */ - /* $tex .= $this->texBigSkip; - $tex .= $this->texBigSkip." "; */ - - if($export_format == 'pdf'){ //ce je pdf - //$tex .= '\\end{absolutelynopagebreak}'; //zakljucimo environment, da med vprasanji ne bo prelomov strani - }else{ //ce je rtf - - } + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time število: '.$execution_time.' sec
'; */ return $tex; } diff --git a/admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php b/admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php index 3cd5a14..88e3aa7 100644 --- a/admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php +++ b/admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php @@ -10,9 +10,9 @@ *****************************************/ -define("PIC_SIZE", "\includegraphics[width=10cm]"); //slika sirine 50mm -define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip -define("RADIO_BTN_SIZE", 0.13); +if (!defined('PIC_SIZE')) define("PIC_SIZE", "\includegraphics[width=5cm]"); //slika sirine 50mm +if (!defined('ICON_SIZE')) define("ICON_SIZE", "\includegraphics[width=0.5cm]"); //za ikone @ slikovni tip +if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13); class VsotaLatex extends LatexSurveyElement { @@ -27,6 +27,7 @@ class VsotaLatex extends LatexSurveyElement private static $_instance; protected $texBigSkip = ' \bigskip '; protected $loop_id = null; // id trenutnega loopa ce jih imamo + protected $usr_id = null; public static function getInstance() { @@ -38,9 +39,10 @@ class VsotaLatex extends LatexSurveyElement public function export($spremenljivke=null, $export_format='', $questionText='', $fillablePdf=null, $texNewLine='', $usr_id=null, $db_table=null, $export_subtype=null, $preveriSpremenljivko=null, $loop_id=null){ + //$time_start = microtime(true); // Ce je spremenljivka v loopu $this->loop_id = $loop_id; - + $this->usr_id = $usr_id; //preveri, ce je kaj v bazi //$userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id); $userDataPresent = $this->GetUsersData($db_table, $spremenljivke['id'], $spremenljivke['tip'], $usr_id, $this->loop_id); @@ -72,17 +74,21 @@ class VsotaLatex extends LatexSurveyElement //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){ $stringTitleRow = $rowVrednost['naslov']; //odgovori na levi strani - array_push($navpicniOdgovori, $this->encodeText($stringTitleRow) ); //filanje polja z navpicnimi odgovori (po vrsticah) + if($usr_id){ + $stringTitleRow = Common::getInstance()->dataPiping($stringTitleRow, $usr_id, $loop_id); + } + $stringTitleRow = LatexDocument::encodeText($stringTitleRow); + array_push($navpicniOdgovori, $stringTitleRow ); //filanje polja z navpicnimi odgovori (po vrsticah) //ureditev polja s podatki trenutnega uporabnika ###################################################### //$sqlUserAnswer = sisplet_query("SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' AND loop_id $loop_id"); - $sqlUserAnswer = sisplet_query("SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' "); + $sqlUserAnswer = sisplet_query("SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivke['id']."' AND usr_id='".$usr_id."' AND vre_id='".$rowVrednost['id']."' ".($loop_id !== null ? " AND loop_id='$loop_id'" : "")); $userAnswer = mysqli_fetch_assoc($sqlUserAnswer); - //echo "userAnswer: ".$userAnswer['text']." za vre_id: ".$rowVrednost['id']."
"; - array_push($odgovoriRespondenta, '\\textcolor{crta}{'.$userAnswer['text'].'}' ); //filanje polja z odgovori respondenta + $texUserAnswer = isset($userAnswer['text'])?$userAnswer['text']:null; + array_push($odgovoriRespondenta, '\\textcolor{crta}{'.$texUserAnswer.'}' ); //filanje polja z odgovori respondenta //ureditev polja s podatki trenutnega uporabnika - konec ############################################## - $vsota += $userAnswer['text']; //izracun sprotne vsote + $vsota += isset($userAnswer['text'])?$userAnswer['text']:null; //izracun sprotne vsote } //pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti - konec @@ -105,7 +111,9 @@ class VsotaLatex extends LatexSurveyElement }else{ //ce je rtf } - + /* $time_end = microtime(true); + $execution_time = ($time_end - $time_start); + echo 'Total Execution Time vsota: '.$execution_time.' sec
'; */ return $tex; } } @@ -119,14 +127,18 @@ class VsotaLatex extends LatexSurveyElement $parameterTabularL = 'rl'; //parametri za tabelo - $textVsota = $this->encodeText($spremenljivke['vsota']); + $textVsota = $spremenljivke['vsota']; + if($this->usr_id){ + $textVsota = Common::getInstance()->dataPiping($textVsota, $this->usr_id, $this->loop_id); + } + $textVsota = LatexDocument::encodeText($textVsota); if($textVsota==''){ $textVsota = $lang['srv_vsota_text']; } //zacetek tabele - $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabularL, 'tabularx', 'tabular*', 0.45, 0.2); + $tabela .= $this->StartLatexTable($typeOfDocument, $parameterTabularL, 'xltabular', 'tabular*', 0.45, 0.2); //argumenti za leve okvirje $textboxWidthL = 0.2; @@ -153,11 +165,10 @@ class VsotaLatex extends LatexSurveyElement } //besedilo in okvir pod crto, kjer je prikazana koncna vsota - $tabela .= $textVsota.' & '.$this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, $odgovoriRespondenta[$i-1], $textboxAllignment, $noBorders); - //$tabela .= $lang['srv_vsota_text'].' & '.$this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, $odgovoriRespondenta[$i-1], $textboxAllignment, $noBorders); + $tabela .= $textVsota.' & '.$this->LatexTextBox($typeOfDocument, $textboxHeight, $textboxWidth, isset($odgovoriRespondenta[$i-1])?$odgovoriRespondenta[$i-1]:null, $textboxAllignment, $noBorders); //zakljucek tabele - $tabela .= $this->EndLatexTable($typeOfDocument, 'tabularx', 'tabular*'); + $tabela .= $this->EndLatexTable($typeOfDocument, 'xltabular', 'tabular*'); //izpis kode tabela - konec diff --git a/admin/survey/export/latexclasses/class.LatexAnalysis.php b/admin/survey/export/latexclasses/class.LatexAnalysis.php index ec00834..98815ed 100644 --- a/admin/survey/export/latexclasses/class.LatexAnalysis.php +++ b/admin/survey/export/latexclasses/class.LatexAnalysis.php @@ -86,13 +86,9 @@ class LatexAnalysis{ # preberemo header if ($this->headFileName !== null) { //polovimo podatke o nastavitvah trenutnega profila (missingi..) - //SurveyMissingProfiles :: Init(self::$sid,$global_user_id); SurveyMissingProfiles :: Init($this->spremenljivka,$this->anketa['uid']); SurveyAnalysis::$missingProfileData = SurveyMissingProfiles::getProfile(SurveyAnalysis::$currentMissingProfile); - //echo "SurveyAnalysis::missingProfileData in displayAnalysis: ".SurveyAnalysis::$missingProfileData."
"; - //echo "Indeksi SurveyAnalysis::missingProfileData v displayAnalysis: ".print_r(array_keys(SurveyAnalysis::$missingProfileData))."
"; - //echo "display_mv_type in displayAnalysis: ".SurveyAnalysis::$missingProfileData['display_mv_type']."
"; // Preverimo ce imamo zanke (po skupinah) SurveyAnalysis::$_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); @@ -105,14 +101,9 @@ class LatexAnalysis{ #odstranimo sistemske variable SurveyAnalysis::removeSystemVariables(); - - //echo in_array($this->$spremenljivka['tip'], SurveyAnalysis::$_FILTRED_TYPES ); //$vars_count = count(SurveyAnalysis::$_FILTRED_VARIABLES); - //echo 'sprID: '.$_GET['sprID'].'
'; - //echo 'export_subtype: '.$export_subtype.'
'; - /*Izpis naslova izvoza*/ switch ( $export_subtype ){ case 'sums': @@ -166,13 +157,10 @@ class LatexAnalysis{ foreach (SurveyAnalysis::$_HEADERS AS $spid => $spremenljivka) { $analysisTable = new LatexAnalysisElement($this->anketa, $spremenljivka, $this->export_format, 0, $spid, $this->headFileName, $export_subtype); //if(SurveyAnalysis::$_FILTRED_VARIABLES[$spid]){ - if (($spremenljivka['tip'] != 'm' + if ((isset($spremenljivka['tip']) && $spremenljivka['tip'] != 'm' && in_array($spremenljivka['tip'], SurveyAnalysis::$_FILTRED_TYPES )) && (!isset($_spid) || (isset($_spid) && $_spid == $spid)) && ($this->spremenljivka == $spid || $this->spremenljivka == null) ){ - //echo "spremenljivka tip : ".$spremenljivka['tip']."
"; - /*echo "spr_id: ".$this->spremenljivka."
"; - echo "spid : ".$spid."
"; */ # če nimamo zank if(count(SurveyAnalysis::$_LOOPS) == 0){ $tex .= $analysisTable->displayTablesLatex($spid, $this->export_format); @@ -238,8 +226,10 @@ class LatexAnalysis{ break; case 'crosstab': - $crossData1 = explode(",", $_GET['data1']); - $crossData2 = explode(",", $_GET['data2']); + $tmp_data1 = isset($_GET['data1'])?$_GET['data1']:null; + $tmp_data2 = isset($_GET['data2'])?$_GET['data2']:null; + $crossData1 = explode(",", $tmp_data1); + $crossData2 = explode(",", $tmp_data2); $analysisTable = new LatexAnalysisElement($this->anketa, 0, $this->export_format, 0, 0, $this->headFileName, $export_subtype); $tex .= $analysisTable->displayCrosstabsTablesLatex($crossData1, $crossData2); break; @@ -261,11 +251,13 @@ class LatexAnalysis{ break; case 'heatmap_image_pdf': $analysisHeatmapImage = new LatexAnalysisElement($this->anketa, 0, $this->export_format, 0, 0, $this->headFileName, $export_subtype); - $tex .= $analysisHeatmapImage->displayHeatmapImageLatex($_GET['sprID']); + $tmp_sprID = isset($_GET['sprID'])?$_GET['sprID']:null; + $tex .= $analysisHeatmapImage->displayHeatmapImageLatex($tmp_sprID); break; case 'chart': $analysisChart = new LatexAnalysisElement($this->anketa, 0, $this->export_format, 0, 0, $this->headFileName, $export_subtype); - $tex .= $analysisChart->displayChartLatex($_GET['sprID']); + $tmp_sprID = isset($_GET['sprID'])?$_GET['sprID']:null; + $tex .= $analysisChart->displayChartLatex($tmp_sprID); break; case 'creport': $analysisCreport = new LatexAnalysisElement($this->anketa, 0, $this->export_format, 0, 0, $this->headFileName, $export_subtype); diff --git a/admin/survey/export/latexclasses/class.LatexAnalysisElement.php b/admin/survey/export/latexclasses/class.LatexAnalysisElement.php index 9b3cec2..4e0696b 100644 --- a/admin/survey/export/latexclasses/class.LatexAnalysisElement.php +++ b/admin/survey/export/latexclasses/class.LatexAnalysisElement.php @@ -9,7 +9,7 @@ include('../../vendor/autoload.php'); -define("MAX_STRING_LENGTH", 20); +if (!defined("MAX_STRING_LENGTH")) define("MAX_STRING_LENGTH", 20); class LatexAnalysisElement{ @@ -35,6 +35,20 @@ class LatexAnalysisElement{ protected $export_subtype; protected $export_format; + + protected $path2HeatmapImages = ''; + + protected $counter = 0; + + protected $ttestClass = null; + + protected $tableSettingsNumerus = null; + + protected $tableSettingsPercent = null; + + protected $tableSettingsAvgVar = null; + + protected $tableSettingsDelezVar = null; public $crosstabClass = null; //crosstab class protected $crossData1; @@ -59,7 +73,7 @@ class LatexAnalysisElement{ protected $path2Images; protected $path2Charts; - + //function __construct($anketa, $spremenljivka){ //$anketa, $export_format, $fillablePdf, $usr_id //function __construct($anketa, $export_format, $fillablePdf, $usr_id, $export_subtype){ @@ -171,11 +185,10 @@ class LatexAnalysisElement{ switch ( $this->export_subtype ){ case 'crosstab': - $this->crosstabClass->_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); - //echo "stevilo crosstab loopov: ".count($this->crosstabClass->_LOOPS)."
"; - if (count($this->crosstabClass->_LOOPS) > 0) { + $_LOOPS = SurveyZankaProfiles::getFiltersForLoops(); + if (count($_LOOPS) > 0) { # če mamo zanke - foreach ( $this->crosstabClass->_LOOPS AS $loop) { + foreach ( $_LOOPS AS $loop) { $this->crosstabClass->_CURRENT_LOOP = $loop; $tabela .= $this->displayCrosstabsTable(); } @@ -187,10 +200,12 @@ class LatexAnalysisElement{ for($j=0; $jcrossData2); $j++){ for($i=0; $icrossData1); $i++){ - if($addPage) - $this->pdf->AddPage(); - else + if($addPage){ + //$this->pdf->AddPage(); + }else{ $addPage = true; + } + /*$this->pdf->ln(5);*/ $this->crosstabClass->setVariables($this->crossData2[$j][0],$this->crossData2[$j][1],$this->crossData2[$j][2],$this->crossData1[$i][0],$this->crossData1[$i][1],$this->crossData1[$i][2]); @@ -310,7 +325,7 @@ class LatexAnalysisElement{ $means = array(); - if (meanData1 !== null && $meanData2 !== null) { + if ($meanData1 !== null && $meanData2 !== null) { $variables1 = $meanData2; $variables2 = $meanData1; $c1=0; @@ -322,7 +337,7 @@ class LatexAnalysisElement{ if(is_array($variables2) && count($variables2) > 0){ #prikazujemo ločeno - if ($this->sessionData['means']['meansSeperateTables'] == true || $this->sessionData['mean_charts']['showChart'] == '1') { + if ((isset($this->sessionData['means']['meansSeperateTables'])?$this->sessionData['means']['meansSeperateTables']:null) == true || (isset($this->sessionData['mean_charts']['showChart'])?$this->sessionData['mean_charts']['showChart']:0) == '1') { foreach ($variables2 AS $v_second) { if (is_array($variables1) && count($variables1) > 0) { foreach ($variables1 AS $v_first) { @@ -358,7 +373,7 @@ class LatexAnalysisElement{ $count = 0; foreach ($means AS $mean_sub_grup) { - if($this->sessionData['mean_charts']['showChart'] == '1'){ + if((isset($this->sessionData['mean_charts']['showChart'])?$this->sessionData['mean_charts']['showChart']:0) == '1'){ //$this->displayMeansTable($mean_sub_grup); $tabela .= $mean->displayMeansTable($mean_sub_grup, $this->meansClass, $this->export_format); @@ -441,7 +456,7 @@ class LatexAnalysisElement{ # če nimamo zank if(count(SurveyAnalysis::$_LOOPS) == 0){ - $graf .= $chart->displayCharts(); + $graf .= $chart->displayCharts($this->exportClass); } else{ // izrisemo samo eno tabelo iz enega loopa @@ -452,14 +467,7 @@ class LatexAnalysisElement{ SurveyAnalysis::$_CURRENT_LOOP = $loop; // Izpisemo naslov zanke za skupino -/* $this->pdf->setFont('','B','10'); - $this->pdf->ln(5); - $this->pdf->MultiCell(200, 5, $this->encodeText($lang['srv_zanka_note'].$loop['text']), 0, 'L', 0, 1, 0 ,0, true); - $this->pdf->ln(5); - $this->pdf->setFont('','','6'); */ - - //$graf .= $this->displayCharts(); - $graf .= $chart->displayCharts(); + $graf .= $chart->displayCharts($this->exportClass); } // Izrisemo vse tabele spremenljivka (iz vseh loopov) @@ -472,14 +480,7 @@ class LatexAnalysisElement{ SurveyAnalysis::$_CURRENT_LOOP = $loop; // Izpisemo naslov zanke za skupino -/* $this->pdf->setFont('','B','10'); - $this->pdf->ln(5); - $this->pdf->MultiCell(200, 5, $this->encodeText($lang['srv_zanka_note'].$loop['text']), 0, 'L', 0, 1, 0 ,0, true); - $this->pdf->ln(5); - $this->pdf->setFont('','','6'); */ - - //$graf .= $this->displayCharts(); - $graf .= $chart->displayCharts(); + $graf .= $chart->displayCharts($this->exportClass); } } } @@ -506,7 +507,7 @@ class LatexAnalysisElement{ $creportProfile= $creport->getCreportProfile(); $what = 'creport_title_profile_'.$creportProfile; - $sqlT = sisplet_query("SELECT value FROM srv_user_setting_for_survey WHERE sid='$this->ank_id' AND uid='$this->usr_id' AND what='$what'"); + $sqlT = sisplet_query("SELECT value FROM srv_user_setting_for_survey WHERE sid='$anketaId' AND uid='$global_user_id' AND what='$what'"); if(mysqli_num_rows($sqlT) == 0){ $titleString = $lang['export_analisys_creport'].': '.SurveyInfo::getInstance()->getSurveyTitle(); @@ -516,9 +517,9 @@ class LatexAnalysisElement{ $titleString = $rowT['value']; } - $naslovIzvoza = $this->encodeText($titleString); + $naslovIzvoza = LatexDocument::encodeText($titleString); //$creportLatex .= '\textbf{'.$naslovIzvoza.'}'.$this->texBigSkip.$this->texNewLine; - $creportLatex .= '\MakeUppercase{\huge \textbf{'.$naslovIzvoza.'}}'.$this->texBigSkip.$this->texNewLine; + $creportLatex .= '\MakeUppercase{\huge \textbf{'.$naslovIzvoza.'}}'./* $this->texBigSkip. */$this->texNewLine; if($this->export_format == 'pdf'){ $creportLatex .= '\begin{tableAnalysis}'; /*zacetek environmenta z manjsim fontom*/ @@ -755,6 +756,8 @@ class LatexAnalysisElement{ $imgName = $Cache->GetHash($ID,$DataSet->GetData()); } + $boldedSubTitle=''; + $boldedTitle=''; // Izrisemo naslov (v creportu ne, ker imamo drugacne naslove) if($fromCharts){ @@ -780,7 +783,7 @@ class LatexAnalysisElement{ //self::$exportClass->pdf->setFont('','b','6'); //self::$exportClass->pdf->MultiCell(165, 5, $title, 0, 'C', 0, 1, 0 ,0, true); - $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 if($spremenljivka['tip'] == 2){ //self::$exportClass->pdf->setFont('','','5'); @@ -804,7 +807,8 @@ class LatexAnalysisElement{ shell_exec($pretvoriPng_v_Pdf); ##### ZA TESTIRANJE ureditev pretvorbe slike v pdf - konec - $texImageOnly = " \\includegraphics[scale=0.66]{".$this->path2Charts."".$imgName."} "; //latex za sliko + $texImageOnly = " \\includegraphics[width=\linewidth, frame, scale=0.66]{".$this->path2Charts."".$imgName."} "; //latex za sliko + //$texImageOnly = " \\includegraphics[scale=0.66]{".$this->path2Charts."".$imgName."} "; //latex za sliko //$texImageOnly = " \\includegraphics[scale=0.66, draft=false]{".$this->path2Charts."".$imgName."} "; //latex za sliko //$texImageOnly = " \\includegraphics[scale=0.85]{".$this->path2Charts."".$imgName."} "; //latex za sliko //echo "ime slike: $texImageOnly
"; @@ -838,30 +842,26 @@ class LatexAnalysisElement{ #moja funkcija encodeText function encodeText($text=''){ - // popravimo sumnike ce je potrebno - //$text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8'); - //$text = str_replace("š","š",$text); - //echo "Encoding ".$text."
"; - + $text = isset($text)?$text:''; //resevanje razbirajanja predolgih neprekinjenih besed in URL - spremenljivke za kasnejsi prilagojen izpis $numOfWords = str_word_count($text, 0); //stevilo besed v besedilu $numOfSpacesPrej = substr_count($text, ' '); //stevilo presledkov v besedilu $stringLength = strlen($text); //dolzina besedila - + $findSpace = ' '; $findHttp = 'http://'; $findHttps = 'https://'; $posHttp = strpos($text, $findHttp); $posHttps = strpos($text, $findHttps); $isURL = 0; - /* if($posHttp !== false || $posHttps !== false) { //imamo URL naslov - $isURL = 1; - } */ //resevanje razbirajanja predolgih neprekinjenih besed in URL - konec + if($text == ''){ //ce ni teksta, vrni se return; } + + $textOrig = $text; $findme = '
'; $findmeLength = strlen($findme); @@ -884,27 +884,19 @@ class LatexAnalysisElement{ $posImgEnd = strpos($textPotem, '/>'); //pozicija, kjer se konca html koda za img $textPotem = substr($textPotem, $posImgEnd+strlen('/>')); //tekst od konca html kode za img dalje - //$text = $textPrej.' '.PIC_SIZE_ANS."{".$this->getImageName($text, 0, 'path2Images."".$this->getImageName($text, 0, '"; $textToImgCode = substr($text, 0, $posOfImgCode); //tekst do $findImgCode - //echo $textToImgCode."
"; $textFromImgCode = substr($text, $posOfImgCode); //tekst po $findImgCode - //echo $textFromImgCode."
"; $findImgCodeEnd = '}'; - //$posOfImgCodeEnd = strpos($text, $findImgCodeEnd); $posOfImgCodeEnd = strpos($textFromImgCode, $findImgCodeEnd); - //echo $posOfImgCodeEnd."
"; $textAfterImgCode = substr($textFromImgCode, $posOfImgCodeEnd+1); //tekst po $findImgCodeEnd - //echo $textAfterImgCode."
"; $textOfImgCode = substr($text, $posOfImgCode, $posOfImgCodeEnd+1); - //echo $textOfImgCode."
"; $text = $textToImgCode.$textAfterImgCode; @@ -912,6 +904,7 @@ class LatexAnalysisElement{ } //ureditev izrisa slike - konec + //ureditev posebnih karakterjev za Latex http://www.cespedes.org/blog/85/how-to-escape-latex-special-characters, https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Other_symbols $text = str_replace('\\','\textbackslash{} ',$text); //$text = str_replace('{','\{',$text); @@ -925,29 +918,22 @@ class LatexAnalysisElement{ //$text = str_replace('_','\_ ',$text); $text = str_replace('_','\_',$text); $text = str_replace('~','\textasciitilde{} ',$text); - if(strpos($text, '&')){ //ce je prisotno v besedilu &' - $text = str_replace('&','\& ',$text); - }else{ - $text = str_replace('&','\& ',$text); - } - - $andSymbolPresent = 0; - $posAndSymbolPresent = strpos($text,'&'); - if($posAndSymbolPresent !== false){ //ce je v besedilu prisoten '&' zapisan kot '&' - $text = str_replace('&','\&',$text); - $andSymbolPresent = 1; - } - if($andSymbolPresent == 0){ - $text = str_replace('&','\&',$text); - } //$text = str_replace('<','\textless ',$text); $text = str_replace('<','\textless',$text); //$text = str_replace('>','\textgreater ',$text); $text = str_replace('>','\textgreater',$text); $text = str_replace(' ',' ',$text); + + if(strpos($text, '&')){ //ce je prisotno v besedilu &' + $text = str_replace('&','\&',$text); + } + else{ + $text = str_replace('&','\&',$text); + } //ureditev posebnih karakterjev za Latex - konec + //ureditev grskih crk $text = str_replace('α','\textalpha ',$text); $text = str_replace('β','\textbeta ',$text); @@ -975,39 +961,38 @@ class LatexAnalysisElement{ $text = str_replace('ω','\textomega ',$text); //ureditev grskih crk - konec + //ureditev preureditve html kode ul in li v latex itemize $findUl = '"; + $numOfUl = substr_count($text, $findUl); //stevilo '"; - ###################### + if($numOfUl!=0){ $text = str_replace('
    ','\begin{itemize} ', $text); $text = str_replace('
  • ','\item ', $text); $text = str_replace('
','\end{itemize} ', $text); } - //echo "prazno v html: ".strpos($text, '\r')."
"; - //echo "text potem: ".$text."
"; - ###################### } - //ureditev preureditve html kode ul in li v latex itemize - konec + //po ureditvi posebnih karakterjev, dodati del teksta s kodo za sliko, ce je slika prisotna if($posImg !== false){ $text = substr_replace($text, $textOfImgCode, $posOfImgCode, 0); } //po ureditvi posebnih karakterjev, dodati del teksta s kodo za sliko, ce je slika prisotna - if($pos === false && $posImg === false) { //v tekstu ni br in img - //return $text; -/* echo "encode pred strip: ".$text."
"; - echo "encode po strip: ".strip_tags($text)."
"; - return strip_tags($text); */ - }else { //v tekstu sta prisotna br ali img + + //v tekstu ni br in img + if($pos === false && $posImg === false) { + + } + //v tekstu sta prisotna br ali img + else { $text2Return = ''; //tekst ki bo vrnjen //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico @@ -1015,6 +1000,7 @@ class LatexAnalysisElement{ $pos = strpos($text, $findme); $numOfBr = substr_count($text, $findme); //stevilo '
' v tekstu for($i=0; $i<$numOfBr; $i++){ + if($i == 0){ //ce je prvi najdeni '
' $textPrej = substr($text, 0, $pos); $textPotem = substr($text, $pos+$findmeLength); @@ -1023,7 +1009,8 @@ class LatexAnalysisElement{ }else{ $text2Return .= $textPrej.' \break '; } - }else{ //drugace + } + else{ //drugace $pos = strpos($textPotem, $findme); $textPrej = substr($textPotem, 0, $pos); $textPotem = substr($textPotem, $pos+$findmeLength); @@ -1034,40 +1021,43 @@ class LatexAnalysisElement{ } } } + $text = $text2Return; } - //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico - konec -/* echo "encode pred strip: ".$text."
"; - echo "encode po strip: ".strip_tags($text)."
"; - return strip_tags($text); //vrni tekst brez html tag-ov */ } + //ureditev odstranjevanja presledkov, ce so na zacetku ali koncu besedila if(($numOfSpacesPrej)){ //ce so prisotni presledki $odstranjeno = 0; //belezi, ali so bili presledki odstranjeni iz zacetka ali konca + for($numPresledkovTmp = 1; $numPresledkovTmp <= $numOfSpacesPrej; $numPresledkovTmp++){ //za vsak presledek $posSpace = strpos($text, $findSpace); //najdi pozicijo presledka v besedilu//preveri, kje se nahaja + if($posSpace==0){ //ce je presledek na zacetku besedila $text = substr_replace($text, '', $posSpace, 1); //odstrani presledek iz besedila $stringLength = strlen($text); $odstranjeno = 1; - }elseif($posSpace==$stringLength){ //ce je presledek na koncu besedila + } + elseif($posSpace==$stringLength){ //ce je presledek na koncu besedila $text = substr_replace($text, '', $posSpace, 1); //odstrani presledek iz besedila $stringLength = strlen($text); $odstranjeno = 1; } } + $numOfSpacesPrej = substr_count($text, ' '); //stevilo presledkov v besedilu } //ureditev odstranjevanja presledkov, ce so na zacetku ali koncu besedila - konec + - //echo "v besedilu $text je stevilo presledkov $numOfSpacesPrej in besed $numOfWords
"; //priprava izpisa zelo dolgega besedila brez presledkov s seqsplit (URL, email, ...) - if( ($numOfSpacesPrej == 0 && $stringLength >= MAX_STRING_LENGTH && $odstranjeno) ){ //ce v besedilu ni presledkov in je besedilo daljse od max dovoljene dolzine + if( ($numOfSpacesPrej == 0 && $stringLength >= MAX_STRING_LENGTH && isset($odstranjeno)?$odstranjeno:0) ){ //ce v besedilu ni presledkov in je besedilo daljse od max dovoljene dolzine $text = "\seqsplit{".$text."}"; //ni v redu seqsplit, ker ne dela, če so posebni znaki } //priprava izpisa zelo dolgega besedila brez presledkov - konec + return strip_tags($text); //vrni tekst brez html tag-ov } @@ -1078,9 +1068,10 @@ class LatexAnalysisElement{ $tex .= '\keepXColumns'; if($export_format == 'pdf'){ $tex .= '\begin{'.$pdfTable.'}'; - if($pdfTable=='tabularx'){ + if($pdfTable=='xltabular'){ //$tex .= '{'.$pdfTableWidth.'\textwidth}'; - $tex .= '{\hsize}'; + //$tex .= '{\hsize}'; + $tex .= '{\textwidth}'; } $tex .= '{ '.$parameterTabular.' }'; }elseif($export_format == 'rtf'||$export_format == 'xls'){ @@ -1098,7 +1089,7 @@ class LatexAnalysisElement{ global $lang; $text = array(); - $texoutputSumaValidAnswerVertical = ''; + $outputSumaValidAnswerVertical = ''; # opcije $options = array( 'isTextAnswer' => false, # ali je tekstovni odgovor @@ -1110,26 +1101,26 @@ class LatexAnalysisElement{ $options[$_oKey] = $_option; } - $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; + $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:0) / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_brez_MV = ((int)SurveyAnalysis::$currentMissingProfile == 2) ? TRUE : FALSE; $_sufix = ''; - $text[] = $this->encodeText($lang['srv_anl_valid']); - $text[] = $this->encodeText($lang['srv_anl_suma1']); + $text[] = LatexDocument::encodeText($lang['srv_anl_valid']); + $text[] = LatexDocument::encodeText($lang['srv_anl_suma1']); - $text[] = $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0); + $text[] = LatexDocument::encodeText((isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:0) > 0 ? (isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:0) : 0); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); $text[] = ''; - $exportformat = $options['exportFormat']; + $exportformat = isset($options['exportFormat'])?$options['exportFormat']:null; $brezHline = $this->getBrezHline($exportformat); $outputSumaValidAnswerVertical .= self::tableRow($text, $brezHline); @@ -1138,9 +1129,8 @@ class LatexAnalysisElement{ //return $counter; } - function outputValidAnswerVertical($counter=null,$vkey='', $vAnswer=null, $_sequence=null,$spid=null, &$_kumulativa=null,$_options=array()) { + function outputValidAnswerVertical($counter=null,$vkey='', $vAnswer=null, $_sequence=null,$spid=null, &$_kumulativa=null,$_options=array(), $sprTip=null) { global $lang; - //echo "funkcija outputValidAnswerVertical
"; $text = array(); $texoutputValidAnswerVertical = ''; @@ -1156,50 +1146,33 @@ class LatexAnalysisElement{ } $cssBck = ' '.SurveyAnalysis::$cssColors['0_' . ($counter & 1)]; - $_valid = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; + $_valid = ((isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt']:0) > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['validCnt'] : 0; $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; $_kumulativa += $_valid; # ali presegamo število prikazanih vrstic, takrat v zadnji prikazani dodamo link več.. ostale vrstice pa skrijemo -/* if ($options['textAnswerExceed'] == true) { - if ($counter == TEXT_ANSWER_LIMIT ) { - # link za več - $show_more = '
(več...)
'.NEW_LINE; - } elseif ($counter > TEXT_ANSWER_LIMIT ) { - $hide_row = ' hidden'; - $_exceed = true; - } - } */ - //if ($counter < TEXT_MAX_ANSWER_LIMIT) { - $text[] = ''; + $text[] = ''; - $addText = (($options['isTextAnswer'] == false && (string)$vkey != $vAnswer['text']) ? ' ('.$vAnswer['text'] .')' : ''); - //$text[] = $this->encodeText(' '.$vkey.$addText); - $text[] = $this->snippet($this->encodeText(' '.$vkey.$addText), 400); - + $addText = (($options['isTextAnswer'] == false && (string)$vkey != $vAnswer['text']) ? ' ('.$vAnswer['text'] .')' : ''); + $tmptext = $this->snippet($vkey.$addText, 400); + $text[] = LatexDocument::encodeText($tmptext); + //$text[] = $this->snippet(LatexDocument::encodeText(' '.$vkey.$addText), 400); + + if($sprTip!=21){ $text[] = (int)$vAnswer['cnt']; - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_valid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber($_valid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_valid, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_kumulativa, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber($_kumulativa, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - - /*} elseif ($counter == TEXT_MAX_ANSWER_LIMIT ) { - echo ''; - echo ' . . . Prikazujemo samo prvih '.TEXT_MAX_ANSWER_LIMIT.' veljavnih odgovorov!'; - echo ''; - }*/ + $text[] = LatexDocument::encodeText(self::formatNumber($_kumulativa, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + } - $exportformat = $options['exportFormat']; + $exportformat = isset($options['exportFormat'])?$options['exportFormat']:null; $brezHline = $this->getBrezHline($exportformat); $texoutputValidAnswerVertical .= self::tableRow($text, $brezHline); - //echo "Besedilo na koncu funkcije outputValidAnswerVertical:".$texoutputValidAnswerVertical."
"; return $texoutputValidAnswerVertical; /* $counter++; return $counter; */ @@ -1221,7 +1194,7 @@ class LatexAnalysisElement{ $options[$_oKey] = $_option; } - $exportformat = $options['exportFormat']; + $exportformat = isset($options['exportFormat'])?$options['exportFormat']:null; $brezHline = $this->getBrezHline($exportformat); $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*$vAnswer['cnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; @@ -1236,17 +1209,17 @@ class LatexAnalysisElement{ //$_Z_MV = 1; if($_Z_MV){ //echo "this->hideEmpty: ".$this->hideEmpty."
"; - //$text[] = $this->encodeText($lang['srv_anl_missing1']); - //$text[] = '\multirow{ '.$vAnswer['cnt'].'}{*}{ '.$this->encodeText($lang['srv_anl_missing1']).' }'; + //$text[] = LatexDocument::encodeText($lang['srv_anl_missing1']); + //$text[] = '\multirow{ '.$vAnswer['cnt'].'}{*}{ '.LatexDocument::encodeText($lang['srv_anl_missing1']).' }'; $text[] = ''; - $text[] = $this->encodeText($vkey.' (' . $vAnswer['text'].')'); + $text[] = LatexDocument::encodeText($vkey.' (' . $vAnswer['text'].')'); - $text[] = $this->encodeText((int)$vAnswer['cnt']); + $text[] = LatexDocument::encodeText((int)$vAnswer['cnt']); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); $text[] = ''; $text[] = ''; @@ -1274,34 +1247,32 @@ class LatexAnalysisElement{ $options[$_oKey] = $_option; } - $exportformat = $options['exportFormat']; + $exportformat = isset($options['exportFormat'])?$options['exportFormat']:null; $brezHline = $this->getBrezHline($exportformat); $cssBck = ' '.SurveyAnalysis::$cssColors['text_' . ($counter & 1)]; - $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] / SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0; + $_percent = (SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] > 0 ) ? 100*(isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt']:0) / (isset(SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt']:null) : 0; //$_brez_MV = ((int)SurveyAnalysis::$missingProfileData['display_mv_type'] === 0) ? TRUE : FALSE; $_brez_MV = $this->hideEmpty; if(!$_brez_MV){ $text = array(); - //$text[] = $this->encodeText($lang['srv_anl_missing1']); $text[] = ''; - $text[] = $this->encodeText($lang['srv_anl_suma1']); - //$text[] = $this->encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt']); + $text[] = LatexDocument::encodeText($lang['srv_anl_suma1']); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt']); $answer['cnt'] = SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] > 0 ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalidCnt'] : 0; - $text[] = $this->encodeText((int)$answer['cnt']); + $text[] = LatexDocument::encodeText((int)$answer['cnt']); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber($_percent, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); $text[] = ''; $text[] = ''; $texoutputSumaInvalidAnswerVertical .= $this->tableRow($text, $brezHline); } - //echo $texoutputSumaInvalidAnswerVertical."
"; return $texoutputSumaInvalidAnswerVertical; /* $counter++; return $counter; */ @@ -1331,7 +1302,7 @@ class LatexAnalysisElement{ $brezHline = 0; } */ - $exportformat = $options['exportFormat']; + $exportformat = isset($options['exportFormat'])?$options['exportFormat']:null; $brezHline = $this->getBrezHline($exportformat); $_brez_MV = $this->hideEmpty; @@ -1340,10 +1311,10 @@ class LatexAnalysisElement{ $text = array(); $text[] = ''; - $text[] = $this->encodeText($lang['srv_anl_suma2']); - $text[] = $this->encodeText((SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0)); - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); - $text[] = $this->encodeText(self::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText($lang['srv_anl_suma2']); + $text[] = LatexDocument::encodeText((SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] ? SurveyAnalysis::$_FREQUENCYS[$_sequence]['allCnt'] : 0)); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); + $text[] = LatexDocument::encodeText(self::formatNumber('100', SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%')); $text[] = ''; $text[] = ''; @@ -1383,7 +1354,7 @@ class LatexAnalysisElement{ //Priprava parametrov za tabelo - konec //zacetek latex tabele z obrobo za Drugo - $pdfTable = 'tabularx'; + $pdfTable = 'xltabular'; $rtfTable = 'tabular'; $pdfTableWidth = 1; $rtfTableWidth = 1; @@ -1396,8 +1367,8 @@ class LatexAnalysisElement{ /*Naslovni vrstici tabele*/ //prva vrstica tabele - $texOutputOtherAnswers .= $this->encodeText($_variable['variable'])." & \multicolumn{5}{l|}{".$this->encodeText(SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )')."} ".$this->texNewLine; - //$texOutputOtherAnswers .= $this->encodeText($_variable['variable'])." & \multicolumn{5}{X|}{".$this->encodeText(SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )')."} ".$this->texNewLine; + $texOutputOtherAnswers .= LatexDocument::encodeText($_variable['variable'])." & \multicolumn{5}{l|}{".LatexDocument::encodeText(SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )')."} ".$this->texNewLine; + //$texOutputOtherAnswers .= LatexDocument::encodeText($_variable['variable'])." & \multicolumn{5}{X|}{".LatexDocument::encodeText(SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )')."} ".$this->texNewLine; if($export_format != 'xls'){ $texOutputOtherAnswers .= $this->horizontalLineTex; /*obroba*/ $brezHline = 1; @@ -1415,8 +1386,8 @@ class LatexAnalysisElement{ //prva vrstica /* $this->pdf->setFont('','b','6'); $this->pdf->ln(5); - $this->pdf->MultiCell(18, $height, $this->encodeText($_variable['variable']), 1, 'C', 0, 0, 0 ,0, true); - $this->pdf->MultiCell(162, $height, $this->encodeText(SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )'), 1, 'L', 0, 1, 0 ,0, true); */ + $this->pdf->MultiCell(18, $height, LatexDocument::encodeText($_variable['variable']), 1, 'C', 0, 0, 0 ,0, true); + $this->pdf->MultiCell(162, $height, LatexDocument::encodeText(SurveyAnalysis::$_HEADERS[$oAnswers['spid']]['variable'].' ('.$_variable['naslov'].' )'), 1, 'L', 0, 1, 0 ,0, true); */ //druga vrstica /* $this->tableHeader(); @@ -1425,7 +1396,8 @@ class LatexAnalysisElement{ $counter = 1; $_kumulativa = 0; - if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'])> 0 ) { + $freg_seq = array_key_exists('valid', SurveyAnalysis::$_FREQUENCYS[$_sequence])?SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid']:null; + if (is_countable($freg_seq)&&count($freg_seq)> 0 ) { foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['valid'] AS $vkey => $vAnswer) { if ($vAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 //$counter = self::outputValidAnswerVertical($counter,$vkey,$vAnswer,$_sequence,$spid,$_kumulativa,array('isOtherAnswer'=>true)); @@ -1439,7 +1411,7 @@ class LatexAnalysisElement{ if (count(SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'])> 0 ) { $_Z_MV = !$this->hideEmpty; if($_Z_MV){ //ce je potrebno izpisati tudi manjkajoce - $texOutputOtherAnswers .= $this->encodeText($lang['srv_anl_missing1']); + $texOutputOtherAnswers .= LatexDocument::encodeText($lang['srv_anl_missing1']); } foreach (SurveyAnalysis::$_FREQUENCYS[$_sequence]['invalid'] AS $ikey => $iAnswer) { if ($iAnswer['cnt'] > 0 ) { # izpisujemo samo tiste ki nisno 0 @@ -1457,7 +1429,7 @@ class LatexAnalysisElement{ $texOutputOtherAnswers .= self::outputSumaVertical($counter,$_sequence,$spid,array('isOtherAnswer'=>true, 'exportFormat'=>$export_format)); //zaljucek latex tabele za Drugo - $texOutputOtherAnswers .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}"); + $texOutputOtherAnswers .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}"); //zaljucek latex tabele za Drugo - konec return $texOutputOtherAnswers; @@ -1470,11 +1442,11 @@ class LatexAnalysisElement{ $naslov = array(); $naslov[] = ''; - $naslov[] = $this->encodeText($lang['srv_analiza_frekvence_titleAnswers']); - $naslov[] = $this->encodeText($lang['srv_analiza_frekvence_titleFrekvenca']); - $naslov[] = $this->encodeText($lang['srv_analiza_frekvence_titleOdstotek']); - $naslov[] = $this->encodeText($lang['srv_analiza_frekvence_titleVeljavni']); - $naslov[] = $this->encodeText($lang['srv_analiza_frekvence_titleKumulativa']); + $naslov[] = LatexDocument::encodeText($lang['srv_analiza_frekvence_titleAnswers']); + $naslov[] = LatexDocument::encodeText($lang['srv_analiza_frekvence_titleFrekvenca']); + $naslov[] = LatexDocument::encodeText($lang['srv_analiza_frekvence_titleOdstotek']); + $naslov[] = LatexDocument::encodeText($lang['srv_analiza_frekvence_titleVeljavni']); + $naslov[] = LatexDocument::encodeText($lang['srv_analiza_frekvence_titleKumulativa']); $params = array('border' => 'TB', 'bold' => 'B', 'align2' => 'C'); @@ -1486,9 +1458,9 @@ class LatexAnalysisElement{ } $tableHeader .= $this->tableRow($naslov, $brezHline); - /*$linecount = $this->pdf->getNumLines($this->encodeText($arrayText[1]), 90); + /*$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($arrayText[1]), 90); $linecount == 1 ? $height = 4.7 : $height = 4.7 + ($linecount-1)*3.3;*/ - $height = 1; //$height = $this->getCellHeight($this->encodeText($arrayText[1]), 90); + $height = 1; //$height = $this->getCellHeight(LatexDocument::encodeText($arrayText[1]), 90); //ce smo na prelomu strani /* if( ($this->pdf->getY() + $height) > 270){ @@ -1509,9 +1481,10 @@ class LatexAnalysisElement{ } //funkcija skrbi za izpis multicol celice - function MultiColCellLatex($steviloVmesnihStolpcevPodvrstic=null, $text='', $odZacetka=0){ + function MultiColCellLatex($steviloVmesnihStolpcevPodvrstic=null, $text='', $odZacetka=0, $export_format=null){ $tabela = ''; //echo "steviloVmesnihStolpcevPodvrstic: $steviloVmesnihStolpcevPodvrstic
"; + //echo "format: $export_format
"; if($steviloVmesnihStolpcevPodvrstic==1){ //ce je 1, ne sme biti multicolumn{1}, saj so drugace tezave z izpisom $tabela .= " & ".$text." "; }else{ @@ -1519,10 +1492,19 @@ class LatexAnalysisElement{ $steviloArrayrulewidth = ($steviloVmesnihStolpcevPodvrstic-1); if($odZacetka==0){ //$tabela .= " & \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{X|}{";//zacetek multicol - $tabela .= " & \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{>{\hsize=\dimexpr".$steviloVmesnihStolpcevPodvrstic."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{";//zacetek multicol + if($export_format=='pdf'){ + $tabela .= " & \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{>{\hsize=\dimexpr".$steviloVmesnihStolpcevPodvrstic."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{";//zacetek multicol + }elseif($export_format=='rtf'){ + $tabela .= " & \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{C|}{";//zacetek multicol + } + }else{ //$tabela .= " \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{X|}{";//zacetek multicol - $tabela .= " \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{>{\hsize=\dimexpr".$steviloVmesnihStolpcevPodvrstic."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{";//zacetek multicol + if($export_format=='pdf'){ + $tabela .= " \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{>{\hsize=\dimexpr".$steviloVmesnihStolpcevPodvrstic."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{";//zacetek multicol + }elseif($export_format=='rtf'){ + $tabela .= " \multicolumn{".$steviloVmesnihStolpcevPodvrstic."}{C|}{";//zacetek multicol + } } $tabela .= $text; if($odZacetka==0){ @@ -1546,7 +1528,7 @@ class LatexAnalysisElement{ $tabela .= '\multirow{'.$steviloVmesnihVrstic.'}{*}{'; //zacetek multirow } $tabela .= $text; - /* if($cols==0 && $text==$this->encodeText($lang['srv_analiza_crosstab_skupaj'])){ //premaknil nize, ker je delalo težave pri izpisu daljsih tabel + /* if($cols==0 && $text==LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])){ //premaknil nize, ker je delalo težave pri izpisu daljsih tabel $tabela .= ' & '; } */ //if($steviloVmesnihVrstic > 1){ //ce je potrebno multirow prikazovanje @@ -1554,7 +1536,7 @@ class LatexAnalysisElement{ $tabela .= '}'; //konec multirow } - if($cols==0 && $text==$this->encodeText($lang['srv_analiza_crosstab_skupaj'])){ + if($cols==0 && $text==LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])){ $tabela .= ' & '; } //echo $tabela."
"; @@ -1575,21 +1557,14 @@ class LatexAnalysisElement{ return $tabela; } - //function tableRow($arrayText, $brezHline=0, $brezNoveVrstice=0, $nadaljevanjeVrstice=0, $steviloPodstolpcev){ - //function tableRow($arrayText, $brezHline=0, $brezNoveVrstice=0, $nadaljevanjeVrstice=0, $color='', $export_format, $steviloPodstolpcev){ + function tableRow($arrayText=[], $brezHline=0, $brezNoveVrstice=0, $nadaljevanjeVrstice=0, $color='', $export_format='', $steviloPodstolpcev=[]){ $tableRow = ''; - /*$linecount = $this->pdf->getNumLines($this->encodeText($arrayText[1]), 90); + /*$linecount = $this->pdf->getNumLines(LatexDocument::encodeText($arrayText[1]), 90); $linecount == 1 ? $height = 4.7 : $height = 4.7 + ($linecount-1)*3.3;*/ - $height = 1; //$height = $this->getCellHeight($this->encodeText($arrayText[1]), 90); -/* echo $arrayText[0]."
"; - echo $arrayText[1]."
"; - echo "brez hline: ".$brezHline."
"; */ - - if($arrayParams['align2'] != 'C') - $arrayParams['align2'] = 'L'; - //echo "velikost polja s tekstom: ".count($arrayText)."
"; - + $height = 1; //$height = $this->getCellHeight(LatexDocument::encodeText($arrayText[1]), 90); + + $cellBgColor = ''; if($export_format == 'pdf'){ if($color=='blue'){ //$cellBgColor = 'cyan'; @@ -1787,35 +1762,33 @@ class LatexAnalysisElement{ //echo "funkcija displayDescriptivesSpremenljivkaRow: ".$spremenljivka['variable']."
"; $texDisplayDescriptivesSpremenljivkaRow = ''; if ($_sequence != null) { - $_desc = SurveyAnalysis::$_DESCRIPTIVES[$_sequence]; + $_desc = isset(SurveyAnalysis::$_DESCRIPTIVES[$_sequence])?SurveyAnalysis::$_DESCRIPTIVES[$_sequence]:null; } $text = array(); - $text[] = '\textbf{'.$this->encodeText($spremenljivka['variable']).'}'; - $text[] = '\textbf{'.$this->encodeText($spremenljivka['naslov']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($spremenljivka['variable']).'}'; + $text[] = '\textbf{'.LatexDocument::encodeText($spremenljivka['naslov']).'}'; #veljavno - $text[] = $this->encodeText((!$show_enota ? (int)$_desc['validCnt'] : '')); + $text[] = LatexDocument::encodeText((!$show_enota ? (int)(isset($_desc['validCnt'])?$_desc['validCnt']:0) : '')); #ustrezno - $text[] = $this->encodeText((!$show_enota ? (int)$_desc['allCnt'] : '')); + $text[] = LatexDocument::encodeText((!$show_enota ? (int)(isset($_desc['allCnt'])?$_desc['allCnt']:0) : '')); if (isset($_desc['avg']) && (int)$spremenljivka['skala'] !== 1) - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); - $text[] = $this->encodeText(self::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); + $text[] = LatexDocument::encodeText(self::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); else - $text[] = $this->encodeText(''); + $text[] = LatexDocument::encodeText(''); if (isset($_desc['div']) && (int)$spremenljivka['skala'] !== 1) - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); - $text[] = $this->encodeText(self::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); + $text[] = LatexDocument::encodeText(self::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); else - $text[] = $this->encodeText(''); + $text[] = LatexDocument::encodeText(''); - //$text[] = $this->encodeText((int)$spremenljivka['skala'] !== 1 ? $_desc['min'] : ''); - //$text[] = $this->encodeText((int)$spremenljivka['skala'] !== 1 ? $_desc['max'] : ''); - $text[] = (int)$spremenljivka['skala'] !== 1 ? $_desc['min'] : ''; - $text[] = (int)$spremenljivka['skala'] !== 1 ? $_desc['max'] : ''; + $text[] = (int)(isset($spremenljivka['skala'])?$spremenljivka['skala']:0) !== 1 ? (isset($_desc['min'])?$_desc['min']:0) : ''; + $text[] = (int)(isset($spremenljivka['skala'])?$spremenljivka['skala']:0) !== 1 ? (isset($_desc['max'])?$_desc['max']:0) : ''; //$texDisplayDescriptivesSpremenljivkaRow .= $this->descTableRow($text); @@ -1836,55 +1809,50 @@ class LatexAnalysisElement{ $texDescriptivesVariablaRow = ''; $_sequence = $variable['sequence']; # id kolone z podatki if ($_sequence != null) { - $_desc = SurveyAnalysis::$_DESCRIPTIVES[$_sequence]; + $_desc = isset(SurveyAnalysis::$_DESCRIPTIVES[$_sequence])?SurveyAnalysis::$_DESCRIPTIVES[$_sequence]:null; } $text = array(); - $text[] = $this->encodeText($variable['variable']); - $text[] = $this->encodeText($variable['naslov']); + $text[] = LatexDocument::encodeText($variable['variable']); + $text[] = LatexDocument::encodeText($variable['naslov']); #veljavno - $text[] = $this->encodeText((int)$_desc['validCnt']); + $text[] = LatexDocument::encodeText((int)(isset($_desc['validCnt'])?$_desc['validCnt']:0)); #ustrezno - $text[] = $this->encodeText((int)$_desc['allCnt']); + $text[] = LatexDocument::encodeText((int)(isset($_desc['allCnt'])?$_desc['allCnt']:0)); - //if (isset($_desc['avg']) && (int)$spremenljivka['skala'] !== 1) - //if (isset($_desc['avg']) && (int)$spremenljivka['skala'] !== 1 && $spremenljivka['tip'] != 16) if (isset($_desc['avg']) && (int)$spremenljivka['skala'] !== 1 && ($spremenljivka['tip'] != 16 && $spremenljivka['tip'] != 2)) - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); - $text[] = $this->encodeText(self::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); + $text[] = LatexDocument::encodeText(self::formatNumber($_desc['avg'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),'')); //else if (isset($_desc['avg']) && $spremenljivka['tip'] == 2 && (int)$spremenljivka['skala'] == 1 ) else if (isset($_desc['avg']) && $spremenljivka['tip'] == 2 && (int)$spremenljivka['skala'] !== 1 && ($spremenljivka['tip'] != 16)) - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %')); - $text[] = $this->encodeText(self::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %')); + $text[] = LatexDocument::encodeText(self::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %')); else - $text[] = $this->encodeText(''); + $text[] = LatexDocument::encodeText(''); - //if (isset($_desc['div']) && (int)$spremenljivka['skala'] !== 1) - //if (isset($_desc['div']) && (int)$spremenljivka['skala'] !== 1 && $spremenljivka['tip'] != 16) if (isset($_desc['div']) && (int)$spremenljivka['skala'] !== 1 && ($spremenljivka['tip'] != 16 && $spremenljivka['tip'] != 2)) - //$text[] = $this->encodeText(SurveyAnalysis::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); - $text[] = $this->encodeText(self::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); + //$text[] = LatexDocument::encodeText(SurveyAnalysis::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); + $text[] = LatexDocument::encodeText(self::formatNumber($_desc['div'],SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_DEVIATION'),'')); else - $text[] = $this->encodeText(''); + $text[] = LatexDocument::encodeText(''); - //if ((int)$spremenljivka['skala'] !== 1 && $spremenljivka['tip'] != 16){ - if ((int)$spremenljivka['skala'] !== 1 && ($spremenljivka['tip'] != 16 && $spremenljivka['tip'] != 2)){ - $text[] = $this->encodeText($_desc['min']); - $text[] = $this->encodeText($_desc['max']); + if ((int)(isset($spremenljivka['skala'])?$spremenljivka['skala']:0) !== 1 && ($spremenljivka['tip'] != 16 && $spremenljivka['tip'] != 2)){ + $text[] = LatexDocument::encodeText(isset($_desc['min'])?$_desc['min']:0); + $text[] = LatexDocument::encodeText(isset($_desc['max'])?$_desc['max']:0); }else{ - $text[] = $this->encodeText(''); - $text[] = $this->encodeText(''); + $text[] = LatexDocument::encodeText(''); + $text[] = LatexDocument::encodeText(''); } - //$text[] = $this->encodeText((int)$spremenljivka['skala'] !== 1 ? $_desc['min'] : ''); - //$text[] = $this->encodeText((int)$spremenljivka['skala'] !== 1 ? $_desc['max'] : ''); + //$text[] = LatexDocument::encodeText((int)$spremenljivka['skala'] !== 1 ? $_desc['min'] : ''); + //$text[] = LatexDocument::encodeText((int)$spremenljivka['skala'] !== 1 ? $_desc['max'] : ''); $texDescriptivesVariablaRow .= $this->tableRow($text); - //echo "nekaj: ".$this->encodeText(self::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %'))." ".$spremenljivka['tip']."
"; + //echo "nekaj: ".LatexDocument::encodeText(self::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %'))." ".$spremenljivka['tip']."
"; //echo "tex iz funkcije displayDescriptivesVariablaRow: ".$texDescriptivesVariablaRow."
"; return $texDescriptivesVariablaRow; } @@ -2019,4 +1987,182 @@ class LatexAnalysisElement{ return $brezHline; } + #funkcija, ki skrbi za pridobitev imena slike, ki jo je potrebno izrisati ###################################### + function getImageName($text='', $sprId=null, $findme='', $vre_id=0, $img_id=0){ + global $site_path, $site_url; + $imageName = ''; + //echo "id slike $img_id
"; + if($text == 'hotspot' && $findme == 'hotspot_image='){ + $sqlParametrov = sisplet_query("SELECT params FROM srv_spremenljivka WHERE id='".$sprId."'"); + $rowParametrov = mysqli_fetch_row($sqlParametrov); + $text = $rowParametrov[0]; + } + + $pos = strpos($text, $findme); //najdi pozicijo teksta v $findme + //echo "text za echo: ".$text."
"; + //if($pos!=''){ //ce je slika v bazi + if($pos!=''||$pos==0){ //ce je slika v bazi + $imageName = substr($text,$pos); //pokazi le del text od besedila $findme dalje (vkljucno z besedilom) + //echo "imageName prej: ".$imageName."
"; + + //$findme = $site_path.'uploadi/editor/'; + $findme = $site_url.'uploadi/editor/'; + //$findme = 'uploadi/editor/'; + //$findme = 'editor/'; + //echo "findme: ".$findme."
"; + $pos = strpos($imageName, $findme); //najdi pozicijo teksta v $findme + //echo "najdi tole: ".$findme."
"; + //echo "najdi tukaj: ".$imageName."
"; + //echo "pozicija tega: ".$pos."
"; + if($pos){ //ce je slika na strezniku + $slikaNaStrezniku = 1; + }else{//ce slike ni na strezniku + $slikaNaStrezniku = 0; + } + //echo "ali je slika na strežniku: ".$slikaNaStrezniku."
"; + if($slikaNaStrezniku==1){ //ce je slika na strezniku + $findEditor = 'editor/'; + $posEditor = strpos($imageName, $findEditor); //najdi pozicijo teksta v $findEditor + $imageName = substr($imageName,$posEditor+7); //pokazi le del params od besedila 'editor/' dalje, brez besedila 'editor/' + //echo "imagename : ".$imageName."
"; + $pos = $this->getEndPosition($imageName); //najdi pozicijo konca URL slike + $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike (za gif je potrebno sliko pretvoriti v png, saj latex ne podpira gif) + $imageName = substr($imageName, 0, $pos); //pokazi le del params od zacetka besedila do '"' oz. konca URL slike + + $path = $site_path.'uploadi/editor/'.$imageName; + //$path = $site_url.'uploadi/editor/'.$imageName; + + if($imageExtension == 'gif'){ //ce je slika gif, jo je potrebno pretvoriti v png + $this->convertGifToPng($path, $slikaNaStrezniku); + } + + if($imageExtension == 'jpg' || $imageExtension == 'peg'){ //ce je slika jpg ali jpeg, jo je potrebno pretvoriti v png + $this->convertJpgToPng($path, $slikaNaStrezniku, $imageExtension); + } + }elseif($slikaNaStrezniku==0){ //ce slike ni na strezniku + //echo "vre_id: $vre_id
"; + $imageName = $this->getOnlineImageName($imageName, $slikaNaStrezniku, $vre_id, $img_id); //pridobi njen URL + } + + $imageName = substr($imageName, 0, strrpos($imageName, '.')); + + } + + //echo "imagename pred return: ".$imageName."
"; + return $imageName; + } + #funkcija, ki skrbi za pridobitev imena slike, ki jo je potrebno izrisati - konec ############################### + function getEndPosition($imageName=''){ + $findme = '"'; + $pos = strpos($imageName, $findme); //najdi pozicijo teksta '"' + return $pos; + } + + function convertGifToPng($path='', $slikaNaStrezniku=null){ + //echo "path: ".$path."
"; + $image = imagecreatefromgif($path); //pripravi sliko iz gif za pretvorbo + $imageName = substr($path, 0, -3); //ime slike brez extension-a + //echo $imageName."
"; + $imageNamePNG = $imageName.'png'; //ime slike z ustreznim extension + imagepng($image, $imageNamePNG); //pretvori pripravljeno gif sliko v png + + if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, GIF izbrisi + unlink($imageName.'gif'); //izbrisi gif sliko + } + } + + function convertJpgToPng($path='', $slikaNaStrezniku=null, $imageExtension=''){ + $image = imagecreatefromjpeg($path); //pripravi sliko iz jpg za pretvorbo + $imageName = substr($path, 0, strrpos($path, '.')); //ime slike brez extension-a + //echo $imageName."
"; + $imageNamePNG = $imageName.'.png'; //ime slike z ustreznim extension + imagepng($image, $imageNamePNG); //pretvori pripravljeno jpg sliko v png + //echo "pretvorba v png: ".$imageNamePNG."
"; + //echo "xtens: ".$imageExtension."
"; + //$origExtension = strrchr($path, '.'); + //echo "ali je slika na strežniku: ".$slikaNaStrezniku."
"; + if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, izbrisi jo + //echo "tukaj
"; + if($imageExtension == 'jpg'){ + unlink($imageName.'.'.$imageExtension); //izbrisi sliko + }elseif($imageExtension == 'peg'){ + unlink($imageName.'.j'.$imageExtension); //izbrisi sliko + } + } + } + #funkcija, ki skrbi za pridobitev slike, ki se nahaja nekje online in jo je potrebno izrisati, in vrne lokalno ime slike ###################################### + function getOnlineImageName($imageName='', $slikaNaStrezniku=null, $vre_id=null, $img_id=0){ + global $site_path; + //echo "imageName v getOnlineImageName nekje vmes 1: ".$imageName."
"; + $row = Cache::srv_spremenljivka(self::$spremenljivka); + //echo "sprem: ".self::$spremenljivka."
"; + $spremenljivkaParams = new enkaParameters($row['params']); + //echo "params: ".$spremenljivkaParams->get('hotspot_image')."
"; + $imageNameTmp = $spremenljivkaParams->get('hotspot_image'); + //if($imageNameTmp!=''){ //ce je hotspot + if($imageNameTmp!=''&&$vre_id==0){ //ce je hotspot + $imageName = $imageNameTmp; + } + + $findHttp = 'http'; + $posHttp = strpos($imageName, $findHttp); + $imageName = substr($imageName,$posHttp); //besedilo do zacetka http + + $pos = $this->getEndPosition($imageName); //najdi pozicijo konca URL slike + $imageName = substr($imageName, 0, $pos); //pokazi le del params od zacetka besedila do '"' oz. konca URL slike + //echo "imageName v getOnlineImageName nekje vmes 2: ".$imageName."
"; + $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike + //echo "imageExtension: ".$imageExtension."
"; + + //if($imageExtension!='jpg'&&$imageExtension!='png'&&$imageExtension!='gif'&&$imageExtension!='jpeg'){ //ce ni veljavnen extension, spremeni ga v png + if($imageExtension=='jpg'||$imageExtension=='gif'||$imageExtension=='jpeg'){ //ce ni veljavnen extension, spremeni ga v png + //echo "spremeni extension
"; + $imageExtension='png'; + } + + if($vre_id){ //ce se pridobiva imena tmp slik iz vrednosti vprasanja + //$imgFilename = self::$spremenljivka.'_'.$vre_id.'_tmpImage.'.$imageExtension; //tmp ime slike, ki je sestavljeno iz id spremenljivke+tmpImage+extension + $imgFilename = self::$spremenljivka.'_'.$vre_id.'_tmpImage_'.$img_id.'.'.$imageExtension; //tmp ime slike, ki je sestavljeno iz id spremenljivke+tmpImage+extension + }else{ + //$imgFilename = self::$spremenljivka.'_tmpImage.'.$imageExtension; //tmp ime slike, ki je sestavljeno iz id spremenljivke+tmpImage+extension + $imgFilename = self::$spremenljivka.'_tmpImage_'.$img_id.'.'.$imageExtension; //tmp ime slike, ki je sestavljeno iz id spremenljivke+tmpImage+extension + } + + $pathDir = $site_path.'uploadi/editor/'; //pot za novo mapo, kjer se bodo shranjevale slike za trenutno anketo + $path = $pathDir.$imgFilename; //pot do datoteke z imenom datoteke + + # ukaz za pretakanje slike + if(IS_WINDOWS){ + //za windows sisteme //powershell -command "& { iwr URL -OutFile 'PATH' }" + $command = 'powershell -command "& { iwr \''.$imageName.'\' -OutFile \''.$path.'\' }"'; + //$command = 'wget -O \''.$imageName.'\' -O '.$path.' '; + }elseif(IS_LINUX){ + //za linux sisteme //exec('wget URL -P PATH '); + //$command = 'wget \''.$imageName.'\' -P '.$path.' '; + $command = 'wget -O '.$path.' \''.$imageName.'\' '; + //echo "ukaz za pobiranje: $command
"; + } + + //echo "command: ".$command."
"; + exec($command); //pretoci sliko + + //$path = $pathDir.$imgFilename; //pot do datoteke z imenom datoteke + +/* if($imageExtension == 'gif'){ //ce je slika gif, jo je potrebno pretvoriti v png, saj latex ne podpira gif + $this->convertGifToPng($path, $slikaNaStrezniku); + } */ + //echo "imgfilename na koncu: ".$imgFilename."
"; + if($imageExtension != 'png'){ //ce slika ni png, jo pretvori + if($imageExtension == 'gif'){ //ce je slika gif, jo je potrebno pretvoriti v png, saj latex ne podpira gif + $this->convertGifToPng($path, $slikaNaStrezniku); + }else{ + $this->convertJpgToPng($path, $slikaNaStrezniku, $imageExtension); + } + } + + //echo "imgfilename na koncu: ".$imgFilename."
"; + return $imgFilename; + } + #funkcija, ki skrbi za pridobitev slike, ki se nahaja nekje online in jo je potrebno izrisati, in vrne lokalno ime slike - konec ############################### + } \ No newline at end of file diff --git a/admin/survey/export/latexclasses/class.LatexDocument.php b/admin/survey/export/latexclasses/class.LatexDocument.php index dce1108..63b6cac 100644 --- a/admin/survey/export/latexclasses/class.LatexDocument.php +++ b/admin/survey/export/latexclasses/class.LatexDocument.php @@ -99,8 +99,10 @@ omenjeno kodo je potrebno deliti z 255, da dobimo stevilke, ki ustrezajo Latex = include('../../vendor/autoload.php'); define("ENKA_LOGO_SIZE", 'width=3.51cm,height=2cm,keepaspectratio'); define("ENKA_LOGO_SIZE_HEADER", 'width=1.75cm,height=1cm,keepaspectratio'); +define("ENKA_LOGO_SIZE_HEADER_RTF", 'width=40cm,keepaspectratio'); define("SINGLE_TABLE_WIDTH", 3000); define("PAGE_TEXT_WIDTH", 10200); //17 cm, 170 mm, je 10200 twips, 1 mm je 60 twips +if (!defined("MAX_STRING_LENGTH")) define("MAX_STRING_LENGTH", 90); #definicija za izris drsnika s kroglico define ("circleSlider", '\def\circleSLIDER#1#2{% 1: length, 2: position of the mark (0 to 1) @@ -142,7 +144,7 @@ class LatexDocument{ var $grupa = null; // trenutna grupa var $usrId = null; // trenutni user - var $spremenljivka = null; // trenutna spremenljivka + protected static $spremenljivka = null; // trenutna spremenljivka //spremenljivke za Nastavitve pdf/rtf izvozov var $export_font_size = 10; @@ -173,7 +175,7 @@ class LatexDocument{ var $commentType = 1; // tip izpisa komentarjev - var $texNewLine = '\\\\ '; + public static $texNewLine = '\\\\ '; protected $isAnswer = ''; protected $isAnswerBreakPodVprasanjem = ''; @@ -181,6 +183,10 @@ class LatexDocument{ protected $pathToTexFile; protected $path2Images; + + protected $export_show_recnum; + + protected $path2UploadedImages; protected $language = -1; // Katero verzijo prevoda izvazamo protected $usr_id; //id respondenta @@ -200,9 +206,11 @@ class LatexDocument{ public function createDocument($export_type='', $export_subtype='', $export_format='', $sprID = null){ global $lang, $site_path; - $this->usr_id = $_GET['usr_id']; + $this->usr_id = isset($_GET['usr_id'])?$_GET['usr_id']:null; if($export_subtype=='heatmap_image'){ //ce je potrebno zgenerirati sliko heatmap - $this->HeatmapImage($_GET['sprID']); + //$this->HeatmapImage($_GET['sprID']); + $spr_heatmap = isset($_GET['sprID'])?$_GET['sprID']:null; + $this->HeatmapImage($spr_heatmap); return; } @@ -232,16 +240,8 @@ class LatexDocument{ $surveyId = SurveyInfo::getSurveyId(); ################################################ #spremenljivke################################################################# konec - - /*echo 'export_type: '.$export_type.'
'; - echo 'export_subtype: '.$export_subtype.'
'; - echo 'export_format: '.$export_format.'
'; - echo 'anketaID: '.$_GET['anketa'].'
'; - /*echo 'sprID: '.$_GET['sprID'].'
'; - echo '$this->export_font_size: '.$this->export_font_size.'
'; - echo '$this->export_data_type: '.$this->export_data_type.'
'; - echo 'SurveyId: '.SurveyInfo::getSurveyId().'
'; */ + //$time_start = microtime(true); #za pridobitev jezika respondenta //pridobitev splosnega jezika ankete za respondenta nastavitev=> Osnovni jezik za respondente: $sqlL = sisplet_query("SELECT lang_resp FROM srv_anketa WHERE id='$this->anketa' "); @@ -250,7 +250,7 @@ class LatexDocument{ ############testiranje za jezik if(isset($_GET['language'])){ - $this->language = $_GET['language']; + $this->language = isset($_GET['language'])?$_GET['language']:null; //echo "jezik test: ".$this->language."
"; // Naložimo jezikovno datoteko $file = '../../lang/'.$this->language.'.php'; @@ -259,12 +259,18 @@ class LatexDocument{ } ############testiranje za jezik - konec + //$time_end = microtime(true); + //$execution_time = ($time_end - $time_start)/60; + //echo 'Total Execution Time: '.$execution_time.' Mins'; + if ($this->usr_id != '') { //ce je izpis za dolocenega respondenta $sqlL = sisplet_query("SELECT language FROM srv_user WHERE id = '$this->usr_id ' AND ank_id='$this->anketa' "); $rowL = mysqli_fetch_array($sqlL); $this->language = $rowL['language']; $lang['id'] = $this->language; } + //echo "jezik: ".$this->language."
"; + //$this->language = 1; //rocno dodal, da uredim polja stevil, saj iz baze pobira 0 (???) #za pridobitev jezika respondenta - konec //Tex preamble in zacetek latex dokumenta @@ -272,7 +278,7 @@ class LatexDocument{ //Dodatek h kodi, da bo črka đ vidna v pdf if($export_format == 'pdf'){ - $tex .= "\\fontencoding{T1}\selectfont \n"; + //$tex .= "\\fontencoding{T1}\selectfont \n"; } if($export_format != 'xls'){ //ce ni xls @@ -307,7 +313,7 @@ class LatexDocument{ { case 'survey': $survey = new LatexSurvey($this->anketa, $export_format, $this->export_show_intro, $this->export_show_if, $this->export_data_skip_empty, $this->export_data_skip_empty_sub); - //$tex .= $survey->displaySurvey($export_subtype); + switch ( $export_subtype ) { case 'q_empty': @@ -342,48 +348,6 @@ class LatexDocument{ case 'other': if($export_subtype == 'edits_analysis'){ -/* if ($_GET['seansa'] > 0){ - //if (isset ($_GET['seansa'])){ - $seansa = $_GET['seansa']; - }else{ - $seansa = '30'; - } - if (isset ($_GET['time'])){ - $time = $_GET['time']; - }else{ - $time = '1 month'; - } - if (isset ($_GET['status'])){ - $status = $_GET['status']; - }else{ - $status = 0; - } - if (isset ($_GET['from'])){ - $from = $_GET['from']; - }else{ - $from = ''; - } - if (isset ($_GET['to'])){ - $to = $_GET['to']; - }else{ - $to = ''; - } - if (isset ($_GET['user'])){ - $user = $_GET['user']; - }else{ - $user = 'all'; - } - if (isset ($_GET['period'])){ - $period = $_GET['period']; - }else{ - $period = 'day'; - } - //print_r($_GET); - //print_r($_POST); - if (isset ($_GET['seansa'])){ - echo "seansa iz get: ".$_GET['seansa']."
"; - } */ - //$editAnalysis = new LatexEditsAnalysis($this->anketa, $seansa, $time, $status, $from, $to, $user, $period); $editAnalysis = new LatexEditsAnalysis($this->anketa); $tex .= $editAnalysis->displayEditAnalysis(); @@ -477,11 +441,11 @@ class LatexDocument{ /********************* END TEST *****************************/ //brisanje temp datotek tex - unlink($filenameTex); //tex - unlink($filename.".aux"); //aux - unlink($filename.".log"); //log - unlink($filename.".pdf"); //pdf - unlink($filename.".out"); //out + file_exists($filenameTex)?unlink($filenameTex):null; //tex + file_exists($filename.".aux")?unlink($filename.".aux"):null; //aux + file_exists($filename.".log")?unlink($filename.".log"):null; //log + file_exists($filename.".pdf")?unlink($filename.".pdf"):null; //pdf + file_exists($filename.".out")?unlink($filename.".out"):null; //out //brisanje temp datotek tex - konec //brisanje temp slikovnih datotek @@ -497,7 +461,7 @@ class LatexDocument{ ##################################################################################################### function InitDocumentVars($export_type='', $export_subtype='', $export_format='') { - global $site_path; + global $site_path, $site_url; global $lang; $baseLineSkip = intval($this->export_font_size*1.2); @@ -528,7 +492,8 @@ class LatexDocument{ ############testiranje za jezik if(isset($_GET['language'])){ - $this->language = $_GET['language']; + //$this->language = $_GET['language']; + $this->language = isset($_GET['language'])?$_GET['language']:null; //echo "jezik test: ".$this->language."
"; // Naložimo jezikovno datoteko $file = '../../lang/'.$this->language.'.php'; @@ -583,45 +548,6 @@ class LatexDocument{ #Nastavitve pdf/rtf izvozov################################################################konec } - //echo "export show if: ".$this->export_show_if."
"; - //echo "export type: ".$export_type." subtype: ".$this->export_subtype."
"; - #### pokomentiral, ker z uporabo template ni vec potrebno in ker po novih specifikacijah je velikost pisave in razmik med vrsticami predefiniran -/* if($export_type == 'analysis'||$export_type == 'status'||$export_type == 'other'){ //ce je izpis analize ALI status ALI drugo - if($export_type == 'analysis'){ - $tableAnalysisEnvironment = ' \newenvironment{tableAnalysis} - {\parindent0pt \fontsize{6}{'.$baseLineSkip.'} \selectfont } - { }'; - if($export_format == 'xls' || $export_format == 'pdf'){ - $lTablex = '\usepackage{ltablex}'; - } - //$linespread = 1.15; - $linespread = 1.5; - //}elseif($export_type == 'status'){ - }elseif($export_type == 'status'||$export_subtype == 'edits_analysis'){ - $tableStatusEnvironment = ' \newenvironment{tableStatus} - {\parindent0pt \fontsize{8}{'.$baseLineSkip.'} \selectfont } - { }'; - //$linespread = 0.8; - $linespread = 1; - } - }else{ - $tableAnalysisEnvironment = ''; - $tableStatusEnvironment = ''; - $lTablex = ''; //ce je ltablex prisoten pri survey izvozih, so tezave - //$linespread = 1.15; - $linespread = 1.5; - } - if($this->export_data_landscape==1||($export_type=='analysis'&&($this->export_subtype=='crosstab'||$this->export_subtype=='mean'||$this->export_subtype=='ttest'||$this->export_subtype=='multicrosstab')||$this->export_subtype=='break'||$this->export_subtype=='chart'||$this->export_subtype=='creport'||$this->export_subtype=='status')){ //ce je postavitev landscape ALI je izvoz analiz in (Tabele ali Povprecja ali T-test ali Multitabele ali razbitje) - $landscapePostavitev = "landscape"; - $visinaTeksta = 210; - $sirinaTeksta = 294; - $hSize = '\hsize='.$sirinaTeksta.'mm'; - }else{ - $landscapePostavitev = "portrait"; - $visinaTeksta = 294; - $hSize = ''; - } */ - #### pokomentiral, ker z uporabo template ni vec potrebno in ker po novih specifikacijah je velikost pisave in razmik med vrsticami predefiniran - konec if($export_format == 'pdf'){ #################################### @@ -632,7 +558,6 @@ class LatexDocument{ \graphicspath{ {'.$site_path.'admin/survey/export/latexclasses/textemp/images/}, {'.$site_path.'uploadi/editor/}, {'.$site_path.'main/survey/uploads/}, {'.$site_path.'admin/survey/pChart/Cache/} } \begin{document} '; - //}elseif($this->export_data_landscape==1||($export_type=='analysis'&&($this->export_subtype=='crosstab'||$this->export_subtype=='mean'||$this->export_subtype=='ttest'||$this->export_subtype=='multicrosstab')||$this->export_subtype=='break'||$this->export_subtype=='chart'||$this->export_subtype=='creport'||$this->export_subtype=='status')||($export_type=='other'&&$export_subtype == 'edits_analysis')){ //ce je potreben landscape pogled }elseif(($export_type=='analysis'&&($this->export_subtype=='crosstab'||$this->export_subtype=='mean'||$this->export_subtype=='ttest'||$this->export_subtype=='multicrosstab')||$this->export_subtype=='break'||$this->export_subtype=='chart'||$this->export_subtype=='creport'||$this->export_subtype=='status')||($export_type=='other'&&$export_subtype == 'edits_analysis')){ //ce je potreben landscape pogled $this->head = ' \documentclass{latexTemplatePdfAnalysisAndOtherLandscape} %include datoteke s template @@ -688,23 +613,18 @@ class LatexDocument{ #################################### tex preamble + zacetek dokumenta za rtf - konec #################################### //definiranje ukaza za glave in noge za rtf - /*ima 5 vhodnih podatkov: - 1. ime ankete v glavi levo; - 2. logo 1KA v glavi na desni; - 3. besedilo "Stran" v nogi na desni; - 4. velikost logo 1KA v glavi na desni; - 5. datum generiranja izvoza v nogi na levi. + /*ima 7 vhodnih podatkov: + 1. ime ankete v glavi; + 2. logo 1KA v glavi; + 3. besedilo "Stran" v nogi ; + 4. velikost logo 1KA v glavi; + 5. datum generiranja izvoza v nogi na levi; + 6. identifikator respondenta; + 7. url korenske spletne strani. */ - /* $this->headerAndFooter = ' - \\newcommand{\headerfooter}[5]{ - \\lhead{\\includegraphics[scale=#4]{#2} #1} - \\lfoot{www.1ka.si} - \\rfoot{#3 \\thepage} - } - '; */ - + + $recnumBesedilo = ""; if($this->usr_id){ - //echo "usr id: ".$this->usr_id; $recnum = $this->getRecnum(); if($recnum && (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_show_recnum')){ $recnumBesedilo = "(Recnum $recnum)"; @@ -712,22 +632,13 @@ class LatexDocument{ $recnumBesedilo = ""; } } - $this->headerAndFooter = ' - \\newcommand{\headerfooter}[6]{ - \\lhead{\\includegraphics[scale=#4]{#2} #1 '.$recnumBesedilo.'} - \\lfoot{www.1ka.si} + \\newcommand{\headerfooter}[7]{ + \\lhead{#1 '.$recnumBesedilo.' \\includegraphics[#4]{#2}} + \\lfoot{#7} \\rfoot{#3 \\thepage} } '; -/* $this->headerAndFooter = ' - \\newcommand{\headerfooter}[5]{ - \\lhead{#1} - \\rhead{\\includegraphics[scale=#4]{#2}} - \\lfoot{www.1ka.si} - \\rfoot{#3 \\thepage} - } - '; */ #################################### definiranje ukaza za glave in noge za rtf - konec } @@ -743,10 +654,10 @@ class LatexDocument{ //Funkcija za izris glave in noge za pdf ###################################### function GenerateHeaderFooter($imeAnkete='', $stranDokumenta=null, $datumGeneriranjaIzvoza='', $export_format=''){ - global $lang, $site_path; + global $lang, $site_path, $site_url; //Definiranje ukaza $tex = $this->headerAndFooter; //definiranje ukaza za glavo in nogo dokumenta - + $recnumBesedilo = ""; //izbira ustreznega logotipa za določen jezik if($lang['id'] == 1){ //ce je id 1, naj bo slovenski $logo1ka = 'logo1ka'; @@ -766,8 +677,15 @@ class LatexDocument{ } } - //Izris glave in noge s predefiniranim ukazom za pdf - $tex .= "\headerfooter{".$imeAnkete."}{".$this->path2Images."".$logo1ka."}{".$stranDokumenta."}{".ENKA_LOGO_SIZE_HEADER."}{".$datumGeneriranjaIzvoza."}{".$recnumBesedilo."}"; + //Izris glave in noge s predefiniranim ukazom + if($export_format == 'rtf'){ + $enka_logo_size_header = ENKA_LOGO_SIZE_HEADER_RTF; + }else{ + $enka_logo_size_header = ENKA_LOGO_SIZE_HEADER; + } + + + $tex .= "\headerfooter{".$imeAnkete."}{".$this->path2Images."".$logo1ka."}{".$stranDokumenta."}{".$enka_logo_size_header."}{".$datumGeneriranjaIzvoza."}{".$recnumBesedilo."}{".$site_url."}"; return $tex; } @@ -791,7 +709,6 @@ class LatexDocument{ $logo1ka = 'logo1kaeng'; } //izbira ustreznega logotipa za določen jezik - konec - //echo "stevilo spremenljivk: ".(SurveyInfo::getSurveyVariableCount()); $steviloSpremenljivk = SurveyInfo::getSurveyVariableCount(); @@ -801,17 +718,8 @@ class LatexDocument{ //klicanje latex funkcije za generiranje naslovnice $tex .= ' \naslovnica - {'.ENKA_LOGO_SIZE.', right} - {'.$logo1ka.'} - {'.$imeAnkete.'} - {'.$vsiOdgovoriBesedilo.'} - {\MakeUppercase{{'.$kratkoImeAnketeBesedilo.'}}: & {'.$kratkoImeAnkete.'}} - {\MakeUppercase{{'.$steviloVprasanjNaslovnicaBesedilo.'}}: & {'.$steviloVprasanjNaslovnica.'} \\\\ - & \\\\ - \MakeUppercase{{'.$lang['srv_usableResp_qcount'].'}}: & {'.$steviloSpremenljivk.'}} - {\MakeUppercase{{'.$lang['srv_displaydata_status'].'}}: & {'.$activityTex.'}} - {\MakeUppercase{{'.$avtorNaslovnicaBesedilo.'}}: & {'.$avtorNaslovnica.', '.$anketaUstvarjenaNaslovnica.'}} - {\MakeUppercase{{'.$avtorSpremenilNaslovnicaBesedilo.'}}: & {'.$avtorSpremenilNaslovnica.', '.$anketaSpremenjenaNaslovnica.'}} + {'.ENKA_LOGO_SIZE.', right}{'.$logo1ka.'}{'.$imeAnkete.'}{'.$vsiOdgovoriBesedilo.'}{\MakeUppercase{{'.$kratkoImeAnketeBesedilo.'}}: & {'.$kratkoImeAnkete.'}}{\MakeUppercase{{'.$steviloVprasanjNaslovnicaBesedilo.'}}: & {'.$steviloVprasanjNaslovnica.'} \\\\ + & \\\\\MakeUppercase{{'.$lang['srv_usableResp_qcount'].'}}: & {'.$steviloSpremenljivk.'}}{\MakeUppercase{{'.$lang['srv_displaydata_status'].'}}: & {'.$activityTex.'}}{\MakeUppercase{{'.$avtorNaslovnicaBesedilo.'}}: & {'.$avtorNaslovnica.', '.$anketaUstvarjenaNaslovnica.'}}{\MakeUppercase{{'.$avtorSpremenilNaslovnicaBesedilo.'}}: & {'.$avtorSpremenilNaslovnica.', '.$anketaSpremenjenaNaslovnica.'}} '; #################################### //tex za pdf naslovnico - konec }else if($export_format == 'rtf'){ @@ -851,7 +759,7 @@ class LatexDocument{ ########################################### //Funkcija za pridobitev aktiviranosti ankete - function GetAktiviranostAnkete($activity=''){ + function GetAktiviranostAnkete($activity=null){ global $lang; $tex = ''; $_last_active = end($activity); @@ -882,16 +790,18 @@ class LatexDocument{ # generating pdf file //ukaz je potrebno zagnati 2x, ker drugace ne pride do koncnega stevila strani, ki se nahaja v nogi, poleg trenutne strani chdir($this->pathToTexFile); + if(IS_WINDOWS){ //za windows sisteme $ukaz = 'latexmk -pdf '.$filenameTex; //$ukaz = "latexmk -silent -f -pdf -e \'$max_repeat=2\' -pdflatex=\"/usr/bin/pdflatex -interaction=batchmode \"". $filenameTex; exec($ukaz); - }elseif(IS_LINUX){ + } + elseif(IS_LINUX){ //za linux sisteme - exec("/usr/bin/pdflatex ".$filenameTex); + exec("/usr/bin/xelatex --no-shell-escape ".$filenameTex); + //exec("/usr/bin/pdflatex ".$filenameTex); //exec("/usr/bin/buf_size=2000000 pdflatex ".$filenameTex); - } # generating pdf file - konec @@ -984,12 +894,9 @@ class LatexDocument{ shell_exec($rtfGeneratingCommand); # generating rtf file - konec - //$filename = 'export_'.$this->export_subtype.'_'.$surveyId.'_'.$this->export_format; $filename = 'export_'.$this->export_subtype.'_'.$surveyId.'_'.$this->export_format.'_'.$niPrijavljenUporabnik; $filenameRtf = $filename.'.rtf'; - $file = $this->pathToTexFile.$filenameRtf; - //$file = $filenameRtf; - //echo "file: ".$file; + $file = $this->pathToTexFile.$filenameRtf; #uredi sirino stolpca tabele glede na stevilo stolpcev v tabeli neposredno v rtf ############################################ $this->urediStolpceTabele($file); @@ -1025,11 +932,6 @@ class LatexDocument{ //header('Content-Disposition: attachment;filename="'.basename($filename).'"'); #header-ji rtf datoteke - konec - #Stara varianta - //readfile($file); - #Stara varianta - konec - - #nova varianta set_time_limit(0); $chunksize = 2 * (1024 * 1024); //5 MB (= 5 242 880 bytes) per one chunk of file. //$fileD = @fopen($file,"r"); @@ -1040,7 +942,6 @@ class LatexDocument{ ob_flush(); flush(); } - #nova varianta - konec //brisanje temp datotek unlink($file); //rtf @@ -1348,76 +1249,423 @@ class LatexDocument{ return $recnum; } + #funkcija ki skrbi za encode dolocenih spornih delov besedila v latex-u prijazno - function encodeText($text=''){ + public static function encodeText($text = '', $vre_id = 0, $no_br = 0, $img_id = 0, $variable_name = '', $no_par = 0){ global $site_path, $lang; - //$text = str_replace(' ','X',$text); //nadomesti presledke + //echo "Encoding ".$text."
"; + + $text = htmlspecialchars_decode($text); //vse html special chars kot je & spremeni v ustrezne simbole (npr. &=>&) + $text = html_entity_decode($text); + + //Pucanje html kode ***************************************************************** + if($no_par){ //ce ne sme biti

tag + $allowed_tags = '