summaryrefslogtreecommitdiffstats
path: root/admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php')
-rw-r--r--admin/survey/export/latexclasses/Vprasanja/VsotaLatex.php41
1 files changed, 26 insertions, 15 deletions
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