diff --git a/admin/survey/export/latexclasses/class.LatexSurveyElement.php b/admin/survey/export/latexclasses/class.LatexSurveyElement.php index 93ccb1fd0..f6a5bae6d 100644 --- a/admin/survey/export/latexclasses/class.LatexSurveyElement.php +++ b/admin/survey/export/latexclasses/class.LatexSurveyElement.php @@ -195,12 +195,17 @@ class LatexSurveyElement{ $sqlVrstic = sisplet_query("SELECT count(*) FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."'"); $rowVrstic = mysqli_fetch_row($sqlVrstic); $visina = round(($rowVrstic[0]+2) * 8); - + + //$linecount_vprasanja = $this->pdf->getNumLines($spremenljivke['naslov'], $this->pdf->getPageWidth()); + + //$tex = $spremenljivke['naslov']; ######################################### Pridobimo tekst vprasanja - konec #Stevilcenje vprasanj############################################################### + //$numberingText = ($this->numbering == 1) ? $spremenljivke['variable'].' - ' : ''; $numberingText = ($this->numbering == 1) ? $this->encodeText($spremenljivke['variable']).' - ' : ''; ######################################### Stevilcenje vprasanj - konec + //echo "goli naslov: ".$spremenljivke['naslov']."
"; //belezenje imena spremenljivke, zaradi GDPR vprasanja $this->variableName =$spremenljivke['variable']; @@ -219,6 +224,36 @@ class LatexSurveyElement{ #Izpis if-ov pri vprasanju######################################################### if($this->showIf == 1){ + // TODO: Stara koda za iskanje po branchingu (briši, če je vse ok) + //$b = new Branching($this->anketa); + //$parents = $b->get_parents($spremenljivke['id']); + //$parents = explode('p_', $parents); + //foreach ($parents AS $key => $val) { + // if ( is_numeric(trim($val)) ) { + // $parents[$key] = (int)$val; + // } else { + // unset($parents[$key]); + // } + //} + + /* $b = new Branching($this->anketa); + $parents = $b->get_parents($spremenljivke['id']); + $parents = explode('p_', $parents); + foreach ($parents AS $key => $val) { + if ( is_numeric(trim($val)) ) { + $parents[$key] = (int)$val; + } else { + unset($parents[$key]); + } + } + + foreach ($parents AS $if) { + $tex .= $this->displayIf($if); + $tex .= $this->texNewLine; + }*/ + ###### stara koda, ki je delavala + + // Po novem izpisemo pred vsakim vprasanjem vse ife znotraj katerih se nahaja Cache::cache_all_srv_branching($this->anketa); $parents = Cache::srv_branching($spremenljivke['id'], 0)['parent']; @@ -230,6 +265,8 @@ class LatexSurveyElement{ } ######################################### Izpis if-ov pri vprasanju - konec + + //$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 @@ -276,9 +313,43 @@ class LatexSurveyElement{ $tex .= $this->texNewLine; } } - } - } - else{ //ce je vodoravno ob vprasanju + } + + #################### +/* 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
"; + } + } + + //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
"; + } + //$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 @@ -299,16 +370,14 @@ class LatexSurveyElement{ #ce vprasanje nima moznih odgovorov, je potrebno zakljuciti environment (absolutelynopagebreak) pri pdf //echo $rowVrstic[0]."za spremenljivko: ".$spremenljivke['tip']."
"; 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($this->export_format == 'pdf'){ //ce je pdf if($spremenljivke['orientation']==0 || $spremenljivke['orientation']==2){ //ce sta vodoravni orientaciji $tex .= $this->texNewLine; //dodaj na koncu vprasanja prazno vrstico } $tex .= $this->texBigSkip; $tex .= $this->texBigSkip; $tex .= '\\end{absolutelynopagebreak}'; //zakljucimo environment, da med vprasanji ne bo prelomov strani - } - else{ //ce je rtf + }else{ //ce je rtf if($spremenljivke['orientation']==0 || $spremenljivke['orientation']==2){ //ce sta vodoravni orientaciji $tex .= $this->texNewLine; //dodaj na koncu vprasanja prazno vrstico } @@ -318,7 +387,7 @@ class LatexSurveyElement{ } #ce vprasanje nima moznih odgovorov, je potrebno zakljuciti environment (absolutelynopagebreak) pri pdf - konec } - + //echo "tex: ".$tex."
"; return $tex; } #funkcija, ki pripravi latex kodo za prikazovanje besedila vprasanja - konec ############################################################################