summaryrefslogtreecommitdiffstats
path: root/admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php')
-rw-r--r--admin/survey/export/latexclasses/Vprasanja/BesediloLatex.php55
1 files changed, 31 insertions, 24 deletions
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;
}