diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-05-27 13:08:29 +0200 |
commit | 75160b12821f7f4299cce7f0b69c83c1502ae071 (patch) | |
tree | 27e25e4ccaef45f0c58b22831164050d1af1d4db /admin/survey/export | |
parent | prvi-commit (diff) | |
download | 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst 1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip |
Diffstat (limited to 'admin/survey/export')
38 files changed, 3877 insertions, 4371 deletions
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 @@ <?php
# ali je OS windows ali linux
-define('IS_WINDOWS', (DIRECTORY_SEPARATOR === '\\') ? TRUE : FALSE);
-define('IS_LINUX', (DIRECTORY_SEPARATOR === '\\') ? FALSE : TRUE);
+if (!defined('IS_WINDOWS')) define('IS_WINDOWS', (DIRECTORY_SEPARATOR === '\\') ? TRUE : FALSE);
+if (!defined('IS_LINUX')) define('IS_LINUX', (DIRECTORY_SEPARATOR === '\\') ? FALSE : TRUE);
-define("M_ANALIZA_DESCRIPTOR", "descriptor");
+/* define("M_ANALIZA_DESCRIPTOR", "descriptor");
define("M_ANALIZA_FREQUENCY", "frequency");
define("M_ANALIZA_CROSSTAB", "crosstabs");
define("M_ANALIZA_STATISTICS", "statistics");
-define("M_ANALIZA_SUMS", "sums");
+define("M_ANALIZA_SUMS", "sums"); */
/*PDF*/
-define("A_REPORT_VPRASALNIK_PDF", "vprasalnik_pdf");
+/* define("A_REPORT_VPRASALNIK_PDF", "vprasalnik_pdf");
define("A_REPORT_PDF_RESULTS","pdf_results");
define("A_REPORT_PDF_COMMENT","pdf_comment");
@@ -36,14 +36,14 @@ define("M_REPORT_PDF_TEAMMETER","pdf_teammeter"); define("M_REPORT_PDF_MFDPS","pdf_mfpds");
define("M_REPORT_PDF_HEATMAP_IMAGE","heatmap_image_pdf");
-define("M_REPORT_HIERARHIJA_PDF_IZPIS", "hierarhija_pdf_izpis");
+define("M_REPORT_HIERARHIJA_PDF_IZPIS", "hierarhija_pdf_izpis"); */
-define("A_GDPR_PDF_INDIVIDUAL", "pdf_gdpr_individual");
-define("A_GDPR_PDF_ACTIVITY", "pdf_gdpr_activity");
+if (!defined('A_GDPR_PDF_INDIVIDUAL')) define("A_GDPR_PDF_INDIVIDUAL", "pdf_gdpr_individual");
+if (!defined('A_GDPR_PDF_ACTIVITY')) define("A_GDPR_PDF_ACTIVITY", "pdf_gdpr_activity");
/*RTF*/
-define("A_REPORT_VPRASALNIK_RTF", "vprasalnik_rtf");
+/* define("A_REPORT_VPRASALNIK_RTF", "vprasalnik_rtf");
define("A_REPORT_RTF_RESULTS", "rtf_results");
define("A_REPORT_RTF_COMMENT", "rtf_comment");
@@ -59,14 +59,14 @@ define("M_REPORT_ANALIZA_RTF_CHARTS", "charts_rtf"); define("M_REPORT_ANALIZA_RTF_CREPORT", "creport_rtf");
define("A_REPORT_RTF_LIST", "list_rtf");
-define("M_REPORT_ANALIZA_RTF_HEATMAP_IMAGE","heatmap_image_rtf");
+define("M_REPORT_ANALIZA_RTF_HEATMAP_IMAGE","heatmap_image_rtf"); */
-define("A_GDPR_RTF_INDIVIDUAL", "rtf_gdpr_individual");
-define("A_GDPR_RTF_ACTIVITY", "rtf_gdpr_activity");
+if (!defined('A_GDPR_RTF_INDIVIDUAL')) define("A_GDPR_RTF_INDIVIDUAL", "rtf_gdpr_individual");
+if (!defined('A_GDPR_RTF_ACTIVITY')) define("A_GDPR_RTF_ACTIVITY", "rtf_gdpr_activity");
/*XLS*/
-define("M_REPORT_ANALIZA_XLS_STAT", "statistics_xls");
+/* define("M_REPORT_ANALIZA_XLS_STAT", "statistics_xls");
define("M_REPORT_ANALIZA_XLS_FREKVENCA", "frequency_xls");
define("M_REPORT_ANALIZA_XLS_CROSSTAB_IZPIS", "crosstabs_izpis_xls");
define("M_REPORT_ANALIZA_XLS_MULTICROSSTAB_IZPIS", "multicrosstabs_izpis_xls");
@@ -79,19 +79,18 @@ define("A_REPORT_XLS_LIST", "list_xls"); define("A_REPORT_XLS_USABLE", "usable_xls");
define("A_REPORT_XLS_SPEEDER", "speeder_xls");
define("A_REPORT_XLS_TEXT_ANALYSIS", "text_analysis_xls");
-define("A_REPORT_CSV_TEXT_ANALYSIS", "text_analysis_csv");
-define("A_LANGUAGE_TECHNOLOGY_XLS", "lt_excel");
+define("A_REPORT_CSV_TEXT_ANALYSIS", "text_analysis_csv"); */
/*PPT*/
-define("M_REPORT_ANALIZA_PPT_CHARTS", "charts_ppt");
-define("M_REPORT_ANALIZA_PPT_HEATMAP_IMAGE", "heatmap_image_ppt");
+/* define("M_REPORT_ANALIZA_PPT_CHARTS", "charts_ppt");
+define("M_REPORT_ANALIZA_PPT_HEATMAP_IMAGE", "heatmap_image_ppt"); */
/*IMAGE*/
-define("M_REPORT_ANALIZA_HEATMAP_IMAGE", "heatmap_image");
+//define("M_REPORT_ANALIZA_HEATMAP_IMAGE", "heatmap_image");
/*XML*/
-define("A_REPORT_VPRASALNIK_XML", "vprasalnik_xml");
+if (!defined('A_REPORT_VPRASALNIK_XML')) define("A_REPORT_VPRASALNIK_XML", "vprasalnik_xml");
?>
\ 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'])."</br>";
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'])."</br>";
+ //$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'])."</br>";
}
}
$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."</br>";
}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."</br>";
$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'])."</br>";
//echo "znotraj </br>";
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."</br>";
$podatkiVrstica = array();
- $podatkiVrstica[] = $this->encodeText($forSpremenljivka['options'][$fkey]); //naslov horizontalne vrstice
- //echo "debug text: ".$this->encodeText($forSpremenljivka['options'][$fkey])."</br>";
+ $podatkiVrstica[] = LatexDocument::encodeText($forSpremenljivka['options'][$fkey]); //naslov horizontalne vrstice
+ //echo "debug text: ".LatexDocument::encodeText($forSpremenljivka['options'][$fkey])."</br>";
//foreach ($spremenljivka['grids'] AS $gkey => $grid) {
for($s1=$indeksPodatkov1; $s1<($steviloPodstolpcev-1+$indeksPodatkovOld1); $s1++){
@@ -564,8 +564,8 @@ class AnalizaBreak extends LatexAnalysisElement { //echo "sdvsdv </br>";
/* 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'])."</br>";
+ $podatkiVrstica[] = LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt']);
+ //echo "podatki Vrstica 1 :".LatexDocument::encodeText($frequencys[$fkey][$sequence]['valid'][$okey]['cnt'])."</br>";
}
} */
$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."</br>";
@@ -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 "</br> Tex celotne tabele: ".$descLatex."</br>";
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 "</br>"; */
- $grid1 = $spr1['grids'][$v_first['grd']];
- $grid2 = $spr2['grids'][$v_second['grd']];
+ $grid1 = isset($spr1['grids'][$v_first['grd']])?$spr1['grids'][$v_first['grd']]:array();
+ $grid2 = isset($spr2['grids'][$v_second['grd']])?$spr2['grids'][$v_second['grd']]:array();
#število vrstic in število kolon
$cols = count($crosstabs['options1']);
@@ -317,13 +318,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $this->crosstabClass->crossChkSR +
$this->crosstabClass->crossChkAR;
- //echo "steviloVmesnihVrstic: ".$steviloVmesnihVrstic."</br>";
- //echo "steviloVmesnihStolpcevPodvrstica2: ".$steviloVmesnihStolpcevPodvrstica2."</br>";
- //echo "steviloVmesnihStolpcevPodvrstica3: ".$steviloVmesnihStolpcevPodvrstica3."</br>";
$podVrstice = 0;
- //if($steviloVmesnihStolpcevPodvrstica2||$steviloVmesnihStolpcevPodvrstica3){
if($steviloVmesnihStolpcevPodvrstica2&&$steviloVmesnihStolpcevPodvrstica3){
//echo "1 </br>";
if($steviloVmesnihStolpcevPodvrstica2 >= $steviloVmesnihStolpcevPodvrstica3){
@@ -462,18 +459,15 @@ class AnalizaCrosstab extends LatexAnalysisElement{ for($i = 0; $i < $steviloStolpcevParameterTabular; $i++){
//ce je prvi stolpec
if($i == 0){
- //$parameterTabular .= ($export_format == 'pdf' ? 'P|' : 'l|');
$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'l|');
}else{
- //$parameterTabular .= ($export_format == 'pdf' ? ' >{\hsize='.$sirinaOstalihStolpcev.'\hsize \centering\arraybackslash}X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
$parameterTabular .= ($export_format == 'pdf' ? 'X|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/
- //$parameterTabular .= ($export_format == 'pdf' ? 'c|' : 'c|'); /*sirina ostalih je odvisna od njihovega stevila, da se sirine razporedijo po celotni sirini tabele*/ //pred spremembo je bilo to
}
}
//Priprava parametrov za tabelo - konec
//zacetek latex tabele z obrobo za prvo tabelo
- $pdfTable = 'tabularx';
+ $pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
@@ -494,10 +488,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $steviloArrayrulewidth = ($steviloMultiCol1-1);
if($export_format=='pdf'){
- //$tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}elseif($export_format=='rtf'){
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}
###########
@@ -524,9 +517,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //prva vrstica - konec ##############################################################################
// druga vrstica ####################################################################################
- $tabela .= $this->encodeText($sub_q2); //prvi stolpec 2. vrstice
- //echo "testiram, kjer ssem: ".$this->encodeText($sub_q2)."</br>";
- //echo "testiram, kjer ssem: ".$steviloTabColSep."</br>";
+ $tabela .= LatexDocument::encodeText($sub_q2); //prvi stolpec 2. vrstice
$drugaVrstica = array();
if (count($crosstabs['options1']) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
foreach ($crosstabs['options1'] as $ckey1 =>$crossVariabla) {
@@ -536,21 +527,25 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if ($crossVariabla['type'] != 't') {
$text .= ' ( '.$ckey1.' )';
}
- $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, $this->encodeText($text));
+ $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, LatexDocument::encodeText($text));
}
}
- //echo "test: ".$podVrstice."</br>";
if($podVrstice){ //ce je potrebno multicol prikazovanje
//spremenljivke za pravilno sirino
$colNum = $steviloVmesnihStolpcevPodvrstic;
- $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
- $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ if($steviloVmesnihStolpcevPodvrstica2){
+ $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
+ }
+ if($steviloVmesnihStolpcevPodvrstica3){
+ $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ }
+
//spremenljivke za pravilno sirino - konec
- $tabela .= $this->MultiColCellLatex($colNum, $this->encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vestice
+ $tabela .= $this->MultiColCellLatex($colNum, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vestice
}else{
$tabela .= " & ";
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vestice
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vestice
}
$tabela .= $this->texNewLine; /*nova vrstica*/
@@ -560,15 +555,20 @@ class AnalizaCrosstab extends LatexAnalysisElement{ // druga vrstica - konec #########################################################################
+ $tabela1 = ''; //za belezenje 1. vrstice s frekvencami
+ $tabela2 = ''; //za belezenje 2. vrstice z odstotki
+ $tabela3 = ''; //za belezenje 3. vrstice z residuali
+ $colNum = isset($colNum)?$colNum:0;
//izpis vmesnih vrstic tabele ####################################################################
if (count($crosstabs['options2']) > 0) {
+
//POSAMEZNA VMESNA VRSTICA
foreach ($crosstabs['options2'] as $ckey2 =>$crossVariabla2) {
//priprava besedila za prvo celico 1. stolpca
$text = $crossVariabla2['naslov'];
if($export_format != 'xls'){
- $text = $this->snippet($this->encodeText($text), 25);
+ $text = $this->snippet(LatexDocument::encodeText($text), 25);
}
if ($crossVariabla2['type'] !== 't') {
$text .= ' ('.$ckey2.')';
@@ -577,7 +577,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis prve celice 1. stolpca
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($text));
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($text));
}else{
$tabela .= $text;
}
@@ -585,45 +585,54 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabela1 = ''; //za belezenje 1. vrstice s frekvencami
$tabela2 = ''; //za belezenje 2. vrstice z odstotki
$tabela3 = ''; //za belezenje 3. vrstice z residuali
-
+ $colNum = isset($colNum)?$colNum:0;
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
-
if ($this->crosstabClass->crossChk0) {
# frekvence crostabov
- $crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ //$crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ if(array_key_exists($ckey1, $crosstabs_value)&&array_key_exists($ckey2, $crosstabs_value)){
+ $crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ }else{
+ $crossChk0 = 0;
+ }
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum);
}
if ($this->crosstabClass->crossChk1) {
#procent vrstica
- $crossChk1 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
- $tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2);
+ if(array_key_exists($ckey1, $crosstabs_value)){
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2);
+ }
+
}
if ($this->crosstabClass->crossChk2) {
#procent stolpec
- $crossChk2 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2);
}
if ($this->crosstabClass->crossChk3) {
#procent skupni
- $crossChk3 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ if(array_key_exists($ckey1, $crosstabs_value)){
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ }
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2);
}
# residuali
if ($this->crosstabClass->crossChkEC) {
- $crossChkEC = $this->encodeText($this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], 3, ''));
+ $crossChkEC = LatexDocument::encodeText($this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkEC, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkRE) {
- $crossChkRE = $this->encodeText($this->formatNumber($crosstabs['res'][$ckey1][$ckey2], 3, ''));
+ $crossChkRE = LatexDocument::encodeText($this->formatNumber($crosstabs['res'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkRE, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkSR) {
- $crossChkSR = $this->encodeText($this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], 3, ''));
+ $crossChkSR = LatexDocument::encodeText($this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkSR, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkAR) {
- $crossChkAR = $this->encodeText($this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], 3, ''));
+ $crossChkAR = LatexDocument::encodeText($this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkAR, $podVrstice, $colNum3);
}
}
@@ -631,21 +640,25 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //se zadnji stolpec - vedno risemo
if ($this->crosstabClass->crossChk0) {
# suma po vrsticah
- $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
+ if(array_key_exists($ckey2, $crosstabs['sumaVrstica'])){
+ $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
+ }else{
+ $crossChk0 = null;
+ }
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po vrsticah v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -691,35 +704,40 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis celice v prvem stolpcu
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols);
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols);
}else{
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']);
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']);
}
//izpis celice v prvem stolpcu - konec
+ $tabelaZadnja1 = ''; //belezi kodo za 1. podvrstico zadnje vrstice
+ $tabelaZadnja2 = ''; //belezi kodo za 2. podvrstico zadnje vrstice
if (count($crosstabs['options1']) > 0){
- $tabelaZadnja1 = ''; //belezi kodo za 1. podvrstico zadnje vrstice
- $tabelaZadnja2 = ''; //belezi kodo za 2. podvrstico zadnje vrstice
+
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
# prikazujemo eno od treh možnosti
if ($this->crosstabClass->crossChk0) {
# suma po stolpcih
- $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ if(array_key_exists($ckey1, $crosstabs['sumaStolpec'])){
+ $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ }else{
+ $crossChk0 = null;
+ }
$tabelaZadnja1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3){
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -734,15 +752,15 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -851,7 +869,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //Priprava parametrov za tabelo - konec
//zacetek latex tabele z obrobo za prvo tabelo
- $pdfTable = 'tabularx';
+ $pdfTable = 'xltabular';
$rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
@@ -887,16 +905,16 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $steviloTabColSep = ($steviloMultiCol1-1)*2;
$steviloArrayrulewidth = ($steviloMultiCol1-1);
if($export_format=='pdf'){
- //$tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ //$tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}C|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{>{\hsize=\dimexpr".$steviloMultiCol1."\hsize+".$steviloTabColSep."\\tabcolsep+".$steviloArrayrulewidth."\arrayrulewidth\\relax}c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}elseif($export_format=='rtf'){
- $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".$this->encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
+ $tabela .= " & \multicolumn{".$steviloMultiCol1."}{c|}{".LatexDocument::encodeText($sub_q1)."} "; //prvi (prazen) in stolpec z besedilom
}
}else{
- $tabela .= " & ".$this->encodeText($sub_q1)." ";
+ $tabela .= " & ".LatexDocument::encodeText($sub_q1)." ";
}
###########
- //echo "testiram, kjer ssem: ".$this->encodeText($sub_q1)."</br>";
+ //echo "testiram, kjer ssem: ".LatexDocument::encodeText($sub_q1)."</br>";
if($cols[$t]!=0 &&($t == ($steviloTabel-1))){
if($steviloVmesnihStolpcevPodvrstic==1){
@@ -923,14 +941,11 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //echo "$tabela</br>";
// druga vrstica ####################################################################################
- $tabela .= $this->encodeText($sub_q2); //prvi stolpec 2. vrstice
- //echo "testiram, kjer ssem: ".$this->encodeText($sub_q2)."</br>";
- //echo "testiram, kjer ssem: ".$steviloTabColSep."</br>";
+ $tabela .= LatexDocument::encodeText($sub_q2); //prvi stolpec 2. vrstice
$drugaVrstica = array();
//echo count($crosstabsOptions1All[$t])."</br>";
- //if (count($crosstabs['options1']) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
- if (count($crosstabsOptions1All[$t]) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
+ if (isset($crosstabsOptions1All[$t])&&count($crosstabsOptions1All[$t]) > 0 ) { //stolpci (izkljucno) med prvim in zadnjim
foreach ($crosstabsOptions1All[$t] as $ckey1 =>$crossVariabla) {
#ime variable
$text = $crossVariabla['naslov'];
@@ -938,9 +953,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if ($crossVariabla['type'] != 't') {
$text .= ' ( '.$ckey1.' )';
}
- $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, $this->encodeText($text));
+ $tabela .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, LatexDocument::encodeText($text));
//echo "steviloVmesnihStolpcevPodvrstic $t: $steviloVmesnihStolpcevPodvrstic</br>";
- //echo $this->encodeText($text)."</br>";
+ //echo LatexDocument::encodeText($text)."</br>";
}
if($niSodo && $t == ($steviloTabel-2) && $reziduali){ //ce ni sodo in je predzadnja podtabela in so reziduali, dodaj se vse potrebno za prazen stolpec
//if($niSodo && $t == ($steviloTabel-2)){ //ce ni sodo in je predzadnja podtabela, dodaj se vse potrebno za prazen stolpec
@@ -953,18 +968,22 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if($podVrstice){ //ce je potrebno multicol prikazovanje
//spremenljivke za pravilno sirino
$colNum = $steviloVmesnihStolpcevPodvrstic;
- $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
- $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ if($steviloVmesnihStolpcevPodvrstica2){
+ $colNum2 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica2; //stevilo podstolpcev za 2. podvrstico
+ }
+ if($steviloVmesnihStolpcevPodvrstica3){
+ $colNum3 = $steviloVmesnihStolpcevPodvrstic/$steviloVmesnihStolpcevPodvrstica3; //stevilo podstolpcev za 3. podvrstico
+ }
//spremenljivke za pravilno sirino - konec
if($t == ($steviloTabel-1)){ //ce je zadnji stolpec v podtabeli
- $tabela .= $this->MultiColCellLatex($colNum, $this->encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vrstice
+ $tabela .= $this->MultiColCellLatex($colNum, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj'])); //izpis naslova zadnjega stolpca 2. vrstice
}
//}else{
}elseif(($t == ($steviloTabel-1))){ //ce je zadnja podtabela
//}elseif(($t == ($steviloTabel-1)) && $niSodo == 1){
$tabela .= " & ";
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vrstice
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']); //izpis naslova zadnjega stolpca 2. vrstice
}
$tabela .= $this->texNewLine; /*nova vrstica*/
@@ -985,7 +1004,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //priprava besedila za prvo celico 1. stolpca
$text = $crossVariabla2['naslov'];
if($export_format != 'xls'){
- $text = $this->snippet($this->encodeText($text), 25);
+ $text = $this->snippet(LatexDocument::encodeText($text), 25);
}
if ($crossVariabla2['type'] !== 't') {
$text .= ' ('.$ckey2.')';
@@ -994,7 +1013,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis prve celice 1. stolpca
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($text));
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($text));
}else{
$tabela .= $text;
}
@@ -1004,11 +1023,12 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabela3 = ''; //za belezenje 3. vrstice z residuali
//foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
+ if(isset($crosstabsOptions1All[$t]))
foreach ($crosstabsOptions1All[$t] as $ckey1 => $crossVariabla1) {
if ($this->crosstabClass->crossChk0) {
# frekvence crostabov
- $crossChk0 = ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ $crossChk0 = (isset($crosstabs_value[$ckey1][$ckey2])&&(int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum);
/* if($niSodo && $t == ($steviloTabel-2)){ //ce ni sodo in je predzadnja podtabela, dodaj se vse potrebno za prazen stolpec
$tabela1 .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, '');
@@ -1017,35 +1037,35 @@ class AnalizaCrosstab extends LatexAnalysisElement{ }
if ($this->crosstabClass->crossChk1) {
#procent vrstica
- $crossChk1 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage((isset($crosstabs['sumaVrstica'][$ckey2])?$crosstabs['sumaVrstica'][$ckey2]:null), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:null)), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2);
}
if ($this->crosstabClass->crossChk2) {
#procent stolpec
- $crossChk2 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage((isset($crosstabs['sumaStolpec'][$ckey1])?$crosstabs['sumaStolpec'][$ckey1]:null), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:null)), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2);
}
if ($this->crosstabClass->crossChk3) {
#procent skupni
- $crossChk3 = $this->encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber($this->crosstabClass->getCrossTabPercentage((isset($crosstabs['sumaSkupna'])?$crosstabs['sumaSkupna']:null), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:null)), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2);
}
# residuali
if ($this->crosstabClass->crossChkEC) {
- $crossChkEC = $this->encodeText($this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], 3, ''));
+ $crossChkEC = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['exC'][$ckey1][$ckey2])?$crosstabs['exC'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkEC, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkRE) {
- $crossChkRE = $this->encodeText($this->formatNumber($crosstabs['res'][$ckey1][$ckey2], 3, ''));
+ $crossChkRE = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['res'][$ckey1][$ckey2])?$crosstabs['res'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkRE, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkSR) {
- $crossChkSR = $this->encodeText($this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], 3, ''));
+ $crossChkSR = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['stR'][$ckey1][$ckey2])?$crosstabs['stR'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkSR, $podVrstice, $colNum3);
}
if ($this->crosstabClass->crossChkAR) {
- $crossChkAR = $this->encodeText($this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], 3, ''));
+ $crossChkAR = LatexDocument::encodeText($this->formatNumber((isset($crosstabs['adR'][$ckey1][$ckey2])?$crosstabs['adR'][$ckey1][$ckey2]:null), 3, ''));
$tabela3 .= $this->DisplayLatexCells($crossChkAR, $podVrstice, $colNum3);
}
//echo "tabela 3: $tabela3 </br>";
@@ -1056,7 +1076,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabela1 .= $this->MultiColCellLatex($steviloVmesnihStolpcevPodvrstic, '');
}
- if(!$crosstabsOptions1All[$t]){
+ /* if(!$crosstabsOptions1All[$t]){
if($tabela1){
//$tabela1 .= ' & ';
}
@@ -1066,34 +1086,40 @@ class AnalizaCrosstab extends LatexAnalysisElement{ if($tabela3!=''){
//$tabela3 .= ' & ';
}
- }
+ } */
//se zadnji stolpec - risemo, ko je zadnja tabela
if($t == ($steviloTabel-1)){
if ($this->crosstabClass->crossChk0) {
# suma po vrsticah
- $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
- if(!$crosstabsOptions1All[$t]){
+ //$crossChk0 = isset($crosstabs['sumaVrstica'][$ckey2])?(int)$crosstabs['sumaVrstica'][$ckey2]:0;
+ if(isset($crosstabs['sumaVrstica'][$ckey2])&&array_key_exists($ckey2, $crosstabs['sumaVrstica'])){
+ $crossChk0 = (int)$crosstabs['sumaVrstica'][$ckey2];
+ }else{
+ $crossChk0 = 0;
+ }
+
+ if(!isset($crosstabsOptions1All[$t])){
$tabela1 .= ' & ';
}
$tabela1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
- if(!$crosstabsOptions1All[$t]){
+ if(!isset($crosstabsOptions1All[$t])){
$tabela2 .= ' & ';
}
# suma po vrsticah v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crossChk0 / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crossChk0 / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabela2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic, $niSodo);
}
}
@@ -1160,9 +1186,9 @@ class AnalizaCrosstab extends LatexAnalysisElement{ //izpis celice v prvem stolpcu
if($export_format != 'xls'){
- $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, $this->encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols[$t]);
+ $tabela .= $this->MultiRowCellLatex($steviloVmesnihVrstic, LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']), $tabela2, $tabela3, $cols[$t]);
}else{
- $tabela .= $this->encodeText($lang['srv_analiza_crosstab_skupaj']);
+ $tabela .= LatexDocument::encodeText($lang['srv_analiza_crosstab_skupaj']);
}
//izpis celice v prvem stolpcu - konec
@@ -1172,26 +1198,32 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $tabelaZadnja1 = ''; //belezi kodo za 1. podvrstico zadnje vrstice
$tabelaZadnja2 = ''; //belezi kodo za 2. podvrstico zadnje vrstice
//foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
+ if(isset($crosstabsOptions1All[$t]))
foreach ($crosstabsOptions1All[$t] as $ckey1 => $crossVariabla1) {
# prikazujemo eno od treh možnosti
if ($this->crosstabClass->crossChk0) {
# suma po stolpcih
- $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ //$crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ if(isset($crosstabs['sumaStolpec'][$ckey1])&&array_key_exists($ckey1, $crosstabs['sumaStolpec'])){
+ $crossChk0 = (int)$crosstabs['sumaStolpec'][$ckey1];
+ }else{
+ $crossChk0 = 0;
+ }
$tabelaZadnja1 .= $this->DisplayLatexCells($crossChk0, $podVrstice, $colNum, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3){
- $crossChk3 = $this->encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -1212,19 +1244,19 @@ class AnalizaCrosstab extends LatexAnalysisElement{ }
if ($this->crosstabClass->crossChk1 || $this->crosstabClass->crossChk2 || $this->crosstabClass->crossChk3) {
# suma po stolpcih v procentih
- if (!$crosstabsOptions1All[$t]){
+ if (!isset($crosstabsOptions1All[$t])){
$tabelaZadnja2 .= " & ";
}
if ($this->crosstabClass->crossChk1) {
- $crossChk1 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk1 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk1, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk2) {
- $crossChk2 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk2 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk2, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
if ($this->crosstabClass->crossChk3) {
- $crossChk3 = $this->encodeText($this->formatNumber(100, 2, '%'));
+ $crossChk3 = LatexDocument::encodeText($this->formatNumber(100, 2, '%'));
$tabelaZadnja2 .= $this->DisplayLatexCells($crossChk3, $podVrstice, $colNum2, $steviloVmesnihStolpcevPodvrstic);
}
}
@@ -1264,7 +1296,7 @@ class AnalizaCrosstab extends LatexAnalysisElement{ // skupni sestevki po stolpcih - ZADNJA VRSTICA - konec #############################################################################
$stevec++;
- $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}");
+ $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
}
}
}
@@ -1272,13 +1304,12 @@ class AnalizaCrosstab extends LatexAnalysisElement{ /*zakljucek latex tabele*/
if($presirokaTabela == 0){ //ce ni presiroka tabela
- $tabela .= ($export_format == 'pdf' ? "\\end{tabularx}" : "\\end{tabular}");
+ $tabela .= ($export_format == 'pdf' ? "\\end{xltabular}" : "\\end{tabular}");
}
/*zaljucek latex tabele - konec */
- //echo "showChart: ".$this->sessionData['showChart']."</br>";
// Izris grafa (ce je vklopljena nastavitev)
- if($this->sessionData['showChart'] == '1' && $creport == false){
+ if((isset($this->sessionData['showChart'])?$this->sessionData['showChart']:0) == '1' && $creport == false){
$tabela .= $this->displayCrosstabChart();
}
}
@@ -1294,18 +1325,18 @@ class AnalizaCrosstab extends LatexAnalysisElement{ $chartID = implode('_', $this->crosstabClass->variabla1[0]).'_'.implode('_', $this->crosstabClass->variabla2[0]);
$chartID .= '_counter_'.$this->counter;
- $settings = $this->sessionData[$chartID];
- $imgName = $settings['name'];
+ $settings = isset($this->sessionData[$chartID])?$this->sessionData[$chartID]:array();
+ $imgName = isset($settings['name']) ? $settings['name'] : $chartID;
// Naslov posameznega grafa
- if($settings['type'] == 1 || $settings['type'] == 4){
+ /* if($settings['type'] == 1 || $settings['type'] == 4){
$title = $this->crosstabVars[0].'/'.$this->crosstabVars[1];
}
else{
$title = $this->crosstabVars[0];
- }
+ } */
- $boldedTitle = $this->returnBold($this->encodeText($title)).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico
+ $boldedTitle = $this->returnBold(LatexDocument::encodeText(/* $title */)).$this->texNewLine; //vrni boldan naslov in skoci v novo vrstico
copy('pChart/Cache/'.$imgName,'pChart/Cache/'.$imgName.'.png');
$texImageOnly = " \\includegraphics[scale=0.75]{".$imgName."} "; //latex za sliko
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 "</br> Tex celotne tabele: ".$tabela."</br>";
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."</br>";
- //echo "vrstice: ".$rows."</br>";
$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'])."</br>";
- $tabela .= '\textbf{'.$this->encodeText($this->multiCrosstabClass->table_settings[$this->multiCrosstabClass->table_id]['title']).'}'.$this->texBigSkip.$this->texNewLine;
- //echo $tabela."</br>";
-/* $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."</br>";
+ $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</br>";
$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."</br>";
}
}
- //$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 </br>";
// 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 </br>";
}
@@ -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."</br>";
$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)."</br>";
+
}
else{
$tabela .= " & ";
- //$this->pdf->MultiCell($width, $this->cellHeight, '', 'LR'.$border1, 'C', 0, 0, 0 ,0, true);
- //echo "naslov : </br>";
}
@@ -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)."</br>";
- //$this->pdf->MultiCell($width, $this->cellHeight, $this->snippet($option, 25), 'LR', 'C', 0, 0, 0 ,0, true);
}
else{
$tabela .= " & ";
- //echo "variabla : </br>";
- //$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)."</br>";
- //$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: </br>";
- //$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)."</br>";
// 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."</br>";
$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)."</br>";
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."</br>";
// 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."</br>";
-/* $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."</br>";
}
// 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."</br>";
+
+ $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."</br>";
+
$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."</br>";
- $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 @@ <?php
+use Drupal\migrate\Plugin\migrate\id_map\NullIdMap;
+
global $site_path;
include_once('../../function.php');
@@ -8,37 +10,37 @@ 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);
@@ -165,7 +167,6 @@ class AnalizaSums extends LatexAnalysisElement{ //$vars_count = count(SurveyAnalysis::$_FILTRED_VARIABLES);
//$line_break = '';
- //echo "Spr tip v Sums: ".$spremenljivka['tip']."</br>";
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."</br>";
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']."</br>";
@@ -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 </br>";
@@ -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."</br>";
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."</br>";
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."</br>";
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 </br>";
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."</br>";
- 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."</br>";
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<sizeof($answers[0]); $i++){
- $row = array();
- for($j=0; $j<$count; $j++){
- // Testiramo visino vrstice glede na najdaljsi text
- $singleWidth = ($count > 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<sizeof(isset($answers[0])?$answers[0]:array()); $i++){
+ $row = array();
+ for($j=0; $j<$count; $j++){
+ // Testiramo visino vrstice glede na najdaljsi text
+ $singleWidth = ($count > 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."</br>";
@@ -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 </br>";
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."</br>";
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."</br>";
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."</br>";
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 </br>";
+ $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."</br>";
+ $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'])."</br>";
//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 '<td class="anl_bl anl_br anl_bb anl_ac">'.$freqHeatmapRegion.'</td>';
- //$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 '<td class="anl_bl anl_br anl_bb anl_ac">'.$validHeatmapRegion.'</td>';
- $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 '<td class="anl_bl anl_br anl_bb anl_ac">'.$_procentValidHeatmapRegion.'</td>';
- $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 '<td class="anl_bl anl_br anl_bb anl_ac">'.$ustrezniHeatmapRegion.'</td>';
- $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 '<td class="anl_bl anl_br anl_bb anl_ac">'.$_procentUstrezniHeatmapRegion.'</td>';
- $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."</br>";
- //$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."</br>";
- //echo "_percent: ".$_percent."</br>";
- }
- }
- # izpišemo sumo neveljavnih
- //$counter = SurveyAnalysis::outputSumaInvalidAnswerHeatmap($counter,$_sequence,$spid,$options, $manjkajoci);
- echo "manjkajoci: ".$manjkajoci."</br>";
- } */
- #izpišemo še skupno sumo
- //$counter = SurveyAnalysis::outputSumaHeatmap($counter,$_sequence,$spid,$options, $ustrezniHeatmapRegion);
- //$ustrezniHeatmapRegion
- //echo "ustrezniHeatmapRegion: ".$ustrezniHeatmapRegion."</br>";
$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 </br>";
@@ -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</br>";
}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</br>";
}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 </br>";
}
}
- //echo "tex koda: ".$tex."</br>";
+
// 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</br>";
+ /* $time_end = microtime(true);
+ $execution_time = ($time_end - $time_start);
+ echo '<b>Total Execution Time besedilo 1:</b> '.$execution_time.' sec</br>'; */
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."</br>";
+
$sqlUserAnswer = sisplet_query($sqlUserAnswerString);
$userAnswer = mysqli_fetch_assoc($sqlUserAnswer);
//echo "userAnswer: ".$userAnswer['text']."</br>";
//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 '<b>Total Execution Time datum:</b> '.$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 "<b>tip izpisa: $export_data_type</b> </br>"; //$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."</br>";
}
$izpisOdgovorov = 1;
}
- //echo "Usr_id: ".$usr_id.'</br>';
- //echo "Stevilo odgovorov: ".count($userAnswer).'</br>';
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']."</br>";
- echo "spr ".$rowMultiple['spr_id']."</br>"; */
- //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 </br>";
}
- $sprIdRoletSeznamovTmp = $sprIdRoletSeznamov;
+ $sprIdRoletSeznamovTmp = $sprIdRoletSeznamov;
}
//pregled vseh odgovorov po stolpcih po $sqlStolpciVrednosti - vodoravni odgovori - konec
$vodoravniOdgovoriVsi = $vodoravniOdgovori;
- /* echo "stevilo skupin rolet/seznamov ".($steviloSkupinRoletSeznamov)." </br>";
- echo "stevilo odgovorov v roletah ali seznamu ".($steviloOdgovorovRoletSeznamov)." </br>"; */
-
-/* echo "vodoravniOdgovoriSprId: ";
- print_r($vodoravniOdgovoriSprId);
- echo "</br>";
- echo "Enote: ";
- print_r($vodoravniOdgovoriEnota);
- echo "</br>"; */
//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 "<b>velikost tabele: </b>".($velikostTabele)." </br>";
+
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</br>";
-
$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)." </br>";
- //echo "stevilo podtabel mod ".($steviloTabelMod)." </br>";
- //echo "stevilo podtabel za izpis: ".($steviloTabel)." </br>";
- //echo "stevilo podatkov za izpis: ".($steviloPodatkovZaIzpis)." </br>";
}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]."</br>";
- //echo "value: ".$value."</br>";
- //echo "valueTmp: ".$valueTmp."</br>";
- //echo "indeksParameterTabular: ".$indeksParameterTabular."</br>";
- //echo "Stevilo vodoravniOdgovoriSprId: ".count($vodoravniOdgovoriSprId)."</br>";
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."</br>";
-
//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 </br>";
//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<count($podNaslovi);$n++){
- //echo $podNaslovi[$n].'</br>';
- //$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 </br>";
- $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 '<b>Total Execution Time kombinirana tabela:</b> '.$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</br>";
#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."</br>";
}
$izpisOdgovorov = 1;
}
- //echo "podatek je: ".$userDataPresent."</br>";
- /* print_r($userAnswer);
- echo "</br>"; */
+
#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']."</br>";
}
//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 "</br>";
- print_r($vodoravniOdgovoriSprId);
- echo "</br>";*/
- /* print_r($vodoravniOdgovoriEnota);
- echo "</br>"; */
- /* print_r($vodoravniOdgovori);
- echo "</br>"; */
//ureditev parametrov tabele
- /* echo "enota:".$vodoravniOdgovoriEnota[0]."</br>";
- echo "izpisOdgovorov:".$izpisOdgovorov."</br>";
- echo "tip:".$vodoravniOdgovoriTip[0]."</br>";
- echo "export_data_type:".$export_data_type."</br>"; */
- //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</br>";
-
- /* 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</br>";
$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 </br>";
//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<count($podNaslovi);$n++){
- //echo "podnaslov za sprem ".$vodoravniOdgovoriSprId[0]." je: ".$podNaslovi[$n]." število stolpcev pa $steviloPodStolpcev</br>";
- //$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 </br>";
- $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."</br>");
+ //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 </br>";
+
+ 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"]."</br>";
+ //echo "stevilo tock znotraj obmocja: ".$point["Besedilo"]."</br>";
}
#pridobitev podatkov o obmocjih in podatka o prisotnosti tocke v obmocju - konec
//echo $answer."</br>";
@@ -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 </br>";
}
$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 </br>";
- //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 </br>";
- } */
- //echo "odgovor: ".$stringCell_title." </br>";
$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</br>";
$sqlUserAnswerMissing = $this->GetUsersDataGrid($spremenljivkeData, $db_table, $rowVrednost, $rowVsehVrednosti, $usr_id,0);
$userAnswerMissing = mysqli_fetch_assoc($sqlUserAnswerMissing);
- //echo "userAnswer Missing: ".$userAnswerMissing['grd_id'].'</br>';
}
- //echo "rowVsehVrednosti['id']: ".$rowVsehVrednosti['id'].'</br>';
- //echo "userAnswer: ".$userAnswer['text'].'</br>';
- //echo "userAnswer: ".$userAnswer['grd_id'].'</br>';
- //echo "rowVrednost['spr_id']: ".$rowVrednost['spr_id'].'</br>';
- 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 </br>";
$indeksZaWhile++;
- $podatek = 1;
- //echo "Zgornji: ".$indeksZaWhile."</br>";
- //echo "Zgornji: ".$indeksZaWhile." za ".$this->encodeText($rowVsehVrednosti['naslov'])."</br>";
- //echo "tex: ".$tex1."</br>";
+ $podatek = 1;
}else{
$podatek = 0;
}
-
- //echo $this->encodeText($this->userAnswer['text']).'</br>';
if($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je grid stevilk ali besedil
- //echo "Indeks missing: ".$IndeksZaMissing."</br>";
if(($IndeksZaMissing > ($numColSql-count($missingOdgovori)))&&(count($missingOdgovori))){
- //echo "userAnswer Missing je prisoten in njegov grd_id je: ".$userAnswerMissing['grd_id'].'</br>';
- $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."</br>";
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']."</br>";
if($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je grid stevilk ali besedil
- //echo "stevilo odgovorov: ".count($odgovoriRespondent)."</br>";
- //echo "stevilo odgovorov missing: ".count($userAnswerMissing)."</br>";
- //echo "stevilo odgovorov : ".count($userAnswer)."</br>";
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."</br>";
+ $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 </br>";
-
$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'].'</br>';
$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 </br>";
+ $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'].'</br>';
- //echo "userAnswerVreId: ".$userAnswer['vre_id'].'</br>';
- //echo "text: ".$userAnswer['text'].'</br>';
-
-/* if($spremenljivke['enota']==4&&$userAnswer['grd_id']){
- $userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id'];
- echo "userAnswerData: ".$userAnswerData[$indeksOdgovorov].'</br>';
- //echo 'je 4 </br>';
- $indeksOdgovorov++; */
if($spremenljivke['enota']==4){ //ce je ena moznost proti drugi
- //echo 'je 4 '.$indeksOdgovorov.'</br>';
if($userAnswer['grd_id']){ //ce je podatek, ga zabelezi
$userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id'];
- //echo "userAnswerData s podatkom: ".$userAnswerData[$indeksOdgovorov].'</br>';
- //echo 'je 4 '.$indeksOdgovorov.'</br>';
$indeksOdgovorov++;
}else{ //drugace
if($indeksEnaMoznostProtiDrugi>=1){
$userAnswerData[$indeksOdgovorov] = $userAnswer['grd_id'];
- //echo "rabim prazno polje </br>";
- //echo "userAnswerData brez podatka: ".$userAnswerData[$indeksOdgovorov].'</br>';
- //echo 'je 4 '.$indeksOdgovorov.'</br>';
$indeksOdgovorov++;
}
- //echo "indeks se spremeni </br>";
$indeksEnaMoznostProtiDrugi++;
}
- //echo "indeksEnaMoznostProtiDrugi: ".$indeksEnaMoznostProtiDrugi.'</br>';
- //echo "userAnswerData: ".$userAnswerData[$indeksOdgovorov].'</br>';
- }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."</br>";
+ $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']."</br>";
- //echo $indeksOdgovorovTextR.'</br>';
-
- //$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].'</br>';
$this->textRArray[$indeksOdgovorovTextR][$userAnswer['grd_id']]=$rowTextR['naslov'];
- //echo "this->textRArray: ".$this->textRArray[$indeksOdgovorovTextR][$userAnswer['grd_id']].'</br>';
- //echo "this->textRArray indeks ".$indeksOdgovorov." ".$textRVreId[$indeksOdgovorov].'</br>';
$indeksOdgovorovTextR++;
}
}
$indeksOdgovorov++;
- }
- //echo "rowVrednost['spr_id']: ".$rowVrednost['spr_id'].'</br>';
- //echo "rowVrednost['id']: ".$rowVrednost['id'].'</br>';
- //echo "rowVsehVrednosti['id']: ".$rowVsehVrednosti['id'].'</br>';
- 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].'</br>';
- //echo "enota: ".$spremenljivke['enota'].'</br>';
- //echo "indeksOdgovorov: ".$indeksOdgovorov.'</br>';
- //$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."</br>";
- echo "preveriSpremenljivko: ".$preveriSpremenljivko."</br>"; */
-
+
$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']."</br>";
+ //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('<br />','',$stringTitleCol); //odstranitev odvecnih </br> 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."</br>";
- }else{ //drugace, ce je VAS
- //$symbol = $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $spremenljivke['grids'], 0, 0, $spremenljivke['enota']);
- //echo "simbol VAS: ".$symbol."</br>";
- //echo "simbol radio grid: ".$spremenljivke['enota']."</br>";
- }
- $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 </br>";
-
- $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."</br>");
- 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 '</br><b>Total Execution Time tabele</b> '.$execution_time.' sec za vprašanje '.strip_tags($spremenljivke['naslov']).'</br>';
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<count($missingOdgovori);$m++){
@@ -660,17 +515,6 @@ class MultiGridLatex extends LatexSurveyElement }
}
#missingi - konec###########
-
- // TODO: Zanke, ki ne izpisujejo ničesar
- /* foreach($vodoravniOdgovori AS $key => $vodoravniOdgovor){ //za vsak odgovor v vrstici
- echo $vodoravniOdgovor."</br>";
- //echo $key."</br>";
- } */
- //
- /* foreach($data AS $key => $datum){ //za vsak odgovor v vrstici
- echo "Podatek: ".$datum."</br>";
- //echo $key."</br>";
- } */
$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]."</br>";
}
}
#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]."</br>";
}
}
#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]."</br>";
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]."</br>";
- //echo "stevilo stolpcev VAS: ".$steviloStolpcev."</br>";
- //$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."</br>";
- }
- } elseif($spremenljivke['enota']==12){ //ce je slikovni tip
- if($data[$j]){ //ce je podatek
- $steviloSlikovnihIkon = $data[$j];
- //echo "stevilo slikovnih ikon: ".$steviloSlikovnihIkon."</br>";
- //echo "_______________________</br>";
- }
- }*/else{
+ }else{
if($i==$steviloStolpcev){
$i=0;
}
- /* echo "tip: ".$spremenljivke['tip']."</br>";
- echo "enota: ".$spremenljivke['enota']."</br>"; */
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."</br>";
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.'</br>';
- //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.'</br>';
-
//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."</br>";
}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."</br>";
//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<count($vodoravniOdgovori);$m++){
- echo $vodoravniOdgovori[$m].'</br>';
- } */
+
}
//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."</br>";
//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.'</br>';
- //echo $spremenljivke['grids'].'</br>';
-
+ }
//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."</br>";
- } */
- $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."</br>";
//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]."</br>";
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."</br>";
-
- //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."</br>";
- //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."</br>");
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."</br>";
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."</br>";
}
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</br>";
- //echo "jezik: ".$this->language."</br>";
- 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 </br>";
- }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 '<b>Total Execution Time radio:</b> '.floatval($execution_time).' sec</br>'; */
+
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."</br>";
$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 '<b>Total Execution Time razvrščanje:</b> '.$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."</br>";
-/* echo "odgovori respondenta: ".count($odgovoriRespondenta)."</br>";
- echo "navpični odgovori: ".count($navpicniOdgovori)."</br>";
- echo "stevilo Odgovorov: ".$steviloOdgovorov."</br>";
- echo "stevilo desnih okvirjev: ".$steviloDesnihOkvirjev."</br>"; */
//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."</br>";
//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]."</br>";
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."</br>");
+ 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']."</br>";
//ureditev polja s podatki trenutnega uporabnika - konec ##############################################
@@ -152,12 +154,16 @@ class SteviloLatex extends LatexSurveyElement //echo "parametri tabele: ".$parameterTabular."</br>";
//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."</br>";
-
}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."</br>";
-
-/* $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 '<b>Total Execution Time število:</b> '.$execution_time.' sec </br>'; */
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']."</br>";
- 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 '<b>Total Execution Time vsota:</b> '.$execution_time.' sec </br>'; */
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." </br>";
- //echo "Indeksi SurveyAnalysis::missingProfileData v displayAnalysis: ".print_r(array_keys(SurveyAnalysis::$missingProfileData))." </br>";
- //echo "display_mv_type in displayAnalysis: ".SurveyAnalysis::$missingProfileData['display_mv_type']." </br>";
// 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'].'</br>';
- //echo 'export_subtype: '.$export_subtype.'</br>';
-
/*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']."</br>";
- /*echo "spr_id: ".$this->spremenljivka."</br>";
- echo "spid : ".$spid."</br>"; */
# č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)."</br>";
- 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; $j<sizeof($this->crossData2); $j++){
for($i=0; $i<sizeof($this->crossData1); $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 </br>";
@@ -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."</br>";
-
+ $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 = '<br />';
$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, '<img')."}".' '.$textPotem;
$text = $textPrej.' '.PIC_SIZE_ANS."{".$this->path2Images."".$this->getImageName($text, 0, '<img')."}".' '.$textPotem;
}
//pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike
- $findImgCode = '\includegraphics';
+ $findImgCode = '\includegraphics';
$posOfImgCode = strpos($text, $findImgCode);
- //echo $posOfImgCode."</br>";
$textToImgCode = substr($text, 0, $posOfImgCode); //tekst do $findImgCode
- //echo $textToImgCode."</br>";
$textFromImgCode = substr($text, $posOfImgCode); //tekst po $findImgCode
- //echo $textFromImgCode."</br>";
$findImgCodeEnd = '}';
- //$posOfImgCodeEnd = strpos($text, $findImgCodeEnd);
$posOfImgCodeEnd = strpos($textFromImgCode, $findImgCodeEnd);
- //echo $posOfImgCodeEnd."</br>";
$textAfterImgCode = substr($textFromImgCode, $posOfImgCodeEnd+1); //tekst po $findImgCodeEnd
- //echo $textAfterImgCode."</br>";
$textOfImgCode = substr($text, $posOfImgCode, $posOfImgCodeEnd+1);
- //echo $textOfImgCode."</br>";
$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 = '<ul';
$findUlLength = strlen($findUl);
$posUl = strpos($text, $findUl);
+
if($posUl !== false){
- //echo "text prej: ".$text."</br>";
+
$numOfUl = substr_count($text, $findUl); //stevilo '<ul' v tekstu
- //echo "numOfUl ".$numOfUl."</br>";
- ######################
+
if($numOfUl!=0){
$text = str_replace('<ul>','\begin{itemize} ', $text);
$text = str_replace('<li>','\item ', $text);
$text = str_replace('</ul>','\end{itemize} ', $text);
}
- //echo "prazno v html: ".strpos($text, '\r')."</br>";
- //echo "text potem: ".$text."</br>";
- ######################
}
-
//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."</br>";
- echo "encode po strip: ".strip_tags($text)."</br>";
- 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 '<br />' v tekstu
for($i=0; $i<$numOfBr; $i++){
+
if($i == 0){ //ce je prvi najdeni '<br />'
$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."</br>";
- echo "encode po strip: ".strip_tags($text)."</br>";
- 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 </br>";
//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 </br>";
$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 = '<div id="valid_row_togle_'.$_sequence.'" class="floatRight blue pointer" onclick="showHidenTextRow(\''.$_sequence.'\');return false;">(več...)</div>'.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 '<tr id="'.$spid.'_'.$_sequence.'_'.$counter.'" name="valid_row_'.$_sequence.'">';
- echo '<td class="anl_bl anl_ac anl_br gray anl_dash_bt anl_dash_bb" colspan="'.(6+(int)SurveyAnalysis::$_HEADERS[$spid]['show_valid_percent']+((int)SurveyAnalysis::$_SHOW_LEGENDA*2)).'"> . . . Prikazujemo samo prvih '.TEXT_MAX_ANSWER_LIMIT.' veljavnih odgovorov!</td>';
- echo '</tr>';
- }*/
+ $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."</br>";
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."</br>";
- //$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."</br>";
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</br>";
+ //echo "format: $export_format</br>";
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."</br>";
@@ -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]."</br>";
- echo $arrayText[1]."</br>";
- echo "brez hline: ".$brezHline."</br>"; */
-
- if($arrayParams['align2'] != 'C')
- $arrayParams['align2'] = 'L';
- //echo "velikost polja s tekstom: ".count($arrayText)."</br>";
-
+ $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']." </br>";
$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']."</br>";
+ //echo "nekaj: ".LatexDocument::encodeText(self::formatNumber($_desc['avg']*100,SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'),' %'))." ".$spremenljivka['tip']."</br>";
//echo "tex iz funkcije displayDescriptivesVariablaRow: ".$texDescriptivesVariablaRow."</br>";
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 </br>";
+ 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."</br>";
+ //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."</br>";
+
+ //$findme = $site_path.'uploadi/editor/';
+ $findme = $site_url.'uploadi/editor/';
+ //$findme = 'uploadi/editor/';
+ //$findme = 'editor/';
+ //echo "findme: ".$findme."</br>";
+ $pos = strpos($imageName, $findme); //najdi pozicijo teksta v $findme
+ //echo "najdi tole: ".$findme."</br>";
+ //echo "najdi tukaj: ".$imageName."</br>";
+ //echo "pozicija tega: ".$pos."</br>";
+ 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."</br>";
+ 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."</br>";
+ $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 </br>";
+ $imageName = $this->getOnlineImageName($imageName, $slikaNaStrezniku, $vre_id, $img_id); //pridobi njen URL
+ }
+
+ $imageName = substr($imageName, 0, strrpos($imageName, '.'));
+
+ }
+
+ //echo "imagename pred return: ".$imageName."</br>";
+ 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."</br>";
+ $image = imagecreatefromgif($path); //pripravi sliko iz gif za pretvorbo
+ $imageName = substr($path, 0, -3); //ime slike brez extension-a
+ //echo $imageName."</br>";
+ $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."</br>";
+ $imageNamePNG = $imageName.'.png'; //ime slike z ustreznim extension
+ imagepng($image, $imageNamePNG); //pretvori pripravljeno jpg sliko v png
+ //echo "pretvorba v png: ".$imageNamePNG."</br>";
+ //echo "xtens: ".$imageExtension."</br>";
+ //$origExtension = strrchr($path, '.');
+ //echo "ali je slika na strežniku: ".$slikaNaStrezniku."</br>";
+ if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, izbrisi jo
+ //echo "tukaj </br>";
+ 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."</br>";
+ $row = Cache::srv_spremenljivka(self::$spremenljivka);
+ //echo "sprem: ".self::$spremenljivka."</br>";
+ $spremenljivkaParams = new enkaParameters($row['params']);
+ //echo "params: ".$spremenljivkaParams->get('hotspot_image')."</br>";
+ $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."</br>";
+ $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike
+ //echo "imageExtension: ".$imageExtension."</br>";
+
+ //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 </br>";
+ $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 </br>";
+ }
+
+ //echo "command: ".$command."</br>";
+ 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."</br>";
+ 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."</br>";
+ 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.'</br>';
- echo 'export_subtype: '.$export_subtype.'</br>';
- echo 'export_format: '.$export_format.'</br>';
- echo 'anketaID: '.$_GET['anketa'].'</br>';
- /*echo 'sprID: '.$_GET['sprID'].'</br>';
- echo '$this->export_font_size: '.$this->export_font_size.'</br>';
- echo '$this->export_data_type: '.$this->export_data_type.'</br>';
- echo 'SurveyId: '.SurveyInfo::getSurveyId().'</br>'; */
+ //$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."</br>";
// 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 '<b>Total Execution Time:</b> '.$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."</br>";
+ //$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']."</br>";
- } */
-
//$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."</br>";
// 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."</br>";
- //echo "export type: ".$export_type." subtype: ".$this->export_subtype."</br>";
- #### 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."</br>";
+
+ $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 <p> tag
+ $allowed_tags = '<br><img><ul><ol><li>'; //Seznam dovoljenih html znack
+ }else{
+ $allowed_tags = '<br><img><p><ul><ol><li>'; //Seznam dovoljenih html znack
+ }
+
+
+ $text = strip_tags($text, $allowed_tags); //Odstranitev vseh znack, razen dovoljenih
+
+ $text = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $text); //Pucanje stylinga iz znack, ki so ostale
+
+ //echo "Po pucanju".$text."</br>";
+ //Pucanje html kode - konec ********************************************************
+
+ $numOfUl = 0;
+
+ //resevanje razbirajanja predolgih neprekinjenih besed in URL - spremenljivke za kasnejsi prilagojen izpis - PREVERITI, CE JE SE POTREBNO GLEDE NA SKOK NA XELATEX - PATRIK 8.1.2024
+ $numOfSpacesPrej = substr_count($text, ' '); //stevilo presledkov v besedilu
+ $stringLength = strlen($text);
+
+ $findSpace = ' ';
+ $posSpace1 = strpos($text, $findSpace); //najdi pozicijo prvega presledka v besedilu
+ $posSpace2 = strripos($text, $findSpace); //najdi pozicijo zadnjega presledka v besedilu
+
+
+ $findHttp = 'http://';
+ $findHttps = 'https://';
+ $posHttp = strpos($text, $findHttp);
+ $posHttps = strpos($text, $findHttps);
+ $isURL = 0;
+ //resevanje razbirajanja predolgih neprekinjenih besed in URL - konec
- $this->path2UploadedImages = $site_path.'uploadi/editor/';
+
+ $path2UploadedImages = $site_path.'uploadi/editor/';
if($text == ''){ //ce ni teksta, vrni se
return;
}
+
+ $textOrig = $text;
+ $findme = '<br />';
+ $findmeLength = strlen($findme);
+ $findImg = '<img';
+ $findImgLength = strlen($findImg);
+ $findUl = '<ul';
+ $findUlLength = strlen($findUl);
+ $findOl = '<ol';
+ $findLi = '<li';
+
+ $findPar = '<p>';
+
+ $pos = strpos($text, $findme);
+ $posImg = strpos($text, $findImg);
+ $posUl = strpos($text, $findUl);
+ $posOl = strpos($text, $findOl);
+ $posLi = strpos($text, $findLi);
+ $posPar = strpos($text, $findPar);
+
+ //ureditev izrisa slike
+ if($posImg !== false){
+ $numOfImgs = substr_count($text, $findImg); //stevilo '<img ' v tekstu
+ $posImg = strpos($text, $findImg);
+ $textPrej = '';
+ $textPotem = '';
+ for($i=0; $i<$numOfImgs; $i++){
+ $posImg = strpos($text, $findImg);
+ $textPrej = substr($text, 0, $posImg); //tekst do img
+ $textPotem = substr($text, $posImg); //tekst po img, z vkljuceno hmlt kodo z img
+ $posImgEnd = strpos($textPotem, '/>'); //pozicija, kjer se konca html koda za img
+ $textPotem = substr($textPotem, $posImgEnd+strlen('/>')); //tekst od konca html kode za img dalje
+
+ $imageName = $path2UploadedImages."".self::getImageName($text, 0, '<img', $vre_id, $img_id);
+ $imageNameTest = $imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku
+
+ $text = '';
+
+ if(file_exists($imageNameTest)){
+ $text .= $textPrej.' '.PIC_SIZE_ANS."{".$imageName."}";
+ }
+ else{
+ $image = $lang['srv_pc_unavailable'];
+ $text .= $image;
+ }
+ $text .= ' '.$textPotem;
+ }
- //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);
- //$text = str_replace('}','\}',$text);
- $text = str_replace('$','\$ ',$text);
- $text = str_replace('#','\# ',$text);
- $text = str_replace('%','\% ',$text);
- $text = str_replace('€','\euro',$text);
- $text = str_replace('^','\textasciicircum{} ',$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);
+
+ //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike
+ $findImgCode = '\includegraphics';
+ $posOfImgCode = strpos($text, $findImgCode);
+ //echo $posOfImgCode."</br>";
+ $textToImgCode = substr($text, 0, $posOfImgCode); //tekst do $findImgCode
+ //echo $textToImgCode."</br>";
+ $textFromImgCode = substr($text, $posOfImgCode); //tekst po $findImgCode
+ //echo $textFromImgCode."</br>";
+ $findImgCodeEnd = '}';
+ //$posOfImgCodeEnd = strpos($text, $findImgCodeEnd);
+ $posOfImgCodeEnd = strpos($textFromImgCode, $findImgCodeEnd);
+ //echo $posOfImgCodeEnd."</br>";
+ $textAfterImgCode = substr($textFromImgCode, $posOfImgCodeEnd+1); //tekst po $findImgCodeEnd
+ //echo $textAfterImgCode."</br>";
+ $textOfImgCode = substr($text, $posOfImgCode, $posOfImgCodeEnd+1);
+ //echo $textOfImgCode."</br>";
+
+ $text = $textToImgCode.$textAfterImgCode;
+ //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike - konec
}
- $text = str_replace(' ','~',$text);
- //$text = str_replace('<','\textless ',$text);
- $text = str_replace('<',' \textless ',$text);
- //$text = str_replace('>','\textgreater ',$text);
- $text = str_replace('>',' \textgreater ',$text);
+ //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
+ //brez tega se sesuje tudi pri uporabi XeLatex
+ $text = str_replace('\\','\textbackslash ',$text);
+ if(substr_count($text, '#')){ //ce je stevilo # vecje od 1
+ $text = str_replace('#','\#',$text);
+ }
+ else{
+ $text = str_replace('#','\# ',$text);
+ }
+ $text = str_replace('$','\$ ',$text);
+ $text = str_replace('%','\% ',$text);
+ $text = str_replace('{','\{',$text);
+ $text = str_replace('}','\}',$text);
+ $text = str_replace('^','\textasciicircum ',$text);
+ $text = str_replace('_','\_',$text);
+ $text = str_replace('~','\textasciitilde ',$text);
+ $text = str_replace('&','\&',$text);
+ //brez tega se sesuje tudi pri uporabi XeLatex - konec
+
+
//ureditev posebnih karakterjev za Latex - konec
- //ureditev grskih crk
- $text = str_replace('α','\textalpha ',$text);
- $text = str_replace('β','\textbeta ',$text);
- $text = str_replace('γ','\textgamma ',$text);
- $text = str_replace('δ','\textdelta ',$text);
- $text = str_replace('ε','\textepsilon ',$text);
- $text = str_replace('ζ','\textzeta ',$text);
- $text = str_replace('η','\texteta ',$text);
- $text = str_replace('θ','\texttheta ',$text);
- $text = str_replace('ι','\textiota ',$text);
- $text = str_replace('κ','\textkappa ',$text);
- $text = str_replace('λ','\textlambda ',$text);
- $text = str_replace('μ','\textmugreek ',$text);
- $text = str_replace('ν','\textnu ',$text);
- $text = str_replace('ξ','\textxi ',$text);
- //$text = str_replace('ο','\textomikron ',$text);
- $text = str_replace('π','\textpi ',$text);
- $text = str_replace('ρ','\textrho ',$text);
- $text = str_replace('σ','\textsigma ',$text);
- $text = str_replace('τ','\texttau ',$text);
- $text = str_replace('υ','\textupsilon ',$text);
- $text = str_replace('φ','\textphi ',$text);
- $text = str_replace('χ','\textchi ',$text);
- $text = str_replace('ψ','\textpsi ',$text);
- $text = str_replace('ω','\textomega ',$text);
- //ureditev grskih crk - konec
-
-
- //RESEVANJE BESEDILA V CIRILICI
- $contains_cyrillic = (bool) preg_match('/[\p{Cyrillic}]/u', $text); //ali je v besedilu cirilica?
- if($contains_cyrillic){ // ce je cirilica v besedilu
- $text = '\foreignlanguage{russian}{'.$text.'}';
+
+ //ureditev preureditve html kode ul oz. ol in li v latex itemize oz. enumate
+ if($posUl !== false || $posOl !== false){
+ $numOfUl = substr_count($text, $findUl); //stevilo '<ul' v tekstu
+ $numOfOl = substr_count($text, $findOl); //stevilo '<ol' v tekstu
+ ######################
+ if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
+ $text = str_replace(['<ul>', '<ul'],'', $text);
+ $text = str_replace(['<li>', '<li'],' \\\\ ', $text);
+ $text = str_replace('</ul>','', $text);
+ }
+ ######################
+ }
+ //ureditev preureditve html kode ul oz. ol in li v latex itemize oz. enumate - 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($posPar !== false){ //ce je kaksen html tag <p> in jih je potrebno izpisati, dodaj prazno vrstico oz. break
+ if($variable_name == 'gdpr' || $variable_name == 'intro'){
+ if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
+ $divider = ' ';
+ }else{
+ $divider = ' \\ \\\\ ';
+ }
+ $text = str_replace(['<p>', '</p>'], $divider, $text);
+ }else{
+ $text = str_replace(['<p>', '</p>'],' ', $text);
+ }
+ }
+
+ //priprava izpisa zelo dolgega besedila brez presledkov (URL, email, ...) - PREVERITI, CE JE SE POTREBNO GLEDE NA SKOK NA XELATEX - PATRIK 8.1.2024
+ //if($numOfSpacesPrej == 0 && ($stringLength >= MAX_STRING_LENGTH)){ //ce v besedilu ni presledkov in je besedilo daljse od max dovoljene dolzine
+ if( ($numOfSpacesPrej == 0 && ($stringLength >= MAX_STRING_LENGTH)) || ($numOfSpacesPrej == 1 && $posSpace1 == $posSpace2 && $stringLength >= MAX_STRING_LENGTH)){ //ce v besedilu ni presledkov in je besedilo daljse od max dovoljene dolzine
+ $text = "\seqsplit{".$text."}";
+ }
+ //priprava izpisa zelo dolgega besedila brez presledkov - konec
+
+ //echo "text potem: ".$text."</br>";
+
+ if($pos !== false){ // ce je v tekstu prisoten br
+ //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico
+ if($no_br == 0){ // ce besedilo potrebuje ustrezen nadomestek <br> v latex kodi
+ $text = str_replace(['<br>', '<br/>', '<br />'],' '.self::$texNewLine, $text); //preuredi
+ }
+ //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico - konec
+
+ //Odstranitev odvecnega skoka v novo vrtico na zacetku in koncu besedila
+ $find_texNewLine = ' \\\\ ';
+ $pos_find_texNewLine_1 = strpos($text, $find_texNewLine); //najdi pozicijo prvega simbola za novo vrstico v besedilu
+ if($pos_find_texNewLine_1 == 0 && $pos_find_texNewLine_1 !== false){ //ce je simbol na samem zacetku besedila
+ $text = substr_replace($text, ' ', $pos_find_texNewLine_1, strlen($find_texNewLine)); //nadomesti ga s presledkom
+ }
+
+ $pos_find_texNewLine_2 = strripos($text, $find_texNewLine); //najdi pozicijo zadnjega simbola za novo vrstico v besedilu
+ if($pos_find_texNewLine_2 == (strlen($text) - strlen($find_texNewLine)) && $pos_find_texNewLine_2 !== false){ //ce je simbol na ustrezni poziciji na koncu besedila
+ $text = substr_replace($text, ' ', $pos_find_texNewLine_2, strlen($find_texNewLine)); //nadomesti ga s presledkom
+ }
+
+ $text = trim($text); //Odstranitev posebnih znakov za novo vrstico, presledek, ... na zacetku in koncu besedila
+ //Odstranitev odvecnega skoka v novo vrtico na zacetku in koncu besedila - konec
}
- //RESEVANJE BESEDILA V CIRILICI - konec
- return $text;
+ return strip_tags($text);
}
#funkcija ki skrbi za encode dolocenih spornih delov besedila v latex-u prijazno - konec
+
+ #funkcija, ki skrbi za pridobitev imena slike, ki jo je potrebno izrisati ######################################
+ public static function getImageName($text='', $sprId=null, $findme='', $vre_id=0, $img_id=0){
+ global $site_path, $site_url;
+ $imageName = '';
+ //echo "id slike $img_id </br>";
+ 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
+ if($pos!=''||$pos==0){ //ce je slika v bazi
+ $imageName = substr($text,$pos); //pokazi le del text od besedila $findme dalje (vkljucno z besedilom)
+
+ $findme = $site_url.'uploadi/editor/';
+ $pos = strpos($imageName, $findme); //najdi pozicijo teksta v $findme
+ if($pos){ //ce je slika na strezniku
+ $slikaNaStrezniku = 1;
+ }else{//ce slike ni na strezniku
+ $slikaNaStrezniku = 0;
+ }
+ 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/'
+
+ $pos = self::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;
+
+ if($imageExtension == 'gif'){ //ce je slika gif, jo je potrebno pretvoriti v png
+ self::convertGifToPng($path, $slikaNaStrezniku);
+ }
+
+ if($imageExtension == 'jpg' || $imageExtension == 'peg'){ //ce je slika jpg ali jpeg, jo je potrebno pretvoriti v png
+ self::convertJpgToPng($path, $slikaNaStrezniku, $imageExtension);
+ }
+ }elseif($slikaNaStrezniku==0){ //ce slike ni na strezniku
+ self::$spremenljivka = $sprId;
+ $row = Cache::srv_spremenljivka($sprId);
+ $spremenljivkaParams = new enkaParameters($row['params']);
+ $imageName = ($spremenljivkaParams->get('hotspot_image') ? $spremenljivkaParams->get('hotspot_image') : "");
+ if($imageName!=''){
+ $imageName = self::getOnlineImageName($imageName, $slikaNaStrezniku, $vre_id, $img_id); //pridobi njen URL
+ }
+ }
+ if($imageName!=''){
+ $imageName = substr($imageName, 0, strrpos($imageName, '.'));
+ }else{
+ $imageName = 'ni slike';
+ }
+
+ }
+
+ //echo "imagename pred return: ".$imageName."</br>";
+ return $imageName;
+ }
+ #funkcija, ki skrbi za pridobitev imena slike, ki jo je potrebno izrisati - konec ###############################
+
+ #funkcija, ki skrbi za pridobitev ustrezne strezniske poti do slike - trenutno ni v uporabi ########################################################
+ function getPath2Images($text='', $sprId=null, $findme=''){
+ global $site_path;
+ $imageName = '';
+
+ 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
+
+ if($pos!=''||$pos==0){ //ce je slika v bazi
+ $imageName = substr($text,$pos); //pokazi le del text od besedila $findme dalje (vkljucno z besedilom)
+
+ $findme = 'editor/';
+ $pos = strpos($imageName, $findme); //najdi pozicijo teksta 'editor/'
+
+ if($pos){ //ce je slika na strezniku
+ $slikaNaStrezniku = 1;
+ }else{//ce slike ni na strezniku
+ $slikaNaStrezniku = 0;
+ }
+
+ if($slikaNaStrezniku==1){ //ce slika je bila prenesena na streznik
+ $path2Images = $site_path.'admin/survey/export/latexclasses/textemp/images/';
+ }elseif($slikaNaStrezniku==0){ //ce slika je bila na dolocenem URL
+ $path2Images = $site_path.'uploadi/editor/';
+ }
+
+ }
+ //echo "pot do slik: ".$path2Images."</br>";
+ return $path2Images;
+ }
+ #funkcija, ki skrbi za pridobitev ustrezne strezniske poti do slike - konec ########################################################
+
+
+ #funkcija, ki skrbi za pridobitev slike, ki se nahaja nekje online in jo je potrebno izrisati, in vrne lokalno ime slike ######################################
+ public static function getOnlineImageName($imageName='', $slikaNaStrezniku=null, $vre_id=null, $img_id=0){
+ global $site_path;
+ //echo "imageName v getOnlineImageName nekje vmes 1: ".$imageName."</br>";
+ $row = Cache::srv_spremenljivka(self::$spremenljivka);
+ //echo "sprem: ".self::$spremenljivka."</br>";
+ $spremenljivkaParams = new enkaParameters($row['params']);
+ //echo "params: ".$spremenljivkaParams->get('hotspot_image')."</br>";
+ $imageNameTmp = $spremenljivkaParams->get('hotspot_image');
+ //echo "imageNameTmp: ".$imageNameTmp."</br>";
+ //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 = self::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."</br>";
+ $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike
+ //echo "imageExtension: ".$imageExtension."</br>";
+
+ //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 </br>";
+ $imageExtension='png';
+ }
+
+ if($vre_id){ //ce se pridobiva imena tmp slik iz vrednosti vprasanja
+ $imgFilename = self::$spremenljivka.'_'.$vre_id.'_tmpImage_'.$img_id.'.'.$imageExtension; //tmp ime slike, ki je sestavljeno iz id spremenljivke+vre_id+tmpImage+img_id+extension
+ }else{
+ $imgFilename = self::$spremenljivka.'_tmpImage_'.$img_id.'.'.$imageExtension; //tmp ime slike, ki je sestavljeno iz id spremenljivke+tmpImage+img_id+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 </br>";
+ }
+
+ //echo "command: ".$command."</br>";
+ exec($command); //pretoci sliko
+
+ 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
+ self::convertGifToPng($path, $slikaNaStrezniku);
+ }else{
+ self::convertJpgToPng($path, $slikaNaStrezniku, $imageExtension);
+ }
+ }
+
+ //echo "imgfilename na koncu: ".$imgFilename."</br>";
+ return $imgFilename;
+ }
+ #funkcija, ki skrbi za pridobitev slike, ki se nahaja nekje online in jo je potrebno izrisati, in vrne lokalno ime slike - konec ###############################
+
+
+ public static function convertGifToPng($path='', $slikaNaStrezniku=null){
+ //echo "path: ".$path."</br>";
+ $image = imagecreatefromgif($path); //pripravi sliko iz gif za pretvorbo
+ $imageName = substr($path, 0, -3); //ime slike brez extension-a
+ //echo $imageName."</br>";
+ $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
+ }
+ }
+
+ public static 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."</br>";
+ $imageNamePNG = $imageName.'.png'; //ime slike z ustreznim extension
+ imagepng($image, $imageNamePNG); //pretvori pripravljeno jpg sliko v png
+ //echo "pretvorba v png: ".$imageNamePNG."</br>";
+ //echo "xtens: ".$imageExtension."</br>";
+ //$origExtension = strrchr($path, '.');
+ //echo "ali je slika na strežniku: ".$slikaNaStrezniku."</br>";
+ if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, izbrisi jo
+ //echo "tukaj </br>";
+ if($imageExtension == 'jpg'){
+ unlink($imageName.'.'.$imageExtension); //izbrisi sliko
+ }elseif($imageExtension == 'peg'){
+ unlink($imageName.'.j'.$imageExtension); //izbrisi sliko
+ }
+ }
+ }
+
+ public static function getEndPosition($imageName=''){
+ $findme = '"';
+ $pos = strpos($imageName, $findme); //najdi pozicijo teksta '"'
+ return $pos;
+ }
}
\ No newline at end of file diff --git a/admin/survey/export/latexclasses/class.LatexEditsAnalysis.php b/admin/survey/export/latexclasses/class.LatexEditsAnalysis.php index 698f79c..1dd4fc8 100644 --- a/admin/survey/export/latexclasses/class.LatexEditsAnalysis.php +++ b/admin/survey/export/latexclasses/class.LatexEditsAnalysis.php @@ -68,6 +68,13 @@ class LatexEditsAnalysis { protected $texTimeEdits='';
protected $vrsticaTex = array();
+
+ protected $seanse = null;
+ protected $timings = null;
+
+ protected $interval_criteria = array();
+
+ public static $spremenljivka=null;
public static $sea = null; //SurveyEditsAnalysis class
@@ -86,7 +93,7 @@ class LatexEditsAnalysis { if ( is_numeric($anketa) )
{
$this->anketa['id'] = $anketa;
- $this->anketa['podstran'] = $podstran;
+ //$this->anketa['podstran'] = $podstran; //pokomentirano, ker se ne uporablja nikjer in je težava s PHP8
}
else
{
@@ -269,7 +276,7 @@ class LatexEditsAnalysis { $texEditAnalysis .= $this->texBigSkip.$this->texNewLine;
- if(sizeof($this->data) == 0){
+ if(is_countable($this->data) && sizeof($this->data) == 0){
$texEditAnalysis .= $lang['srv_edits_analysis_no_data'];
}
else{
@@ -307,10 +314,10 @@ class LatexEditsAnalysis { $tex = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_edits_analysis_counter']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_edits_analysis_counter']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
- if(sizeof($this->data) == 0)
+ if(is_countable($this->data) && sizeof($this->data) == 0)
$tex .= $lang['srv_edits_analysis_no_data'];
else{
@@ -357,10 +364,10 @@ class LatexEditsAnalysis { //Priprava podatkov za izpis vrstic tabele in njihov izpis
$prvaVrstica = array();
- $prvaVrstica[] = $this->encodeText($lang['srv_edits_analysis_counter_editor']);
- $prvaVrstica[] = $this->encodeText($lang['srv_edits_analysis_time_time']);
- $prvaVrstica[] = $this->encodeText($lang['srv_edits_analysis_num_sessions']);
- $prvaVrstica[] = $this->encodeText($lang['srv_edits_analysis_time_actions']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_counter_editor']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_time_time']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_num_sessions']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_time_actions']);
$tex .= $this->tableRow($prvaVrstica); //Izpis 1. vrstice tabele
@@ -381,7 +388,7 @@ class LatexEditsAnalysis { // vsota veljavnih
$vrsticaSum = array();
- $vrsticaSum[] = $this->encodeText($lang['srv_edits_analysis_time_total']);
+ $vrsticaSum[] = LatexDocument::encodeText($lang['srv_edits_analysis_time_total']);
$vrsticaSum[] = $this->sea->calculateTimeFromSeconds($sum_time);
$vrsticaSum[] = $sum_seans;
$vrsticaSum[] = $sum_akcij;
@@ -411,7 +418,7 @@ class LatexEditsAnalysis { $sum_data = $this->sum_data;
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_edits_analysis_countinu']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_edits_analysis_countinu']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
//izpis nastavitev
@@ -458,7 +465,7 @@ class LatexEditsAnalysis { $interval = $this->sea->calculateTimeBetweenActions($temp_time, DateTime::createFromFormat('Y-m-d'.$interval_crit, $row['formatdate']));
//if interval between actions are 1 unit (1 hour or 1 day), add it to continued editing session
- if($interval/$interval_seconds-$zapored < 2){
+ if((float) $interval/$interval_seconds-$zapored < 2){
$zapored++;
//set maxValue, needed for width of bars
$maxValue = max($maxValue, $zapored);
@@ -482,7 +489,7 @@ class LatexEditsAnalysis { }
if(!$results){
//$this->echoNoData();
- $tex .= $this->encodeText($lang['srv_no_data']).$this->texNewLine;
+ $tex .= LatexDocument::encodeText($lang['srv_no_data']).$this->texNewLine;
}
else{
//Priprava parametrov za tabelo s podatki o anketi
@@ -526,7 +533,7 @@ class LatexEditsAnalysis { }
} else{
//$this->echoNoData();
- $tex .= $this->encodeText($lang['srv_no_data']).$this->texNewLine;
+ $tex .= LatexDocument::encodeText($lang['srv_no_data']).$this->texNewLine;
}
#################
@@ -575,7 +582,7 @@ class LatexEditsAnalysis { $sum_data = $this->sum_data;
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_edits_analysis_editing_details']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_edits_analysis_editing_details']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
$tex .= $this->texTimeEdits;
@@ -652,7 +659,6 @@ class LatexEditsAnalysis { $textPotem = substr($textPotem, $posImgEnd+strlen('/>')); //tekst od konca html kode za img dalje
$text = $textPrej.' '.PIC_SIZE_ANS."{".$this->getImageName($text, 0, '<img')."}".' '.$textPotem;
- //$text2Return = $textPrej.' '.PIC_SIZE_ANS."{".$this->getImageName($text2Return, 0, 'img')."}".' '.$textPotem;
}
//pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike
@@ -811,13 +817,12 @@ class LatexEditsAnalysis { //function tableRow($arrayText, $brezHline=0, $brezNoveVrstice=0, $nadaljevanjeVrstice=0, $steviloPodstolpcev){
function tableRow($arrayText=null, $brezHline=0, $brezNoveVrstice=0, $nadaljevanjeVrstice=0, $color='', $export_format = null, $steviloPodstolpcev = null){
$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);
+ $height = 1; //$height = $this->getCellHeight(LatexDocument::encodeText($arrayText[1]), 90);
- if($arrayParams['align2'] != 'C')
- $arrayParams['align2'] = 'L';
- //echo "velikost polja s tekstom: ".count($arrayText)."</br>";
+ /* if($arrayParams['align2'] != 'C')
+ $arrayParams['align2'] = 'L'; */
if($export_format == 'pdf'){
if($color=='blue'){
@@ -833,7 +838,6 @@ class LatexEditsAnalysis { for($i=0;$i<count($arrayText);$i++){
//echo "array text: ".$arrayText[$i]."</br>";
if($color!=''){ //ce je potrebno besedilo dolocene barve
- //$text = ' \cellcolor{'.$cellBgColor.'} '.$this->coloredTextLatex($color, $arrayText[$i]);
$text = $cellColoring.''.$this->coloredTextLatex($color, $arrayText[$i]);
}else{
$text = $arrayText[$i];
@@ -954,7 +958,7 @@ class LatexEditsAnalysis { //Priprava podatkov za izpis vrstic tabele in izpis vrstic /////////////////////////////////////////////////////
- $time_sum += $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
+ $time_sum += (float) $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
//Izpis posameznih vrstic
foreach($this->vrsticaTex as $vrstica){
@@ -1024,7 +1028,7 @@ class LatexEditsAnalysis { else{
$datetime_last = clone $datetime_start;
$datetime_last->add(new DateInterval('PT5S'));
- $time_sum += $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
+ $time_sum += (float) $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
$st_akcij = 1;
$st_seans_sum++;
$datetime_start = clone $temp_time;
@@ -1044,7 +1048,7 @@ class LatexEditsAnalysis { }
//akcija je izven kriterija seanse, izpisi vse prejsnje akcije
else{
- $time_sum += $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
+ $time_sum += (float) $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
$st_akcij = 1;
$st_seans_sum++;
$datetime_start = clone $temp_time;
@@ -1070,7 +1074,7 @@ class LatexEditsAnalysis { $datetime_last->add(new DateInterval('PT5S'));
}
- $time_sum += $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
+ $time_sum += (float) $this -> TimeEditsRow($datetime_start, $datetime_last, $st_akcij, $action_type, $user_id.'_'.$row_id);
//Izpis posameznih vrstic
foreach($this->vrsticaTex as $vrstica){
@@ -1140,7 +1144,7 @@ class LatexEditsAnalysis { * quotes and no stat and end braces)
* @return type valid converted JSON
*/
- function convertToJSON($toJSON=null){
+ function convertToJSON($toJSON=''){
$toJSON = preg_replace('/("(.*?)"|(\w+))(\s*:\s*(".*?"|.))/s', '"$2$3"$4', $toJSON);
$toJSON = '{'.$toJSON.'}';
return json_decode($toJSON, true);
@@ -1159,17 +1163,17 @@ class LatexEditsAnalysis { $latexVrstica = array();
//casovni razpon urejanja
- $latexVrstica[] = $this->encodeText($datetime);
+ $latexVrstica[] = LatexDocument::encodeText($datetime);
//cas urejanja
- $latexVrstica[] = $this->encodeText($cas_seanse);
+ $latexVrstica[] = LatexDocument::encodeText($cas_seanse);
//stevilo akcij
- $latexVrstica[] = $this->encodeText($st_akcij);
+ $latexVrstica[] = LatexDocument::encodeText($st_akcij);
if($action_type != null){
//vrsta akcij
- $latexVrstica[] = $this->encodeText($action_type.' ');
+ $latexVrstica[] = LatexDocument::encodeText($action_type.' ');
}
$tex .= $this->tableRow($latexVrstica);
@@ -1183,7 +1187,7 @@ class LatexEditsAnalysis { * @param type $row_id - int sequence nuber of row (unique user int and row in table)
* @return string - converter array to string to put it in table cell
*/
- function createActionsTypeString($action_type=null, $row_id=null){
+ function createActionsTypeString($action_type=array(), $row_id=null){
$action_type_string = '';
//urejanje - ali drug specificen status
if(!isset($action_type[0]['sum'])){
@@ -1228,7 +1232,7 @@ class LatexEditsAnalysis { $tex = '';
$vrsticaPodatkovSkupaj = array();
//casovni razpon urejanja
- $vrsticaPodatkovSkupaj[] = $this->returnBold($this->encodeText($lang['srv_edits_analysis_time_total']));
+ $vrsticaPodatkovSkupaj[] = $this->returnBold(LatexDocument::encodeText($lang['srv_edits_analysis_time_total']));
//cas urejanja
$vrsticaPodatkovSkupaj[] = $this->returnBold($this->sea->calculateTimeFromSeconds($time));
@@ -1238,7 +1242,7 @@ class LatexEditsAnalysis { if($action_type != null){
//vrsta akcij
- $vrsticaPodatkovSkupaj[] = $this->returnBold($this->encodeText($this->createActionsTypeString($action_type, $row_id)));
+ $vrsticaPodatkovSkupaj[] = $this->returnBold(LatexDocument::encodeText($this->createActionsTypeString($action_type, $row_id)));
}
$tex .= $this->tableRow($vrsticaPodatkovSkupaj); //Izpis vrstic tabele s podatki o sumi
@@ -1284,11 +1288,11 @@ class LatexEditsAnalysis { $tex .= $this->tableRow($prvaVrstica);
$drugaVrstica = array();
- $drugaVrstica[] = $this->encodeText($lang['srv_edits_analysis_time_span']);
- $drugaVrstica[] = $this->encodeText($lang['srv_edits_analysis_time_time']);
- $drugaVrstica[] = $this->encodeText($lang['srv_edits_analysis_time_actions']);
+ $drugaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_time_span']);
+ $drugaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_time_time']);
+ $drugaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_time_actions']);
if($status < 1){
- $drugaVrstica[] = $this->encodeText($lang['srv_edits_analysis_action_type']);
+ $drugaVrstica[] = LatexDocument::encodeText($lang['srv_edits_analysis_action_type']);
}else{
$drugaVrstica[] = '';
}
@@ -1300,6 +1304,191 @@ class LatexEditsAnalysis { $tex = "\\end{tabularx}";
return $tex;
}
+
+ #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 = '';
+ self::$spremenljivka = $sprId;
+ 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."</br>";
+ //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."</br>";
+
+ //$findme = $site_path.'uploadi/editor/';
+ $findme = $site_url.'uploadi/editor/';
+ //$findme = 'uploadi/editor/';
+ //$findme = 'editor/';
+ //echo "findme: ".$findme."</br>";
+ $pos = strpos($imageName, $findme); //najdi pozicijo teksta v $findme
+ //echo "najdi tole: ".$findme."</br>";
+ //echo "najdi tukaj: ".$imageName."</br>";
+ //echo "pozicija tega: ".$pos."</br>";
+ 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."</br>";
+ 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."</br>";
+ $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 </br>";
+ $imageName = $this->getOnlineImageName($imageName, $slikaNaStrezniku, $vre_id, $img_id); //pridobi njen URL
+ }
+
+ $imageName = substr($imageName, 0, strrpos($imageName, '.'));
+
+ }
+
+ //echo "imagename pred return: ".$imageName."</br>";
+ 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."</br>";
+ $image = imagecreatefromgif($path); //pripravi sliko iz gif za pretvorbo
+ $imageName = substr($path, 0, -3); //ime slike brez extension-a
+ //echo $imageName."</br>";
+ $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."</br>";
+ $imageNamePNG = $imageName.'.png'; //ime slike z ustreznim extension
+ imagepng($image, $imageNamePNG); //pretvori pripravljeno jpg sliko v png
+ //echo "pretvorba v png: ".$imageNamePNG."</br>";
+ //echo "xtens: ".$imageExtension."</br>";
+ //$origExtension = strrchr($path, '.');
+ //echo "ali je slika na strežniku: ".$slikaNaStrezniku."</br>";
+ if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, izbrisi jo
+ //echo "tukaj </br>";
+ 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."</br>";
+ $row = Cache::srv_spremenljivka(self::$spremenljivka);
+ //echo "sprem: ".self::$spremenljivka."</br>";
+ $spremenljivkaParams = new enkaParameters($row['params']);
+ //echo "params: ".$spremenljivkaParams->get('hotspot_image')."</br>";
+ $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."</br>";
+ $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike
+ //echo "imageExtension: ".$imageExtension."</br>";
+
+ //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 </br>";
+ $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 </br>";
+ }
+
+ //echo "command: ".$command."</br>";
+ 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."</br>";
+ 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."</br>";
+ return $imgFilename;
+ }
+ #funkcija, ki skrbi za pridobitev slike, ki se nahaja nekje online in jo je potrebno izrisati, in vrne lokalno ime slike - konec ###############################
+
+ function coloredTextLatex($color='', $text=''){
+ $coloredText = '';
+ $coloredText .= '\textcolor{'.$color.'}{'.$text.'}';
+ return $coloredText;
+ }
+
}
?>
\ No newline at end of file diff --git a/admin/survey/export/latexclasses/class.LatexStatus.php b/admin/survey/export/latexclasses/class.LatexStatus.php index 522e843..62e9c83 100644 --- a/admin/survey/export/latexclasses/class.LatexStatus.php +++ b/admin/survey/export/latexclasses/class.LatexStatus.php @@ -9,11 +9,11 @@ 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
- 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");
@@ -50,7 +50,7 @@ * @desc: po novem je potrebno form elemente generirati ro�no kot slike
*
*/
-class LatexStatus {
+class LatexStatus{
var $anketa;// = array(); // trenutna anketa
@@ -79,7 +79,7 @@ class LatexStatus { if ( is_numeric($anketa) )
{
$this->anketa['id'] = $anketa;
- $this->anketa['podstran'] = $podstran;
+ //$this->anketa['podstran'] = $podstran;
// create new PDF document
//$this->pdf = new enka_TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
}
@@ -148,7 +148,6 @@ class LatexStatus { $this->ss->PrepareStatusView();
//naslov izvoza
- //$texStatus .= $this->returnBold('Status').$this->texNewLine.$this->texNewLine;
$texStatus .= '\MakeUppercase{\huge \textbf{Status - '.$lang['srv_status_summary'].'}}'.$this->texBigSkip.$this->texNewLine;
@@ -203,7 +202,7 @@ class LatexStatus { $texStatusInfo = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_statistic_info_title']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_statistic_info_title']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
//Priprava parametrov za tabelo s podatki o anketi
@@ -241,89 +240,89 @@ class LatexStatus { //ime ankete
$prvaVrstica = array();
- $prvaVrstica[] = $this->encodeText($lang['srv_info_name'].':');
- //$prvaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText(SurveyInfo::getSurveyTitle()).'} ';
- $prvaVrstica[] = $this->encodeText(SurveyInfo::getSurveyTitle());
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_info_name'].':');
+ //$prvaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText(SurveyInfo::getSurveyTitle()).'} ';
+ $prvaVrstica[] = LatexDocument::encodeText(SurveyInfo::getSurveyTitle());
//katere napredne možnosti so vklopljene
- $row = SurveyInfo::getSurveyRow();
+ $row = SurveyInfo::getSurveyModules();
$enabled_advanced = null;
$prefix = '';
- if ($row['uporabnost'] == 1) {
+ if (isset($row['uporabnost'])) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_4'];
$prefix = ', ';
}
- if ($row['user_from_cms'] == 1) {
+ if (isset($row['user_from_cms'])) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_5'];
$prefix = ', ';
}
- if ($row['quiz'] == 1) {
+ if (isset($row['quiz'])) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_6'];
$prefix = ', ';
}
- if ($row['voting'] == 1) {
+ if (isset($row['voting'])) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_18'];
$prefix = ', ';
}
- if ($row['phone'] == 1) {
+ if (isset($row['phone'])) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_7'];
$prefix = ', ';
}
- if ($row['social_network'] == 1) {
+ if (isset($row['social_network'])) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_8'];
$prefix = ', ';
}
//tip ankete
$drugaVrstica = array();
- $drugaVrstica[] = $this->encodeText($lang['srv_info_type'].':');
+ $drugaVrstica[] = LatexDocument::encodeText($lang['srv_info_type'].':');
//$drugaVrstica[] = '\multicolumn{2}{l}{ '.$lang['srv_vrsta_survey_type_'.SurveyInfo::getSurveyType()] . ($enabled_advanced != null ? ' ('.$enabled_advanced.')' : '' ).'} ';
$drugaVrstica[] = $lang['srv_vrsta_survey_type_'.SurveyInfo::getSurveyType()] . ($enabled_advanced != null ? ' ('.$enabled_advanced.')' : '' );
/* //vprašanj, variabel
$tretjaVrstica = array();
- //$tretjaVrstica[] = $this->encodeText($lang['srv_info_questions1'].': ').$this->encodeText(SurveyInfo::getSurveyQuestionCount());
- $tretjaVrstica[] = $this->encodeText($lang['srv_info_questions1'].': ');
- $tretjaVrstica[] = $this->encodeText(SurveyInfo::getSurveyQuestionCount());
- //$tretjaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_info_variables'].': ').$this->encodeText(SurveyInfo::getSurveyVariableCount()).'} ';
- $tretjaVrstica[] = $this->encodeText($lang['srv_info_variables'].': ').$this->encodeText(SurveyInfo::getSurveyVariableCount()); */
+ //$tretjaVrstica[] = LatexDocument::encodeText($lang['srv_info_questions1'].': ').LatexDocument::encodeText(SurveyInfo::getSurveyQuestionCount());
+ $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_info_questions1'].': ');
+ $tretjaVrstica[] = LatexDocument::encodeText(SurveyInfo::getSurveyQuestionCount());
+ //$tretjaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_info_variables'].': ').LatexDocument::encodeText(SurveyInfo::getSurveyVariableCount()).'} ';
+ $tretjaVrstica[] = LatexDocument::encodeText($lang['srv_info_variables'].': ').LatexDocument::encodeText(SurveyInfo::getSurveyVariableCount()); */
//vprašanj
$tretjaVrsticaA = array();
- //$tretjaVrstica[] = $this->encodeText($lang['srv_info_questions1'].': ').$this->encodeText(SurveyInfo::getSurveyQuestionCount());
- $tretjaVrsticaA[] = $this->encodeText($lang['srv_info_questions1'].': ');
- $tretjaVrsticaA[] = $this->encodeText(SurveyInfo::getSurveyQuestionCount());
+ //$tretjaVrstica[] = LatexDocument::encodeText($lang['srv_info_questions1'].': ').LatexDocument::encodeText(SurveyInfo::getSurveyQuestionCount());
+ $tretjaVrsticaA[] = LatexDocument::encodeText($lang['srv_info_questions1'].': ');
+ $tretjaVrsticaA[] = LatexDocument::encodeText(SurveyInfo::getSurveyQuestionCount());
//variabel
$tretjaVrsticaB = array();
- $tretjaVrsticaB[] = $this->encodeText($lang['srv_info_variables'].': ');
- $tretjaVrsticaB[] = $this->encodeText(SurveyInfo::getSurveyVariableCount());
+ $tretjaVrsticaB[] = LatexDocument::encodeText($lang['srv_info_variables'].': ');
+ $tretjaVrsticaB[] = LatexDocument::encodeText(SurveyInfo::getSurveyVariableCount());
/* //uporabnikov, odgovorov
$cetrtaVrstica = array();
- $cetrtaVrstica[] = $this->encodeText($lang['srv_analiza_stUporabnikov'].':');
- $cetrtaVrstica[] = $this->encodeText(SurveyInfo::getSurveyAnswersCount());
- $cetrtaVrstica[] = $this->encodeText($lang['srv_info_answers_valid'].': ').$this->encodeText(SurveyInfo::getSurveyApropriateAnswersCount()); */
+ $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_analiza_stUporabnikov'].':');
+ $cetrtaVrstica[] = LatexDocument::encodeText(SurveyInfo::getSurveyAnswersCount());
+ $cetrtaVrstica[] = LatexDocument::encodeText($lang['srv_info_answers_valid'].': ').LatexDocument::encodeText(SurveyInfo::getSurveyApropriateAnswersCount()); */
//uporabnikov
$cetrtaVrsticaA = array();
- $cetrtaVrsticaA[] = $this->encodeText($lang['srv_analiza_stUporabnikov'].':');
- $cetrtaVrsticaA[] = $this->encodeText(SurveyInfo::getSurveyAnswersCount());
+ $cetrtaVrsticaA[] = LatexDocument::encodeText($lang['srv_analiza_stUporabnikov'].':');
+ $cetrtaVrsticaA[] = LatexDocument::encodeText(SurveyInfo::getSurveyAnswersCount());
//odgovorov
$cetrtaVrsticaB = array();
- $cetrtaVrsticaB[] = $this->encodeText($lang['srv_info_answers_valid'].': ');
- $cetrtaVrsticaB[] = $this->encodeText(SurveyInfo::getSurveyApropriateAnswersCount());
+ $cetrtaVrsticaB[] = LatexDocument::encodeText($lang['srv_info_answers_valid'].': ');
+ $cetrtaVrsticaB[] = LatexDocument::encodeText(SurveyInfo::getSurveyApropriateAnswersCount());
//jezik ankete
$petaVrstica = array();
- $petaVrstica[] = $this->encodeText($lang['srv_info_language'].':');
- //$petaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText(SurveyInfo::getRespondentLanguage()).'} ';
- $petaVrstica[] = $this->encodeText(SurveyInfo::getRespondentLanguage());
+ $petaVrstica[] = LatexDocument::encodeText($lang['srv_info_language'].':');
+ //$petaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText(SurveyInfo::getRespondentLanguage()).'} ';
+ $petaVrstica[] = LatexDocument::encodeText(SurveyInfo::getRespondentLanguage());
//avtor
$sestaVrstica = array();
- $sestaVrstica[] = $this->encodeText($lang['srv_info_creator'].':');
+ $sestaVrstica[] = LatexDocument::encodeText($lang['srv_info_creator'].':');
$text = '';
$text .= SurveyInfo::getSurveyInsertName();
if (SurveyInfo::getSurveyInsertDate() && SurveyInfo::getSurveyInsertDate() != "00.00.0000")
@@ -331,12 +330,12 @@ class LatexStatus { if (SurveyInfo::getSurveyInsertTime() && SurveyInfo::getSurveyInsertTime() != "00:00:00")
$text .= SurveyInfo::getDateTimeSeperator() . $this->ss->dateFormat(SurveyInfo::getSurveyInsertTime(),TIME_FORMAT_SHORT);
- //$sestaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($text).'} ';
- $sestaVrstica[] = $this->encodeText($text);
+ //$sestaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($text).'} ';
+ $sestaVrstica[] = LatexDocument::encodeText($text);
//spreminjal
$sedmaVrstica = array();
- $sedmaVrstica[] = $this->encodeText($lang['srv_info_modify'].':');
+ $sedmaVrstica[] = LatexDocument::encodeText($lang['srv_info_modify'].':');
$text = '';
$text .= SurveyInfo::getSurveyEditName();
if (SurveyInfo::getSurveyEditDate() && SurveyInfo::getSurveyEditDate() != "00.00.0000")
@@ -344,49 +343,49 @@ class LatexStatus { if (SurveyInfo::getSurveyEditTime() && SurveyInfo::getSurveyEditTime() != "00:00:00")
$text .= SurveyInfo::getDateTimeSeperator() . $this->ss->dateFormat(SurveyInfo::getSurveyEditTime(),TIME_FORMAT_SHORT);
- //$sedmaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($text).'} ';
- $sedmaVrstica[] = $this->encodeText($text);
+ //$sedmaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($text).'} ';
+ $sedmaVrstica[] = LatexDocument::encodeText($text);
//dostop, Kdo razen avtorja ima dostop
$dostop = SurveyInfo::getSurveyAccessUsers();
if ($dostop) {
- //$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_access'].':'), 0, 0, 'L', 0);
+ //$this->pdf->Cell(20, 3, LatexDocument::encodeText($lang['srv_info_access'].':'), 0, 0, 'L', 0);
$osmaVrstica = array();
- $osmaVrstica[] = $this->encodeText($lang['srv_info_access'].':');
+ $osmaVrstica[] = LatexDocument::encodeText($lang['srv_info_access'].':');
$prefix='';
foreach ( $dostop as $user) {
$prefix .= $user['name'].'; ';
}
$prefix = substr($prefix, 0, -2);
- //$osmaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($prefix).'} ';
- $osmaVrstica[] = $this->encodeText($prefix);
+ //$osmaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($prefix).'} ';
+ $osmaVrstica[] = LatexDocument::encodeText($prefix);
}
//aktivnost
$devetaVrstica = array();
$activity = SurveyInfo:: getSurveyActivity();
$_last_active = end($activity);
- $devetaVrstica[] = $this->encodeText($lang['srv_displaydata_status'].':');
+ $devetaVrstica[] = LatexDocument::encodeText($lang['srv_displaydata_status'].':');
if (SurveyInfo::getSurveyColumn('active') == 1) {
- //$devetaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_anketa_active2']).'} ';
- $devetaVrstica[] = $this->encodeText($lang['srv_anketa_active2']);
+ //$devetaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_anketa_active2']).'} ';
+ $devetaVrstica[] = LatexDocument::encodeText($lang['srv_anketa_active2']);
} else {
# preverimo ali je bila anketa že aktivirana
if (!isset($_last_active['starts'])) {
# anketa še sploh ni bila aktivirana
- //$devetaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_survey_non_active_notActivated1']).'} ';
- $devetaVrstica[] = $this->encodeText($lang['srv_survey_non_active_notActivated1']);
+ //$devetaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_survey_non_active_notActivated1']).'} ';
+ $devetaVrstica[] = LatexDocument::encodeText($lang['srv_survey_non_active_notActivated1']);
} else {
# anketa je že bila aktivirna ampak je sedaj neaktivna
- //$devetaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_survey_non_active1']).'} ';
- $devetaVrstica[] = $this->encodeText($lang['srv_survey_non_active1']);
+ //$devetaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_survey_non_active1']).'} ';
+ $devetaVrstica[] = LatexDocument::encodeText($lang['srv_survey_non_active1']);
}
}
//trajanje: datumi aktivnosti
- if ( count($activity) > 0 ) {
+ if (is_countable($activity) && count($activity) > 0 ) {
$desetaVrstica = array();
- $desetaVrstica[] = $this->encodeText($lang['srv_info_activity'].':');
+ $desetaVrstica[] = LatexDocument::encodeText($lang['srv_info_activity'].':');
$prefix = '';
foreach ($activity as $active) {
$_starts = explode('-',$active['starts']);
@@ -395,8 +394,8 @@ class LatexStatus { $prefix .= $_starts[2].'.'.$_starts[1].'.'.$_starts[0].'-'.$_expire[2].'.'.$_expire[1].'.'.$_expire[0];
$prefix .= '; ';
}
- //$desetaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($prefix).'} ';
- $desetaVrstica[] = $this->encodeText($prefix);
+ //$desetaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($prefix).'} ';
+ $desetaVrstica[] = LatexDocument::encodeText($prefix);
}
# predviceni cas trajanja enkete
@@ -407,12 +406,12 @@ class LatexStatus { //predviceni cas trajanja enkete
$enajstaVrstica = array();
- $enajstaVrstica[] = $this->encodeText($lang['srv_info_duration'].':');
+ $enajstaVrstica[] = LatexDocument::encodeText($lang['srv_info_duration'].':');
$text = '';
$text .= ($skupni_cas != '') ? $skupni_cas.', ' : '';
$text .= $lang['srv_predvideno'].': '.$skupni_predvideni_cas;
- //$enajstaVrstica[] = '\multicolumn{2}{l}{ '.$this->encodeText($text).'} ';
- $enajstaVrstica[] = $this->encodeText($text);
+ //$enajstaVrstica[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($text).'} ';
+ $enajstaVrstica[] = LatexDocument::encodeText($text);
//VNOSI - prvi / zadnji vnos
@@ -423,22 +422,22 @@ class LatexStatus { $dvanajstaVrstica = array();
$dvanajstaVrsticaA = array();
if ($prvi_vnos_date != null) {
- $dvanajstaVrstica[] = $this->encodeText($lang['srv_info_first_entry'].':');
+ $dvanajstaVrstica[] = LatexDocument::encodeText($lang['srv_info_first_entry'].':');
$text = '';
$text .= $this->ss->dateFormat($prvi_vnos_date,DATE_FORMAT_SHORT);
$text .= $prvi_vnos_time != null ? (SurveyInfo::$dateTimeSeperator .$this->ss->dateFormat($prvi_vnos_time,TIME_FORMAT_SHORT)) : '';
- $dvanajstaVrstica[] = $this->encodeText($text);
+ $dvanajstaVrstica[] = LatexDocument::encodeText($text);
}else{
$dvanajstaVrstica[] = '';
$dvanajstaVrstica[] = '';
}
if ($zadnji_vnos_date != null) {
- $dvanajstaVrsticaA[] = $this->encodeText($lang['srv_info_last_entry'].':');
+ $dvanajstaVrsticaA[] = LatexDocument::encodeText($lang['srv_info_last_entry'].':');
$text = '';
$text .= $this->ss->dateFormat($zadnji_vnos_date,DATE_FORMAT_SHORT);
$text .= $zadnji_vnos_time != null ? (SurveyInfo::$dateTimeSeperator .$this->ss->dateFormat($zadnji_vnos_time,TIME_FORMAT_SHORT)) : '';
- //$dvanajstaVrsticaA[] = $this->encodeText($lang['srv_info_last_entry'].': '.$this->encodeText($text));
- $dvanajstaVrsticaA[] = $this->encodeText($text);
+ //$dvanajstaVrsticaA[] = LatexDocument::encodeText($lang['srv_info_last_entry'].': '.LatexDocument::encodeText($text));
+ $dvanajstaVrsticaA[] = LatexDocument::encodeText($text);
}else{
$dvanajstaVrsticaA[] = '';
}
@@ -463,17 +462,17 @@ class LatexStatus { $trinajstaVrsticaB = array();
$trinajstaVrsticaC = array();
- $trinajstaVrsticaA[] = $this->encodeText($lang['srv_diagnostic_4_element_0'].':');
- //$trinajstaVrsticaA[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_diagnostic_4_element_1'].': '.(int)$commentsAll.' / '.(int)$commentsUnresolved).'} ';
- $trinajstaVrsticaA[] = $this->encodeText($lang['srv_diagnostic_4_element_1'].': '.(int)$commentsAll.' / '.(int)$commentsUnresolved);
+ $trinajstaVrsticaA[] = LatexDocument::encodeText($lang['srv_diagnostic_4_element_0'].':');
+ //$trinajstaVrsticaA[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_diagnostic_4_element_1'].': '.(int)$commentsAll.' / '.(int)$commentsUnresolved).'} ';
+ $trinajstaVrsticaA[] = LatexDocument::encodeText($lang['srv_diagnostic_4_element_1'].': '.(int)$commentsAll.' / '.(int)$commentsUnresolved);
$trinajstaVrsticaB[] = '';
- //$trinajstaVrsticaB[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_diagnostic_4_element_6'].': '.(int)$commentsQuestionAll.' / '.(int)$commentsQuestionUnresolved).'} ';
- $trinajstaVrsticaB[] = $this->encodeText($lang['srv_diagnostic_4_element_6'].': '.(int)$commentsQuestionAll.' / '.(int)$commentsQuestionUnresolved);
+ //$trinajstaVrsticaB[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_diagnostic_4_element_6'].': '.(int)$commentsQuestionAll.' / '.(int)$commentsQuestionUnresolved).'} ';
+ $trinajstaVrsticaB[] = LatexDocument::encodeText($lang['srv_diagnostic_4_element_6'].': '.(int)$commentsQuestionAll.' / '.(int)$commentsQuestionUnresolved);
$trinajstaVrsticaC[] = '';
- //$trinajstaVrsticaC[] = '\multicolumn{2}{l}{ '.$this->encodeText($lang['srv_diagnostic_4_element_7'].': '.(int)$commentsUser.' / '.(int)$commentsUserUnresolved).'} ';
- $trinajstaVrsticaC[] = $this->encodeText($lang['srv_diagnostic_4_element_7'].': '.(int)$commentsUser.' / '.(int)$commentsUserUnresolved);
+ //$trinajstaVrsticaC[] = '\multicolumn{2}{l}{ '.LatexDocument::encodeText($lang['srv_diagnostic_4_element_7'].': '.(int)$commentsUser.' / '.(int)$commentsUserUnresolved).'} ';
+ $trinajstaVrsticaC[] = LatexDocument::encodeText($lang['srv_diagnostic_4_element_7'].': '.(int)$commentsUser.' / '.(int)$commentsUserUnresolved);
$komentarji = 1;
}
@@ -496,7 +495,7 @@ class LatexStatus { $texStatusInfo .= $this->tableRow($osmaVrstica, 1);
}
$texStatusInfo .= $this->tableRow($devetaVrstica, 1);
- if ( count($activity) > 0 ) {
+ if ( is_countable($activity) && count($activity) > 0 ) {
$texStatusInfo .= $this->tableRow($desetaVrstica, 1);
}
$texStatusInfo .= $this->tableRow($enajstaVrstica, 1);
@@ -537,7 +536,7 @@ class LatexStatus { $texStatusView = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_statistic_status_title1']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_statistic_status_title1']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
//Priprava parametrov za tabelo s podatki o anketi
@@ -556,6 +555,7 @@ class LatexStatus { $rtfTable = 'tabular';
$pdfTableWidth = 1;
$rtfTableWidth = 1;
+ $cntInvitation = 0;
$texStatusView .= $this->StartLatexTable($export_format, $parameterTabular, $pdfTable, $rtfTable, $pdfTableWidth, $rtfTableWidth); /*zacetek tabele*/
@@ -570,8 +570,8 @@ class LatexStatus { foreach ($this->ss->appropriateStatus as $status) {
$vrsticaA = array();
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['valid'][$status] == 0)) {// da ne delamo po neporebnem
- $vrsticaA[] = $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :');
- $vrsticaA[] = $this->encodeText($this->ss->userByStatus['valid'][$status]);
+ $vrsticaA[] = LatexDocument::encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :');
+ $vrsticaA[] = LatexDocument::encodeText($this->ss->userByStatus['valid'][$status]);
$texStatusView .= $this->tableRow($vrsticaA,1);
$cntValid++;
}
@@ -581,15 +581,15 @@ class LatexStatus { if ($cntValid > 0 || !$this->ss->hideNullValues_status) {
$vrsticaB = array();
/* $this->pdf->setFont('','B','6');
- $this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_valid']), 'T', 0, 'L', 0);
- $this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['valid']), 'T', 1, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_statistic_redirection_sum_valid']), 'T', 0, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($this->ss->cntUserByStatus['valid']), 'T', 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
$this->pdf->setFont('','','6'); */
$texStatusView .= $this->horizontalLineTex;
- $vrsticaB[] = $this->encodeText($lang['srv_statistic_redirection_sum_valid']);
- $vrsticaB[] = $this->encodeText($this->ss->cntUserByStatus['valid']);
+ $vrsticaB[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum_valid']);
+ $vrsticaB[] = LatexDocument::encodeText($this->ss->cntUserByStatus['valid']);
$texStatusView .= $this->tableRow($vrsticaB,1);
$texStatusView .= $this->texNewLine;
}
@@ -598,10 +598,10 @@ class LatexStatus { foreach ($this->ss->unAppropriateStatus as $status) {
$vrsticaC = array();
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['nonvalid'][$status] == 0)) {// da ne delamo po neporebnem
- //$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
- //$this->pdf->Cell(45, 0, $this->encodeText($this->ss->userByStatus['nonvalid'][$status]), 0, 1, 'L', 0);
- $vrsticaC[] = $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :');
- $vrsticaC[] = $this->encodeText($this->ss->userByStatus['nonvalid'][$status]);
+ //$this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
+ //$this->pdf->Cell(45, 0, LatexDocument::encodeText($this->ss->userByStatus['nonvalid'][$status]), 0, 1, 'L', 0);
+ $vrsticaC[] = LatexDocument::encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :');
+ $vrsticaC[] = LatexDocument::encodeText($this->ss->userByStatus['nonvalid'][$status]);
$texStatusView .= $this->tableRow($vrsticaC,1);
$cntNonValid++;
//$this->pdf->setX($X);
@@ -610,12 +610,12 @@ class LatexStatus { // se status null (neznan status)
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['nonvalid'][-1] == 0)) {// da ne delamo po neporebnem
$vrsticaD = array();
- //$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_null']), 0, 0, 'L', 0);
- //$this->pdf->Cell(45, 0, $this->encodeText(isset($this->ss->userByStatus['nonvalid'][-1]) ? $this->ss->userByStatus['nonvalid'][-1] : '0'), 0, 1, 'L', 0);
+ //$this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_userstatus_null']), 0, 0, 'L', 0);
+ //$this->pdf->Cell(45, 0, LatexDocument::encodeText(isset($this->ss->userByStatus['nonvalid'][-1]) ? $this->ss->userByStatus['nonvalid'][-1] : '0'), 0, 1, 'L', 0);
//$texStatusView .= $this->horizontalLineTex;
- $vrsticaD[] = $this->encodeText($lang['srv_userstatus_null']);
- $vrsticaD[] = $this->encodeText(isset($this->ss->userByStatus['nonvalid'][-1]) ? $this->ss->userByStatus['nonvalid'][-1] : '0');
+ $vrsticaD[] = LatexDocument::encodeText($lang['srv_userstatus_null']);
+ $vrsticaD[] = LatexDocument::encodeText(isset($this->ss->userByStatus['nonvalid'][-1]) ? $this->ss->userByStatus['nonvalid'][-1] : '0');
$texStatusView .= $this->tableRow($vrsticaD,1);
//$texStatusView .= $this->texNewLine;
$cntNonValid++;
@@ -626,29 +626,29 @@ class LatexStatus { if ($cntNonValid > 0 || !$this->ss->hideNullValues_status) {
$vrsticaE = array();
/* $this->pdf->setFont('','B','6');
- $this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_nonvalid']), 'T', 0, 'L', 0);
- $this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['nonvalid']), 'T', 1, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_statistic_redirection_sum_nonvalid']), 'T', 0, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($this->ss->cntUserByStatus['nonvalid']), 'T', 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
$this->pdf->setFont('','','6'); */
- $vrsticaE[] = $this->encodeText($lang['srv_statistic_redirection_sum_nonvalid']);
- $vrsticaE[] = $this->encodeText($this->ss->cntUserByStatus['nonvalid']);
+ $vrsticaE[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum_nonvalid']);
+ $vrsticaE[] = LatexDocument::encodeText($this->ss->cntUserByStatus['nonvalid']);
$texStatusView .= $this->horizontalLineTex;
$texStatusView .= $this->tableRow($vrsticaE,1);
$texStatusView .= $this->texNewLine;
}
/* $this->pdf->setFont('','B','6');
- $this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum']), 'T', 0, 'L', 0);
- $this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']), 'T', 1, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_statistic_redirection_sum']), 'T', 0, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']), 'T', 1, 'L', 0);
$this->pdf->setFont('','','6');
$this->pdf->setX($X); */
$texStatusView .= $this->horizontalLineTex;
$vrsticaF = array();
- $vrsticaF[] = $this->encodeText($lang['srv_statistic_redirection_sum']);
- if(($this->encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']))){
- $vrsticaF[] = $this->encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']);
+ $vrsticaF[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum']);
+ if((LatexDocument::encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']))){
+ $vrsticaF[] = LatexDocument::encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']);
}else{
$vrsticaF[] = 0;
}
@@ -665,10 +665,10 @@ class LatexStatus { foreach ($this->ss->invitationStatus as $status){
$vrsticaG = array();
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['invitation'][$status] == 0)){// da ne delamo po neporebnem
- //$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
- //$this->pdf->Cell(45, 0, $this->encodeText($this->ss->userByStatus['invitation'][$status]), 0, 1, 'L', 0);
- $vrsticaG[] = $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :');
- $vrsticaG[] = $this->encodeText($this->ss->userByStatus['invitation'][$status]);
+ //$this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
+ //$this->pdf->Cell(45, 0, LatexDocument::encodeText($this->ss->userByStatus['invitation'][$status]), 0, 1, 'L', 0);
+ $vrsticaG[] = LatexDocument::encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :');
+ $vrsticaG[] = LatexDocument::encodeText($this->ss->userByStatus['invitation'][$status]);
$texStatusView .= $this->tableRow($vrsticaG,1);
$cntInvitation++;
}
@@ -678,14 +678,14 @@ class LatexStatus { if ($cntInvitation > 0 || !$this->ss->hideNullValues_status) {
$vrsticaH = array();
/* $this->pdf->setFont('','B','6');
- $this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_invitation']), 'T', 0, 'L', 0);
- $this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['invitation']), 'T', 1, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_statistic_redirection_sum_invitation']), 'T', 0, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($this->ss->cntUserByStatus['invitation']), 'T', 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
$this->pdf->setFont('','','6'); */
- $vrsticaH[] = $this->encodeText($lang['srv_statistic_redirection_sum_invitation']);
- $vrsticaH[] = $this->encodeText($this->ss->cntUserByStatus['invitation']);
+ $vrsticaH[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum_invitation']);
+ $vrsticaH[] = LatexDocument::encodeText($this->ss->cntUserByStatus['invitation']);
$texStatusView .= $this->horizontalLineTex;
$texStatusView .= $this->tableRow($vrsticaH,1);
$texStatusView .= $this->texNewLine;
@@ -699,14 +699,14 @@ class LatexStatus { $this->pdf->Cell(90, 6, '', 'B', 1, 'L', 0);
$this->pdf->setX($X);
- $this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_test']), 'T', 0, 'L', 0);
- $this->pdf->Cell(45, 0, $this->encodeText((int)$this->ss->testDataCount), 'T', 1, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_statistic_redirection_test']), 'T', 0, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText((int)$this->ss->testDataCount), 'T', 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6'); */
- $vrsticaI[] = $this->encodeText($lang['srv_statistic_redirection_test']);
- $vrsticaI[] = $this->encodeText((int)$this->ss->testDataCount);
+ $vrsticaI[] = LatexDocument::encodeText($lang['srv_statistic_redirection_test']);
+ $vrsticaI[] = LatexDocument::encodeText((int)$this->ss->testDataCount);
$texStatusView .= $this->horizontalLineTex;
$texStatusView .= $this->tableRow($vrsticaI,1);
$texStatusView .= $this->texNewLine;
@@ -719,13 +719,13 @@ class LatexStatus { if ($view_count > 0 || !$this->ss->hideNullValues_status){
$vrsticaJ = array();
/* $this->pdf->setFont('','B','6');
- $this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_view']), 'T', 0, 'L', 0);
- $this->pdf->Cell(45, 0, $this->encodeText($view_count), 'T', 1, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($lang['srv_statistic_redirection_sum_view']), 'T', 0, 'L', 0);
+ $this->pdf->Cell(45, 0, LatexDocument::encodeText($view_count), 'T', 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6'); */
- $vrsticaJ[] = $this->encodeText($lang['srv_statistic_redirection_sum_view']);
- $vrsticaJ[] = $this->encodeText($view_count);
+ $vrsticaJ[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum_view']);
+ $vrsticaJ[] = LatexDocument::encodeText($view_count);
$texStatusView .= $this->horizontalLineTex;
$texStatusView .= $this->tableRow($vrsticaJ,1);
$texStatusView .= $this->texNewLine;
@@ -751,7 +751,7 @@ class LatexStatus { $texAnswerStateView = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_statistic_answer_state_title']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_statistic_answer_state_title']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
//Priprava parametrov za tabelo s podatki o anketi
@@ -784,9 +784,9 @@ class LatexStatus { //prva vrstica
$prvaVrstica = array();
- $prvaVrstica[] = $this->encodeText($lang['srv_statistic_answer_state_status']);
- $prvaVrstica[] = $this->encodeText($lang['srv_statistic_answer_state_frequency']);
- $prvaVrstica[] = $this->encodeText($lang['srv_statistic_answer_state_percent']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_answer_state_status']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_answer_state_frequency']);
+ $prvaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_answer_state_percent']);
$texAnswerStateView .= $this->tableRow($prvaVrstica,1);
$texAnswerStateView .= $this->horizontalLineTex;
@@ -795,9 +795,9 @@ class LatexStatus { foreach ($order as $key) {
$vrstica2N = array();
- $vrstica2N[] = $this->encodeText($lang['srv_userstatus_'.$key]);
- $vrstica2N[] = $this->encodeText($this->ss->realUsersByStatus[$key]['cnt'] > 0 ? $this->ss->realUsersByStatus[$key]['cnt'] : '0');
- $vrstica2N[] = $this->encodeText( ((float)$this->ss->realUsersByStatus[$key]['percent'] > 1.0) ? '--' : $this->formatNumber($this->ss->realUsersByStatus[$key]['percent']*100,NUM_DIGIT_PERCENT,'%') );
+ $vrstica2N[] = LatexDocument::encodeText($lang['srv_userstatus_'.$key]);
+ $vrstica2N[] = LatexDocument::encodeText($this->ss->realUsersByStatus[$key]['cnt'] > 0 ? $this->ss->realUsersByStatus[$key]['cnt'] : '0');
+ $vrstica2N[] = LatexDocument::encodeText( ((float)$this->ss->realUsersByStatus[$key]['percent'] > 1.0) ? '--' : $this->formatNumber($this->ss->realUsersByStatus[$key]['percent']*100,NUM_DIGIT_PERCENT,'%') );
$texAnswerStateView .= $this->tableRow($vrstica2N,1);
}
@@ -823,7 +823,7 @@ class LatexStatus { $texReferalsView = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_statistic_redirection_title']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_statistic_redirection_title']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
// izrisemo graf
@@ -857,8 +857,8 @@ class LatexStatus { //naslovna vrstica
$naslovnaVrstica = array();
- $naslovnaVrstica[] = $this->encodeText($lang['srv_statistic_redirection_site']);
- $naslovnaVrstica[] = $this->encodeText($lang['srv_statistic_redirection_click']);
+ $naslovnaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_redirection_site']);
+ $naslovnaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_redirection_click']);
$texReferalsView .= $this->tableRow($naslovnaVrstica);
//pridobitev skupnega stevila klikov $value_sum za izris grafov
@@ -884,10 +884,10 @@ class LatexStatus { if (count($this->ss->userRedirections["valid"])) {
foreach ($this->ss->userRedirections["valid"] as $key => $value) {
$vmesnaVrsticaA = array();
- $vmesnaVrsticaA[] = $this->encodeText($key);
- if($this->encodeText($value)){ //ce vrednost ni nula
- $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*$this->encodeText($value);
- $vmesnaVrsticaA[] = $this->drawGraphLatex($graphLineLength, $this->encodeText($value));
+ $vmesnaVrsticaA[] = LatexDocument::encodeText($key);
+ if(LatexDocument::encodeText($value)){ //ce vrednost ni nula
+ $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*LatexDocument::encodeText($value);
+ $vmesnaVrsticaA[] = $this->drawGraphLatex($graphLineLength, LatexDocument::encodeText($value));
}else{
$vmesnaVrsticaA[] = 0;
}
@@ -899,10 +899,10 @@ class LatexStatus { if ($this->ss->userRedirections["direct"] > 0) {
$value = $this->ss->userRedirections["direct"];
$vmesnaVrsticaB = array();
- $vmesnaVrsticaB[] = $this->encodeText($lang['srv_statistic_redirection_direct']);
- if($this->encodeText($value)){ //ce vrednost ni nula
- $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*$this->encodeText($value);
- $vmesnaVrsticaB[] = $this->drawGraphLatex($graphLineLength, $this->encodeText($value));
+ $vmesnaVrsticaB[] = LatexDocument::encodeText($lang['srv_statistic_redirection_direct']);
+ if(LatexDocument::encodeText($value)){ //ce vrednost ni nula
+ $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*LatexDocument::encodeText($value);
+ $vmesnaVrsticaB[] = $this->drawGraphLatex($graphLineLength, LatexDocument::encodeText($value));
}else{
$vmesnaVrsticaB[] = 0;
}
@@ -913,10 +913,10 @@ class LatexStatus { if ($this->ss->userRedirections["email"] > 0) {
$value = $this->ss->userRedirections["email"];
$vmesnaVrsticaC = array();
- $vmesnaVrsticaC[] = $this->encodeText($lang['srv_statistic_redirection_email']);
- if($this->encodeText($value)){ //ce vrednost ni nula
- $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*$this->encodeText($value);
- $vmesnaVrsticaC[] = $this->drawGraphLatex($graphLineLength, $this->encodeText($value));
+ $vmesnaVrsticaC[] = LatexDocument::encodeText($lang['srv_statistic_redirection_email']);
+ if(LatexDocument::encodeText($value)){ //ce vrednost ni nula
+ $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*LatexDocument::encodeText($value);
+ $vmesnaVrsticaC[] = $this->drawGraphLatex($graphLineLength, LatexDocument::encodeText($value));
}else{
$vmesnaVrsticaC[] = 0;
}
@@ -926,8 +926,8 @@ class LatexStatus { // dodamo sumo
$texReferalsView .= $this->horizontalLineTex;
$vrsticaSuma = array();
- $vrsticaSuma[] = $this->encodeText($lang['srv_statistic_redirection_sum_clicked']);
- $vrsticaSuma[] = $this->encodeText($value_sum);
+ $vrsticaSuma[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum_clicked']);
+ $vrsticaSuma[] = LatexDocument::encodeText($value_sum);
$texReferalsView .= $this->tableRow($vrsticaSuma,1);
// dodamo se neveljavne *******************************************
@@ -945,10 +945,10 @@ class LatexStatus { $value = $this->ss->userRedirections["$key"];
if ($value > 0) {
$vrsticaNeveljavni = array();
- $vrsticaNeveljavni[] = $this->encodeText($lang['srv_userstatus_'.$key]);
- if($this->encodeText($value)){ //ce vrednost ni nula
- $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*$this->encodeText($value);
- $vrsticaNeveljavni[] = $this->drawGraphLatex($graphLineLength, $this->encodeText($value));
+ $vrsticaNeveljavni[] = LatexDocument::encodeText($lang['srv_userstatus_'.$key]);
+ if(LatexDocument::encodeText($value)){ //ce vrednost ni nula
+ $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$value_sum)*LatexDocument::encodeText($value);
+ $vrsticaNeveljavni[] = $this->drawGraphLatex($graphLineLength, LatexDocument::encodeText($value));
}else{
$vrsticaNeveljavni[] = 0;
}
@@ -959,15 +959,15 @@ class LatexStatus { if ($value_sum_nonvalid > 0 ) {
$texReferalsView .= $this->horizontalLineTex;
$vrsticaSumaNeveljavni = array();
- $vrsticaSumaNeveljavni[] = $this->encodeText($lang['srv_statistic_redirection_sum_nonvalid']);
- $vrsticaSumaNeveljavni[] = $this->encodeText($value_sum_nonvalid);
+ $vrsticaSumaNeveljavni[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum_nonvalid']);
+ $vrsticaSumaNeveljavni[] = LatexDocument::encodeText($value_sum_nonvalid);
$texReferalsView .= $this->tableRow($vrsticaSumaNeveljavni,1);
}
if (!($value_sum_nonvalid == 0 || $value_sum == 0 )) {
$texReferalsView .= $this->horizontalLineTex;
$vrsticaSumaNeveljavni = array();
- $vrsticaSumaNeveljavni[] = $this->encodeText($lang['srv_statistic_redirection_sum']);
- $vrsticaSumaNeveljavni[] = $this->encodeText($value_sum+$value_sum_nonvalid);
+ $vrsticaSumaNeveljavni[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum']);
+ $vrsticaSumaNeveljavni[] = LatexDocument::encodeText($value_sum+$value_sum_nonvalid);
$texReferalsView .= $this->tableRow($vrsticaSumaNeveljavni,1);
}
// dodamo se neveljavne - konec *******************************************
@@ -977,19 +977,19 @@ class LatexStatus { //zaljucek latex tabele s podatki - konec
}
else {
- $texReferalsView .= $this->encodeText($lang['srv_statistic_show_no_referals']).$this->texNewLine;
+ $texReferalsView .= LatexDocument::encodeText($lang['srv_statistic_show_no_referals']).$this->texNewLine;
}
//stevilo razlicnih IP stevilk
$texReferalsView .= $this->texBigSkip.' ';
//$texReferalsView .= $this->texNewLine;
- $texReferalsView .= $this->encodeText($lang['srv_count_ip_list'].': '.count($this->ss->ip_list));
+ $texReferalsView .= LatexDocument::encodeText($lang['srv_count_ip_list'].': '.count($this->ss->ip_list));
if ($admin_type==0 && count($this->ss->ip_list) > 0) {
$texReferalsView .= ' '.$this->texBigSkip;
$texReferalsView .= $this->texNewLine;
- $titleTextIP = $this->encodeText($lang['srv_detail_ip_list']);
+ $titleTextIP = LatexDocument::encodeText($lang['srv_detail_ip_list']);
$titleIP = $this->returnBoldAndRed($titleTextIP);
$texReferalsView .= $this->returnBoldAndRed($titleIP).$this->texNewLine;
@@ -1016,8 +1016,8 @@ class LatexStatus { //Izpis vrstic
foreach($this->ss->ip_list AS $key => $val) {
$vrsticaIP = array();
- $vrsticaIP[] = $this->encodeText($val);
- $vrsticaIP[] = $this->encodeText($key);
+ $vrsticaIP[] = LatexDocument::encodeText($val);
+ $vrsticaIP[] = LatexDocument::encodeText($key);
$texReferalsView .= $this->tableRow($vrsticaIP,1);
}
@@ -1040,7 +1040,7 @@ class LatexStatus { $texDateView = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_statistic_timeline_title']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_statistic_timeline_title']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
$this->ss->maxValue *= GRAPH_REDUCE;
@@ -1084,11 +1084,11 @@ class LatexStatus { foreach ($this->ss->arrayRange as $key => $value) {
$label = $this->ss->formatStatsString($key, $this->ss->period);
$vmesnaVrstica = array();
- $vmesnaVrstica[] = $this->encodeText($label);
- //if($this->encodeText($value)){ //ce vrednost ni nula
+ $vmesnaVrstica[] = LatexDocument::encodeText($label);
+ //if(LatexDocument::encodeText($value)){ //ce vrednost ni nula
if($value){ //ce vrednost ni nula
- $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$cnt)*$this->encodeText($value);
- //$vmesnaVrstica[] = $this->drawGraphLatex($graphLineLength, $this->encodeText($value));
+ $graphLineLength = (GRAPH_LINE_LENGTH_MAX/$cnt)*LatexDocument::encodeText($value);
+ //$vmesnaVrstica[] = $this->drawGraphLatex($graphLineLength, LatexDocument::encodeText($value));
$vmesnaVrstica[] = $this->drawGraphLatex($graphLineLength, $value);
}else{
$vmesnaVrstica[] = 0;
@@ -1100,8 +1100,8 @@ class LatexStatus { // dodamo sumo
$texDateView .= $this->horizontalLineTex;
$vrsticaSuma = array();
- $vrsticaSuma[] = $this->encodeText($lang['srv_statistic_redirection_sum']);
- $vrsticaSuma[] = $this->encodeText($cnt);
+ $vrsticaSuma[] = LatexDocument::encodeText($lang['srv_statistic_redirection_sum']);
+ $vrsticaSuma[] = LatexDocument::encodeText($cnt);
$texDateView .= $this->tableRow($vrsticaSuma,1);
//zaljucek latex tabele s podatki
@@ -1109,7 +1109,7 @@ class LatexStatus { //zaljucek latex tabele s podatki - konec
}
else {
- $texDateView .= $this->encodeText($lang['srv_no_data']).$this->texNewLine;
+ $texDateView .= LatexDocument::encodeText($lang['srv_no_data']).$this->texNewLine;
}
//izpis tabele in beedila v okvir
@@ -1127,7 +1127,7 @@ class LatexStatus { $texPagesStateView = '';
//naslov okvirja
- $titleText = $this->encodeText($lang['srv_statistic_pages_state_title']).$this->texNewLine;
+ $titleText = LatexDocument::encodeText($lang['srv_statistic_pages_state_title']).$this->texNewLine;
$title = $this->returnBoldAndRed($titleText);
//ali lovimo samo strani ki niso bile preskočene
@@ -1173,21 +1173,21 @@ class LatexStatus { //Priprava podatkov za izpis vrstic tabele in izpis vrstic
//naslovna vrstica
$naslovnaVrstica = array();
- $naslovnaVrstica[] = $this->encodeText($lang['srv_statistic_answer_state_status']);
- $naslovnaVrstica[] = $this->encodeText($lang['srv_statistic_redirection_click']);
+ $naslovnaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_answer_state_status']);
+ $naslovnaVrstica[] = LatexDocument::encodeText($lang['srv_statistic_redirection_click']);
$texPagesStateView .= $this->tableRow($naslovnaVrstica);
# status 3 - "Klik na anketo"
$value = $this->ss->realUsersByStatus['3ll']['cnt'];
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($lang['srv_userstatus_3']), $this->encodeText($value), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($lang['srv_userstatus_3']), LatexDocument::encodeText($value), $maxValue);
# status 4 - "Klik na prvo stran"
$value = $this->ss->realUsersByStatus['4ll']['cnt'];
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($lang['srv_userstatus_4']), $this->encodeText($value), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($lang['srv_userstatus_4']), LatexDocument::encodeText($value), $maxValue);
# status 5 - "Zacel izpolnjevati",
$value = $this->ss->realUsersByStatus[5]['cnt'];
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($lang['srv_userstatus_5']), $this->encodeText($value), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($lang['srv_userstatus_5']), LatexDocument::encodeText($value), $maxValue);
$texPagesStateView .= $this->horizontalLineTex; //horizontalna crta
$texPagesStateView .= $this->texNewLine; //prazna crta
@@ -1195,7 +1195,7 @@ class LatexStatus { #strani
foreach ($pages as $key => $page) {
$value = $page['cnt'];
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($page['naslov']), $this->encodeText($value), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($page['naslov']), LatexDocument::encodeText($value), $maxValue);
}
$texPagesStateView .= $this->horizontalLineTex; //horizontalna crta
@@ -1203,7 +1203,7 @@ class LatexStatus { # status 6 - "Koncal",
$value6 = $this->ss->realUsersByStatus[6]['cnt'];
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($lang['srv_userstatus_6']), $this->encodeText($value6), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($lang['srv_userstatus_6']), LatexDocument::encodeText($value6), $maxValue);
#če imamo lurkerje 6l dodamo skupaj konačal anketo (to je 6 + 6l) in nato še koliko jih je samo s statusom 6 (končal anketo)
# status 6l - "Koncal - lurker", izpišemo samo če obstajajo 6l
@@ -1212,13 +1212,13 @@ class LatexStatus { $valueall = $this->ss->realUsersByStatus['6ll']['cnt'] ;
# končal s tem da je lurker (6l)
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($lang['srv_userstatus_6l']), $this->encodeText($lurkerjev), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($lang['srv_userstatus_6l']), LatexDocument::encodeText($lurkerjev), $maxValue);
#črta
$texPagesStateView .= $this->horizontalLineTex; //horizontalna crta
# končal ne glede na to ali je lurker
- $texPagesStateView .= $this->displayStatusLine($this->encodeText($lang['srv_userstatus_all']), $this->encodeText($valueall), $maxValue);
+ $texPagesStateView .= $this->displayStatusLine(LatexDocument::encodeText($lang['srv_userstatus_all']), LatexDocument::encodeText($valueall), $maxValue);
}
//zaljucek latex tabele s podatki
@@ -1269,151 +1269,7 @@ class LatexStatus { return $result;
}
-
- #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."</br>";
- if($text == ''){ //ce ni teksta, vrni se
- return;
- }
- $textOrig = $text;
- $findme = '<br />';
- $findmeLength = strlen($findme);
- $findImg = '<img';
- $findImgLength = strlen($findImg);
-
- $pos = strpos($text, $findme);
- $posImg = strpos($text, $findImg);
-
- //ureditev izrisa slike
- if($posImg !== false){
- $numOfImgs = substr_count($text, $findImg); //stevilo '<br />' v tekstu
- $posImg = strpos($text, $findImg);
- $textPrej = '';
- $textPotem = '';
- for($i=0; $i<$numOfImgs; $i++){
- $posImg = strpos($text, $findImg);
- $textPrej = substr($text, 0, $posImg); //tekst do img
- $textPotem = substr($text, $posImg); //tekst po img, z vkljuceno hmlt kodo z img
- $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, '<img')."}".' '.$textPotem;
- //$text2Return = $textPrej.' '.PIC_SIZE_ANS."{".$this->getImageName($text2Return, 0, 'img')."}".' '.$textPotem;
- }
-
- //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike
- $findImgCode = '\includegraphics';
- $posOfImgCode = strpos($text, $findImgCode);
- //echo $posOfImgCode."</br>";
- $textToImgCode = substr($text, 0, $posOfImgCode); //tekst do $findImgCode
- //echo $textToImgCode."</br>";
- $textFromImgCode = substr($text, $posOfImgCode); //tekst po $findImgCode
- //echo $textFromImgCode."</br>";
- $findImgCodeEnd = '}';
- //$posOfImgCodeEnd = strpos($text, $findImgCodeEnd);
- $posOfImgCodeEnd = strpos($textFromImgCode, $findImgCodeEnd);
- //echo $posOfImgCodeEnd."</br>";
- $textAfterImgCode = substr($textFromImgCode, $posOfImgCodeEnd+1); //tekst po $findImgCodeEnd
- //echo $textAfterImgCode."</br>";
- $textOfImgCode = substr($text, $posOfImgCode, $posOfImgCodeEnd+1);
- //echo $textOfImgCode."</br>";
-
- $text = $textToImgCode.$textAfterImgCode;
-
- //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike - konec
- }
- //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);
- //$text = str_replace('}','\}',$text);
- $text = str_replace('$','\$ ',$text);
- $text = str_replace('#','\# ',$text);
- $text = str_replace('%','\% ',$text);
- $text = str_replace('€','\euro',$text);
- $text = str_replace('^','\textasciicircum{} ',$text);
- //$text = str_replace('_','\_ ',$text);
- $text = str_replace('_','\_',$text);
- $text = str_replace('~','\textasciitilde{} ',$text);
- $text = str_replace('&','\&',$text);
- $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);
- //ureditev posebnih karakterjev za Latex - 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."</br>";
- echo "encode po strip: ".strip_tags($text)."</br>";
- return strip_tags($text); */
- }else { //v tekstu sta prisotna br ali img
- $text2Return = ''; //tekst ki bo vrnjen
-
- //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico
- if($pos !== false){
- $pos = strpos($text, $findme);
- $numOfBr = substr_count($text, $findme); //stevilo '<br />' v tekstu
- for($i=0; $i<$numOfBr; $i++){
- if($i == 0){ //ce je prvi najdeni '<br />'
- $textPrej = substr($text, 0, $pos);
- $textPotem = substr($text, $pos+$findmeLength);
- if($i == $numOfBr-1){
- $text2Return .= $textPrej.' \break '.$textPotem;
- }else{
- $text2Return .= $textPrej.' \break ';
- }
- }else{ //drugace
- $pos = strpos($textPotem, $findme);
- $textPrej = substr($textPotem, 0, $pos);
- $textPotem = substr($textPotem, $pos+$findmeLength);
- if($i == $numOfBr-1){
- $text2Return .= $textPrej.' \break '.$textPotem;
- }else{
- $text2Return .= $textPrej.' \break ';
- }
- }
- }
- $text = $text2Return;
- }
- //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico - konec
-/* echo "encode pred strip: ".$text."</br>";
- echo "encode po strip: ".strip_tags($text)."</br>";
- return strip_tags($text); //vrni tekst brez html tag-ov */
- }
- //preveri, ce je url v besedilu (http:// ... ) in uredi Latex izpis le-tega
- $findHttp = 'http://';
- $findHttps = 'https://';
- $posHttp = strpos($text, $findHttp);
- $posHttps = strpos($text, $findHttps);
-
- if($posHttp !== false || $posHttps !== false) { //v imamo URL naslov
- $space = ' ';
- if($posHttp !== false){
- $text = substr_replace($text, $space, ($posHttp+7), 0);
- }elseif($posHttps !== false){
- $text = substr_replace($text, $space, ($posHttps+8), 0);
- }
- }
- //preveri, ce je url v besedilu (http:// ... ) in uredi Latex izpis le-tega - konec
-
- return strip_tags($text); //vrni tekst brez html tag-ov
- }
-
function returnBold($text=''){
$boldedText = '';
$boldedText .= '\textbf{'.$text.'}';
@@ -1460,13 +1316,9 @@ class LatexStatus { function tableRow($arrayText=[], $brezHline=0){
$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);
-
- if($arrayParams['align2'] != 'C')
- $arrayParams['align2'] = 'L';
- //echo "velikost polja s tekstom: ".count($arrayText)."</br>";
+ $height = 1; //$height = $this->getCellHeight(LatexDocument::encodeText($arrayText[1]), 90);
for($i=0;$i<count($arrayText);$i++){
//echo "array text: ".$arrayText[$i]."</br>";
diff --git a/admin/survey/export/latexclasses/class.LatexSurvey.php b/admin/survey/export/latexclasses/class.LatexSurvey.php index 7f93749..575043e 100644 --- a/admin/survey/export/latexclasses/class.LatexSurvey.php +++ b/admin/survey/export/latexclasses/class.LatexSurvey.php @@ -10,14 +10,14 @@ include('../../vendor/autoload.php');
-define("RADIO_BTN_SIZE", 0.13);
+if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13);
+if (!defined('PIC_SIZE_ANS')) define("PIC_SIZE_ANS", "\includegraphics[width=3cm]"); //slika dolocene sirine
class LatexSurvey{
var $anketa; // ID ankete
var $tex; //shrani tex kodo
var $texNewLine = '\\\\ ';
- //var $texPageBreak = "\\pagebreak";
var $texPageBreak = "\\newpage";
var $export_format;
var $export_data_show_recnum;
@@ -28,6 +28,7 @@ class LatexSurvey{ var $loop_id = null; // id trenutnega loopa ce jih imamo
var $db_table = '';
+ var $path2Images = '';
protected $showIntro = 0;
protected $showGDPRIntro = 0;
@@ -43,13 +44,18 @@ class LatexSurvey{ protected $usr_id = 0;
protected $texBigSkip = '\bigskip';
+ protected $grupa = 0;
+ protected $currentHeight = 0;
+ protected $variableName = '';
+
protected $admin_type;
protected $path2UploadedImages;
protected $language = -1; // Katero verzijo prevoda izvazamo
+
+ public static $spremenljivka;
- //function __construct($anketa, $export_format){
function __construct($anketa=null, $export_format='', $export_show_intro=null, $export_show_if=null, $export_data_skip_empty=null, $export_data_skip_empty_sub=null){
global $site_path, $global_user_id, $admin_type, $lang;
@@ -58,7 +64,7 @@ class LatexSurvey{ $this->admin_type = $admin_type;
- $this->usr_id = $_GET['usr_id'];
+ $this->usr_id = isset($_GET['usr_id']) ? $_GET['usr_id'] : '';
$this->showIntro = $export_show_intro;
$this->showIf = $export_show_if;
@@ -73,12 +79,9 @@ class LatexSurvey{ //Prikazi GDPR v uvodu
$gdpr = new GDPR();
$this->showGDPRIntro = $gdpr->isGDPRSurveyTemplate($this->anketa);
- //echo "gdpr nastavitve: ".$this->showGDPRIntro."</br>";
if($this->showGDPRIntro){
$this->GDPRIntro = $gdpr->getSurveyIntro($this->anketa);
- //echo "gdpr te: ".$this->GDPRIntro."</br>";
}
-
if ($this->usr_id != '') {
$sqlR = sisplet_query("SELECT recnum FROM srv_user WHERE id = '$this->usr_id '");
$rowR = mysqli_fetch_array($sqlR);
@@ -95,9 +98,7 @@ class LatexSurvey{ //if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init())
if ( SurveyInfo::getInstance()->SurveyInit($this->anketa) )
{
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1){
- $this->db_table = '_active';
- }
+ $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
}
else{
return false;
@@ -107,7 +108,7 @@ class LatexSurvey{ #funkcija, ki skrbi za izpis praznega vprasalnika in vprasalnika z odgovori enega respondenta
public function displaySurvey($export_subtype='', $export_data_type='', $language=null){
global $lang, $site_url;
- //echo "Funkcija displaySurvey user: $this->usr_id</br>";
+
$this->language = $language;
if($this->language!=-1){
// Naložimo jezikovno datoteko
@@ -130,12 +131,13 @@ class LatexSurvey{ $tmp_svp_pv[$vid] = substr($vid, 0, strpos($vid, '_'));
}
-
+ $tex = '';
+
if($export_subtype=='q_data'){ //ce je vprasalnik za enega respondenta
//pridobitev podatkov trenutnega respondenta za izpis Recnum
$izbranStatusProfile = SurveyStatusProfiles :: getStatusAsQueryString();
$sqluString = "SELECT id, last_status, lurker, recnum FROM srv_user WHERE ank_id = '".$this->anketa."' ".$izbranStatusProfile." AND deleted='0' AND preview='0' AND id='".$this->usr_id."' ORDER BY recnum";
- //echo $sqluString;
+
$sqlu = sisplet_query($sqluString);
$rowu = mysqli_fetch_array($sqlu);
$recnum = $rowu['recnum'];
@@ -145,20 +147,18 @@ class LatexSurvey{ $recnumBesedilo = "";
}
//pridobitev podatkov trenutnega respondenta za izpis Recnum - konec
-
-
-
- //$tex .= $lang['srv_respondent_answer'].": ".$this->recnum;
- $tex .= '\MakeUppercase{\huge \textbf{'.$lang['srv_respondent_answer'].' '.$recnumBesedilo.'}}'; //izpisi "Odgovori respondenta"
+
+ $tex .= '\MakeUppercase{\huge \textbf{'./* $lang['srv_respondent_answer']. */' '.$recnumBesedilo.'}}'; //izpisi "Odgovori respondenta"
$tex .= $this->texNewLine;
$tex .= $this->texNewLine;
}
-
//ce je potrebno izpisati GDPR besedilo v intro
- if($this->showGDPRIntro == 1){
- //$GDPRintro = "gdpr INTRO";
+ if($this->showGDPRIntro == 1){
$GDPRintro = strip_tags($this->GDPRIntro, '<a><img><ul><li><ol><br><p>');
- $GDPRintro = $this->encodeTextHere($GDPRintro);
+
+ //$GDPRintro = $this->encodeTextHere($GDPRintro);
+ $GDPRintro = LatexDocument::encodeText($GDPRintro, 0, 0, 0, 'gdpr');
+
$tex .= ' \textbf{'.$GDPRintro.'} ';
//radio buttona
@@ -176,11 +176,11 @@ class LatexSurvey{ //pridobitev informacije obiska strani oz. ankete
$sqlStringStran = "SELECT time_edit FROM srv_user_grupa".$this->db_table." WHERE usr_id='".$this->usr_id."' AND gru_id='".$grupa."'";
- //echo $sqlStringStran;
+
$sqlStran = sisplet_query($sqlStringStran);
$rowStran = mysqli_fetch_array( $sqlStran );
$stran = $rowStran['time_edit'];
- //echo $stran;
+
//pridobitev informacije obiska strani oz. ankete - konec
if($stran){
@@ -209,28 +209,31 @@ class LatexSurvey{ {
//preverjanje, ali je prevod
if(isset($_GET['language'])){
- $this->language = $_GET['language'];
+ //$this->language = $_GET['language'];
+ $this->language = isset($_GET['language'])?$_GET['language']:null;
$prevod = 1;
}else{
$prevod = 0;
}
//preverjanje, ali je prevod - konec
- //if($this->language!=-1){ //ce je prevod ankete
if($prevod){ //ce je prevod ankete
$spr_id_uvod = -1;
$sqll = sisplet_query("SELECT naslov, info FROM srv_language_spremenljivka WHERE ank_id='".$this->anketa."' AND spr_id='".$spr_id_uvod."' AND lang_id='".$this->language."'");
$rowl = mysqli_fetch_array($sqll); //pridobi prevod uvoda v ustreznem jeziku
$intro = $rowl['naslov']; //prevod uvoda v ustreznem jeziku
}else{
- $intro = (SurveyInfo::getInstance()->getSurveyIntro() == '') ? $lang['srv_intro'] : SurveyInfo::getInstance()->getSurveyIntro();
- }
- $tex .= $this->encodeTextHere($intro);
+ $sqlIntroString = "SELECT introduction FROM srv_anketa WHERE id=".$this->anketa." ";
+ $sqlIntro = sisplet_query($sqlIntroString);
+ $rowl = mysqli_fetch_array($sqlIntro); //pridobi besedilu uvoda
+ $intro = $rowl['introduction']; //prevod uvoda v ustreznem jeziku
+ }
+ $tex .= LatexDocument::encodeText($intro, 0, 0, 0, 'intro');
if($intro){
+ $tex .= "\r\n";
$tex .= $this->texNewLine;
$tex .= $this->texNewLine;
}
-
}
}
@@ -244,22 +247,19 @@ class LatexSurvey{ }
$question = new LatexSurveyElement($this->anketa, $this->export_format, 0, $this->usr_id, $export_subtype, $language);
-
########
while ( $rowGrupe = mysqli_fetch_assoc( $sqlGrupe ) )
{ // sprehodmo se skozi grupe ankete
$this->grupa = $rowGrupe['id'];
-
// Pogledamo prvo spremenljivko v grupi ce je v loopu
$sql = sisplet_query("SELECT id FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC");
$row = mysqli_fetch_array($sql);
-
+
// ce je ima loop za parenta
- $if_id = $this->find_parent_loop($row['id']);
+ $if_id = isset(($row['id']))?$this->find_parent_loop($row['id']):null;
if ($if_id > 0 && ($export_subtype=='q_data'||$export_subtype=='q_data_all')){ //ce je loop in (je izpis odgovorov respondentov)
$texLoop = '';
- //echo "Je v loopu $if_id </br>";
$sql1 = sisplet_query("SELECT if_id FROM srv_loop WHERE if_id = '$if_id'");
$row1 = mysqli_fetch_array($sql1);
@@ -277,14 +277,13 @@ class LatexSurvey{ // Izrisemo naslov loopa
$tex .= $this->dataPiping($loop_title);
-
+ $zaporedna = 0;
//TODO: TUdi tu se celotna spremenljivka prenaša naprej
- $sqlSpremenljivke = sisplet_query("SELECT id, tip, visible, sistem, variable, naslov, info, orientation, dostop FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC");
- //echo "SELECT id, tip, visible, sistem, variable, naslov, info, orientation FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC "."</br>";
+ $sqlSpremenljivke = sisplet_query("SELECT id, tip, visible, sistem, variable, naslov, info, orientation, dostop, grids, ranking_k, enota, grid_subtitle1, grid_subtitle2, text_kosov, text_orientation, signature, upload, size, design, vsota FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC");
while ($rowSpremenljivke = mysqli_fetch_assoc($sqlSpremenljivke))
{ // sprehodimo se skozi spremenljivke grupe
-
+
$spremenljivka = $rowSpremenljivke['id'];
if ($rowSpremenljivke['visible'] == 0 || !( ($this->admin_type <= $rowSpremenljivke['dostop'] && $this->admin_type>=0) || ($this->admin_type==-1 && $rowSpremenljivke['dostop']==4) ) ) {
@@ -308,16 +307,23 @@ class LatexSurvey{ {
if ($rowSpremenljivke['sistem'] == 1)
{ // če je oboje = vijolčno
- $this->pdf->SetTextColor(128,0,128);
+ //$this->pdf->SetTextColor(128,0,128);
}
else
{ // Če je skrito = rdeče
- $this->pdf->SetTextColor(255,0,0);
+ //$this->pdf->SetTextColor(255,0,0);
}
}
else if ($rowSpremenljivke['sistem'] == 1)
- $this->pdf->SetTextColor(0,0,255);
-
+ {
+ //$this->pdf->SetTextColor(0,0,255);
+ }
+
+ // če imamo številčenje Type = 1 potem številčimo V1
+ if (SurveyInfo::getInstance()->getSurveyCountType())
+ $zaporedna++;
+ $stevilcenje = ( SurveyInfo::getInstance()->getSurveyCountType() ) ?
+ ( ( SurveyInfo::getInstance()->getSurveyCountType() == 2 ) ? $rowSpremenljivke['variable'].") " : $zaporedna.") " ) : null;
// Izpis vprasalnika z rezultati
@@ -363,11 +369,8 @@ class LatexSurvey{ $loop_id = 'IS NULL';
$zaporedna = 0;
//TODO: Omenjen query je potrebno optimizirati in da se naprej samo prenaša ID, ki se potem v podfunkcijah kliče ustrezen query
- // trenutno se potrebuje: id, tip, visible, sistem, variable, params
- $sqlSpremenljivke = sisplet_query("SELECT * FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC");
-
- //$testniStavek = "SELECT * FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC";
- //echo "sql stavek za testiranje: ".$testniStavek."</br>";
+ // trenutno se potrebuje: id, tip, visible, sistem, variable, params
+ $sqlSpremenljivke = sisplet_query("SELECT id, tip, visible, sistem, variable, params, dostop, naslov, orientation, info, grids, ranking_k, enota, grid_subtitle1, grid_subtitle2, text_kosov, text_orientation, signature, upload, size, design, vsota FROM srv_spremenljivka WHERE gru_id='".$this->grupa."' AND visible='1' ORDER BY vrstni_red ASC");
while ($rowSpremenljivke = mysqli_fetch_assoc($sqlSpremenljivke)){ // sprehodimo se skozi spremenljivke grupe
$spremenljivka = $rowSpremenljivke['id'];
@@ -383,7 +386,6 @@ class LatexSurvey{ $preveriSpremenljivko = $this->checkSpremenljivka($spremenljivka);
}
- //if ( $this->checkSpremenljivka ($spremenljivka) /*|| $this->showIf == 1*/ )
if ($preveriSpremenljivko)
{ // lahko izrišemo spremenljivke
@@ -587,7 +589,7 @@ class LatexSurvey{ if ( mysqli_num_rows($sql) > 0 && ( (int)$question_resp_comment_viewadminonly + (int)$question_comment_viewadminonly ) > 0 ) {
-
+ $zaporedna = 0;
while ($row = mysqli_fetch_array($sql)) {
$sql1 = sisplet_query("SELECT thread, note FROM srv_spremenljivka WHERE id = '$row[id]'");
@@ -613,6 +615,12 @@ class LatexSurvey{ if ($this->commentType == 5) $only_unresolved = " AND ocena = 3 ";
if ($this->commentType == 5) $only_unresolved2 = " AND text2 = 3 ";
+
+ // če imamo številčenje Type = 1 potem številčimo V1
+ if (SurveyInfo::getInstance()->getSurveyCountType())
+ $zaporedna++;
+ $stevilcenje = ( SurveyInfo::getInstance()->getSurveyCountType() ) ?
+ ( ( SurveyInfo::getInstance()->getSurveyCountType() == 2 ) ? $row['variable'].") " : $zaporedna.") " ) : null;
$tema_vsebuje = substr($lang['srv_forum_intro'],0,10); // da ne prikazujemo 1. default sporocila
@@ -642,11 +650,11 @@ class LatexSurvey{ //$tex .= $texNewLine;
$tex .= $this->texNewLine;
- $tex .= $question->encodeText($lang['hour_comment']);
+ $tex .= LatexDocument::encodeText($lang['hour_comment']);
//$tex .= $texNewLine;
$tex .= $this->texNewLine;
- $tex .= $question->encodeText($row1['note']);
+ $tex .= LatexDocument::encodeText($row1['note']);
}
}
@@ -656,17 +664,15 @@ class LatexSurvey{ if (mysqli_num_rows($sqlt) > 0) {
//$tex .= $texNewLine;
$tex .= $this->texNewLine;
- //$tex .= '\textbf{'.$question->encodeText($lang['srv_admin_comment']).'}'; //izpis naslova komentarjev
- $tex .= '\textcolor{komentar}{\textbf{'.$question->encodeText($lang['srv_admin_comment']).'}}'; //izpis naslova komentarjev
- //$tex .= '\textcolor{komentar}{\textbf{'.$question->encodeText($lang['srv_admin_comment']).'}}'; //izpis naslova komentarjev
+ $tex .= '\textcolor{komentar}{\textbf{'.LatexDocument::encodeText($lang['srv_admin_comment']).'}}'; //izpis naslova komentarjev
$tex .= '\\\\';
$i = 0;
while ($rowt = mysqli_fetch_array($sqlt)) {
- $tex .= '\textbf{'.$question->encodeText($f->user($rowt['uid'])).'}'; //izpis imena trenutnega urednika
+ $tex .= '\textbf{'.LatexDocument::encodeText($f->user($rowt['uid'])).'}'; //izpis imena trenutnega urednika
- $tex .= $question->encodeText(' ('.$f->datetime1($rowt['time']).'):'); //izpis datuma komentarja
+ $tex .= LatexDocument::encodeText(' ('.$f->datetime1($rowt['time']).'):'); //izpis datuma komentarja
$tex .= '\\\\';
@@ -674,7 +680,7 @@ class LatexSurvey{ $vsebina = $rowt['vsebina'];
$odgovori = explode("<blockquote style=\"margin-left:20px\">", $vsebina);
- $tex .= $question->encodeText($odgovori[0]); //izpis komentarja
+ $tex .= LatexDocument::encodeText($odgovori[0]); //izpis komentarja
unset($odgovori[0]);
foreach($odgovori as $odgovor){ //izpis replik
@@ -683,12 +689,12 @@ class LatexSurvey{ $tex .= '\\\\';
$tex .= '\forceindent'; //da je indented
- $tex .= '\textbf{'.$question->encodeText($avtor[0]).'} '; //avtor replike
- $tex .= $question->encodeText($avtor[1]); //izpis datuma replike
+ $tex .= '\textbf{'.LatexDocument::encodeText($avtor[0]).'} '; //avtor replike
+ $tex .= LatexDocument::encodeText($avtor[1]); //izpis datuma replike
$tex .= '\\\\';
$tex .= '\forceindent '; //da je indented
- $tex .= $question->encodeText($odgovor[1]); //izpis replike
+ $tex .= LatexDocument::encodeText($odgovor[1]); //izpis replike
}
// Crta
@@ -703,14 +709,8 @@ class LatexSurvey{ if ($row2['count'] > 0) {
if ($admin_type <= $question_resp_comment_viewadminonly) {
-
-/* $this->pdf->Ln(3);
- $this->pdf->setFont('','B', 10);
- $this->pdf->Write (0, $this->encodeText($lang['srv_repondent_comment']), '', 0, 'l', 1, 1); */
- //$tex .= $texNewLine;
$tex .= $this->texNewLine;
- //$tex .= '\textbf{'.$question->encodeText($lang['srv_repondent_comment']).'}'; //izpisa naslova komentarjev
- $tex .= '\textcolor{komentar}{\textbf{'.$question->encodeText($lang['srv_repondent_comment']).'}}'; //izpisa naslova komentarjev
+ $tex .= '\textcolor{komentar}{\textbf{'.LatexDocument::encodeText($lang['srv_repondent_comment']).'}}'; //izpisa naslova komentarjev
$tex .= '\\\\';
//$this->pdf->Ln(3);
@@ -720,16 +720,12 @@ class LatexSurvey{ $sqlt = sisplet_query("SELECT d.text AS text, u.time_edit AS time_edit FROM srv_data_text".$this->db_table." d, srv_user u WHERE d.spr_id='0' AND d.vre_id='$row[id]' AND u.id=d.usr_id $only_unresolved2 ORDER BY d.id ASC");
if (!$sqlt) echo mysqli_error($GLOBALS['connect_db']);
while ($rowt = mysqli_fetch_array($sqlt)) {
-
-/* $this->pdf->setFont('','', 10);
- $this->pdf->Write(0, $this->encodeText($f->datetime1($rowt['time_edit']).':'), '', 0, 'l', 1, 1);*/
-
- $tex .= $question->encodeText($f->datetime1($rowt['time_edit']).':'); //izpis datuma komentarja
+
+ $tex .= LatexDocument::encodeText($f->datetime1($rowt['time_edit']).':'); //izpis datuma komentarja
$tex .= '\\\\';
- //$this->pdf->MultiCell(100, 0, $this->encodeText($rowt['text']),0,'L',0,1,0,0,true,0);
- $tex .= $question->encodeText($rowt['text']); //izpis komentarja respondenta
+ $tex .= LatexDocument::encodeText($rowt['text']); //izpis komentarja respondenta
$tex .= '\\\\';
@@ -1070,14 +1066,16 @@ class LatexSurvey{ $sql = sisplet_query("SELECT parent FROM srv_branching WHERE element_spr = '$element_spr' AND element_if = '$element_if' AND ank_id='".$this->anketa."'");
if (!$sql) echo mysqli_error($GLOBALS['connect_db']);
$row = mysqli_fetch_array($sql);
+
+ $row_parent = isset($row['parent'])?$row['parent']:null;
- if ($row['parent'] == 0) return 0;
-
+ if ($row_parent == 0) return 0;
+
$count = sisplet_query("SELECT COUNT(*) AS st FROM srv_if WHERE id = '$row[parent]' AND tip = '2'", "obj");
if ($count->st > 0) {
- return $row['parent'];
+ return $row_parent;
}else {
- return $this->find_parent_loop(0, $row['parent']);
+ return $this->find_parent_loop(0, $row_parent);
}
}
@@ -1217,11 +1215,34 @@ class LatexSurvey{ }
#funkcija ki skrbi za encode dolocenih spornih delov besedila v latex-u prijazno
- function encodeTextHere($text='', $vre_id=0){
+ function encodeTextHere($text='', $vre_id=0, $naslovStolpca = 0, $img_id=0){
global $site_path, $lang;
-
+ //$text = str_replace(' ','X',$text); //nadomesti presledke
//echo "Encoding ".$text."</br>";
//echo "vre_id: ".$vre_id."</br>";
+ //echo "ime spremenljivke ".$this->variableName."</br>";
+
+ $text = ($text!=null && $text='' ? htmlspecialchars_decode($text) : ''); //vse html special chars kot je & spremeni v ustrezne simbole (npr. &=>&)
+
+ //resevanje razbirajanja predolgih neprekinjenih besed in URL - spremenljivke za kasnejsi prilagojen izpis
+ //$numOfWords = str_word_count($text, 0);
+ $numOfSpacesPrej = substr_count($text, ' '); //stevilo presledkov v besedilu
+ $stringLength = strlen($text);
+
+ $findSpace = ' ';
+ $posSpace1 = strpos($text, $findSpace); //najdi pozicijo prvega presledka v besedilu
+ $posSpace2 = strripos($text, $findSpace); //najdi pozicijo zadnjega presledka v besedilu
+
+
+ $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
$this->path2UploadedImages = $site_path.'uploadi/editor/';
if($text == ''){ //ce ni teksta, vrni se
@@ -1234,6 +1255,7 @@ class LatexSurvey{ $findImgLength = strlen($findImg);
$findUl = '<ul';
$findUlLength = strlen($findUl);
+ $findOl = '<ol';
$findLi = '<li';
$findPar = '<p>';
@@ -1241,28 +1263,140 @@ class LatexSurvey{ $pos = strpos($text, $findme);
$posImg = strpos($text, $findImg);
$posUl = strpos($text, $findUl);
+ $posOl = strpos($text, $findOl);
$posLi = strpos($text, $findLi);
$posPar = strpos($text, $findPar);
-
+ //echo "pozicija paragrafa: $posPar </br>";
+
+ //ureditev izrisa slike
+ if($posImg !== false){
+ $numOfImgs = substr_count($text, $findImg); //stevilo '<img ' v tekstu
+ $posImg = strpos($text, $findImg);
+ $textPrej = '';
+ $textPotem = '';
+ for($i=0; $i<$numOfImgs; $i++){
+ $posImg = strpos($text, $findImg);
+ $textPrej = substr($text, 0, $posImg); //tekst do img
+ $textPotem = substr($text, $posImg); //tekst po img, z vkljuceno hmlt kodo z img
+ $posImgEnd = strpos($textPotem, '/>'); //pozicija, kjer se konca html koda za img
+ $textPotem = substr($textPotem, $posImgEnd+strlen('/>')); //tekst od konca html kode za img dalje
+
+ $imageName = $this->path2UploadedImages."".$this->getImageName($text, 0, '<img', $vre_id, $img_id);
+ $imageNameTest = $imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku
+ //echo $imageName."</br>";
+ //error_log("iz survey element: ".$imageNameTest);
+ //echo("iz survey element imageNameTest: ".$imageNameTest."</br>");
+ //echo "Obstaja ? ".file_exists($imageNameTest)."</br>";
+ //echo("iz survey element imageName: ".$imageName."</br>");
+ //echo "velikost: ".filesize($imageNameTest)."</br>";
+/* if(filesize($imageNameTest) > 0){
+ $text = $textPrej.' '.PIC_SIZE_ANS."{".$imageName."}".' '.$textPotem;
+ }else{
+ $image = $lang['srv_pc_unavailable'];
+ $text = $textPrej.' '.$image.' '.$textPotem;
+ } */
+ $text = '';
+ //$text = $textPrej.' ';
+
+ //if(filesize($imageNameTest) > 0){
+ if(file_exists($imageNameTest)){
+ $text .= $textPrej.' '.PIC_SIZE_ANS."{".$imageName."}";
+ }else{
+ $image = $lang['srv_pc_unavailable'];
+ $text .= $image;
+ }
+ $text .= ' '.$textPotem;
+ }
+
+ //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike
+ $findImgCode = '\includegraphics';
+ $posOfImgCode = strpos($text, $findImgCode);
+ //echo $posOfImgCode."</br>";
+ $textToImgCode = substr($text, 0, $posOfImgCode); //tekst do $findImgCode
+ //echo $textToImgCode."</br>";
+ $textFromImgCode = substr($text, $posOfImgCode); //tekst po $findImgCode
+ //echo $textFromImgCode."</br>";
+ $findImgCodeEnd = '}';
+ //$posOfImgCodeEnd = strpos($text, $findImgCodeEnd);
+ $posOfImgCodeEnd = strpos($textFromImgCode, $findImgCodeEnd);
+ //echo $posOfImgCodeEnd."</br>";
+ $textAfterImgCode = substr($textFromImgCode, $posOfImgCodeEnd+1); //tekst po $findImgCodeEnd
+ //echo $textAfterImgCode."</br>";
+ $textOfImgCode = substr($text, $posOfImgCode, $posOfImgCodeEnd+1);
+ //echo $textOfImgCode."</br>";
+
+ $text = $textToImgCode.$textAfterImgCode;
+
+ //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike - konec
+ }
+ //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);
//$text = str_replace('}','\}',$text);
$text = str_replace('$','\$ ',$text);
- $text = str_replace('#','\# ',$text);
+
+ if(substr_count($text, '#')){ //ce je stevilo # vecje od 1
+ $text = str_replace('#','\#',$text);
+ }else{
+ $text = str_replace('#','\# ',$text);
+ }
$text = str_replace('%','\% ',$text);
$text = str_replace('€','\euro',$text);
$text = str_replace('^','\textasciicircum{} ',$text);
$text = str_replace('_','\_ ',$text);
$text = str_replace('~','\textasciitilde{} ',$text);
- $text = str_replace('&','\&',$text);
+ if(strpos($text, '&')){ //ce je prisotno v besedilu &'
+ $text = str_replace('&','\& ',$text);
+ }else{
+ $text = str_replace('&','\& ',$text);
+ }
+ $text = str_replace(' ','~',$text);
//$text = str_replace('<','\textless ',$text);
- $text = str_replace('<','\textless',$text);
+ $text = str_replace('<',' \textless ',$text);
//$text = str_replace('>','\textgreater ',$text);
- $text = str_replace('>','\textgreater',$text);
+ $text = str_replace('>',' \textgreater ',$text);
//ureditev posebnih karakterjev za Latex - konec
+ //ureditev grskih crk
+ /* $text = str_replace('α','\textalpha ',$text); //ά
+ $text = str_replace('ά','\textalpha ',$text);
+ $text = str_replace('β','\textbeta ',$text);
+ $text = str_replace('γ','\textgamma ',$text);
+ $text = str_replace('δ','\textdelta ',$text);
+ $text = str_replace('ε','\textepsilon ',$text);
+ $text = str_replace('ζ','\textzeta ',$text);
+ $text = str_replace('η','\texteta ',$text);
+ $text = str_replace('θ','\texttheta ',$text);
+ $text = str_replace('ι','\textiota ',$text);
+ $text = str_replace('κ','\textkappa ',$text);
+ $text = str_replace('λ','\textlambda ',$text);
+ $text = str_replace('μ','\textmugreek ',$text);
+ $text = str_replace('ν','\textnu ',$text);
+ $text = str_replace('ξ','\textxi ',$text); */
+ //$text = str_replace('ο','o',$text); // \textomicron ne dela
+ //$text = str_replace('ο','\textgreek{ο}',$text);
+ //$text = str_replace('ς','\textvarsigma ',$text);
+ /* $text = str_replace('ς','\textgreek{ς}',$text);
+ $text = str_replace('π','\textpi ',$text);
+ $text = str_replace('ρ','\textrho ',$text);
+ $text = str_replace('σ','\textsigma ',$text);
+ $text = str_replace('τ','\texttau ',$text);
+ $text = str_replace('υ','\textupsilon ',$text);
+ $text = str_replace('φ','\textphi ',$text);
+ $text = str_replace('χ','\textchi ',$text);
+ $text = str_replace('ψ','\textpsi ',$text);
+ $text = str_replace('ω','\textomega ',$text);
+ $text = str_replace('ύ','\textgreek{ύ}',$text); */
+ //ureditev grskih crk - konec
+
+ //ureditev ostalih posebnih crk
+ $text = str_replace('ə','\textschwa ',$text);
+ //ureditev ostalih posebnih crk - konec
+
+
//ureditev preureditve html kode ul in li v latex itemize
if($posUl !== false){
//echo "text prej: ".$text."</br>";
@@ -1272,27 +1406,148 @@ class LatexSurvey{ //if($numOfUl!=0){
if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
$text = str_replace('<ul>','\begin{itemize} ', $text);
- $text = str_replace('<li>','\item ', $text);
- $text = str_replace('</ul>','\end{itemize} ', $text);
+ $text = str_replace('<ul','\begin{itemize} ', $text);
+/* $text = str_replace('<li>','\item ', $text);
+ $text = str_replace('<li','\item ', $text); */
+ $text = str_replace('<li>','\item \ ', $text);
+ $text = str_replace('<li','\item \ ', $text);
+ $text = str_replace('</ul>','\end{itemize} \ ', $text);
}
//echo "prazno v html: ".strpos($text, '\r')."</br>";
//echo "text potem: ".$text."</br>";
######################
}
//ureditev preureditve html kode ul in li v latex itemize - konec
-
+
+ //ureditev preureditve html kode ol in li v latex enumerate, ki je ostevilcen
+ if($posOl !== false){
+ //echo "text prej: ".$text."</br>";
+ $numOfOl = substr_count($text, $findOl); //stevilo '<ol' v tekstu
+ //echo "numOfUl ".$numOfUl."</br>";
+ ######################
+ //if($numOfUl!=0){
+ if($numOfOl!=0 && $posLi !== false){ //ce imamo ol in li
+ $text = str_replace('<ol>','\begin{enumerate} ', $text);
+/* $text = str_replace('<li>','\item ', $text);
+ $text = str_replace('<li','\item ', $text); */
+ $text = str_replace('<li>','\item \ ', $text);
+ $text = str_replace('<li','\item \ ', $text);
+ $text = str_replace('</ol>','\end{enumerate} \ ', $text);
+ }
+ //echo "prazno v html: ".strpos($text, '\r')."</br>";
+ //echo "text potem: ".$text."</br>";
+ ######################
+ }
+ //ureditev preureditve html kode ol in li v latex enumerate, ki je ostevilcen - 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($posPar !== false){ //ce je kaksen html tag <p>, dodaj prazno vrstico oz. break
- if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
- $divider = ' ';
+ if($this->variableName=='gdpr'){
+ if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
+ $divider = ' ';
+ }else{
+ $divider = ' \\ \\\\ ';
+ }
+ $text = str_replace('<p>',$divider, $text);
+ }else{
+ $text = str_replace('<p>',' ', $text);
+ }
+ }
+
+
+ //priprava izpisa zelo dolgega besedila brez presledkov (URL, email, ...)
+ //if($numOfSpacesPrej == 0 && ($stringLength >= MAX_STRING_LENGTH)){ //ce v besedilu ni presledkov in je besedilo daljse od max dovoljene dolzine
+ if( ($numOfSpacesPrej == 0 && ($stringLength >= MAX_STRING_LENGTH)) || ($numOfSpacesPrej == 1 && $posSpace1 == $posSpace2 && $stringLength >= MAX_STRING_LENGTH)){ //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
+ $text = substr_replace($text, $this->texNewLine, MAX_STRING_LENGTH, 0); //dodaj na ustrezni dolzini besedila prehod v novo vrstico
+ }
+ //priprava izpisa zelo dolgega besedila brez presledkov - konec
+
+ //echo "text potem: ".$text."</br>";
+
+ //detekcija prisotnosti e-naslova v besedilu in primerna preureditev, da pride do pravilnega izpisa
+ $findAt = '@1'; //IZKLOPIL DETEKCIJO, KER DELA TUDI BREZ TEGA
+ $numOfAt = substr_count($text, $findAt); //stevilo '@' v besedilu
+ $findNewline = 'br';
+
+ $text = preg_replace("/<\/?a( [^>]*)?>/i", "", $text); //remove anchor tag from string <a href= ... </a>, to se je uredilo za rešiti <a href= mailto: ...
+
+ $posAt = strpos($text, $findAt);
+ if($posAt && $posSpace1){ //ce je prisotna afna in je prisoten presledek v besedilu
+
+ $posSpace1Mail = strpos(substr($text, $posAt), $findSpace); //najdi pozicijo prvega presledka v besedilu po e-naslovu
+ $posSpace1Mail = $posSpace1Mail+$posAt; //koncna pozicija, ce se gleda celotno besedilo
+ //echo "pozicija prvega presledka v besedilu po e-naslovu: ".$posSpace1Mail."</br>";
+
+ //najdi prvi presledek pred afno
+ $posSpace2Mail = strripos(substr($text, 0, $posAt), $findSpace); //najdi pozicijo zadnjega presledka v besedilu pred e-naslovom
+ //echo "pozicijo zadnjega presledka v besedilu pred e-naslovom: ".$posSpace2Mail."</br>";
+
+
+
+ //najdi prvi simbol za v novo vrstico "br" po afni
+ //echo substr($text, $posAt) ."</br>";
+ $posNewLineMail = strpos(substr($text, $posAt), $findNewline); //najdi pozicijo prvega simbola za v novo vrstico v besedilu po e-naslovu
+ $posNewLineMail = $posNewLineMail+$posAt-1; //koncna pozicija, ce se gleda celotno besedilo
+
+ if($posSpace1Mail<$posNewLineMail){ //ce se po e-naslovu pojavi prej presledek
+ $posKonec = $posSpace1Mail; //se zakljuci pri presledku, ker je ta lokacija za zakljucek url
}else{
- $divider = ' \\ \\\\ ';
+ $posKonec = $posNewLineMail; //se zakljuci pred simbolom za novo vrstico, ker je ta lokacija za zakljucek url
}
- //$text = str_replace('<p>',' ', $text);
- //$text = str_replace('<p>',' \break ', $text);
- //$text = str_replace('<p>',' \\\\ ', $text);
+ //echo "posKonec: ".$posKonec."</br>";
+
+ //dodaj po e-naslovu potrebno latex kodo za zakljucek url
+ //$text = substr_replace($text, '}', $posSpace1Mail, 0);
+ $text = substr_replace($text, '}', $posKonec, 0);
+
+ //dodaj pred e-naslovom potrebno latex kodo za url
+ //substr_replace(string_name, replacement_string, start_pos, length)
+ $text = substr_replace($text, ' \url{', $posSpace2Mail, 0);
+ //echo $text."</br>";
- $text = str_replace('<p>', $divider, $text);
}
+ //detekcija prisotnosti e-naslova v besedilu in primerna preureditev, da pride do pravilnega izpisa - konec
+
+
+ //RESEVANJE BESEDILA V CIRILICI
+ $contains_cyrillic = (bool) preg_match('/[\p{Cyrillic}]/u', $text); //ali je v besedilu cirilica?
+ if($contains_cyrillic){ // ce je cirilica v besedilu
+ $text = '\foreignlanguage{russian}{'.$text.'}';
+ }
+ //RESEVANJE BESEDILA V CIRILICI - konec
+
+
+
+ //RESEVANJE odstranitve dodatnih style tag-ov po ul, ipd. #######################################################
+ $findStyleTagFull = '<style="';
+ $findStyleTagIn = 'style="';
+ $findStyleTagEnd = '">';
+ $numOfStyleTagsFull = substr_count($text, $findStyleTagFull); //stevilo '<style=" ' v tekstu
+ $numOfStyleTagsIn = substr_count($text, $findStyleTagIn); //stevilo 'style=" ' v tekstu
+ if($numOfStyleTagsFull){
+ $numOfStyleTags = $numOfStyleTagsFull;
+ $findStyleTag = $findStyleTagFull;
+ $offset = 2;
+ }else{
+ $numOfStyleTags = $numOfStyleTagsIn;
+ $findStyleTag = $findStyleTagIn;
+ $offset = 1;
+ }
+ for($s=0; $s<$numOfStyleTags; $s++){ //za vsako najdeno 'style=" ' besedilo, uredi njeno odstranitev
+ $posStyleTag = strpos($text, $findStyleTag);
+ $posStyleTagEnd = strpos($text, $findStyleTagEnd, $posStyleTag); //strpos(string,find,start) najdi $findStyleTagEnd v $text, isci od $posStyleTag dalje
+ $dolzinaOff = $posStyleTagEnd - $posStyleTag + $offset;
+ $text = substr_replace($text, "", $posStyleTag, $dolzinaOff); //substr_replace(string,replacement,start,length)
+ }
+ //RESEVANJE odstranitve dodatnih style tag-ov po ul, ipd. - konec #################################################
+
+ //echo "po style: ".$text."</br>";
if($pos === false && $posImg === false) { //v tekstu ni br in img
@@ -1300,37 +1555,39 @@ class LatexSurvey{ return strip_tags($text);
}else { //v tekstu sta prisotna br ali img
$text2Return = ''; //tekst ki bo vrnjen
-
+
//ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico
- if($pos !== false){
- $pos = strpos($text, $findme);
- $numOfBr = substr_count($text, $findme); //stevilo '<br />' v tekstu
- for($i=0; $i<$numOfBr; $i++){
- if($i == 0){ //ce je prvi najdeni '<br />'
- $textPrej = substr($text, 0, $pos);
- $textPotem = substr($text, $pos+$findmeLength);
- if($i == $numOfBr-1){
- //$text2Return .= $textPrej.' \break '.$textPotem;
- $text2Return .= $textPrej.' \\\\ '.$textPotem;
- }else{
- //$text2Return .= $textPrej.' \break ';
- $text2Return .= $textPrej.' \\\\ ';
- }
- }else{ //drugace
- $pos = strpos($textPotem, $findme);
- $textPrej = substr($textPotem, 0, $pos);
- $textPotem = substr($textPotem, $pos+$findmeLength);
- if($i == $numOfBr-1){
- //$text2Return .= $textPrej.' \break '.$textPotem;
- $text2Return .= $textPrej.' \\\\ '.$textPotem;
- }else{
- //$text2Return .= $textPrej.' \break ';
- $text2Return .= $textPrej.' \\\\ ';
+ if($naslovStolpca==0){ // ce besedilo ni naslov stolpca tabele
+ if($pos !== false){
+ $pos = strpos($text, $findme);
+ $numOfBr = substr_count($text, $findme); //stevilo '<br />' v tekstu
+ for($i=0; $i<$numOfBr; $i++){
+ if($i == 0){ //ce je prvi najdeni '<br />'
+ $textPrej = substr($text, 0, $pos);
+ $textPotem = substr($text, $pos+$findmeLength);
+ if($i == $numOfBr-1){
+ //$text2Return .= $textPrej.' \break '.$textPotem;
+ $text2Return .= $textPrej.' \\\\ '.$textPotem;
+ }else{
+ //$text2Return .= $textPrej.' \break ';
+ $text2Return .= $textPrej.' \\\\ ';
+ }
+ }else{ //drugace
+ $pos = strpos($textPotem, $findme);
+ $textPrej = substr($textPotem, 0, $pos);
+ $textPotem = substr($textPotem, $pos+$findmeLength);
+ if($i == $numOfBr-1){
+ //$text2Return .= $textPrej.' \break '.$textPotem;
+ $text2Return .= $textPrej.' \\\\ '.$textPotem;
+ }else{
+ //$text2Return .= $textPrej.' \break ';
+ $text2Return .= $textPrej.' \\\\ ';
+ }
}
}
+ $text = $text2Return;
}
- $text = $text2Return;
- }
+ }
//ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico - konec
//echo "text potem: ".$text."</br>";
$text = preg_replace("/(\R){2,}/", "$1", $text);
@@ -1338,5 +1595,184 @@ class LatexSurvey{ }
}
#funkcija ki skrbi za encode dolocenih spornih delov besedila v latex-u prijazno - konec
+
+ #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 </br>";
+ 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."</br>";
+ //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."</br>";
+
+ //$findme = $site_path.'uploadi/editor/';
+ $findme = $site_url.'uploadi/editor/';
+ //$findme = 'uploadi/editor/';
+ //$findme = 'editor/';
+ //echo "findme: ".$findme."</br>";
+ $pos = strpos($imageName, $findme); //najdi pozicijo teksta v $findme
+ //echo "najdi tole: ".$findme."</br>";
+ //echo "najdi tukaj: ".$imageName."</br>";
+ //echo "pozicija tega: ".$pos."</br>";
+ 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."</br>";
+ 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."</br>";
+ $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 </br>";
+ $imageName = $this->getOnlineImageName($imageName, $slikaNaStrezniku, $vre_id, $img_id); //pridobi njen URL
+ }
+
+ $imageName = substr($imageName, 0, strrpos($imageName, '.'));
+
+ }
+
+ //echo "imagename pred return: ".$imageName."</br>";
+ 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."</br>";
+ $image = imagecreatefromgif($path); //pripravi sliko iz gif za pretvorbo
+ $imageName = substr($path, 0, -3); //ime slike brez extension-a
+ //echo $imageName."</br>";
+ $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."</br>";
+ $imageNamePNG = $imageName.'.png'; //ime slike z ustreznim extension
+ imagepng($image, $imageNamePNG); //pretvori pripravljeno jpg sliko v png
+ //echo "pretvorba v png: ".$imageNamePNG."</br>";
+ //echo "xtens: ".$imageExtension."</br>";
+ //$origExtension = strrchr($path, '.');
+ //echo "ali je slika na strežniku: ".$slikaNaStrezniku."</br>";
+ if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, izbrisi jo
+ //echo "tukaj </br>";
+ 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."</br>";
+ $row = Cache::srv_spremenljivka(self::$spremenljivka);
+ //echo "sprem: ".self::$spremenljivka."</br>";
+ $spremenljivkaParams = new enkaParameters($row['params']);
+ //echo "params: ".$spremenljivkaParams->get('hotspot_image')."</br>";
+ $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."</br>";
+ $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike
+ //echo "imageExtension: ".$imageExtension."</br>";
+
+ //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 </br>";
+ $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 </br>";
+ }
+
+ //echo "command: ".$command."</br>";
+ 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."</br>";
+ 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."</br>";
+ 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.LatexSurveyElement.php b/admin/survey/export/latexclasses/class.LatexSurveyElement.php index 587fb3a..e8bf384 100644 --- a/admin/survey/export/latexclasses/class.LatexSurveyElement.php +++ b/admin/survey/export/latexclasses/class.LatexSurveyElement.php @@ -10,13 +10,13 @@ include('../../vendor/autoload.php');
-define("MAX_STRING_LENGTH", 90);
-define("LINE_BREAK_AT", '7 cm');
-define("RADIO_BTN_SIZE", 0.13);
-define("CHCK_BTN_SIZE", 0.13);
-define("PIC_SIZE_ANS", "\includegraphics[width=3cm]"); //slika dolocene sirine
-define("DROPDOWN_SIZE", 0.8);
-define("VAS_SIZE", 0.04); //VAS_SIZE
+if (!defined("MAX_STRING_LENGTH")) define("MAX_STRING_LENGTH", 90);
+if (!defined("LINE_BREAK_AT")) define("LINE_BREAK_AT", '7 cm');
+if (!defined('RADIO_BTN_SIZE')) define("RADIO_BTN_SIZE", 0.13);
+if (!defined('CHCK_BTN_SIZE')) define("CHCK_BTN_SIZE", 0.13);
+if (!defined('PIC_SIZE_ANS')) define("PIC_SIZE_ANS", "\includegraphics[width=3cm]"); //slika dolocene sirine
+if (!defined('DROPDOWN_SIZE')) define("DROPDOWN_SIZE", 0.8);
+if (!defined('VAS_SIZE')) define("VAS_SIZE", 0.04); //VAS_SIZE
class LatexSurveyElement{
@@ -48,6 +48,8 @@ class LatexSurveyElement{ protected $prevod;
protected $admin_type;
protected $variableName;
+ protected $path2UrlImages;
+ protected $export_subtype;
function __construct($anketa=null, $export_format='', $fillablePdf=null, $usr_id=null, $export_subtype='', $language=null){
@@ -86,11 +88,12 @@ class LatexSurveyElement{ //preverjanje, ali je prevod
if(isset($_GET['language'])){
- $this->language = $_GET['language'];
+ //$this->language = $_GET['language'];
+ $this->language = isset($_GET['language'])?$_GET['language']:null;
$this->prevod = 1;
}else{
$this->prevod = 0;
- }
+ }
//preverjanje, ali je prevod - konec
//if($language!=-1){ //ce ni default jezik, ampak je prevod
@@ -102,8 +105,7 @@ class LatexSurveyElement{ {
SurveyUserSetting::getInstance()->Init($anketa, $global_user_id);
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1)
- $this->db_table = '_active';
+ $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
}
else{
return false;
@@ -116,7 +118,6 @@ class LatexSurveyElement{ public function displayQuestionText($spremenljivke=null, $zaporedna=null, $export_subtype='', $preveriSpremenljivko=null, $loop_id=null, $export_data_type=''){
$tex = '';
$userDataPresent = null; //dodal definicijo spremenljivke zaradi intellisense napake
- //echo "Funkcija displayQuestionText </br>";
self::$spremenljivka = $spremenljivke['id'];
$row = Cache::srv_spremenljivka($spremenljivke['id']);
$this->spremenljivkaParams = new enkaParameters($row['params']);
@@ -128,21 +129,18 @@ class LatexSurveyElement{ if($export_subtype!='q_empty'){
if( in_array($spremenljivke['tip'], array(1, 2, 3)) ){ //ce je radio,checkbox ali roleta
//if( in_array($spremenljivke['tip'], array(1, 2, 3)) && $spremenljivke['orientation']!=5){
- //echo "orientation: ".$spremenljivke['orientation'];
$userDataPresent = $this->GetUsersData($this->db_table, $spremenljivke['id'], $spremenljivke['tip'], $this->usr_id, $this->loop_id);
}elseif( in_array($spremenljivke['tip'], array(6, 16, 19, 20)) ){ //ce je multigrid radio, checkbox, besedilo ali stevilo
$sqlVrednosti = sisplet_query("SELECT id, naslov, naslov2, variable, other, spr_id FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red");
- //echo "Funkcija displayQuestionText </br>";
//pregled vseh moznih vrednosti (kategorij) po $sqlVrednosti
while ($rowVrednost = mysqli_fetch_assoc($sqlVrednosti)){
$indeksZaWhile = 1;
- //echo "rowVrednost['id']: ".$rowVrednost['id'].'</br>';
$sqlVsehVrednsti = sisplet_query("SELECT id, naslov FROM srv_grid WHERE spr_id='".$spremenljivke['id']."' ORDER BY 'vrstni_red'");
while ($rowVsehVrednosti = mysqli_fetch_assoc($sqlVsehVrednsti)){
$sqlUserAnswer = $this->GetUsersDataGrid($spremenljivke, $this->db_table, $rowVrednost, $rowVsehVrednosti, $this->usr_id, 0, $this->loop_id);
$userAnswer = mysqli_fetch_assoc($sqlUserAnswer);
- if($rowVsehVrednosti['id'] == $userAnswer['grd_id']){
+ if(isset($userAnswer['grd_id']) && $rowVsehVrednosti['id'] == $userAnswer['grd_id']){
$indeksZaWhile++;
}
if($indeksZaWhile!=1){
@@ -159,16 +157,12 @@ class LatexSurveyElement{ $indeksPolja = 0;
$userDataPresentArray = $this->GetUsersDataKombinirana($spremenljivke, $this->db_table, $this->usr_id, $questionText, $this->loop_id);
if (is_array($userDataPresentArray)){
- //echo "je polje".'</br>';
$userDataPresent=0;
- //echo "Dolzina polja: ".count($userDataPresentArray)."</br>";
- //echo "Id: ".$spremenljivke['id']."</br>";
foreach($userDataPresentArray as $key=>$value){
if($key==$indeksPolja){
if($value!=''){
$userDataPresent=1;
}
- //echo "Podatek z indeksom ".$key." je :".$value."</br>";
$indeksPolja++;
}
}
@@ -181,14 +175,12 @@ class LatexSurveyElement{ }
}
}
- //echo "userDataPresent za spremenljivko ".$spremenljivke['id'].': '.$userDataPresent.'</br>';
- //echo "Preveri spremenljivko: $preveriSpremenljivko</br>";
#pridobitev podatkov o odgovorih respondenta na trenutno vprasanje - konec ####################################
if(($export_subtype=='q_empty')||($export_subtype=='q_comment')||(($export_subtype=='q_data'||$export_subtype=='q_data_all')&&($userDataPresent!=0||$preveriSpremenljivko))){ //ce je prazen vprasalnik ali (je vprasalnik poln in (so podatki prisotni ali je potrebno pokazati vprasanje tudi, ce ni podatkov))
$rowl = $this->srv_language_spremenljivka($spremenljivke);
- if (strip_tags($rowl['naslov']) != '') $spremenljivke['naslov'] = $rowl['naslov'];
- if (strip_tags($rowl['info']) != '') $spremenljivke['info'] = $rowl['info'];
+ if ($rowl!=null && strip_tags($rowl['naslov']) != '') $spremenljivke['naslov'] = $rowl['naslov'];
+ if ($rowl!=null && strip_tags($rowl['info']) != '') $spremenljivke['info'] = $rowl['info'];
#Pridobimo tekst vprasanja#################################################################################
@@ -202,22 +194,18 @@ class LatexSurveyElement{ ######################################### Pridobimo tekst vprasanja - konec
#Stevilcenje vprasanj###############################################################
- //$numberingText = ($this->numbering == 1) ? $spremenljivke['variable'].' - ' : '';
- $numberingText = ($this->numbering == 1) ? $this->encodeText($spremenljivke['variable']).' - ' : '';
+ $numberingText = ($this->numbering == 1) ? ($spremenljivke['variable']).' - ' : '';
######################################### Stevilcenje vprasanj - konec
- //echo "goli naslov: ".$spremenljivke['naslov']."</br>";
-
+
//belezenje imena spremenljivke, zaradi GDPR vprasanja
- $this->variableName =$spremenljivke['variable'];
+ $this->variableName = $spremenljivke['variable'];
//belezenje imena spremenljivke, zaradi GDPR vprasanja - konec
#Izris stevilke in besedila vprasanja ter IF ali BLOK, ce so prisotni ###############################################
- //$text = strip_tags($numberingText . $spremenljivke['naslov'], '<a><img><ul><li><ol><br>');
- $text = strip_tags($numberingText . $spremenljivke['naslov'], '<a><img><ul><li><ol><br><p>'); //je potrebno spustiti <p>, zaradi GDPR vprasanja
+ $text = strip_tags($numberingText . $spremenljivke['naslov'], '<a><img><ul><li><ol><br><p>'); //je potrebno spustiti <p>, zaradi GDPR vprasanja
- //echo "naslov: ".$text."</br>";
//$tex = $text." ".$texNewLine;
- if( !in_array($spremenljivke['tip'], array(1, 2, 3, 4, 7, 8, 6, 16, 19, 20, 21, 17, 18, 24, 26, 27)) ){ //ce ni radio, check, roleta, stevilo, datum, multigrid radio, checkbox, besedilo, stevilo, razvrscanje, vsota ali kombinirana tabela, lokacija, ali heatmap
+ if( !in_array($spremenljivke['tip'], array(0, 1, 2, 3, 4, 7, 8, 6, 16, 19, 20, 21, 17, 18, 24, 26, 27)) ){ //ce ni radio, check, roleta, stevilo, datum, multigrid radio, checkbox, besedilo, stevilo, razvrscanje, vsota ali kombinirana tabela, lokacija, ali heatmap
$tex .= ($this->export_format == 'pdf' ? '\\begin{absolutelynopagebreak} \\noindent ' : ' '); //ce je pdf uredimo, da med vprasanji ne bo prelomov strani
}
@@ -258,7 +246,7 @@ class LatexSurveyElement{ Cache::cache_all_srv_branching($this->anketa);
$parents = Cache::srv_branching($spremenljivke['id'], 0)['parent'];
if($parents){
- $tex .= $this->displayIf($parents);
+ $tex .= ' '.LatexDocument::encodeText($this->displayIf($parents));
$tex .= $this->texNewLine;
}
#preuredil kodo, da zadeva deluje tako kot ta stara, ki se nahaja nad tem
@@ -269,21 +257,20 @@ class LatexSurveyElement{ //$tex .= '\textbf{'.$text.'} '.$texNewLine; //izris besedila vprasanja
if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je izpis odgovorov
- $text = $this->dataPiping($text); //pokazi odgovore po zanki
+ $text = $this->dataPiping($text); //pokazi odgovore po zanki
}
$tex .= ' \noindent '; //dodal pred vsakim tekstom vprasanja, da ni indent-a
if($spremenljivke['orientation']==0){ //ce je vodoravno ob vprasanju
- //if($spremenljivke['tip'] == 21){ //ce je besedilo (vodoravno ob vprasanju)
if($spremenljivke['tip'] == 21 || $spremenljivke['tip'] == 4){ //ce je besedilo (vodoravno ob vprasanju)
$tex .= ' \par { '; //dodaj zacetek odstavka, ki je pomemben za pravile izpis
}
}
- $tex .= '\textbf{'.$this->encodeText($text).'} '; //izris besedila vprasanja
+ $tex .= '\textbf{'.LatexDocument::encodeText($text, null, null, $loop_id).'} '; //izris besedila vprasanja //encodeText($text='', $vre_id=0, $naslovStolpca = 0, $img_id=0){
- $this->questionText = $text; //zabelezimo tekst vprasanja, ki ga potrebujemo kasneje
+ $this->questionText = $text; //zabelezimo tekst vprasanja, ki ga potrebujemo kasneje
#Izris stevilke in besedila vprasanja ter IF ali BLOK, ce so prisotni - konec ###############################################
@@ -294,8 +281,7 @@ class LatexSurveyElement{ if($spremenljivke['info'] != ''){
$tex .= $this->texNewLine;
$tex .= '\vspace{2 mm}';
- //$tex .= ' {\noindent \\footnotesize '.$this->encodeText($spremenljivke['info']).'}';
- $tex .= ' \noindent \\footnotesize '.$this->encodeText($spremenljivke['info']).' \\normalsize ';
+ $tex .= ' \noindent \\footnotesize '.LatexDocument::encodeText($spremenljivke['info']).' \\normalsize ';
}
if( !in_array($spremenljivke['tip'], array(4, 6, 16, 19, 20, 21, 7, 8, 18)) ){ //ce ni multigrid radio, checkbox, besedilo, stevilo, datum ali vsota ki ne potrebujejo prazne vrstice zaradi uporabe tabele
@@ -314,49 +300,13 @@ class LatexSurveyElement{ }
}
}
-
- ####################
-/* if( !in_array($spremenljivke['tip'], array(6, 16, 19, 20, 21, 7)) ){ //ce ni multigrid radio, checkbox, besedilo ali stevilo
-
- //preveri, ce je itemize v besedilu in ustrezno uredi prazno vrstico
- $findItemize = '\begin{itemize}';
- $posItemize = strpos($tex, $findItemize); //v trenutni tex kodi najdi prisotnost besedila za itemize
- if($posItemize === false){ //ce ni besedila itemize, dodaj prazno vrstico
- //pejdi v novo vrstico
- $tex .= $this->texNewLine;
- }
- //preveri, ce je itemize v besedilu in ustrezno uredi prazno vrstico - konec
- }
-
- if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je izpis odgovorov
- if( in_array($spremenljivke['tip'], array(6, 16, 19, 20, 21, 7)) ){ //ce je multigrid radio, checkbox, besedilo ali stevilo
- $tex .= $this->texNewLine;
- //echo "ni vodoravno ob vprašanju in je število ali besedilo </br>";
- }
- }
-
- //ce imamo opombo, jo izpisi
- if($spremenljivke['info'] != ''){
- if( in_array($spremenljivke['tip'], array(6, 16, 19, 20, 21, 7)) ){ //ce je multigrid radio, checkbox, besedilo ali stevilo
- $tex .= $this->texNewLine;
- echo "ni vodoravno ob vprašanju in je število ali besedilo </br>";
- }
- //$tex .= $this->texNewLine;
- $tex .= '\vspace{2 mm}';
- $tex .= ' {\indent \\footnotesize '.$this->encodeText($spremenljivke['info']).'}';
- if( !in_array($spremenljivke['tip'], array(6, 16, 19, 20, 21, 7)) ){ //ce ni multigrid radio, checkbox, besedilo ali stevilo
- $tex .= $this->texNewLine;
- }
- } */
- ####################
}else{ //ce je vodoravno ob vprasanju
//ce imamo opombo, jo izpisi
if($spremenljivke['info'] != ''){
//pejdi v novo vrstico
$tex .= $this->texNewLine;
$tex .= '\vspace{2 mm}';
- //$tex .= ' {\indent \\footnotesize '.$this->encodeText($spremenljivke['info']).'} ';
- $tex .= ' {\noindent \\footnotesize '.$this->encodeText($spremenljivke['info']).' \\normalsize } ';
+ $tex .= ' {\noindent \\footnotesize '.LatexDocument::encodeText($spremenljivke['info']).' \\normalsize } ';
}
if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je izpis odgovorov
@@ -368,7 +318,6 @@ class LatexSurveyElement{ #Izris opombe - konec #########################################################################
#ce vprasanje nima moznih odgovorov, je potrebno zakljuciti environment (absolutelynopagebreak) pri pdf
- //echo $rowVrstic[0]."za spremenljivko: ".$spremenljivke['tip']."</br>";
if($rowVrstic[0]==0 && (in_array($spremenljivke['tip'], array(1, 2, 3, 6, 16, 17, 20, 9, 19, 17))) ){
if($this->export_format == 'pdf'){ //ce je pdf
if($spremenljivke['orientation']==0 || $spremenljivke['orientation']==2){ //ce sta vodoravni orientaciji
@@ -387,7 +336,6 @@ class LatexSurveyElement{ }
#ce vprasanje nima moznih odgovorov, je potrebno zakljuciti environment (absolutelynopagebreak) pri pdf - konec
}
- //echo "tex: ".$tex."</br>";
return $tex;
}
#funkcija, ki pripravi latex kodo za prikazovanje besedila vprasanja - konec ############################################################################
@@ -395,7 +343,7 @@ class LatexSurveyElement{ #funkcija, ki pripravi latex kodo za prikazovanje moznih odgovorov glede na tip vprasanja################################################################
public function displayAnswers($spremenljivke=null, $export_subtype='', $preveriSpremenljivko=null, $export_data_type='', $loop_id=null){
-
+
switch ( $spremenljivke['tip'] )
{
case 1: //radio
@@ -406,7 +354,7 @@ class LatexSurveyElement{ case 6: //multigrid
case 16:// multicheckbox
case 19:// multitext
- case 20:// multinumber
+ case 20:// multinumber
return MultiGridLatex::getInstance()->export($spremenljivke, $this->export_format, $this->questionText, $this->fillablePdf, $this->texNewLine, $this->getUserId(), $this->db_table, $export_subtype, $preveriSpremenljivko, $this->skipEmptySub, $export_data_type, $this->skipEmpty, $loop_id, $this->language);
break;
case 21: //besedilo
@@ -428,7 +376,7 @@ class LatexSurveyElement{ return VsotaLatex::getInstance()->export($spremenljivke, $this->export_format, $this->questionText, $this->fillablePdf, $this->texNewLine, $this->getUserId(), $this->db_table, $export_subtype, $preveriSpremenljivko, $loop_id);
break;
case 24: // kombinirana tabela
- return GridMultipleLatex::getInstance()->export($spremenljivke, $this->export_format, $this->questionText, $this->fillablePdf, $this->texNewLine, $this->getUserId(), $this->db_table, $export_subtype, $preveriSpremenljivko, $export_data_type, $loop_id);
+ return GridMultipleLatex::getInstance()->export($spremenljivke, $this->export_format, $this->questionText, $this->fillablePdf, $this->texNewLine, $this->getUserId(), $this->db_table, $export_subtype, $preveriSpremenljivko, $export_data_type, $loop_id, $this->language);
break;
case 26: //lokacija
return LokacijaLatex::getInstance()->export($spremenljivke, $this->export_format, $this->questionText, $this->fillablePdf, $this->texNewLine, $this->getUserId(), $this->db_table, $export_subtype, $preveriSpremenljivko, $loop_id);
@@ -470,7 +418,6 @@ class LatexSurveyElement{ function displayIf($if=null){
global $lang;
- //echo "funckija za if </br>";
$sql_if = sisplet_query("SELECT tip FROM srv_if WHERE id = '$if'");
$row_if = mysqli_fetch_array($sql_if);
@@ -521,7 +468,7 @@ class LatexSurveyElement{ } else
$row1 = null;
- $output .= $this->encodeText($row1['variable']);
+ $output .= LatexDocument::encodeText($row1['variable']);
// radio, checkbox, dropdown in multigrid
if (($row2['tip'] <= 3 || $row2['tip'] == 6) && ($row['spr_id'] || $row['vre_id'])) {
@@ -595,24 +542,19 @@ class LatexSurveyElement{ }
#funkcija, ki skrbi za izbiro radio, checkbox ali ostale simbole, ki so potrebni za izris odgovorov #############################################################
- function getAnswerSymbol($export_format='', $fillablePdf=null, $spremenljivkeTip=null, $spremenljivkeGrids=null, $numOfMissings=null, $data=null, $enota='', $indeksVASIcon='', $VASNumberRadio='', $spremenljivkeId=null){
- $tip=$spremenljivkeTip;
+ function getAnswerSymbol($export_subtype=null, $export_format='', $fillablePdf=null, $spremenljivkeTip=null, $spremenljivkeGrids=null, $numOfMissings=null, $data=null, $enota='', $indeksVASIcon=0, $VASNumberRadio='', $spremenljivkeId=null){
+ //return;
+ $tip = $spremenljivkeTip;
global $site_path;
$this->path2Images = $site_path.'admin/survey/export/latexclasses/textemp/images/';
- //echo $tip;
- //$numGrids=$spremenljivke['grids'];
+ $this->export_subtype = $export_subtype;
$numGrids=$spremenljivkeGrids;
- //echo "Data:".($data)."</br>";
- //echo "DataCount:".count($data)."</br>";
- //if($tip==21||$tip==8){ //ce je besedilo ali datum,
if($tip==21||$tip==4||$tip==8){ //ce je besedilo ali datum,
$tip=2; //naj se pobere checkbox
}
-
if( ($export_format=='pdf'&&$fillablePdf==0)||$export_format=='rtf'){//ce je navaden pdf ali rtf dokument (brez moznosti izbire ali vnosa v polja)
-
if($data){
- $data = $this->encodeText($data);
+ $data = LatexDocument::encodeText($data);
}
if($tip==1||$tip==6){ //radio ali multigrid z radio
@@ -654,9 +596,9 @@ class LatexSurveyElement{ break;
case 5:
$arrayVAS = [ 'vas2checked', 'vas3checked', 'vas4checked', 'vas5checked', 'vas6checked'];
- foreach($arrayVAS AS $VAS){
+ /* foreach($arrayVAS AS $VAS){
$radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ } */
break;
case 6:
$arrayVAS = ['vas1checked', 'vas2checked', 'vas3checked', 'vas5checked', 'vas6checked', 'vas7checked'];
@@ -677,99 +619,77 @@ class LatexSurveyElement{ $prviOdgovorSlikovniTip = 1;
$radioButtonTex = ICON_SIZE."{".$this->path2Images."".$this->getCustomRadioSymbol($spremenljivkeId, $prviOdgovorSlikovniTip)."}";
}
- }else{
+ }else{ //ce ni odgovorov respondenta oz. je prazen vprasalnik
if($enota!=11&&$enota!=12){ //ce ni VAS ali slikovni tip
$radioButtonTex = ($export_format=='pdf'?"{\Large $\ocircle$}" : "\\includegraphics[scale=".RADIO_BTN_SIZE."]{".$this->path2Images."radio}");
}elseif($enota==11){ //drugace, ce je VAS
- if($tip==1){
+ if($tip == 1){ //ce je radio
$VASNumber = $VASNumberRadio;
- }else{
- $spremenljivkeGrids = $spremenljivkeGrids - 1;
+ }else{ //drugace (ce je tabela z radio)
$VASNumber = $spremenljivkeGrids;
- }
- $indeksVASIcon = $indeksVASIcon - 1;
- $radioButtonTex = [];
- if($VASNumber>1){
+ }
+ if($VASNumber > 1){
switch ($VASNumber) {
case 1:
$radioButtonTex = "";
break;
case 2:
- $arrayVAS = ['vas3', 'vas5'];
- foreach($arrayVAS AS $VAS){
- $radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ $radioButtonTex = array("\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas3}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas5}");
break;
case 3:
- $arrayVAS = ['vas3', 'vas4', 'vas5'];
- foreach($arrayVAS AS $VAS){
- $radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ $radioButtonTex = array("\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas3}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas4}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas5}");
break;
- case 4:
- $arrayVAS = ['vas2', 'vas3', 'vas5', 'vas6'];
- foreach($arrayVAS AS $VAS){
- $radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ case 4:
+ $radioButtonTex = array("\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas1}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas3}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas5}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas7}");
break;
case 5:
- $arrayVAS = [ 'vas2', 'vas3', 'vas4', 'vas5', 'vas6'];
- foreach($arrayVAS AS $VAS){
- $radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ $radioButtonTex = 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}");
break;
case 6:
- $arrayVAS = ['vas1', 'vas2', 'vas3', 'vas5', 'vas6', 'vas7'];
- foreach($arrayVAS AS $VAS){
- $radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ $radioButtonTex = array("\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas1}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas2}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas3}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas5}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas6}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas7}");
break;
case 7:
- $arrayVAS = ['vas1', 'vas2', 'vas3', 'vas4', 'vas5', 'vas6', 'vas7'];
- foreach($arrayVAS AS $VAS){
- $radioButtonTex[] = "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."".$VAS."}";
- }
+ $radioButtonTex = array("\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas1}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas2}", "\\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."vas6}", "\\includegraphics[scale=".VAS_SIZE."]{".$this->path2Images."vas7}");
break;
}
- return $radioButtonTex[$indeksVASIcon]; //$indeksVASIcon
+ //echo "polje z VAS simboli </br>";
+ return $radioButtonTex;
}
- }elseif($enota==12){
+ }elseif($enota==12){ //ce je slikovni tip
$prviOdgovorSlikovniTip = 0;
$radioButtonTex = ICON_SIZE."{".$this->path2Images."".$this->getCustomRadioSymbol($spremenljivkeId, $prviOdgovorSlikovniTip)."}";
}
}
return $radioButtonTex;
}else if($tip==2||$tip==16){ //checkbox ali multigrid s checkbox
- if($data){
+ if($data){ //ce je odgovor respondenta
$checkboxTex = ($export_format=='pdf'?'{\Large \CheckedBox}' : "\\includegraphics[scale=".CHCK_BTN_SIZE."]{".$this->path2Images."checkbox2}");
- }else{
+ }else{ //ce ni odgovorov respondenta oz. je prazen vprasalnik
$checkboxTex = ($export_format=='pdf'?'{\Large \Square}' : "\\includegraphics[scale=".CHCK_BTN_SIZE."]{".$this->path2Images."checkbox}");
}
return $checkboxTex;
}elseif($tip==19||$tip==20){ //multi text ali multi number
- $textboxWidth = 0.5/($numGrids+$numOfMissings); //sirina praznega textbox-a
+ $textboxWidth = 0.4/($numGrids+$numOfMissings); //sirina praznega textbox-a
//priprava latex kode za prazen text box dolocene sirine in visine glede na export format
- if($export_format == 'pdf'){
- if($data!=''){
+ if($export_format == 'pdf'){
+ if($data != null){ //ce je odgovor respondenta
$TextBoxWithText = ' \\textcolor{crta}{\footnotesize{'.$data.'}} ';
- //$TextBoxWithText = ' \\textcolor{crta}{\footnotesize{'.$this->encodeText($data).'}} ';
$emptyTextBox = $TextBoxWithText;
- }else{
+ }else{ //ce ni odgovorov respondenta oz. je prazen vprasalnik
if($this->export_subtype == 'q_empty' || $this->export_subtype == 'q_comments'){
$emptyTextBox = ' \fbox{\parbox{'.$textboxWidth.'\textwidth}{ \hphantom{\hspace{'.$textboxWidth.'\textwidth}} }} ';
}else{
$emptyTextBox = ' ';
}
-
}
}elseif($export_format == 'rtf'){
- if($data!=''){
+ if($data!=0){ //ce je odgovor respondenta
$TextBoxWithText = ' '.$data.' ';
$emptyTextBox = $TextBoxWithText;
- }else{
+ }else{ //ce ni odgovorov respondenta oz. je prazen vprasalnik
if($this->export_subtype == 'q_empty' || $this->export_subtype == 'q_comments'){
- $emptyTextBox =' \fbox{\parbox{'.$textboxWidth.'\textwidth}{ \hphantom{\hspace{'.$textboxWidth.'\textwidth}} }} ';
+ $emptyTextBox =' \rule{'.$textboxWidth.'\textwidth}{.1pt} ';
}else{
$emptyTextBox = ' ';
}
@@ -795,548 +715,6 @@ class LatexSurveyElement{ return $temp;
}
#funkcija, ki ureja pretvorbo stevilskega ID vprasanja v "crkovsko" identifikacijo, ker Latex ne podpira imen s stevilkami - konec #############################
-
- #funkcija ki skrbi za encode dolocenih spornih delov besedila v latex-u prijazno
- function encodeText($text='', $vre_id=0, $naslovStolpca = 0){
- global $site_path, $lang;
- //$text = str_replace(' ','X',$text); //nadomesti presledke
- //echo "Encoding ".$text."</br>";
- //echo "vre_id: ".$vre_id."</br>";
- //echo "ime spremenljivke ".$this->variableName."</br>";
-
- $text = htmlspecialchars_decode($text); //vse html special chars kot je & spremeni v ustrezne simbole (npr. &=>&)
-
- //resevanje razbirajanja predolgih neprekinjenih besed in URL - spremenljivke za kasnejsi prilagojen izpis
- //$numOfWords = str_word_count($text, 0);
- $numOfSpacesPrej = substr_count($text, ' '); //stevilo presledkov v besedilu
- $stringLength = strlen($text);
-
- $findSpace = ' ';
- $posSpace1 = strpos($text, $findSpace); //najdi pozicijo prvega presledka v besedilu
- $posSpace2 = strripos($text, $findSpace); //najdi pozicijo zadnjega presledka v besedilu
-
-
- $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
-
- $this->path2UploadedImages = $site_path.'uploadi/editor/';
- if($text == ''){ //ce ni teksta, vrni se
- return;
- }
- $textOrig = $text;
- $findme = '<br />';
- $findmeLength = strlen($findme);
- $findImg = '<img';
- $findImgLength = strlen($findImg);
- $findUl = '<ul';
- $findUlLength = strlen($findUl);
- $findOl = '<ol';
- $findLi = '<li';
-
- $findPar = '<p>';
-
- $pos = strpos($text, $findme);
- $posImg = strpos($text, $findImg);
- $posUl = strpos($text, $findUl);
- $posOl = strpos($text, $findOl);
- $posLi = strpos($text, $findLi);
- $posPar = strpos($text, $findPar);
-
- //echo "pozicija paragrafa: $posPar </br>";
-
- //ureditev izrisa slike
- if($posImg !== false){
- $numOfImgs = substr_count($text, $findImg); //stevilo '<img ' v tekstu
- $posImg = strpos($text, $findImg);
- $textPrej = '';
- $textPotem = '';
- for($i=0; $i<$numOfImgs; $i++){
- $posImg = strpos($text, $findImg);
- $textPrej = substr($text, 0, $posImg); //tekst do img
- $textPotem = substr($text, $posImg); //tekst po img, z vkljuceno hmlt kodo z img
- $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->path2UploadedImages."".$this->getImageName($text, 0, '<img')."}".' '.$textPotem;
- //$text = $textPrej.' '.PIC_SIZE_ANS."{".$this->path2UploadedImages."".$this->getImageName($text, 0, '<img', $vre_id)."}".' '.$textPotem;
- $imageName = $this->path2UploadedImages."".$this->getImageName($text, 0, '<img', $vre_id);
- $imageNameTest = $imageName.'.png'; //za preveriti, ali obstaja slikovna datoteka na strezniku
- //error_log("iz survey element: ".$imageNameTest);
- //echo("iz survey element: ".$imageNameTest."</br>");
- if(filesize($imageNameTest) > 0){
- $text = $textPrej.' '.PIC_SIZE_ANS."{".$imageName."}".' '.$textPotem;
- }else{
- $image = $lang['srv_pc_unavailable'];
- $text = $textPrej.' '.$image.' '.$textPotem;
- }
- }
-
- //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike
- $findImgCode = '\includegraphics';
- $posOfImgCode = strpos($text, $findImgCode);
- //echo $posOfImgCode."</br>";
- $textToImgCode = substr($text, 0, $posOfImgCode); //tekst do $findImgCode
- //echo $textToImgCode."</br>";
- $textFromImgCode = substr($text, $posOfImgCode); //tekst po $findImgCode
- //echo $textFromImgCode."</br>";
- $findImgCodeEnd = '}';
- //$posOfImgCodeEnd = strpos($text, $findImgCodeEnd);
- $posOfImgCodeEnd = strpos($textFromImgCode, $findImgCodeEnd);
- //echo $posOfImgCodeEnd."</br>";
- $textAfterImgCode = substr($textFromImgCode, $posOfImgCodeEnd+1); //tekst po $findImgCodeEnd
- //echo $textAfterImgCode."</br>";
- $textOfImgCode = substr($text, $posOfImgCode, $posOfImgCodeEnd+1);
- //echo $textOfImgCode."</br>";
-
- $text = $textToImgCode.$textAfterImgCode;
-
- //pred ureditvijo posebnih karakterjev, odstrani del teksta s kodo za sliko, da se ne pojavijo tezave zaradi imena datoteke od slike - konec
- }
- //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);
- //$text = str_replace('}','\}',$text);
- $text = str_replace('$','\$ ',$text);
-
- if(substr_count($text, '#')){ //ce je stevilo # vecje od 1
- $text = str_replace('#','\#',$text);
- }else{
- $text = str_replace('#','\# ',$text);
- }
- $text = str_replace('%','\% ',$text);
- $text = str_replace('€','\euro',$text);
- $text = str_replace('^','\textasciicircum{} ',$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);
- }
- $text = str_replace(' ','~',$text);
- //$text = str_replace('<','\textless ',$text);
- $text = str_replace('<',' \textless ',$text);
- //$text = str_replace('>','\textgreater ',$text);
- $text = str_replace('>',' \textgreater ',$text);
- //ureditev posebnih karakterjev za Latex - konec
-
- //ureditev grskih crk
- $text = str_replace('α','\textalpha ',$text);
- $text = str_replace('β','\textbeta ',$text);
- $text = str_replace('γ','\textgamma ',$text);
- $text = str_replace('δ','\textdelta ',$text);
- $text = str_replace('ε','\textepsilon ',$text);
- $text = str_replace('ζ','\textzeta ',$text);
- $text = str_replace('η','\texteta ',$text);
- $text = str_replace('θ','\texttheta ',$text);
- $text = str_replace('ι','\textiota ',$text);
- $text = str_replace('κ','\textkappa ',$text);
- $text = str_replace('λ','\textlambda ',$text);
- $text = str_replace('μ','\textmugreek ',$text);
- $text = str_replace('ν','\textnu ',$text);
- $text = str_replace('ξ','\textxi ',$text);
- //$text = str_replace('ο','\textomikron ',$text);
- $text = str_replace('π','\textpi ',$text);
- $text = str_replace('ρ','\textrho ',$text);
- $text = str_replace('σ','\textsigma ',$text);
- $text = str_replace('τ','\texttau ',$text);
- $text = str_replace('υ','\textupsilon ',$text);
- $text = str_replace('φ','\textphi ',$text);
- $text = str_replace('χ','\textchi ',$text);
- $text = str_replace('ψ','\textpsi ',$text);
- $text = str_replace('ω','\textomega ',$text);
- //ureditev grskih crk - konec
-
- //ureditev preureditve html kode ul in li v latex itemize
- if($posUl !== false){
- //echo "text prej: ".$text."</br>";
- $numOfUl = substr_count($text, $findUl); //stevilo '<ul' v tekstu
- //echo "numOfUl ".$numOfUl."</br>";
- ######################
- //if($numOfUl!=0){
- if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
- $text = str_replace('<ul>','\begin{itemize} ', $text);
- $text = str_replace('<ul','\begin{itemize} ', $text);
- $text = str_replace('<li>','\item ', $text);
- $text = str_replace('<li','\item ', $text);
- $text = str_replace('</ul>','\end{itemize} \ ', $text);
- }
- //echo "prazno v html: ".strpos($text, '\r')."</br>";
- //echo "text potem: ".$text."</br>";
- ######################
- }
- //ureditev preureditve html kode ul in li v latex itemize - konec
-
- //ureditev preureditve html kode ol in li v latex enumerate, ki je ostevilcen
- if($posOl !== false){
- //echo "text prej: ".$text."</br>";
- $numOfOl = substr_count($text, $findOl); //stevilo '<ol' v tekstu
- //echo "numOfUl ".$numOfUl."</br>";
- ######################
- //if($numOfUl!=0){
- if($numOfOl!=0 && $posLi !== false){ //ce imamo ol in li
- $text = str_replace('<ol>','\begin{enumerate} ', $text);
- $text = str_replace('<li>','\item ', $text);
- $text = str_replace('<li','\item ', $text);
- $text = str_replace('</ol>','\end{enumerate} \ ', $text);
- }
- //echo "prazno v html: ".strpos($text, '\r')."</br>";
- //echo "text potem: ".$text."</br>";
- ######################
- }
- //ureditev preureditve html kode ol in li v latex enumerate, ki je ostevilcen - 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($posPar !== false){ //ce je kaksen html tag <p>, dodaj prazno vrstico oz. break
- if($this->variableName=='gdpr'){
- if($numOfUl!=0 && $posLi !== false){ //ce imamo ul in li
- $divider = ' ';
- }else{
- $divider = ' \\ \\\\ ';
- }
- $text = str_replace('<p>',$divider, $text);
- }else{
- $text = str_replace('<p>',' ', $text);
- }
- }
-
-
- //priprava izpisa zelo dolgega besedila brez presledkov (URL, email, ...)
- //if($numOfSpacesPrej == 0 && ($stringLength >= MAX_STRING_LENGTH)){ //ce v besedilu ni presledkov in je besedilo daljse od max dovoljene dolzine
- if( ($numOfSpacesPrej == 0 && ($stringLength >= MAX_STRING_LENGTH)) || ($numOfSpacesPrej == 1 && $posSpace1 == $posSpace2 && $stringLength >= MAX_STRING_LENGTH)){ //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
- $text = substr_replace($text, $this->texNewLine, MAX_STRING_LENGTH, 0); //dodaj na ustrezni dolzini besedila prehod v novo vrstico
- }
- //priprava izpisa zelo dolgega besedila brez presledkov - konec
- //echo "text potem: ".$text."</br>";
-
- //detekcija prisotnosti e-naslova v besedilu in primerna preureditev, da pride do pravilnega izpisa
- $findAt = '@';
- $numOfAt = substr_count($text, $findAt); //stevilo '@' v besedilu
-
- $posAt = strpos($text, $findAt);
- if($posAt && $posSpace1){ //ce je prisotna afna in je prisoten presledek v besedilu
- //echo "afna je: $posAt </br>";
- //echo "Encoding: ".$text."</br>";
-
- //najdi prvi presledek po afni
- //echo substr($text, $posAt) ."</br>";
- $posSpace1Mail = strpos(substr($text, $posAt), $findSpace); //najdi pozicijo prvega presledka v besedilu po e-naslovu
- $posSpace1Mail = $posSpace1Mail+$posAt; //koncna pozicija, ce se gleda celotno besedilo
- //echo $posSpace1Mail."</br>";
-
- //najdi prvi presledek pred afno
- $posSpace2Mail = strripos(substr($text, 0, $posAt), $findSpace); //najdi pozicijo zadnjega presledka v besedilu pred e-naslovom
- //echo $posSpace2Mail."</br>";
-
- //dodaj po e-naslovu potrebno latex kodo za zakljucek url
- $text = substr_replace($text, '}', $posSpace1Mail, 0);
-
- //dodaj pred e-naslovom potrebno latex kodo za url
- //substr_replace(string_name, replacement_string, start_pos, length)
- $text = substr_replace($text, ' \url{', $posSpace2Mail+1, 0);
- //echo $text."</br>";
- }
- //detekcija prisotnosti e-naslova v besedilu in primerna preureditev, da pride do pravilnega izpisa - konec
-
-
- //RESEVANJE BESEDILA V CIRILICI
- $contains_cyrillic = (bool) preg_match('/[\p{Cyrillic}]/u', $text); //ali je v besedilu cirilica?
- if($contains_cyrillic){ // ce je cirilica v besedilu
- $text = '\foreignlanguage{russian}{'.$text.'}';
- }
- //RESEVANJE BESEDILA V CIRILICI - konec
-
-
-
- //RESEVANJE odstranitve dodatnih style tag-ov po ul, ipd. #######################################################
- $findStyleTag = 'style="';
- //$findStyleTagEnd = '"';
- $findStyleTagEnd = '">';
- $numOfStyleTags = substr_count($text, $findStyleTag); //stevilo 'style=" ' v tekstu
- //echo "stevilo style: ".$numOfStyleTags." </br>";
- //echo $text."</br>";
- for($s=0; $s<$numOfStyleTags; $s++){ //za vsako najdeno 'style=" ' besedilo, uredi njeno odstranitev
- $posStyleTag = strpos($text, $findStyleTag);
- $posStyleTagEnd = strpos($text, $findStyleTagEnd, $posStyleTag); //strpos(string,find,start) najdi $findStyleTagEnd v $text, isci od $posStyleTag dalje
- $dolzinaOff = $posStyleTagEnd - $posStyleTag + 2;
- $text = substr_replace($text, "", $posStyleTag, $dolzinaOff);
-
- }
- //RESEVANJE odstranitve dodatnih style tag-ov po ul, ipd. - konec #################################################
-
- if($pos === false && $posImg === false) { //v tekstu ni br in img
-
- $text = preg_replace("/(\R){2,}/", "$1", $text);
- return strip_tags($text);
- }else { //v tekstu sta prisotna br ali img
- $text2Return = ''; //tekst ki bo vrnjen
-
- //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico
- if($naslovStolpca==0){ // ce besedilo ni naslov stolpca tabele
- if($pos !== false){
- $pos = strpos($text, $findme);
- $numOfBr = substr_count($text, $findme); //stevilo '<br />' v tekstu
- for($i=0; $i<$numOfBr; $i++){
- if($i == 0){ //ce je prvi najdeni '<br />'
- $textPrej = substr($text, 0, $pos);
- $textPotem = substr($text, $pos+$findmeLength);
- if($i == $numOfBr-1){
- //$text2Return .= $textPrej.' \break '.$textPotem;
- $text2Return .= $textPrej.' \\\\ '.$textPotem;
- }else{
- //$text2Return .= $textPrej.' \break ';
- $text2Return .= $textPrej.' \\\\ ';
- }
- }else{ //drugace
- $pos = strpos($textPotem, $findme);
- $textPrej = substr($textPotem, 0, $pos);
- $textPotem = substr($textPotem, $pos+$findmeLength);
- if($i == $numOfBr-1){
- //$text2Return .= $textPrej.' \break '.$textPotem;
- $text2Return .= $textPrej.' \\\\ '.$textPotem;
- }else{
- //$text2Return .= $textPrej.' \break ';
- $text2Return .= $textPrej.' \\\\ ';
- }
- }
- }
- $text = $text2Return;
- }
- }
- //ureditev preureditev html kode za novo vrstico v latex, ureditev prenosa v novo vrstico - konec
- //echo "text potem: ".$text."</br>";
- $text = preg_replace("/(\R){2,}/", "$1", $text);
- return strip_tags($text); //vrni tekst brez html tag-ov
- }
- }
- #funkcija ki skrbi za encode dolocenih spornih delov besedila v latex-u prijazno - konec
-
- #funkcija, ki skrbi za pridobitev imena slike, ki jo je potrebno izrisati ######################################
- function getImageName($text='', $sprId=null, $findme='', $vre_id=0){
- global $site_path;
- $imageName = '';
-
- 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."</br>";
- //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."</br>";
-
- $findme = $site_path.'uploadi/editor/';
- //$findme = 'uploadi/editor/';
-
- $pos = strpos($imageName, $findme); //najdi pozicijo teksta v $findme
- //echo "najdi tole: ".$findme."</br>";
- //echo "najdi tukaj: ".$imageName."</br>";
- //echo "pozicija tega: ".$pos."</br>";
- 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."</br>";
- if($slikaNaStrezniku==1){ //ce je slika na strezniku
- $imageName = substr($imageName,$pos+7); //pokazi le del params od besedila 'editor/' dalje, brez besedila 'editor/'
- $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)
- /* echo "exr1: ".$imageExtension."</br>";
- $imageExtension = strrchr($imageName, '.'); //pridobi koncnico slike (za gif je potrebno sliko pretvoriti v png, saj latex ne podpira gif, jpg in jpeg)
- echo "exr2: ".$imageExtension."</br>"; */
-
- $imageName = substr($imageName, 0, $pos); //pokazi le del params od zacetka besedila do '"' oz. konca URL slike
-
- $path = $site_path.'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 </br>";
- $imageName = $this->getOnlineImageName($imageName, $slikaNaStrezniku, $vre_id); //pridobi njen URL
- }
-
- $imageName = substr($imageName, 0, strrpos($imageName, '.'));
-
- }
-
- //echo "imagename pred return: ".$imageName."</br>";
- return $imageName;
- }
- #funkcija, ki skrbi za pridobitev imena slike, ki jo je potrebno izrisati - konec ###############################
-
-
- #funkcija, ki skrbi za pridobitev ustrezne strezniske poti do slike - trenutno ni v uporabi ########################################################
- function getPath2Images($text='', $sprId=null, $findme=''){
- global $site_path;
- $imageName = '';
-
- 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
-
- if($pos!=''||$pos==0){ //ce je slika v bazi
- $imageName = substr($text,$pos); //pokazi le del text od besedila $findme dalje (vkljucno z besedilom)
-
- $findme = 'editor/';
- $pos = strpos($imageName, $findme); //najdi pozicijo teksta 'editor/'
-
- if($pos){ //ce je slika na strezniku
- $slikaNaStrezniku = 1;
- }else{//ce slike ni na strezniku
- $slikaNaStrezniku = 0;
- }
-
- if($slikaNaStrezniku==1){ //ce slika je bila prenesena na streznik
- $path2Images = $site_path.'admin/survey/export/latexclasses/textemp/images/';
- }elseif($slikaNaStrezniku==0){ //ce slika je bila na dolocenem URL
- $path2Images = $site_path.'uploadi/editor/';
- }
-
- }
- //echo "pot do slik: ".$path2Images."</br>";
- return $path2Images;
- }
- #funkcija, ki skrbi za pridobitev ustrezne strezniske poti do slike - konec ########################################################
-
-
- #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){
- global $site_path;
- //echo "imageName v getOnlineImageName nekje vmes 1: ".$imageName."</br>";
- $row = Cache::srv_spremenljivka(self::$spremenljivka);
- //echo "sprem: ".self::$spremenljivka."</br>";
- $spremenljivkaParams = new enkaParameters($row['params']);
- //echo "params: ".$spremenljivkaParams->get('hotspot_image')."</br>";
- $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."</br>";
- $imageExtension = substr($imageName, $pos-3, 3); //pridobi koncnico slike
- //echo "imageExtension: ".$imageExtension."</br>";
-
- if($imageExtension!='jpg'&&$imageExtension!='png'&&$imageExtension!='gif'&&$imageExtension!='jpeg'){ //ce ni veljavnen extension, spremeni ga v png
- $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
- }else{
- $imgFilename = self::$spremenljivka.'_tmpImage.'.$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 "command: ".$command."</br>";
- 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);
- } */
-
- 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: ".$imgFilename."</br>";
- return $imgFilename;
- }
- #funkcija, ki skrbi za pridobitev slike, ki se nahaja nekje online in jo je potrebno izrisati, in vrne lokalno ime slike - konec ###############################
-
-
- function convertGifToPng($path='', $slikaNaStrezniku=null){
- //echo "path: ".$path."</br>";
- $image = imagecreatefromgif($path); //pripravi sliko iz gif za pretvorbo
- $imageName = substr($path, 0, -3); //ime slike brez extension-a
- //echo $imageName."</br>";
- $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
-
- $imageNamePNG = $imageName.'.png'; //ime slike z ustreznim extension
- imagepng($image, $imageNamePNG); //pretvori pripravljeno jpg sliko v png
-
- //$origExtension = strrchr($path, '.');
-
- if($slikaNaStrezniku==0){ //ce slika je iz URL in ni na strezniku, izbrisi jo
- if($imageExtension == 'jpg'){
- unlink($imageName.'.'.$imageExtension); //izbrisi sliko
- }elseif($imageExtension == 'peg'){
- unlink($imageName.'.j'.$imageExtension); //izbrisi sliko
- }
- }
- }
-
- function getEndPosition($imageName=''){
- $findme = '"';
- $pos = strpos($imageName, $findme); //najdi pozicijo teksta '"'
- return $pos;
- }
-
#funkcija, ki skrbi za pridobitev simbola za slikovni tip ######################################
function getCustomRadioSymbol($sprId=null, $odgovor=null){
@@ -1351,7 +729,6 @@ class LatexSurveyElement{ if($odgovor){ //ce je odgovor
$customRadioSymbol = $customRadioSymbol."Inverted"; //preuredi, da bo razvidna grafika, ko je prisoten odgovor respondenta
}
- //echo $customRadioSymbol.' asca</br>';
return $customRadioSymbol;
}
#funkcija, ki skrbi za pridobitev simbola za slikovni tip - konec ###############################
@@ -1363,11 +740,12 @@ class LatexSurveyElement{ * @param mixed $vrednost
*/
function srv_language_vrednost ($vre_id=null) {
- //if ($this->language != -1) {
+ //if ($this->language != -1) {
+
if ($this->prevod) {
$sqllString = "SELECT naslov, naslov2 FROM srv_language_vrednost WHERE vre_id='".$vre_id."' AND lang_id='".$this->language."'";
$sqll = sisplet_query($sqllString);
- $rowl = mysqli_fetch_array($sqll);
+ $rowl = mysqli_fetch_array($sqll);
return $rowl;
}
return false;
@@ -1379,10 +757,9 @@ class LatexSurveyElement{ * @param mixed $vrednost
*/
function srv_language_grid ($grd_id=null, $spr_id=null) {
-
//if ($this->language != -1) {
if ($this->prevod) {
- $sqllString = "SELECT naslov FROM srv_language_grid WHERE spr_id = '".$spr_id."' AND grd_id='".$grd_id."' AND lang_id='".$this->language."'";
+ $sqllString = "SELECT naslov, podnaslov FROM srv_language_grid WHERE spr_id = '".$spr_id."' AND grd_id='".$grd_id."' AND lang_id='".$this->language."'";
$sqll = sisplet_query($sqllString);
$rowl = mysqli_fetch_array($sqll);
return $rowl;
@@ -1390,7 +767,7 @@ class LatexSurveyElement{ return false;
}
-/* function srv_language_grid ($spremenljivka, $grid) {
+ function srv_language_grid_old ($spremenljivka, $grid) {
if ($this->language != -1) {
$sqll = sisplet_query("SELECT * FROM srv_language_grid WHERE ank_id='".$this->anketa['id']."' AND spr_id='".$spremenljivka."' AND grd_id='".$grid."' AND lang_id='".$this->language."'");
@@ -1400,7 +777,7 @@ class LatexSurveyElement{ }
return false;
- } */
+ }
#funkcija, ki skrbi za filanje obstojecega polja z odgovori z missing odgovori #############################################################
function AddMissingsToAnswers($vodoravniOdgovori=[], $missingOdgovori=[]){
@@ -1414,11 +791,12 @@ class LatexSurveyElement{ #funkcija, ki skrbi za izpis latex kode za zacetek tabele ##################################################################################
#argumenti 1. export_format, 2. parametri tabele, 3. tip tabele za pdf, 4. tip tabele za rtf, 5. sirina pdf tabele (delez sirine strani), 6. sirina rtf tabele (delez sirine strani)
function StartLatexTable($export_format='', $parameterTabular='', $pdfTable=null, $rtfTable=null, $pdfTableWidth=null, $rtfTableWidth=null){
- $tex = '';
- $tex .= '\keepXColumns';
+ $tex = "";
+ $tex .= "\keepXColumns";
if($export_format == 'pdf'){
- $tex .= '\begin{'.$pdfTable.'}';
- if($pdfTable=='tabularx'){
+ //$tex .= "\r\n";
+ $tex .= "\begin{".$pdfTable."}";
+ if($pdfTable=='xltabular'){
$tex .= '{'.$pdfTableWidth.'\textwidth}';
}
$tex .= '{ '.$parameterTabular.' }';
@@ -1458,13 +836,16 @@ class LatexSurveyElement{ $tex .= ' {\parbox{'.$textboxWidth.'\textwidth}';
}
+
+ if(is_array($text)){
+ $text = implode(" ", $text);
+ }
if($text==''){ //ce ni teksta, je okvir prazen
if($export_format == 'pdf'){
$tex .= '{ \hphantom{\hspace{'.$textboxWidth.'\textwidth}} }}';
}elseif($export_format == 'rtf'){
- //$tex .= ' \rule{40mm}{.1pt} '; //izpisi neprekinjeno crto, ki je dolga 40mmm in debela 0.1pt
- $tex .= ' \rule{'.$textboxWidth.'\textwidth}{.1pt} '; //izpisi neprekinjeno crto, ki je dolga 40mmm in debela 0.1pt
+ $tex .= ' \rule{'.$textboxWidth.'\textwidth}{.1pt} '; //izpisi neprekinjeno crto, ki je premaknjena za hspace in dolga $textboxWidth in debela 0.1pt
}
}else{ //drugace, izpisi besedilo
if($export_format == 'pdf'){
@@ -1483,7 +864,7 @@ class LatexSurveyElement{ function LatexUShape($export_format='', $textboxHeight=null, $textboxWidth=null){
$tex = '';
if($export_format == 'pdf'&&$textboxHeight!=0){
- $tex .= '\keepXColumns\begin{tabularx}{0.25\textwidth}{C} '; //zacetek tabele, ki bo zgledala kot okvir
+ $tex .= '\keepXColumns\begin{xltabular}{0.25\textwidth}{C} '; //zacetek tabele, ki bo zgledala kot okvir
$tex .= ' \begin{tikzpicture} ';
//$tex .= ' \draw (0,0) -- (4,0) -- (4,4) (0,4) -- (0,0);';
$tex .= ' \draw (0,0) -- ('.$textboxWidth.',0) -- ('.$textboxWidth.','.$textboxHeight.') (0,'.$textboxHeight.') -- (0,0);';
@@ -1503,7 +884,7 @@ class LatexSurveyElement{ $tex = '';
if($export_format == 'pdf'&&$textboxHeight!=0){
- $tex .= '\keepXColumns\begin{tabularx}{0.25\textwidth}{C} '; //zacetek tabele, ki bo zgledala kot okvir
+ $tex .= '\keepXColumns\begin{xltabular}{0.25\textwidth}{C} '; //zacetek tabele, ki bo zgledala kot okvir
$tex .= ' \begin{tikzpicture} ';
//\draw (-2,0) -- (2,0) -- (2,1.5 cm) (-2,1.5 cm) -- (-2,0)
@@ -1531,11 +912,11 @@ class LatexSurveyElement{ $tex = '';
if($export_format == 'pdf'&&$textboxHeight!=0){
if($jeOdgovor==0){
- $tex .= '\keepXColumns\begin{tabularx}{0.25\textwidth}{|C|} '; //zacetek tabele, ki bo zgledala kot okvir
+ $tex .= '\keepXColumns\begin{xltabular}{0.25\textwidth}{|C|} '; //zacetek tabele, ki bo zgledala kot okvir
$tex .= '\hline'; //izris horizontalne obrobe za zacetek tabele
- $tex .= '{\parbox{0.25\textwidth}{\vspace{0.5\baselineskip} \centering ';
+ $tex .= '{\parbox{0.25\textwidth} \centering '; //$tex .= '{\parbox{0.25\textwidth}{\vspace{0.5\baselineskip} \centering ';
$tex .= $textNaslovOkvir;
- $tex .= '\vspace{0.5\baselineskip}}}';
+ $tex .= '}'; //$tex .= '\vspace{0.5\baselineskip}}}';
$tex .= $this->texNewLine;
$tex .= '\hline'; //izris horizontalne obrobe za zakljuciti tabelo
$tex .= '{\parbox{0.25\textwidth}{\vspace{0.5\baselineskip} \centering ';
@@ -1543,15 +924,15 @@ class LatexSurveyElement{ $tex .= '\vspace{0.5\baselineskip}}}';
$tex .= $this->texNewLine;
$tex .= '\hline'; //izris horizontalne obrobe za zakljuciti tabelo
- $tex .= '\end{tabularx}'; //konec tabele znotraj skatle
+ $tex .= '\end{xltabular}'; //konec tabele znotraj skatle
}else{
- $tex .= '\keepXColumns\begin{tabularx}{0.25\textwidth}{|C|} '; //zacetek tabele, ki bo zgledala kot okvir
+ $tex .= '\keepXColumns\begin{xltabular}{0.25\textwidth}{|C|} '; //zacetek tabele, ki bo zgledala kot okvir
$tex .= '\hline'; //izris horizontalne obrobe za zacetek tabele
$tex .= $textNaslovOkvir;
$tex .= '\hline'; //izris horizontalne obrobe za zakljuciti tabelo
$tex .= $textIzpis;
$tex .= '\hline'; //izris horizontalne obrobe za zakljuciti tabelo
- $tex .= '\end{tabularx}'; //konec tabele znotraj skatle
+ $tex .= '\end{xltabular}'; //konec tabele znotraj skatle
}
}elseif($export_format == 'rtf'||($export_format == 'pdf'&&$textboxHeight==0)){
$tex .= ' \fbox{\parbox{'.$textboxWidth.'\textwidth}';
@@ -1567,34 +948,29 @@ class LatexSurveyElement{ $tex = '';
for($i = 0; $i < $steviloStolpcev; $i++){
if ($i != 0){ //ce ni prvi stolpec
- //if($enota==11 || $enota==12 || ($enota==0 && ($trak==0&&$customColumnLabelOption==1)) ||($enota==0 && $spremenljivke['tip']==16) ||($enota==1 && ($trak==0&&$customColumnLabelOption==1)) || $enota==8 || $enota==3){ //klasicna ali diferencial tabela (brez traku) ali tabela da/ne ali dvojna tabela ali VAS ali slikovni tip
- if(($enota==0 && ($trak==0&&$customColumnLabelOption==1)) ||($enota==0 && $spremenljivke['tip']==16) ||($enota==1 && ($trak==0&&$customColumnLabelOption==1)) || $enota==8 || $enota==3 || $enota==11 || $enota==12 || ($enota==2 && $spremenljivke['tip']==24)){ // ce je klasicna ali diferencial tabela (brez traku) ali tabela da/ne ali dvojna tabela ali VAS ali slikovni tip ali roleta/seznam v kombinirani tabeli
+ if((($enota==0 && ($trak==0&&$customColumnLabelOption==1)) || ($enota==1 && ($trak==0&&$customColumnLabelOption==1))) ||($enota==0 && $spremenljivke['tip']==16) ||($enota==1 && ($trak==0&&$customColumnLabelOption==1)) || $enota==8 || $enota==3 || $enota==11 || $enota==12 || ($enota==2 && $spremenljivke['tip']==24)){ // ce je (klasicna ali diferencial tabela (brez traku)) ali tabela da/ne ali dvojna tabela ali VAS ali slikovni tip ali roleta/seznam v kombinirani tabeli
if($i==$steviloStolpcev-1 && $enota==1){ //ce je zadnji stolpec in je diferencial
for($m=0;$m<count($missingOdgovori);$m++){
$tex .= " & ".$missingOdgovori[$m];
}
$tex .= " & ";
}else{
- $tex .= " & ".$vodoravniOdgovori[$i-1];
+ $tex .= " & ".$vodoravniOdgovori[$i-1];
+
}
}elseif($enota == 5){ //maxdiff
if($i == 1){
$tex .= ' & ';
}
$tex .= $vodoravniOdgovori[$i];
- }
+ }
}elseif($i == 0 && $enota != 5){ //ce je prvi stolpec tabele in ni "maxdiff"
$tex .= '';
}elseif($i == 0 && $enota == 5){ //ce je prvi stolpec tabele in "maxdiff"
$tex .= $vodoravniOdgovori[$i].' & ';
- //}elseif( ($i == $steviloStolpcev-1 && $enota != 5) || $enota == 1){ //ce je zadnji stolpec tabele in ni "maxdiff" ali je diferencial
- }elseif( ($i == $steviloStolpcev-1 && $enota != 5) ){ //ce je zadnji stolpec tabele in ni "maxdiff" ali je diferencial
- $tex .= ' & ';
+ }elseif( ($i == $steviloStolpcev-1 && $enota != 5) ){ //ce je zadnji stolpec tabele in ni "maxdiff"
+ $tex .= ' & ';
}
-
-
- //echo "odgovori ".$i.": ".$vodoravniOdgovori[$i-1]." </br>";
- //echo "koda za indeks ".$i.": ".$tex." </br>";
}
#Nastavitev UPORABA LABEL
@@ -1641,102 +1017,94 @@ class LatexSurveyElement{ }
}
#Nastavitev UPORABA LABEL - KONEC
- //echo "</br>";
//$tex .= '\endhead'; //da se naslovna vrstica ponovi na vsaki strani, ce tabela gre na novo stran
- //echo "koda: ".$tex."</br>";
- return $tex;
+ return $tex;
}
#funkcija, ki skrbi za pravilen izris prve vrstice v tabelah (vrstica z vodoravnimi naslovi multigridov) - konec #####################
#funkcija, ki skrbi za izris vrstic tabele (z multigrid) ###########################################################
- function LatexVrsticeMultigrid($numRowsSql=null, $export_format='', $enota=null, $simbolTex=null, $navpicniOdgovori=null, $trakStartingNumberTmp=null, $fillablePdf=null, $numColSql=null, $spremenljivke=null, $trak=null, $vodoravniOdgovori=null, $texNewLine='', $navpicniOdgovori2=null, $missingOdgovori=null, $vodoravniOdgovoriTip=null, $vodoravniOdgovoriEnota=null, $vodoravniOdgovoriSprId=null, $data=null, $export_subtype=null, $preveriSpremenljivko=null, $userDataPresent=null, $presirokaKombo = null, $export_data_type=null){
+ function LatexVrsticeMultigrid($numRowsSql=null, $export_format='', $enota=null, $simbolTex=null, $navpicniOdgovori=null, $trakStartingNumber=null, $fillablePdf=null, $numColSql=null, $spremenljivke=null, $trak=null, $vodoravniOdgovori=null, $texNewLine='', $navpicniOdgovori2=null, $missingOdgovori=null, $vodoravniOdgovoriTip=null, $vodoravniOdgovoriEnota=null, $vodoravniOdgovoriSprId=null, $data=null, $export_subtype=null, $preveriSpremenljivko=null, $userDataPresent=null, $presirokaKombo = null, $export_data_type=null, $usr_id=null, $loop_id=null, $skipEmpty = null, $skipEmptySub = null){
+ //$time_start = microtime(true);
+
$this->export_subtype = $export_subtype;
$tex = '';
global $lang, $site_path;
$this->path2Images = $site_path.'admin/survey/export/latexclasses/textemp/images/';
- //$radioButtonTex = ($export_format=='pdf'?"{\Large $\ocircle$}" : "\\includegraphics[scale=".RADIO_BTN_SIZE."]{radio}");
$indeksOdgovorovRespondentMultiNumText = 0;
-
- if($spremenljivke['enota']==2||$spremenljivke['enota']==6){ //ce je seznam ali roleta //$enota == 2 || $enota == 6
+
+ if(($spremenljivke['enota']==2||$spremenljivke['enota']==6)&&($spremenljivke['tip']!=20&&$spremenljivke['tip']!=19)){ //ce je seznam ali roleta in ni multinumber ALI multitext
if(count($missingOdgovori)==0){ //ce ni missing vrednosti
$numColSql = $numColSql + 1;
- }
+ }
}
$userAnswerIndex = array();
$userAnswerIndex[$spremenljivke['id']] = 0;
$z = 0;
$skipRow = false;
- $this->skipEmpty = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty'); // izpusti vprasanja brez odgovora
- $this->skipEmptySub = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty_sub'); // izpusti podvprasanja brez odgovora
+ //$this->skipEmpty = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty'); // izpusti vprasanja brez odgovora
+ //$this->skipEmptySub = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty_sub'); // izpusti podvprasanja brez odgovora
+ $this->skipEmpty = $skipEmpty;
+ $this->skipEmptySub = $skipEmptySub;
if($spremenljivke['tip']==24){ //ce je kombinirana tabela
- //echo "stevilo stolpcev za izpis kombinirane podan: ".$numColSql."</br>";
- //print_r($data);
- //if($presirokaKombo == 1 && count($data) != 0 && ($enota == 2 || $enota == 6)){
if($presirokaKombo == 1 && count($data) != 0 && (($enota == 2 || $enota == 6) || $export_data_type == 2 && $vodoravniOdgovoriTip[0] == 6)){
$numColSql = 1 + 1;
- //echo "stevilo stolpcev za izpis kombinirane izračunan: ".$numColSql."</br>";
}else{
$numColSql = count($vodoravniOdgovoriEnota) + 1;
}
}
-
- //echo "stevilo vrstic: $numRowsSql za enoto: ".$spremenljivke['enota']."</br>";
+ if($trakStartingNumber && $trak){
+ $trakStartingNumberTmp = intval($trakStartingNumber); //tmp spremenljivka, ki je potrebna za pravilen izris stevilk, ce imamo trak
+ }
+
+
//IZRIS PO VRSTICAH
+
for ($i = 1; $i <= $numRowsSql; $i++){ //za vsako vrstico
-
+
if($i == 1 && ($enota == 2 || $enota == 6)&&$spremenljivke['tip']!=24){ //ce je prvi dogovor IN je roleta ALI seznam IN ni kombinirana tabela
if($export_format == 'rtf'){ //ce je rtf
$tex .= ' \hline '; //dodaj crto
}
}
-
- //echo "preskakovanje vprašanj: ".$this->skipEmptySub."</br>";
-
+
// Ce imamo nastavljeno preskakovanje podvprasanj preverimo ce je kaksen odgovor v vrstici
if($this->skipEmptySub == 1){
$skipRow = true;
- for($z=$z;$z<$i*($numColSql-1);$z++){
- //echo "Podatek: ".$data[$z]."</br>";
- if($data[$z]){
- //echo "Podatek je"."</br>";
- $skipRow = false;
- $podatekZaSlikovniTip = $data[$z]; //belezi podatek za slikovni tip, ki pride prav za pravilen izpis izvoza
+ for($z = $z; $z < $i * ($numColSql - 1); $z++){
+ if(is_array($data)){
+ if(array_key_exists($z, $data)){
+ if($data[$z]){
+ $skipRow = false;
+ $podatekZaSlikovniTip = $data[$z]; //belezi podatek za slikovni tip, ki pride prav za pravilen izpis izvoza
+ }
+ }
}
}
- }
-
- /* echo "skipRow je $skipRow"."</br>";
- echo "userDataPresent je $userDataPresent"."</br>";
- echo "skipEmpty je ".$this->skipEmpty."</br>"; */
- //echo "____________________________________________</br>";
+ }
// Ce imamo nastavljeno preskakovanje podvprasanj preverimo ce je kaksen odgovor v vrstici - konec
- //echo "za vrstico $i je $skipRow na stolpcih: $numColSql</br>";
- //if(!$skipRow||(!$userDataPresent&&$this->skipEmpty==0)){ /* ce je potrebno preskociti vrstico ALI (ni podatkov za prikaz, vendar je potrebno pokazati vprasanja brez odgovorov) */
- if(!$skipRow||(!$userDataPresent&&$this->skipEmpty==0)||$export_subtype == 'q_empty'){ /* ce je potrebno preskociti vrstico ALI (ni podatkov za prikaz, vendar je potrebno pokazati vprasanja brez odgovorov) */
+
+ if(!$skipRow || (!$userDataPresent && $this->skipEmpty == 0) || $export_subtype == 'q_empty'){ /* ce je potrebno preskociti vrstico ALI (ni podatkov za prikaz, vendar je potrebno pokazati vprasanja brez odgovorov) ALI je prazen vprasalnik */
if($i%2 != 0 && $export_format == 'pdf'){
if($enota == 5){ //ce je maxdiff
+ $tex .= "\\rowcolor[gray]{.9}".$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]).' & '; //pobarvaj ozadje vrstice
//$tex .= "\\rowcolor[gray]{.9}".$simbolTex.' & '; //pobarvaj ozadje vrstice
- $tex .= "\\rowcolor[gray]{.9}".$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]).' & '; //pobarvaj ozadje vrstice
$userAnswerIndex[$spremenljivke['id']]++;
}else{
$tex .= "\\rowcolor[gray]{.9}".$navpicniOdgovori[$i-1]; //pobarvaj ozadje vrstice
}
}else{
if($enota == 5){ //ce je maxdiff
- //$tex .= $simbolTex.' & ';
- $tex .= $this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]).' & ';
+ $tex .= $this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]).' & ';
$userAnswerIndex[$spremenljivke['id']]++;
}else{
$tex .= $navpicniOdgovori[$i-1];
}
}
- //tmp spremenljivka, ki je potrebna za pravilen izris stevilk, ce imamo trak
- //$trakStartingNumberTmp = intval($trakStartingNumber);
- $trakStartingNumberTmp = intval($trakStartingNumberTmp); //spremenil, zaradi intelephense napake
+
//ureditev spremenljivk za pravilen kasnejsi izris seznama ali rolete
$roletaAliSeznam = 0; //belezi, ali je tak tip podtabele ali tabele prisoten
@@ -1750,292 +1118,187 @@ class LatexSurveyElement{ $noItem = 1;
}
}
-
-
//$numColSql = count($vodoravniOdgovoriEnota) + 1;
-
-
- //echo "stevilo stolpcev za izpis kombinirane izračunan: ".$numColSql."</br>";
- //echo "stevilo stolpcev za izpis kombinirane izračunan: ".count($vodoravniOdgovoriEnota)."</br>";
- //print_r($vodoravniOdgovoriEnota);
- //$numColSql = 4;
- /* echo "Enote: ";
- print_r($vodoravniOdgovoriEnota);
- echo "</br>";
- echo "Vodoravni odgvoroi spr id: ";
- print_r($vodoravniOdgovoriSprId);
- echo "</br>";
- echo "Podatki: ";
- print_r($data);
- echo "</br>";
- echo "Tip: ";
- print_r($vodoravniOdgovoriTip);
- echo "</br>"; */
}
//ureditev spremenljivk za pravilen kasnejsi izris seznama ali rolete - konec
- //echo "___________________________________________________</br>";
-
- $izpisRoletePresiroka = 0;
-
- if($fillablePdf == 0){ //naveden pdf (brez vnosnih polj) in rtf
- //echo "INDEKS vrstic: ".$i."</br>";
- //IZRIS PO STOLPCIH
- //echo "___________________________________________________</br>";
- //echo "stevilo stolpcev izpis: ".$numColSql."</br>";
- for($j = 1; $j < $numColSql; $j++){ //izris posameznega stolpca v vrstici
-
- //for($j = 1; $j <= $numColSql; $j++){ //izris posameznega stolpca v vrstici #################### PAZI!!! DODAL ROČNO ZA TESTIRANJE
- if($spremenljivke['tip']==24){ //ce je kombinirana tabela, uredi enote znotraj te tabele
-
- if($presirokaKombo == 1 && count($data) != 0 && ($enota == 2 || $enota == 6)){
- $enota = $vodoravniOdgovoriEnota[0];
- }else{
- $enota = $vodoravniOdgovoriEnota[$j-1];
- }
-
- //$enota = $vodoravniOdgovoriEnota[$j-1];
- $sprID = $vodoravniOdgovoriSprId[$j-1];
-
-
- //echo "Odgovori: ".$vodoravniOdgovori[$j-1]."</br>";
- //echo "INDEKS: ".$j."</br>";
- //echo "id spremenljivke: ".$sprID."</br>";
- //echo "enota tukaj: ".$enota."</br>";
- //if($j == 1){
- /* echo "___________________________________________________</br>";
- echo "Enote: ";
- print_r($vodoravniOdgovoriEnota);
- echo "</br>";
- echo "Vodoravni odgovori spr id: ";
- print_r($vodoravniOdgovoriSprId);
- echo "</br>";
- echo "Odgovori: ";
- print_r($vodoravniOdgovori);
- echo "</br>";
- echo "Tip: ";
- print_r($vodoravniOdgovoriTip);
- echo "</br>"; */
-
- /* echo "indeks for zanke: ".($j-1)."</br>";
- echo "enota for zanke: ".($enota)."</br>";
- echo "spr for zanke: ".($sprID )."</br>";
- echo "___________________________________________________</br>"; */
- //}
+ for($j = 1; $j < $numColSql; $j++){ //izris posameznega stolpca v vrstici
+ if($spremenljivke['tip']==24){ //ce je kombinirana tabela, uredi enote znotraj te tabele
+ if($presirokaKombo == 1 && count($data) != 0 && ($enota == 2 || $enota == 6)){
+ $enota = $vodoravniOdgovoriEnota[0];
+ }else{
+ $enota = $vodoravniOdgovoriEnota[$j-1];
}
-
- if($enota==0||$enota==1||$enota==3||$enota==11||$enota==12||$spremenljivke['tip']==19||$spremenljivke['tip']==20){ //klasika ali diferencial ali VAS ali slikovni tip ali multitext ali multinumber
- if(($trak == 1 && $enota != 3 && $spremenljivke['tip'] == 6)||($spremenljivke['tip']==19||$spremenljivke['tip']==20)){ //ce je trak ali multitext
- if($j<=$spremenljivke['grids']){ //ce so stolpci, ki vsebujejo trak s stevilkami ali textbox-e
- if($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je multitext ali multinumber
- if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je odgovor respondenta ali vec respondentov
- $tex .= "& ".$simbolTex[$indeksOdgovorovRespondentMultiNumText];
- }elseif($export_subtype=='q_empty'||$export_subtype=='q_comment'){
- $tex .= "& ".$simbolTex;
- }
- }else{
- $tex .= '& '.($trakStartingNumberTmp); //prikazovanje brez obrob celic
-
- //$tabela .= '& \multicolumn{1}{|c|}{'.($trakStartingNumberTmp).'} '; //1. moznost z navpicnimi obrobami
-
- //2. moznost z navpicnimi obrobami
- /*if($j==1){ //ce je prvi stolpec, ko je trak
- $tabela .= '& \multicolumn{1}{|c}{'.($trakStartingNumberTmp).'} ';
- }else{
- $tabela .= '& \multicolumn{1}{c|}{'.($trakStartingNumberTmp).'} ';
- } */
- $trakStartingNumberTmp++;
- }
- }else{ //drugace so missing-i, kjer je potrebno izrisati ustrezen simbol (radio button)
- if($enota==0&&($spremenljivke['tip']==6||$spremenljivke['tip']==16)){ //ce je klasicna tabela ali multitext ali multinumber
+ $sprID = $vodoravniOdgovoriSprId[$j-1];
+ }
+
+ if($enota==0||$enota==1||$enota==3||$enota==11||$enota==12||$spremenljivke['tip']==19||$spremenljivke['tip']==20){ //klasika ali diferencial ali VAS ali slikovni tip ali multitext ali multinumber
+ if(($trak == 1 && $enota != 3 && $spremenljivke['tip'] == 6)||($spremenljivke['tip']==19||$spremenljivke['tip']==20)){ //ce je trak ali multitext ali multinumber
+ if($j<=$spremenljivke['grids']){ //ce so stolpci, ki vsebujejo trak s stevilkami ali textbox-e
+ if($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je multitext ali multinumber
+ if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je odgovor respondenta ali vec respondentov
+ $tex .= "& ".$simbolTex[$indeksOdgovorovRespondentMultiNumText];
+ }elseif($export_subtype=='q_empty'||$export_subtype=='q_comment'){
$tex .= "& ".$simbolTex;
- }elseif($spremenljivke['tip']==19||$spremenljivke['tip']==20){//ce je multitext ali multinumber, izrisi missing simbol kot radio
- if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je odgovor respondenta ali vec respondentov
- $tex .= "& ".$simbolTex[$indeksOdgovorovRespondentMultiNumText];
- }else{
- $radioButtonTex = ($export_format=='pdf'?"{\Large $\ocircle$}" : "\\includegraphics[scale=".RADIO_BTN_SIZE."]{".$this->path2Images."radio}");
- $tex .= "& ".$radioButtonTex;
- }
- //$tex .= "& ".$radioButtonTex;
-
- //echo "radio button, ko je missing: ".$radioButtonTex."</br>";
- }
+ }
+ }else{
+ $tex .= '& '.($trakStartingNumberTmp); //prikazovanje brez obrob celic
+ $trakStartingNumberTmp++;
}
- }else{
- if($spremenljivke['tip']==24){ //ce je kombinirana tabela, s klasicno podtabelo
-
- //$tex .= "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
- //$test = "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
- //echo "vodoravni odgovori tip ".$vodoravniOdgovoriTip[$j-1]." $i</br>";
- //echo "tip exp: ".$export_data_type."</br>";
- //echo "testna koda $test z enoto $enota</br>";
-
- if($export_data_type==0 || $export_data_type==1 || ($export_data_type==2 && $vodoravniOdgovoriTip[$j-1] != 6)){ //ce je razsirjen izvoz ALI je skrcen izvoz IN ni klasicna tabela
- $tex .= "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
- //$test = "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
- //echo "testna koda $test z enoto $enota</br>";
- //echo "tip exp: ".$export_data_type."</br>";
- //echo $vodoravniOdgovoriTip[$j-1]."</br>";
-
+ }else{ //drugace so missing-i, kjer je potrebno izrisati ustrezen simbol (radio button)
+ if($enota==0&&($spremenljivke['tip']==6||$spremenljivke['tip']==16)){ //ce je klasicna tabela ali multitext ali multinumber
+ $tex .= "& ".$simbolTex;
+ }elseif($spremenljivke['tip']==19||$spremenljivke['tip']==20){//ce je multitext ali multinumber, izrisi missing simbol kot radio
+ if($export_subtype=='q_data'||$export_subtype=='q_data_all'){ //ce je odgovor respondenta ali vec respondentov
+ $tex .= "& ".$simbolTex[$indeksOdgovorovRespondentMultiNumText];
}else{
- $tex .= ' & \\textcolor{crta}{\footnotesize{'.$data[$userAnswerIndex[$spremenljivke['id']]].'}}';
- //echo "vodoravni odgovori tip ".$vodoravniOdgovoriTip[$j-1]." $i</br>";
+ $radioButtonTex = ($export_format=='pdf'?"{\Large $\ocircle$}" : "\\includegraphics[scale=".RADIO_BTN_SIZE."]{".$this->path2Images."radio}");
+ $tex .= "& ".$radioButtonTex;
}
- /* elseif($export_data_type==2 && $vodoravniOdgovoriTip[$j-1]){ //ce je skrcen izvoz IN
-
- } */
+ //$tex .= "& ".$radioButtonTex;
- }else{ //ce so ostali tipi vprasanj
- if($enota == 12){ //ce je slikovni tip
- $podatekSlikovniTip = $podatekZaSlikovniTip;
- if($j <= $podatekSlikovniTip){
- $podatekSlikovniTipTmp = $podatekSlikovniTip;
- }else{
- $podatekSlikovniTipTmp = 0;
- }
- $tex .= "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0,
- $podatekSlikovniTipTmp, $enota, $j, '', $spremenljivke['id']);
- }else{
- $tex .= "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]], $enota, $j, '', $spremenljivke['id']);
- }
- //echo "tukaj ".$spremenljivke['id']." </br>";
- //echo "userAnswerData: ".$data[$userAnswerIndex[$spremenljivke['id']]]."</br>";
- }
- }
- }elseif($enota==2||$enota==6){ //roleta ali izberite s seznama
- if($export_format == 'pdf'){ //ce je pdf
- $beginItemize = '& \begin{itemize}[leftmargin=*]'; //zacetek itemize, ce je pdf
- }else{
- $beginItemize = '& \begin{itemize}'; //zacetek itemize, ce je rtf
+ //echo "radio button, ko je missing: ".$radioButtonTex."</br>";
+ }
}
- if($spremenljivke['tip']!=24){ //ce ni kombinirana tabela
- if($j==1){ //ce je prvi mozen odgovor v roleti ali seznamu
- $tex .= $beginItemize; //zacetek itemize
+ }else{
+ if($spremenljivke['tip']==24){ //ce je kombinirana tabela, s klasicno podtabelo
+ if( is_array($data) ){
+ $data_4_izpis = $data[$userAnswerIndex[$spremenljivke['id']]];
+ }else{
+ $data_4_izpis = null;
}
- //$tex .= '\item[] '.$vodoravniOdgovori[$j-1]; //izris odgovora v roleti ali seznamu kot item
- }/* elseif($spremenljivke['tip']==24){ //ce je kombinirana tabela
- if($presirokaKombo == 0){ //ce ni presiroka kombinirana tabela, zacni z itemize
- if($roletaAliSeznam){ //ce je zacetek seznama ali rolete
- //$tex .= $beginItemize; //zacetek itemize
- //$tex .= ' & ';
- $roletaAliSeznam = 0;
+ if($export_data_type==0 || $export_data_type==1 || ($export_data_type==2 && $vodoravniOdgovoriTip[$j-1] != 6)){ //ce je razsirjen izvoz ALI je skrcen izvoz IN ni klasicna tabela
+
+ $tex .= "& ".$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data_4_izpis);
+
+ }else{
+ $test = $data_4_izpis;
+ if($usr_id){
+ $test = Common::getInstance()->dataPiping($test, $usr_id, $loop_id);
}
- }
- } */
-
- if($export_subtype=='q_empty'){ //ce je prazen vprasalnik
- //echo count($vodoravniOdgovori);
- if($spremenljivke['tip']==24){ //ce je kombinirana tabela z izberite s seznama (ali roleto)
- //echo "id spremenljivk $sprID ".$vodoravniOdgovoriSprId[$j]." za indeks $j </br>";
- //$tex .= ' & '.$vodoravniOdgovori[$j-1]; //izpis odgovora
- //$tex .= ' & radio'; //izpis kot radio odgovora
- $tex .= "& ".$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
+ $test = LatexDocument::encodeText($test);
+ $tex .= ' & \\textcolor{crta}{\footnotesize{'.$test.'}}';
}
- else{ //ce je roleta ali seznam
- if($i==1){ //samo za prvo vrstico izpisi vse mozne odgovore v roleti
- $tex .= '\item[] '.$vodoravniOdgovori[$j-1]; //izris odgovora v roleti kot item
- }elseif($j==1){
- $tex .= '\item[] '; //prazno vrstico
+ /* elseif($export_data_type==2 && $vodoravniOdgovoriTip[$j-1]){ //ce je skrcen izvoz IN
+
+ } */
+
+ }else{ //ce so ostali tipi vprasanj
+ if($enota == 12){ //ce je slikovni tip
+ $podatekSlikovniTip = $podatekZaSlikovniTip;
+ if($j <= $podatekSlikovniTip){
+ $podatekSlikovniTipTmp = $podatekSlikovniTip;
+ }else{
+ $podatekSlikovniTipTmp = 0;
+ }
+ $tex .= "& ".$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0,
+ $podatekSlikovniTipTmp, $enota, $j, '', $spremenljivke['id']);
+ }elseif($enota == 11){ //ce je VAS
+ if(array_key_exists($userAnswerIndex[$spremenljivke['id']], $data)){
+ $dataUserAnswerIndex = $data[$userAnswerIndex[$spremenljivke['id']]];
+ }
+ $tex .= "& ".$simbolTex[$j-1];
+ //if($i == 1){ //ce je prva iteracija uredi VAS simbole
+ // $tex .= "& ".$simbolTex[$j-1];
+ //}else{ //drugace naj bo prazno
+ // $tex .= "& ";
+ //}
+ }else{ //drugace
+ if(array_key_exists($userAnswerIndex[$spremenljivke['id']], $data)){
+ $dataUserAnswerIndex = $data[$userAnswerIndex[$spremenljivke['id']]];
}
+ $tex .= "& ".$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $dataUserAnswerIndex, $enota, $j, '', $spremenljivke['id']);
}
- }else{ //drugace, ce je vprasalnik z odgovori
- if($spremenljivke['tip'] != 24){ //ce ni kombinirana tabela z izberite s seznama (ali roleto)
- if($data[$userAnswerIndex[$spremenljivke['id']]]==($indeksRoleta)){ //ce je prisoten podatek za doloceni indeks seznama, ga izpisi
- //$tex .= '& \\textcolor{crta}{'.$vodoravniOdgovori[$j-1].'}'; //izris odgovora respondenta v roleti ali seznamu
- //$tex .= '& \\textcolor{crta}{\footnotesize{'.$vodoravniOdgovori[$j-1].'}}'; //izris odgovora respondenta v roleti ali seznamu
- if($export_data_type==0||$export_data_type==2){ //ce skrcen izvoz
- $tex .= '& \\textcolor{crta}{\footnotesize{'.$vodoravniOdgovori[$j-1].'}}'; //izris odgovora respondenta v roleti ali
- }else{ //drugace, ce je razsirjen izvoz
- $tex .= '\item[] \\textcolor{crta}{\footnotesize{'.$vodoravniOdgovori[$j-1].'}}'; //izris odgovora respondenta v roleti ali
- }
- $noItem = 0;
-
- }else{
+ }
+ }
+ }elseif($enota==2||$enota==6){ //roleta ali izberite s seznama
+ if($export_format == 'pdf'){ //ce je pdf
+ $beginItemize = '& \begin{itemize}[leftmargin=*]'; //zacetek itemize, ce je pdf
+ }else{
+ $beginItemize = '& \begin{itemize}'; //zacetek itemize, ce je rtf
+ }
+ if($spremenljivke['tip']!=24){ //ce ni kombinirana tabela
+ if($j==1){ //ce je prvi mozen odgovor v roleti ali seznamu
+ $tex .= $beginItemize; //zacetek itemize
+ }
+ }
+
+ if($export_subtype=='q_empty'){ //ce je prazen vprasalnik
+ if($spremenljivke['tip']==24){ //ce je kombinirana tabela z izberite s seznama (ali roleto)
+ $tex .= "& ".$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
+ }
+ else{ //ce je roleta ali seznam
+ if($i==1){ //samo za prvo vrstico izpisi vse mozne odgovore v roleti
+ $tex .= '\item[] '.$vodoravniOdgovori[$j-1]; //izris odgovora v roleti kot item
+ }elseif($j==1){
+ $tex .= '\item[] '; //prazno vrstico
+ }
+ }
+ }else{ //drugace, ce je vprasalnik z odgovori
+ if($spremenljivke['tip'] != 24){ //ce ni kombinirana tabela z izberite s seznama (ali roleto)
+ if($data[$userAnswerIndex[$spremenljivke['id']]]==($indeksRoleta)){ //ce je prisoten podatek za doloceni indeks seznama, ga izpisi
+ if($export_data_type==0||$export_data_type==2){ //ce skrcen izvoz
+ $tex .= '& \\textcolor{crta}{\footnotesize{'.$vodoravniOdgovori[$j-1].'}}'; //izris odgovora respondenta v roleti ali
+ }else{ //drugace, ce je razsirjen izvoz
+ $tex .= '\item[] \\textcolor{crta}{\footnotesize{'.$vodoravniOdgovori[$j-1].'}}'; //izris odgovora respondenta v roleti ali
+ }
+ $noItem = 0;
+
+ }else{
+ if($export_data_type==0||$export_data_type==2){ //ce skrcen izvoz
+ $tex .= ' & '.$vodoravniOdgovori[$j-1];
+ }else{ //drugace, ce je razsirjen izvoz
//echo "tip exp: ".$export_data_type."</br>";
- if($export_data_type==0||$export_data_type==2){ //ce skrcen izvoz
- $tex .= ' & '.$vodoravniOdgovori[$j-1];
- }else{ //drugace, ce je razsirjen izvoz
-
- }
-
}
- }else{ //ce je kombinirana tabela z izberite s seznama (ali roleto)
- $tex .= ' & \\textcolor{crta}{\footnotesize{'.$data[$userAnswerIndex[$spremenljivke['id']]].'}}';
- /* echo "odgovor : ".$data[$userAnswerIndex[$spremenljivke['id']]]."</br>";
- print_r($data); */
}
-
- }
-
- $indeksRoleta++;
- /* echo "indeks za testirati tale del: ".$j."</br>";
- echo "spremenljivka sprID: ".$sprID."</br>";
- echo "spremenljivka odoravniOdgovoriSprId: ".$vodoravniOdgovoriSprId[$j]."</br>"; */
-
-
+ }else{ //ce je kombinirana tabela z izberite s seznama (ali roleto)
+ $tex .= ' & \\textcolor{crta}{\footnotesize{'.$data[$userAnswerIndex[$spremenljivke['id']]].'}}';
- if($spremenljivke['tip']==24&&$sprID!=$vodoravniOdgovoriSprId[$j]){//ce je naslednji ID spremenljivke razlicen od trenutnega ID
- if($presirokaKombo == 0){
- //$tex .= '\end{itemize}'; //zakljucek itemize
- }
- $roletaAliSeznam = 1;
}
-
- }elseif($enota == 4){ //ena moznost proti drugi
- //$tex .= '& '.$simbolTex.' & '.$lang['srv_tip_sample_t6_4_vmes'].' & '.$simbolTex;
- //$this->getAnswerSymbol($export_format, $fillablePdf, $vodoravniOdgovoriTip[$j-1], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]])
- //echo "userAnswerData: ".$data[$userAnswerIndex[$spremenljivke['id']]]." ".$spremenljivke['id']."</br>";
- //echo "V latexSurveyElement </br>";
- //echo "userAnswerData: ".$data[$userAnswerIndex[$spremenljivke['id']]]." </br>";
- //echo "indeks: ".$userAnswerIndex[$spremenljivke['id']]." </br>";
- if($data[$userAnswerIndex[$spremenljivke['id']]]==1){
- $simbolTex1=$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
- $simbolTex2=$simbolTex;
- //echo "levo </br>";
- }elseif($data[$userAnswerIndex[$spremenljivke['id']]]==2){
- $simbolTex1=$simbolTex;
- $simbolTex2=$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, 1);
- //echo "desno</br>";
- }elseif($data[$userAnswerIndex[$spremenljivke['id']]]==''){
- $simbolTex1=$simbolTex;
- $simbolTex2=$simbolTex;
- $simbolTex3='';
- }
- $tex .= '& '.$simbolTex1.' & '.$lang['srv_tip_sample_t6_4_vmes'].' & '.$simbolTex2;
- //echo "userAnswerData: ".$data[$userAnswerIndex[$spremenljivke['id']]]."</br>";
- }elseif($enota == 5){ //maxdiff
- //$tex .= $navpicniOdgovori[$i-1].' & '.$simbolTex;
- $tex .= $navpicniOdgovori[$i-1].' & '.$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
- }elseif($enota == 8){ //tabela da/ne
- //$tex .= ' & '.$simbolTex;
- $tex .= ' & '.$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
}
- $indeksOdgovorovRespondentMultiNumText++;
-
- $userAnswerIndex[$spremenljivke['id']]++;
- //echo "simbolTex: ".$simbolTex."</br>";
- } //IZRIS PO STOLPCIH - KONEC
- }else if($fillablePdf == 1){
- $isCheckBox = null;
- for($j = 1; $j < $numColSql; $j++){
- if($isCheckBox){
- $tex .= '& {\CheckBox[name=checkbox_'.$j.'_'.$i.',checkboxsymbol=\ding{56}]{}}';
- }else{
- $tex .= '& {\ChoiceMenu[radio, name=radio_'.$i.',radiosymbol=\ding{108}]{}{='.$j.'}}';
+ $indeksRoleta++;
+
+ if($spremenljivke['tip']==24&&$sprID!=$vodoravniOdgovoriSprId[$j]){//ce je naslednji ID spremenljivke razlicen od trenutnega ID
+ if($presirokaKombo == 0){
+ //$tex .= '\end{itemize}'; //zakljucek itemize
+ }
+ $roletaAliSeznam = 1;
}
+
+
+ }elseif($enota == 4){ //ena moznost proti drugi
+ if($data[$userAnswerIndex[$spremenljivke['id']]]==1){
+ $simbolTex1=$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
+ $simbolTex2=$simbolTex;
+ }elseif($data[$userAnswerIndex[$spremenljivke['id']]]==2){
+ $simbolTex1=$simbolTex;
+ $simbolTex2=$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, 1);
+ }elseif($data[$userAnswerIndex[$spremenljivke['id']]]==''){
+ $simbolTex1=$simbolTex;
+ $simbolTex2=$simbolTex;
+ $simbolTex3='';
+ }
+ $tex .= '& '.$simbolTex1.' & '.$lang['srv_tip_sample_t6_4_vmes'].' & '.$simbolTex2;
+ }elseif($enota == 5){ //maxdiff
+ $tex .= $navpicniOdgovori[$i-1].' & '.$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
+ }elseif($enota == 8){ //tabela da/ne
+ $tex .= ' & '.$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
}
- }
+
+ $indeksOdgovorovRespondentMultiNumText++;
+
+ $userAnswerIndex[$spremenljivke['id']]++;
+ } //IZRIS PO STOLPCIH - KONEC
if($enota==1 || $enota==4){ //ce je "diferencial tabela" ali "ena moznost proti drugi", dodaj se tekst v zadnjem stolpcu tabele
$tex .= ' & '.$navpicniOdgovori2[$i-1].' '; //tekst v drugem stolpcu ob symbol
if(($enota==4 && count($missingOdgovori)!=0)||($enota==1 && $trak==1 && count($missingOdgovori)!=0)){ //ce je "ena moznost proti drugi" in so missingi ALI je "diferencial tabela" na traku in so missingi
for($m=0;$m<count($missingOdgovori);$m++){
- //$tex .= ' & '.$simbolTex;
- $tex .= ' & '.$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
+ $tex .= ' & '.$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]);
$userAnswerIndex[$spremenljivke['id']]++;
if($enota==4){ //ce je "ena moznost proti drugi"
$tex .= ' '.$missingOdgovori[$m]; //izpisi se missing odgovor
@@ -2048,22 +1311,16 @@ class LatexSurveyElement{ if($enota==5&&count($missingOdgovori)!=0){ //ce je maxdiff in so missingi
for($m=0;$m<count($missingOdgovori);$m++){
//$tex .= ' & '.$simbolTex.' '.$missingOdgovori[$m];
- $tex .= ' & '.$this->getAnswerSymbol($export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]).' '.$missingOdgovori[$m];
+ $tex .= ' & '.$this->getAnswerSymbol($this->export_subtype, $export_format, $fillablePdf, $spremenljivke['tip'], $numColSql, 0, $data[$userAnswerIndex[$spremenljivke['id']]]).' '.$missingOdgovori[$m];
$userAnswerIndex[$spremenljivke['id']]++;
}
}
- if(($enota == 2 || $enota == 6)&&$spremenljivke['tip']!=24){ //ce je roleta ali seznam in ni kombinirana tabela
+ if(($enota == 2 || $enota == 6)&&$spremenljivke['tip']!=24&&$spremenljivke['tip']!=20&&$spremenljivke['tip']!=19){ //ce je roleta ali seznam in ni kombinirana tabela in ni mutinumber in ni multitekst
$tex .= '\end{itemize}'; //zakljucek itemize
-
- /* if($export_format == 'rtf'){ //ce je rtf
- $tex .= ' \hline '; //dodaj crto na koncu vrstice
- } */
-
}
$tex .= $texNewLine;
- //echo "tex: ".$tex."</br>";
if($spremenljivke['tip']==24){
//$userAnswerIndex++;
}
@@ -2075,9 +1332,12 @@ class LatexSurveyElement{ $tex .= ' \hline '; //dodaj crto na koncu vrstice
}
}
+ //echo "koda vrstice: $tex </br>";
}
//IZRIS PO VRSTICAH - KONEC
- //echo "tex: ".$tex."</br>";
+ //$time_end = microtime(true);
+ // $execution_time = ($time_end - $time_start);
+ // echo '</br><b>Total Execution Time izpisa vrstice</b> '.$execution_time.' sec za vprašanje '.strip_tags($spremenljivke['naslov']).'</br>';
return $tex;
}
#funkcija, ki skrbi za izris vrstic tabele (z multigrid) - konec ###########################################################
@@ -2088,31 +1348,25 @@ class LatexSurveyElement{ function GetUsersData($db_table=null, $spremenljivkeId=null, $spremenljivkeTip=null, $usr_id=null, $loop_id_raw=null){
$userDataPresent = 0; //belezi, ali je odgovor respondenta prisoten in je indeks za določena polja, ki shranjujejo podatke o odgovorih respondenta
$loop_id = $loop_id_raw == null ? " IS NULL" : " = '".$loop_id_raw."'";
- //echo "loop_id v GetUsersData: ".$loop_id."</br>";
// če imamo vnose, pogledamo kaj je odgovoril uporabnik
- //if( in_array($spremenljivkeTip, array(21, 7, 8, 18)) ){ //ce je tip besedilo ali stevilo ali datum ali vsota
if( in_array($spremenljivkeTip, array(21, 4, 7, 8, 18)) ){ //ce je tip besedilo ali besedilo staro (4) ali stevilo ali datum ali vsota
$sqlUserAnswerString ="SELECT text FROM srv_data_text".$db_table." WHERE spr_id='".$spremenljivkeId."' AND usr_id='".$usr_id."' AND loop_id $loop_id ";
}elseif($spremenljivkeTip==17){ //ce je razvrscanje
//$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");
//$sqlUserAnswerString = "SELECT vrstni_red FROM srv_data_rating WHERE spr_id='".$spremenljivkeId."' AND usr_id='".$usr_id."' ";
$sqlUserAnswerString = "SELECT vrstni_red FROM srv_data_rating WHERE spr_id='".$spremenljivkeId."' AND usr_id='$usr_id' AND loop_id $loop_id ";
- //echo $sqlUserAnswerString."</br>";
}elseif($spremenljivkeTip==26){ //ce je lokacija
//$sqlUserAnswerString ="SELECT lat, lng, address, text FROM srv_data_map WHERE spr_id='".$spremenljivkeId."' AND usr_id='".$usr_id."' ";
$sqlUserAnswerString ="SELECT IF(dm.lat > 0, dm.lat, vm.lat) as lat, IF(dm.lng > 0, dm.lng, vm.lng) as lng, IF(dm.address != \"\", dm.address, vm.address) as address, text FROM srv_data_map as dm "
. "LEFT JOIN (SELECT lat, lng, address, vre_id FROM srv_vrednost_map) AS vm on vm.vre_id=dm.vre_id "
. "WHERE spr_id='".$spremenljivkeId."' AND usr_id='$usr_id' AND loop_id $loop_id ";
- //echo $sqlUserAnswerString."</br>";
}elseif($spremenljivkeTip==27){ //ce je heatmap
//$sqlUserAnswerString ="SELECT lat, lng, address, text FROM srv_data_heatmap WHERE spr_id='".$spremenljivkeId."' AND usr_id='".$usr_id."' ";
$sqlUserAnswerString ="SELECT lat, lng, address, text FROM srv_data_heatmap WHERE spr_id='".$spremenljivkeId."' AND usr_id='$usr_id' AND loop_id $loop_id ";
- //echo $sqlUserAnswerString."</br>";
}else{
//$sqlUserAnswerString = "SELECT vre_id FROM srv_data_vrednost".$db_table." WHERE spr_id='$spremenljivkeId' AND usr_id=$usr_id";
$sqlUserAnswerString = "SELECT vre_id FROM srv_data_vrednost".$db_table." WHERE spr_id='$spremenljivkeId' AND usr_id='$usr_id' AND loop_id $loop_id";
- //echo $sqlUserAnswerString."</br>";
}
$sqlUserAnswer = sisplet_query($sqlUserAnswerString);
@@ -2120,7 +1374,6 @@ class LatexSurveyElement{ if( in_array($spremenljivkeTip, array(21, 4, 7, 8, 18, 17)) ){//ce je tip besedilo ali stevilo ali datum ali vsota ali razvrscanje
$rowAnswers = mysqli_fetch_assoc($sqlUserAnswer);
if($rowAnswers){ //ce je kaj v bazi
- //echo "Nekaj je v bazi za spremenljivko".$spremenljivkeId." in usr ".$usr_id."</br>";
$userDataPresent++;
}
}else{
@@ -2129,11 +1382,9 @@ class LatexSurveyElement{ if($spremenljivkeTip==26||$spremenljivkeTip==27){
//$this->userAnswer = $rowAnswers;
$this->userAnswer[$userDataPresent] = $rowAnswers;
- //echo "rowAnswers: ".$this->userAnswer['address'].' za odgovore tip '.$spremenljivkeTip.' id '.$spremenljivkeId.' usr '.$usr_id.'</br>';
$userDataPresent++;
}else{
$this->userAnswer[$rowAnswers['vre_id']] = $rowAnswers['vre_id'];
- //echo "rowAnswers: ".$rowAnswers['vre_id'].' za odgovore tip '.$spremenljivkeTip.' id '.$spremenljivkeId.' usr '.$usr_id.'</br>';
if($rowAnswers['vre_id']>0){
$userDataPresent++;
}
@@ -2141,7 +1392,6 @@ class LatexSurveyElement{ }
}
}
- //echo "userDataPresent za tip ".$spremenljivkeTip." id ".$spremenljivkeId." usr ".$usr_id." je:".$userDataPresent." in loop: $loop_id</br>";
return $userDataPresent;
}
#funkcija, ki skrbi za preverjanje obstoja podatkov za vprasanja, ki niso grid ali kombinirana tabela - konec
@@ -2149,87 +1399,33 @@ class LatexSurveyElement{ #funkcija, ki skrbi za preverjanje obstoja podatkov za vprasanja z grid
function GetUsersDataGrid($spremenljivke=null, $db_table=null, $rowVrednost=null, $rowVsehVrednosti=null, $usr_id=null, $subtip=null, $loop_id_raw=null, $export_data_type=null){
$loop_id = $loop_id_raw == null ? " IS NULL" : " = '".$loop_id_raw."'";
-
// poiščemo kaj je odgovoril uporabnik: PREVERITI, CE JE POTREBEN STAVEK Z LOOP IN KDAJ JE TO AKTUALNO
if(($spremenljivke['tip']==16)||($spremenljivke['tip']==6&&$spremenljivke['enota']==3)){ //ce je grid checkbox ali dvojna tabela
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = '".$rowVsehVrednosti['id']."' AND loop_id $loop_id");
- //$sqlString = "SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
-
- //$sqlString = "SELECT grd_id, vre_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
$sqlString = "SELECT grd_id, vre_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']." AND loop_id $loop_id";
-
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']);
- $sqlUserAnswer = sisplet_query($sqlString);
- //}elseif($spremenljivke['tip']==6){ //ce je grid radio
}elseif($spremenljivke['tip']==6){ //ce je grid radio
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_grid".$db_table." where spr_id = '".$rowVrednost['spr_id']."' and usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND loop_id $loop_id");
-
- //$sqlString ="SELECT grd_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
-
- //$sqlString ="SELECT grd_id, vre_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
$sqlString ="SELECT grd_id, vre_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']." AND loop_id $loop_id";
- //echo $sqlString."</br>";
- $sqlUserAnswer = sisplet_query($sqlString);
-
- //echo $sqlString."</br>";
}elseif($spremenljivke['tip']==19||$spremenljivke['tip']==20){ //ce je grid besedila ali stevil
$sqlString = "SELECT grd_id, text, vre_id FROM srv_data_textgrid".$db_table." where spr_id = '".$rowVrednost['spr_id']."' and usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
- //$sqlUserAnswer = sisplet_query("SELECT grd_id, text FROM srv_data_textgrid".$db_table." where spr_id = '".$rowVrednost['spr_id']."' and usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']);
- //echo "sqlString: ".$sqlString."</br>";
- $sqlUserAnswer = sisplet_query($sqlString);
- }elseif($spremenljivke['tip']==24){ //ce je kombo
- //echo "Subtip kombo vprasanja: ".$subtip."</br>";
- //echo "enota kombo vprasanja: ".$rowVrednost['enota']."</br>";
-
+ }elseif($spremenljivke['tip']==24){ //ce je kombo
if($subtip==6){ //ce je grid radio
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_grid".$db_table." where spr_id = '".$rowVrednost['spr_id']."' and usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND loop_id $loop_id");
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_grid".$db_table." where spr_id = '".$rowVrednost['spr_id']."' and usr_id = '".$usr_id."' AND vre_id = ".$rowVrednost['id']);
- //$sqlString ="SELECT grd_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = ".$rowVrednost['id'];
- //$sqlString ="SELECT grd_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
- //if($rowVrednost['enota'] != 2 && $rowVrednost['enota'] != 6){ //ce ni roleta ali seznam
if($rowVrednost['enota'] != 2 && $rowVrednost['enota'] != 6 && ($export_data_type == 1)){ //ce ni roleta in seznam IN je razsirjen izvoz
$sqlString ="SELECT grd_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']." AND loop_id $loop_id";
}else{ //ce je roleta ali seznam
- //$sqlString ="SELECT grd_id FROM srv_data_grid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND loop_id $loop_id";
$sqlString ="SELECT g.naslov, gdata.grd_id FROM srv_grid g, srv_data_grid".$db_table." gdata WHERE g.id=gdata.grd_id AND g.spr_id = '".$rowVrednost['spr_id']."' AND gdata.usr_id = '".$usr_id."' AND gdata.vre_id = '".$rowVrednost['id']."' AND gdata.loop_id $loop_id";
}
-
- //echo $sqlString."</br>";
- $sqlUserAnswer = sisplet_query($sqlString);
-
- //echo $sqlString."</br>";
}elseif($subtip==16){ //ce je grid checkbox ali dvojna tabela
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = '".$rowVsehVrednosti['id']."' AND loop_id $loop_id");
-
- //$sqlString = "SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
$sqlString = "SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']." AND loop_id $loop_id";
- //$sqlUserAnswer = sisplet_query("SELECT grd_id FROM srv_data_checkgrid".$db_table." WHERE spr_id = '".$rowVrednost['spr_id']."' AND usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id']);
- $sqlUserAnswer = sisplet_query($sqlString);
}elseif($subtip==19||$subtip==20){ //ce je grid besedila ali stevil
$sqlString = "SELECT grd_id, text FROM srv_data_textgrid".$db_table." where spr_id = '".$rowVrednost['spr_id']."' and usr_id = '".$usr_id."' AND vre_id = '".$rowVrednost['id']."' AND grd_id = ".$rowVsehVrednosti['id'];
-
- $sqlUserAnswer = sisplet_query($sqlString);
-
- //$this->userAnswer = mysqli_fetch_assoc($sqlUserAnswer);
- //echo "userAnswer v funkciji: ".$this->userAnswer['text'].'</br>';
}
}
-
- //echo $sqlString."</br>";
- //$this->userAnswer = mysqli_fetch_assoc($sqlUserAnswer);
- //$userAnswer = mysqli_fetch_assoc($sqlUserAnswer);
- //echo "userAnswer v funkciji: ".$this->userAnswer['grd_id'].'</br>';
- //echo "userAnswer v funkciji: ".$userAnswer['text'].'</br>';
- //echo "userAnswer v funkciji: ".$userAnswer['grd_id'].'</br>';
-
+ $sqlUserAnswer = sisplet_query($sqlString);
return $sqlUserAnswer;
-
}
#funkcija, ki skrbi za preverjanje obstoja podatkov za vprasanja z grid - konec
#funkcija, ki skrbi za preverjanje obstoja podatkov za vprasanja s kombinirano tabelo
function GetUsersDataKombinirana($spremenljivke=null, $db_table=null, $usr_id=null, $presirokaTabela=0, $loop_id_raw=null, $export_data_type=null){
- //function GetUsersDataKombinirana($spremenljivke=null, $db_table=null, $usr_id=null, $questionText=null, $loop_id_raw=null, $export_data_type=null){
$userDataPresent = 0; //belezi, ali je odgovor respondenta prisoten in je indeks za določena polja, ki shranjujejo podatke o odgovorih respondenta
$userAnswerSprIds = array();
$userAnswerSprTip = array();
@@ -2237,27 +1433,21 @@ class LatexSurveyElement{ $orStavek = '';
//$loop_id = $loop_id_raw == null ? " IS NULL" : " = '".$loop_id_raw."'";
$loop_id = $loop_id_raw;
+ $userAnswers = array();
#za pridobitev stevila vrstic
- //echo "SELECT id, naslov, naslov2, variable, other FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red </br>";
$sqlVrednostiKombo = sisplet_query("SELECT id, naslov, naslov2, variable, other FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."' ORDER BY vrstni_red");
$numRowsSql = mysqli_num_rows($sqlVrednostiKombo);
- //echo $numRowsSql."</br>";
- //echo $spremenljivke['id']."</br>";
-
#za pridobitev stevila vrstic - konec
#za pridobitev stevila stolpcev
$sqlStVrednostiKombo = sisplet_query("SELECT count(*) FROM srv_grid g, srv_grid_multiple m WHERE m.spr_id=g.spr_id AND m.parent='".$spremenljivke['id']."'");
$rowStVrednost = mysqli_fetch_array($sqlStVrednostiKombo); //stevilo stolpcev
$numColSql = $rowStVrednost['count(*)']; //stevilo vseh stolpcev
- //echo "stevilo stolpcev: ".$numColSql."</br>";
#za pridobitev stevila stolpcev - konec
- //echo "presirokaTabela: ".$presirokaTabela."</br>";
if($presirokaTabela==0){ //ce tabela ni presiroka
$sqlSubGrid = sisplet_query("SELECT m.spr_id, s.tip FROM srv_grid_multiple m, srv_spremenljivka s WHERE m.parent='".$spremenljivke['id']."' AND m.spr_id=s.id ORDER BY m.vrstni_red"); //pridobimo spr_id in tip podvprasanj, ki sestavljajo kombinirano tabelo
- //echo "SELECT m.spr_id, s.tip FROM srv_grid_multiple m, srv_spremenljivka s WHERE m.parent='".$spremenljivke['id']."' AND m.spr_id=s.id ORDER BY m.vrstni_red"."</br>";
while($rowSubGrid = mysqli_fetch_array($sqlSubGrid)){
array_push($userAnswerSprIds, $rowSubGrid['spr_id'] ); //filanje polja s spr_id podvprasanj
@@ -2265,34 +1455,20 @@ class LatexSurveyElement{ if($userAnswerSprIdsIndex){
$orStavek .= ' OR ';
}
- //$orStavek .= "spr_id='".$rowSubGrid['spr_id']."' ";
$orStavek .= "v.spr_id='".$rowSubGrid['spr_id']."' ";
$userAnswerSprIdsIndex++;
}
}else{
$orStavek = "v.spr_id='".$spremenljivke['id']."' ";
}
- //echo $orStavek."</br>";
-
- //echo count($userAnswerSprTip)."</br>";
for($i=1;$i<=$numRowsSql;$i++){
- //$sqlVrednostiString = "SELECT id, naslov, spr_id FROM srv_vrednost WHERE (".$orStavek.") AND vrstni_red=".($i).";";
- //$sqlVrednostiString = "SELECT v.spr_id, v.naslov, s.tip, v.id FROM srv_vrednost v, srv_spremenljivka s WHERE v.spr_id=s.id AND (".$orStavek.") AND v.vrstni_red=".($i).";";
$sqlVrednostiString = "SELECT v.spr_id, v.naslov, s.tip, v.id, s.enota FROM srv_vrednost v, srv_spremenljivka s WHERE v.spr_id=s.id AND (".$orStavek.") AND v.vrstni_red=".($i).";";
- //echo $sqlVrednostiString."</br>";
$sqlVrednosti = sisplet_query($sqlVrednostiString);
while($rowVrednosti = mysqli_fetch_assoc($sqlVrednosti)){
$sqlVsehVrednostiString = "SELECT id, naslov FROM srv_grid WHERE spr_id='".$rowVrednosti['spr_id']."' ORDER BY 'vrstni_red'";
-
- //echo $sqlVsehVrednostiString."</br>";
- //echo $rowVrednosti['tip']."</br>";
- //echo $rowVrednosti['other']."</br>";
- //echo "Vrednost: ".$rowVrednosti['spr_id']."</br>";
- $sqlVsehVrednosti = sisplet_query($sqlVsehVrednostiString);
- //echo mysqli_num_rows($sqlVsehVrednosti)."</br>";
-
+ $sqlVsehVrednosti = sisplet_query($sqlVsehVrednostiString);
$roletaZabelezena = 0;
@@ -2317,12 +1493,6 @@ class LatexSurveyElement{ }
}
- //echo $this->userAnswer[$userDataPresent]."</br>";
- //echo "odgovori respondenta: ".$userAnswers[$userDataPresent]."</br>";
- //echo "index userDataPresent: ".$userDataPresent."</br>";
- /* if($rowVrednosti['enota']==2){
- $roletaZabelezena = 1;
- }*/
if($roletaZabelezena == 0){
$userDataPresent++;
}
@@ -2331,25 +1501,20 @@ class LatexSurveyElement{ }
}
- //if($questionText){
- //return $userDataPresent;
- //}else{
- //return $this->userAnswer;
- return $userAnswers;
- //}
+ return $userAnswers;
}
#funkcija, ki skrbi za preverjanje obstoja podatkov za vprasanja s kombinirano tabelo - konec
#funkcija, ki skrbi za pridobitev operatorja iz stevilskega podatka ###########################################################
function GetOperator($operatorNum=null){
if ($operatorNum == 0){
- $operator = $this->encodeText('+');
+ $operator = LatexDocument::encodeText('+');
}elseif ($operatorNum == 1){
- $operator = $this->encodeText('-');
+ $operator = LatexDocument::encodeText('-');
}elseif ($operatorNum == 2){
- $operator = $this->encodeText('*');
+ $operator = LatexDocument::encodeText('*');
}elseif ($operatorNum == 3){
- $operator = $this->encodeText('/');
+ $operator = LatexDocument::encodeText('/');
}
return $operator;
}
@@ -2359,12 +1524,7 @@ class LatexSurveyElement{ * @desc V podanem stringu poisce spremenljivke in jih spajpa z vrednostmi
*/
function dataPiping ($text='') {
-/* echo "text: ".$text."</br>";
- echo "Usr_id: ".$this->usr_id."</br>";
- echo "Loop_id: ".$this->loop_id."</br>";
- echo "_____________________</br>"; */
Common::getInstance()->Init($this->anketa);
- //echo Common::getInstance()->dataPiping($text, $this->usr_id, $this->loop_id);
return Common::getInstance()->dataPiping($text, $this->usr_id, $this->loop_id);
}
diff --git a/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisAndOtherLandscape.cls b/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisAndOtherLandscape.cls index 535b617..fea6e53 100644 --- a/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisAndOtherLandscape.cls +++ b/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisAndOtherLandscape.cls @@ -4,25 +4,27 @@ %uporabljene knjiznice
\usepackage[a4paper, landscape, left=20mm, right=20mm, headheight=1cm, top=1cm, bottom=2cm, footskip=3cm, includehead, includefoot, heightrounded]{geometry} % za robove, ipd.
\usepackage{tabularx, booktabs} % za lazje urejanje in izris tabel (ni podprto v latex2rtf)
+\usepackage{xltabular}
\usepackage{color}
\usepackage[dvipsnames]{xcolor} % za uporabo HTML in RGB barv
\usepackage{pgf} % za aritmetiko z length
\usepackage{printlen} %
\usepackage{eurosym} % za izpis simbola €
\usepackage[export]{adjustbox} % za poravnavo slik
-\usepackage[utf8]{inputenc} % za uporabo utf8
-\usepackage{amssymb} %za unicode simbole
+
\usepackage{graphicx} % za prikazovanje slik in ostalih grafik
%\usepackage[allfiguresdraft]{draftfigure}
\usepackage{colortbl} %The package allows rows and columns to be coloured, and even individual cells
\usepackage{fancyhdr} % za ureditev glav in nog
-\usepackage{montserrat} % za uporabo Montserrat pisave v dokumentu
+%\usepackage{montserrat} % za uporabo Montserrat pisave v dokumentu
+\usepackage[default]{sourcesanspro} % za uporabo Source Sans Pro pisave v dokumentu
\usepackage{multirow} % za spajanje vrstic v tabeli
\usepackage{hyperref}
\usepackage{tikz} % za risanje crt, ki oznacujejo stevilo klikov v Status
\usepackage{ltablex}
\usepackage{seqsplit} % za samodejno razbijanje dolgih besed v tabelah
\usepackage{url} %za razbijanje url-jev v tabelah
+\usepackage{fontspec} %ureditev veh UTF-8 charaterjev
\usepackage{textgreek} %za resevanje grskih crk
\urlstyle{same} %nastavitev, da je font URL isti kot je font ostalega besedila (http://ctan.ijs.si/tex-archive/macros/latex/contrib/url/url.pdf)
%definiranje uporabljenih barv
@@ -51,7 +53,7 @@ %definiranje novih ukazov, funkcij, nastavitev potrebnih za izris dolocenih delov besedila
\linespread{1} % za razmik med vrsticami
\fontencoding{T1}\selectfont % za encode besedila
-\renewcommand{\familydefault}{\sfdefault} % za izbiro novega fonta Montserrat
+\renewcommand{\familydefault}{\sfdefault} % za izbiro izbranega fonta, trenutno Source Sans Pro
\color{besedilo} % za izbiro barve besedila
\newenvironment{analysis} % za ureditev prostora za izpis analize
{\parindent0pt \fontsize{10}{12} \selectfont }
@@ -74,8 +76,7 @@ {\par\xdef\tpd{\the\prevdepth}\egroup
\prevdepth=\tpd}
\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}} %
-\pdfcompresslevel=0 %uncompressed PDFs za pohitritev
-\pdfobjcompresslevel=0 %uncompressed PDFs za pohitritev
+
%vse za glavo in nogo
\pagestyle{fancy}
\fancyhf{}
@@ -84,17 +85,10 @@ \renewcommand{\headrulewidth}{6pt} %debelina crte glave
\renewcommand{\footrulewidth}{0.25pt} %debelina crte noga
\setlength{\headsep}{1.5cm} %odmik iz roba strani
-\newcommand{\headerfooter}[5]{ %funkcija za izpis glave in noge
+\newcommand{\headerfooter}[7]{ %funkcija za izpis glave in noge
\lhead{\begin{tabular}{@{} m{135mm} } #1 \end{tabular}}
\rhead{\includegraphics[#4]{#2}}
- \fancyfoot[l]{www.1ka.si}
+ \fancyfoot[l]{#7}
\fancyfoot[r]{\thepage}
}
-%vse za glavo in nogo - konec
-
-\DeclareUnicodeCharacter{200B}{{\hskip 0pt}}
-\DeclareUnicodeCharacter{03C7}{$\chi$}
-\DeclareUnicodeCharacter{2265}{$\geq$}
-\DeclareUnicodeCharacter{03B5}{$\epsilon$
-\DeclareUnicodeCharacter{2003}{$\enspace$}}
-\DeclareUnicodeCharacter{0014}{$\thinspace$} %ni ta pravi nadomestek, ker v Latexu tak simbol ne obstaja
\ No newline at end of file +%vse za glavo in nogo - konec
\ No newline at end of file diff --git a/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisPortrait.cls b/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisPortrait.cls index e21e21a..659551a 100644 --- a/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisPortrait.cls +++ b/admin/survey/export/latexclasses/textemp/latexTemplatePdfAnalysisPortrait.cls @@ -5,6 +5,7 @@ %\usepackage[a4paper, portrait, left=20mm, right=20mm, headheight=1cm, top=1cm, bottom=2cm, footskip=3cm, includehead, includefoot, heightrounded]{geometry} % za robove, ipd.
\usepackage[a4paper, portrait, left=15mm, right=15mm, headheight=1cm, top=1cm, bottom=2cm, footskip=3cm, includehead, includefoot, heightrounded]{geometry} % za robove, ipd.
\usepackage{tabularx, booktabs} % za lazje urejanje in izris tabel (ni podprto v latex2rtf)
+\usepackage{xltabular}
\usepackage{ltablex} % Modifies the tabularx environment to combine the features of the tabularx package (auto-sized columns in a fixed width table) with those of the longtable package (multi-page tables)
\usepackage{color}
\usepackage[dvipsnames]{xcolor} % za uporabo HTML in RGB barv
@@ -17,12 +18,14 @@ \usepackage{graphicx} % za prikazovanje slik in ostalih grafik
\usepackage{colortbl} %The package allows rows and columns to be coloured, and even individual cells
\usepackage{fancyhdr} % za ureditev glav in nog
-\usepackage{montserrat} % za uporabo Montserrat pisave v dokumentu
+%\usepackage{montserrat} % za uporabo Montserrat pisave v dokumentu
+\usepackage[default]{sourcesanspro} % za uporabo Source Sans Pro pisave v dokumentu
\usepackage{multirow} % za spajanje vrstic v tabeli
\usepackage{hyperref}
\usepackage{tikz} % za risanje
\usepackage{seqsplit} % za samodejno razbijanje dolgih besed v tabelah
\usepackage{url} %za razbijanje url-jev v tabelah
+\usepackage{fontspec} %ureditev veh UTF-8 charaterjev
\usepackage{textgreek} %za resevanje grskih crk
\urlstyle{same} %nastavitev, da je font URL isti kot je font ostalega besedila (http://ctan.ijs.si/tex-archive/macros/latex/contrib/url/url.pdf)
%\usepackage{adjustbox} %za samodejno dimenzioniranje tabel
@@ -52,7 +55,7 @@ %\linespread{1.5} % za razmik med vrsticami
\linespread{1.2} % za razmik med vrsticami
\fontencoding{T1}\selectfont % za encode besedila
-\renewcommand{\familydefault}{\sfdefault} % za izbiro novega fonta Montserrat
+\renewcommand{\familydefault}{\sfdefault} % za izbiro izbranega fonta, trenutno Source Sans Pro
\renewcommand{\arraystretch}{1.5}
\color{besedilo} % za izbiro barve besedila
\newenvironment{analysis} % za ureditev prostora za izpis analize
@@ -70,8 +73,7 @@ {\parindent0pt \fontsize{8}{9} \selectfont }
{ }
\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}} %
-\pdfcompresslevel=0 %uncompressed PDFs za pohitritev
-\pdfobjcompresslevel=0 %uncompressed PDFs za pohitritev
+
%vse za glavo in nogo
\pagestyle{fancy}
\fancyhf{}
@@ -80,19 +82,11 @@ \renewcommand{\headrulewidth}{6pt} %debelina crte glave
\renewcommand{\footrulewidth}{0.25pt} %debelina crte noga
\setlength{\headsep}{1.5cm} %odmik iz roba strani
-\newcommand{\headerfooter}[5]{ %funkcija za izpis glave in noge
+\newcommand{\headerfooter}[7]{ %funkcija za izpis glave in noge
\lhead{\begin{tabular}{@{} m{135mm} } #1 \end{tabular}}
\rhead{\includegraphics[#4]{#2}}
- \fancyfoot[l]{www.1ka.si}
+ \fancyfoot[l]{#7}
\fancyfoot[r]{\thepage}
}
%vse za glavo in nogo - konec
-\DeclareUnicodeCharacter{2212}{-}
-\DeclareUnicodeCharacter{030C}{Č}
-\DeclareUnicodeCharacter{200B}{{\hskip 0pt}}
-\DeclareUnicodeCharacter{03C7}{$\chi$}
-\DeclareUnicodeCharacter{2265}{$\geq$}
-\DeclareUnicodeCharacter{03B5}{$\epsilon$}
-\DeclareUnicodeCharacter{2003}{$\enspace$}
-\DeclareUnicodeCharacter{0014}{$\thinspace$} %ni ta pravi nadomestek, ker v Latexu tak simbol ne obstaja
\ No newline at end of file diff --git a/admin/survey/export/latexclasses/textemp/latexTemplatePdfSurvey.cls b/admin/survey/export/latexclasses/textemp/latexTemplatePdfSurvey.cls index 378680c..296178e 100644 --- a/admin/survey/export/latexclasses/textemp/latexTemplatePdfSurvey.cls +++ b/admin/survey/export/latexclasses/textemp/latexTemplatePdfSurvey.cls @@ -1,129 +1,37 @@ \NeedsTeXFormat{LaTeX2e}
\ProvidesClass{latexTemplatePdfSurvey}
\LoadClass{article}
+%da ignorira warninge ob compilanju
+%\hbadness=10000
+%\vbadness=10000
+%\tolerance=10000
%uporabljene knjiznice
-\usepackage[a4paper, portrait, left=20mm, right=20mm, headheight=1cm, top=1cm, bottom=2cm, footskip=3cm, includehead, includefoot, heightrounded]{geometry} % za robove, ipd.
-\usepackage{tabularx, booktabs} % za lazje urejanje in izris tabel (ni podprto v latex2rtf)
-\usepackage{ltablex} % Modifies the tabularx environment to combine the features of the tabularx package (auto-sized columns in a fixed width table) with those of the longtable package (multi-page tables)
+\usepackage[a4paper, portrait, left=20mm, right=20mm, headheight=1cm, top=1cm, bottom=2cm, footskip=1cm, includehead, includefoot, heightrounded]{geometry} % za robove, ipd.
+%\usepackage{tabularx, booktabs} % za lazje urejanje in izris tabel (ni podprto v latex2rtf)
+%\usepackage{ltablex} % Modifies the tabularx environment to combine the features of the tabularx package (auto-sized columns in a fixed width table) with those of the longtable package (multi-page tables)
%\usepackage{color}
+\usepackage{xltabular}
\usepackage[dvipsnames]{xcolor} % za uporabo HTML in RGB barv
-\usepackage{pgf} % za aritmetiko z length
-\usepackage{printlen} %
+%\usepackage{pgf} % za aritmetiko z length
+%\usepackage{printlen} %
\usepackage{enumitem} % za itemize, ki je potreben za pravilen izris rolet in izberite iz seznama v tabelah
-\usepackage{eurosym} % za izpis simbola €
\usepackage[export]{adjustbox} % za poravnavo slik
\usepackage{wasysym} % za izris radio button, checkbox
-\usepackage{tikzsymbols} %za izpis emoji-jev
-
-\usepackage{textgreek} %za resevanje grskih crk
-
-\usepackage[T2A,T1]{fontenc} %za cirilico
-\usepackage[russian,english]{babel} %za cirilico
-%\usepackage[russian]{babel} %za cirilico
-
-\usepackage[utf8]{inputenc} % za uporabo utf8
-\usepackage{amssymb} %za unicode simbole
-
-%DEFINIRANJE NADOMESTIL NEIZPISLJIVIH UNICODE CHARACTER-JEV
-\DeclareUnicodeCharacter{200B}{{\hskip 0pt}}
-\DeclareUnicodeCharacter{03C7}{$\chi$}
-\DeclareUnicodeCharacter{2265}{$\geq$}
-\DeclareUnicodeCharacter{03B5}{$\epsilon$}
-\DeclareUnicodeCharacter{2003}{$\enspace$}
-\DeclareUnicodeCharacter{0014}{$\thinspace$} %ni ta pravi nadomestek, ker v Latexu tak simbol ne obstaja
-
-%Emoji - izpis urejen s slikicami emoji-jev
-\DeclareUnicodeCharacter{1F600}{\includegraphics[height=1em]{1F600.png}}
-\DeclareUnicodeCharacter{1F601}{\includegraphics[height=1em]{1F601.png}}
-\DeclareUnicodeCharacter{1F602}{\includegraphics[height=1em]{1F602.png}}
-\DeclareUnicodeCharacter{1F603}{\includegraphics[height=1em]{1F603.png}}
-\DeclareUnicodeCharacter{1F604}{\includegraphics[height=1em]{1F604.png}}
-\DeclareUnicodeCharacter{1F605}{\includegraphics[height=1em]{1F605.png}}
-\DeclareUnicodeCharacter{1F606}{\includegraphics[height=1em]{1F606.png}}
-\DeclareUnicodeCharacter{1F609}{\includegraphics[height=1em]{1F609.png}}
-\DeclareUnicodeCharacter{1F60A}{\includegraphics[height=1em]{1F60A.png}}
-\DeclareUnicodeCharacter{1F60B}{\includegraphics[height=1em]{1F60B.png}}
-\DeclareUnicodeCharacter{1F60E}{\includegraphics[height=1em]{1F60C.png}}
-\DeclareUnicodeCharacter{1F60D}{\includegraphics[height=1em]{1F60D.png}}
-\DeclareUnicodeCharacter{1F60E}{\includegraphics[height=1em]{1F60E.png}}
-\DeclareUnicodeCharacter{1F60D}{\includegraphics[height=1em]{1F60F.png}}
-
-\DeclareUnicodeCharacter{1F600}{\includegraphics[height=1em]{1F610.png}}
-\DeclareUnicodeCharacter{1F611}{\includegraphics[height=1em]{1F611.png}}
-\DeclareUnicodeCharacter{1F612}{\includegraphics[height=1em]{1F612.png}}
-\DeclareUnicodeCharacter{1F613}{\includegraphics[height=1em]{1F613.png}}
-\DeclareUnicodeCharacter{1F614}{\includegraphics[height=1em]{1F614.png}}
-\DeclareUnicodeCharacter{1F615}{\includegraphics[height=1em]{1F615.png}}
-\DeclareUnicodeCharacter{1F616}{\includegraphics[height=1em]{1F616.png}}
-\DeclareUnicodeCharacter{1F619}{\includegraphics[height=1em]{1F619.png}}
-\DeclareUnicodeCharacter{1F61A}{\includegraphics[height=1em]{1F61A.png}}
-\DeclareUnicodeCharacter{1F61B}{\includegraphics[height=1em]{1F61B.png}}
-\DeclareUnicodeCharacter{1F61E}{\includegraphics[height=1em]{1F61C.png}}
-\DeclareUnicodeCharacter{1F61D}{\includegraphics[height=1em]{1F61D.png}}
-\DeclareUnicodeCharacter{1F61E}{\includegraphics[height=1em]{1F61E.png}}
-\DeclareUnicodeCharacter{1F61D}{\includegraphics[height=1em]{1F61F.png}}
-
-\DeclareUnicodeCharacter{1F600}{\includegraphics[height=1em]{1F620.png}}
-\DeclareUnicodeCharacter{1F621}{\includegraphics[height=1em]{1F621.png}}
-\DeclareUnicodeCharacter{1F622}{\includegraphics[height=1em]{1F622.png}}
-\DeclareUnicodeCharacter{1F623}{\includegraphics[height=1em]{1F623.png}}
-\DeclareUnicodeCharacter{1F624}{\includegraphics[height=1em]{1F624.png}}
-\DeclareUnicodeCharacter{1F625}{\includegraphics[height=1em]{1F625.png}}
-\DeclareUnicodeCharacter{1F626}{\includegraphics[height=1em]{1F626.png}}
-\DeclareUnicodeCharacter{1F629}{\includegraphics[height=1em]{1F629.png}}
-\DeclareUnicodeCharacter{1F62A}{\includegraphics[height=1em]{1F62A.png}}
-\DeclareUnicodeCharacter{1F62B}{\includegraphics[height=1em]{1F62B.png}}
-\DeclareUnicodeCharacter{1F62E}{\includegraphics[height=1em]{1F62C.png}}
-\DeclareUnicodeCharacter{1F62D}{\includegraphics[height=1em]{1F62D.png}}
-\DeclareUnicodeCharacter{1F62E}{\includegraphics[height=1em]{1F62E.png}}
-\DeclareUnicodeCharacter{1F62D}{\includegraphics[height=1em]{1F62F.png}}
-
-\DeclareUnicodeCharacter{1F600}{\includegraphics[height=1em]{1F630.png}}
-\DeclareUnicodeCharacter{1F631}{\includegraphics[height=1em]{1F631.png}}
-\DeclareUnicodeCharacter{1F632}{\includegraphics[height=1em]{1F632.png}}
-\DeclareUnicodeCharacter{1F633}{\includegraphics[height=1em]{1F633.png}}
-\DeclareUnicodeCharacter{1F634}{\includegraphics[height=1em]{1F634.png}}
-\DeclareUnicodeCharacter{1F635}{\includegraphics[height=1em]{1F635.png}}
-\DeclareUnicodeCharacter{1F636}{\includegraphics[height=1em]{1F636.png}}
-\DeclareUnicodeCharacter{1F639}{\includegraphics[height=1em]{1F639.png}}
-\DeclareUnicodeCharacter{1F63A}{\includegraphics[height=1em]{1F63A.png}}
-\DeclareUnicodeCharacter{1F63B}{\includegraphics[height=1em]{1F63B.png}}
-\DeclareUnicodeCharacter{1F63E}{\includegraphics[height=1em]{1F63C.png}}
-\DeclareUnicodeCharacter{1F63D}{\includegraphics[height=1em]{1F63D.png}}
-\DeclareUnicodeCharacter{1F63E}{\includegraphics[height=1em]{1F63E.png}}
-\DeclareUnicodeCharacter{1F63D}{\includegraphics[height=1em]{1F63F.png}}
-
-\DeclareUnicodeCharacter{1F600}{\includegraphics[height=1em]{1F640.png}}
-\DeclareUnicodeCharacter{1F641}{\includegraphics[height=1em]{1F641.png}}
-\DeclareUnicodeCharacter{1F642}{\includegraphics[height=1em]{1F642.png}}
-\DeclareUnicodeCharacter{1F643}{\includegraphics[height=1em]{1F643.png}}
-\DeclareUnicodeCharacter{1F644}{\includegraphics[height=1em]{1F644.png}}
-\DeclareUnicodeCharacter{1F645}{\includegraphics[height=1em]{1F645.png}}
-\DeclareUnicodeCharacter{1F646}{\includegraphics[height=1em]{1F646.png}}
-\DeclareUnicodeCharacter{1F649}{\includegraphics[height=1em]{1F649.png}}
-\DeclareUnicodeCharacter{1F64A}{\includegraphics[height=1em]{1F64A.png}}
-\DeclareUnicodeCharacter{1F64B}{\includegraphics[height=1em]{1F64B.png}}
-\DeclareUnicodeCharacter{1F64E}{\includegraphics[height=1em]{1F64C.png}}
-\DeclareUnicodeCharacter{1F64D}{\includegraphics[height=1em]{1F64D.png}}
-\DeclareUnicodeCharacter{1F64E}{\includegraphics[height=1em]{1F64E.png}}
-\DeclareUnicodeCharacter{1F64D}{\includegraphics[height=1em]{1F64F.png}}
-
-%Emoji - izpis urejen s slikicami emoji-jev - konec
-
-%DEFINIRANJE NADOMESTIL NEIZPISLJIVIH UNICODE CHARACTER-JEV - KONEC
-
+\usepackage{fontspec} %ureditev veh UTF-8 charaterjev
+%\usepackage{float} % For the 'H' placement option
\usepackage{graphicx} % za prikazovanje slik in ostalih grafik
\usepackage{colortbl} %The package allows rows and columns to be coloured, and even individual cells
\usepackage{fancyhdr} % za ureditev glav in nog
\usepackage{seqsplit} % za samodejno razbijanje dolgih besed v tabelah
-\usepackage{url} %za razbijanje url-jev v tabelah
-\urlstyle{same} %nastavitev, da je font URL isti kot je font ostalega besedila (http://ctan.ijs.si/tex-archive/macros/latex/contrib/url/url.pdf)
-\usepackage{montserrat} % za uporabo Montserrat pisave v dokumentu
+%\usepackage{url} %za razbijanje url-jev v tabelah
+%\urlstyle{same} %nastavitev, da je font URL isti kot je font ostalega besedila (http://ctan.ijs.si/tex-archive/macros/latex/contrib/url/url.pdf)
+\usepackage[default]{sourcesanspro} % za uporabo Source Sans Pro pisave v dokumentu
\usepackage{multirow} % za spajanje vrstic v tabeli
-\usepackage[hidelinks]{hyperref}
+%\usepackage[hidelinks]{hyperref}
\usepackage{tikz} % za risanje drsnikov
\usetikzlibrary{calc} % za risanje drsnikov
+
%definiranje uporabljenih barv
\definecolor{Mycolor1}{HTML}{00F9DE}
\definecolor{oneclick}{rgb}{0.2, 0.2, 0.2}
@@ -131,10 +39,11 @@ \definecolor{crta}{HTML}{1e88e5}
\definecolor{1ka_orange}{HTML}{ffa608}
\definecolor{komentar}{HTML}{ff0000}
+
%definiranje poravnav za tabele
\newcolumntype{C}{>{\centering\arraybackslash}X} % za sredinsko poravnavo celice, ki se samodejno prilagaja sirini
\newcolumntype{R}{>{\raggedleft\arraybackslash}X} % za desno poravnavo celice, ki se samodejno prilagaja sirini
-\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}} % za sredinsko poravnane zadeve v tabularx tabeli
+%\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash}m{#1}} % za sredinsko poravnane zadeve v tabularx tabeli
\newcolumntype{s}{>{\hsize=.55\hsize \centering\arraybackslash}X} % za sredinsko poravnane celice manjse dimenzije (0.55 navadne dimenzije)
\newcolumntype{S}{>{\hsize=.2\hsize}X} % za celice manjse dimenzije (0.3 navadne dimenzije)
\newcolumntype{b}{>{\hsize=.5\hsize}X} % za celice manjse dimenzije (0.5 navadne dimenzije)
@@ -152,7 +61,7 @@ \linespread{1.5} % za razmik med vrsticami
%\fontencoding{T1}\selectfont % za encode besedila
%\fontencoding{T2A,T1}\selectfont % za encode besedila
-\renewcommand{\familydefault}{\sfdefault} % za izbiro novega fonta Montserrat
+\renewcommand{\familydefault}{\sfdefault} % za izbiro izbranega fonta, trenutno Source Sans Pro
\color{besedilo} % za izbiro barve besedila
\newenvironment{absolutelynopagebreak} % za ureditev dela besedila, kjer ne sme biti odsek strani; za prepreciti prelome strani, kjer ni potrebno
{\par\nobreak\vfil\penalty0\vfilneg
@@ -167,8 +76,7 @@ { }
{ }
\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}} %
-\pdfcompresslevel=0 %uncompressed PDFs za pohitritev
-\pdfobjcompresslevel=0 %uncompressed PDFs za pohitritev
+
%vse za glavo in nogo
\pagestyle{fancy}
\fancyhf{}
@@ -177,21 +85,15 @@ \renewcommand{\headrulewidth}{6pt} %debelina crte glave
\renewcommand{\footrulewidth}{0.25pt} %debelina crte noga
\setlength{\headsep}{1.5cm} %odmik iz roba strani
-%newcommand{\headerfooter}[5]{ %funkcija za izpis glave in noge
-% \lhead{\begin{tabular}{@{} m{135mm} } #1 \end{tabular}}
-% \rhead{\includegraphics[#4]{#2}}
-% \fancyfoot[l]{www.1ka.si}
-% %\fancyfoot[r]{#3 \thepage{}}
-% \fancyfoot[r]{ \thepage}
-%}
-\newcommand{\headerfooter}[6]{ %funkcija za izpis glave in noge
+
+\newcommand{\headerfooter}[7]{ %funkcija za izpis glave in noge
\lhead{\begin{tabular}{@{} m{135mm} } #1 #6 \end{tabular}}
\rhead{\includegraphics[#4]{#2}}
- \fancyfoot[l]{www.1ka.si}
- %\fancyfoot[r]{#3 \thepage{}}
+ \fancyfoot[l]{#7}
\fancyfoot[r]{ \thepage}
}
%vse za glavo in nogo - konec
+
%vse za naslovnico
\newcommand{\naslovnica}[9]{
\begin{titlepage}
@@ -207,7 +109,7 @@ \textcolor{crta}{\noindent\makebox[\linewidth]{\rule{\textwidth}{6pt}}} \par
\noindent
{\large \fontseries{l} \selectfont
- \begin{tabularx}{\textwidth}{Xl}
+ \begin{xltabular}{\textwidth}{Xl}
& \\
#5 \\
& \\
@@ -218,9 +120,10 @@ #8 \\
& \\
#9
- \end{tabularx}
+ \end{xltabular}
}
\vfill
\end{titlepage}
}
-%vse za naslovnico - konec
\ No newline at end of file +%vse za naslovnico - konec
+
diff --git a/admin/survey/export/xmlClasses/class.XmlSurvey.php b/admin/survey/export/xmlClasses/class.XmlSurvey.php index c4f7250..893b05e 100644 --- a/admin/survey/export/xmlClasses/class.XmlSurvey.php +++ b/admin/survey/export/xmlClasses/class.XmlSurvey.php @@ -63,9 +63,7 @@ class XmlSurvey{ //if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init())
if ( SurveyInfo::getInstance()->SurveyInit($this->anketa) )
{
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1){
- $this->db_table = '_active';
- }
+ $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
}
else{
return false;
diff --git a/admin/survey/export/xmlClasses/class.XmlSurveyElement.php b/admin/survey/export/xmlClasses/class.XmlSurveyElement.php index 630cdca..dceb330 100644 --- a/admin/survey/export/xmlClasses/class.XmlSurveyElement.php +++ b/admin/survey/export/xmlClasses/class.XmlSurveyElement.php @@ -57,8 +57,7 @@ class XmlSurveyElement{ {
SurveyUserSetting::getInstance()->Init($anketa, $global_user_id);
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1)
- $this->db_table = '_active';
+ $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
}
else{
return false;
|