false); // za shrambo parametrov in sporocil var $pdf; var $currentStyle; var $currentHeight = 0; // visina trenutnega vprasanja var $SUS; //SurveyUserSettng var $SA; //SurveyAnketa var $db_table = ''; var $type = 0; // nacin izpisa vprasanj - kratek -> 0, dolg -> 1, 2 -> zelo kratek var $pageBreak = 0; // vsak respondent na svoji strani var $showIf = 0; // izpis if-ov var $font = 10; // velikost pisave var $numbering = 0; // ostevillcevanje vprasanj var $showRecnum = 1; // prikaz recnuma var $skipEmpty = 0; // izpusti vprasanja brez odgovora var $skipEmptySub = 0; // izpusti podvprasanja brez odgovora var $landscape = 0; // landscape izpis var $loop_id = null; // id trenutnega loopa ce jih imamo var $usr_type = null; // tip userja (null->iz vmesnika, author->avtor iz maila, respondent->respondent iz maila, other->other iz maila) var $usr_id = null; // id userja ki je odgovarjal (na katerega so vezani podatki) var $resp_id = null; // id userja na katerega so vezane nastavitve ankete (filtriranje spremenljivk...) var $admin_type = -1; // tip userja ki odpira pdf (posebej nastavimo ker global admin_type ne dela iz mailov) /** * @desc konstruktor */ function __construct ($anketa = null, $usr_type = null, $usr_id = null) { global $site_path; global $global_user_id; // preverimo ali imamo stevilko ankete if ( is_numeric($anketa) ) { $this->anketa['id'] = $anketa; $this->usr_id = $_GET['usr_id']; // Ce prihajamo iz maila imamo nastavljen usr_type in usr_id if($usr_type != null && $usr_id != null){ $this->usr_type = $usr_type; //$this->resp_id = $usr_id; // Ajda hoce da ce dobi po mailu pdf mora bit isti kot ga dobi respondent $this->resp_id = $_GET['usr_id']; } // Drugace prihajamo normalno iz podatkov (usr_id je avtorjev -> $global_user_id) else{ $this->resp_id = $global_user_id; } // Nastavimo admin type $sqlU = sisplet_query("SELECT type FROM users WHERE id='".$this->resp_id."'"); if($rowU = mysqli_fetch_array($sqlU)) $this->admin_type = $rowU['type']; // Po novem imamo globalne nastavitve SurveySetting::getInstance()->Init($anketa); $this->type = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_type'); $this->font = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_font_size'); $this->showIf = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_show_if'); $this->numbering = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_numbering'); $this->pageBreak = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_PB'); $this->showRecnum = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_show_recnum'); $this->skipEmpty = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty'); $this->skipEmptySub = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_skip_empty_sub'); $this->landscape = (int)SurveySetting::getInstance()->getSurveyMiscSetting('export_data_landscape'); SurveyStatusProfiles::Init($anketa); // create new PDF document $orientation = ($this->landscape == 1) ? 'L' : 'P'; $this->pdf = new enka_TCPDF($orientation, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); } else { $this->pi['msg'] = "Anketa ni izbrana!"; $this->pi['canCreate'] = false; return false; } if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init()) { SurveyUserSetting::getInstance()->Init($this->anketa['id'], $global_user_id); if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) $this->db_table = '_active'; } else return false; // ce smo prisli do tu je vse ok $this->pi['canCreate'] = true; return true; } // SETTERS && GETTERS function checkCreate() { return $this->pi['canCreate']; } function getFile($fileName) { //Close and output PDF document $this->pdf->Output($fileName, 'I'); } function init() { global $lang; // array used to define the language and charset of the pdf file to be generated $language_meta = Array(); $language_meta['a_meta_charset'] = 'UTF-8'; $language_meta['a_meta_dir'] = 'ltr'; $language_meta['a_meta_language'] = 'sl'; $language_meta['w_page'] = $lang['page']; //set some language-dependent strings $this->pdf->setLanguageArray($language_meta); //set margins if(!$this->getUserId()){ $this->pdf->setPrintHeaderFirstPage(false); $this->pdf->setPrintFooterFirstPage(false); } else{ $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 if($this->getUserId()){ $sqlu = sisplet_query("SELECT * FROM srv_user WHERE id = '".$this->getUserId()."'"); $rowu = mysqli_fetch_array($sqlu); $rightTitle = ($this->showRecnum == 1) ? SurveyInfo::getInstance()->getSurveyAkronim().' (recnum '.$rowu['recnum'].')' : SurveyInfo::getInstance()->getSurveyAkronim(); $this->pdf->SetHeaderData(null, null, "www.1ka.si", $this->encodeText($rightTitle)); //nastavimo datum za footer $this->pdf->SetFooterDate($rowu['time_edit']); } else $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, '', $this->font); //set image scale factor $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); return true; } function createPdf() { // Izpis vseh odgovorov (vsi respondenti -> max 300) if(!$this->getUserId()) $this->outputAllResults(); // Izpis odgovorov enega respondenta else $this->outputSurvey(); } function createFrontPage() { global $lang; // dodamo prvo stran $this->pdf->AddPage(); $this->pdf->SetFont(FNT_MAIN_TEXT, '', 16); // dodamo naslov $this->pdf->SetFillColor(224, 235, 255); $this->pdf->SetTextColor(0); $this->pdf->SetDrawColor(128, 0, 0); $this->pdf->SetLineWidth(0.1); $this->pdf->Sety(100); if(!$this->getUserId()){ $this->pdf->Cell(0, 10, $this->encodeText(SurveyInfo::getInstance()->getSurveyTitle()), 'TLR', 1,'C', 1, 0,0); $this->pdf->SetFont(FNT_MAIN_TEXT, '', 13); $this->pdf->Cell(0, 10, $this->encodeText($lang['export_firstpage_results']), 'BLR', 1,'C', 1, 0,0); } else{ $this->pdf->Cell(0, 16, $this->encodeText(SurveyInfo::getInstance()->getSurveyTitle()), 1, 1,'C', 1, 0,0); } // dodamo info: $this->pdf->SetFont(FNT_MAIN_TEXT, '', 12); $this->currentStyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(128, 0, 0)); $this->pdf->ln(30); // $this->pdf->Write (0, $this->encodeText("Info:"), '', 0, 'l', 1, 1); $this->drawLine(); // avtorja, št vprašanj, datum kreiranja $this->pdf->MultiCell(95, 5, $lang['export_firstpage_shortname'].': '.$this->encodeText(SurveyInfo::getInstance()->getSurveyTitle()), 0, 'L', 0, 1, 0 ,0, true); if ( SurveyInfo::getInstance()->getSurveyTitle() != SurveyInfo::getInstance()->getSurveyAkronim()) $this->pdf->MultiCell(95, 5, $lang['export_firstpage_longname'].': '.$this->encodeText(SurveyInfo::getInstance()->getSurveyAkronim()), 0, 'L', 0, 1, 0 ,0, true); $this->pdf->MultiCell(95, 5, $lang['export_firstpage_qcount'].': '.SurveyInfo::getInstance()->getSurveyQuestionCount(), 0, 'L', 0, 1, 0 ,0, true); /// Aktiviranost $activity = SurveyInfo:: getSurveyActivity(); $_last_active = end($activity); if (SurveyInfo::getSurveyColumn('active') == 1) { $this->pdf->SetTextColor(0,150,0); $this->pdf->MultiCell(95, 5, $this->encodeText($lang['srv_anketa_active2']), 0, 'L', 0, 1, 0 ,0, true); } else { # preverimo ali je bila anketa že aktivirana if (!isset($_last_active['starts'])) { # anketa še sploh ni bila aktivirana $this->pdf->SetTextColor(255,120,0); $this->pdf->MultiCell(95, 5, $this->encodeText($lang['srv_survey_non_active_notActivated']), 0, 'L', 0, 1, 0 ,0, true); } else { # anketa je že bila aktivirna ampak je sedaj neaktivna $this->pdf->SetTextColor(255,120,0); $this->pdf->MultiCell(95, 5, $this->encodeText($lang['srv_survey_non_active']), 0, 'L', 0, 1, 0 ,0, true); } } $this->pdf->SetTextColor(0); // Aktivnost if( count($activity) > 0 ){ $this->pdf->MultiCell(95, 5, $lang['export_firstpage_active_from'].': '.SurveyInfo::getInstance()->getSurveyStartsDate(), 0, 'L', 0, 0, 0 ,0, true); $this->pdf->MultiCell(95, 5, $lang['export_firstpage_active_until'].': '.SurveyInfo::getInstance()->getSurveyExpireDate(), 0, 'L', 0, 1, 0 ,0, true); } $this->pdf->MultiCell(95, 5, $lang['export_firstpage_author'].': '.$this->encodeText(SurveyInfo::getInstance()->getSurveyInsertName()), 0, 'L', 0, 0, 0 ,0, true); $this->pdf->MultiCell(95, 5, $lang['export_firstpage_edit'].': '.$this->encodeText(SurveyInfo::getInstance()->getSurveyEditName()), 0, 'L', 0, 1, 0 ,0, true); $this->pdf->MultiCell(95, 5, $lang['export_firstpage_date'].': '.SurveyInfo::getInstance()->getSurveyInsertDate(), 0, 'L', 0, 0, 0 ,0, true); $this->pdf->MultiCell(95, 5, $lang['export_firstpage_date'].': '.SurveyInfo::getInstance()->getSurveyEditDate(), 0, 'L', 0, 1, 0 ,0, true); if ( SurveyInfo::getInstance()->getSurveyInfo() ) $this->pdf->MultiCell(95, 5, $lang['export_firstpage_desc'].': '.$this->encodeText(SurveyInfo::getInstance()->getSurveyInfo()), 0, 'L', 0, 1, 0 ,0, true); $this->pdf->SetFont(FNT_MAIN_TEXT, '', $this->font); $this->pdf->SetFillColor(0, 0, 0); } // Izpis vseh userjev, ki so odgovorili function outputAllResults(){ global $lang; //$izbranStatusProfile = SurveyUserSetting :: getInstance()->getSettings('default_status_profile_export'); $izbranStatusProfile = SurveyStatusProfiles :: getStatusAsQueryString(); $sqlu = sisplet_query("SELECT * FROM srv_user WHERE ank_id = '".$this->anketa['id']."' ".$izbranStatusProfile." AND deleted='0' AND preview='0' ORDER BY recnum"); //ce imamo vec kot 300 anketirancev ne izpisemo $count = mysqli_num_rows($sqlu); if( $count > 300 ){ $this->pdf->AddPage(); $this->pdf->setFont('','B','15'); $this->pdf->MultiCell(150, 5, 'NAPAKA!', 0, 'L', 0, 1, 0 ,0, true); $this->pdf->MultiCell(150, 5, 'Izpis ni možen zaradi prevelikega števila odgovorov ('.$count.')', 0, 'L', 0, 1, 0 ,0, true); $this->pdf->ln(5); } else{ // izpišemo prvo stran $this->createFrontPage(); if($this->pageBreak == 0) $this->pdf->AddPage(); while( $rowu = mysqli_fetch_array($sqlu) ){ //izpis statusa switch($rowu['last_status']){ case '0': $status = $lang['srv_userstatus_0']; break; case '1': $status = $lang['srv_userstatus_1']; break; case '2': $status = $lang['srv_userstatus_2']; break; case '3': $status = $lang['srv_userstatus_3']; break; case '4': $status = $lang['srv_userstatus_4']; break; case '5': $status = $lang['srv_userstatus_5']; break; case '6': $status = $lang['srv_userstatus_6']; $status .= ($rowu['lurker'] == '1') ? ' - lurker' : ''; break; } if($this->pageBreak == 1) $this->pdf->AddPage(); $this->pdf->setFont('','B', 14); if($this->showRecnum == 1) $this->pdf->MultiCell(150, 5, 'Recnum '.$rowu['recnum'].' (status '.$rowu['last_status'].' - '.$status.')', 0, 'L', 0, 1, 0 ,0, true); else $this->pdf->MultiCell(150, 5, 'Status '.$rowu['last_status'].' - '.$status, 0, 'L', 0, 1, 0 ,0, true); $this->pdf->ln(5); //izpis posameznega userja $this->usr_id = $rowu['id']; $this->outputUser(); } } } // Izpis vprasalnika z odgovori function outputSurvey(){ global $lang; $rowA = SurveyInfo::getInstance()->getSurveyRow(); // izpišemo prvo stran if (false) $this->createFrontPage(); // Izpisemo vprasalnik $this->pdf->AddPage(); // filtriramo spremenljivke glede na profil - SAMO CE NE PRIHAJAMO IZ MAILA! $tmp_svp_pv = array(); if($this->usr_type == null){ SurveyVariablesProfiles :: Init($this->anketa['id']); $dvp = SurveyUserSetting :: getInstance()->getSettings('default_variable_profile'); $_currentVariableProfile = SurveyVariablesProfiles :: checkDefaultProfile($dvp); $tmp_svp_pv = SurveyVariablesProfiles :: getProfileVariables($_currentVariableProfile); foreach ( $tmp_svp_pv as $vid => $variable) { $tmp_svp_pv[$vid] = substr($vid, 0, strpos($vid, '_')); } } // ce obstaja intro izpisemo intro - pri izpisu vprasalnika brez odgovorov (ce smo na prvi strani moramo biti v razsirjenem nacinu) /*if(($rowA['expanded'] == 1 && $this->allResults == 3) || (!$this->getUserId() && $this->allResults == 0)){ if ( SurveyInfo::getInstance()->getSurveyShowIntro() ) { $intro = (SurveyInfo::getInstance()->getSurveyIntro() == '') ? $lang['srv_intro'] : SurveyInfo::getInstance()->getSurveyIntro(); $this->pdf->Write (0, $this->encodeText(SurveyInfo::getInstance()->getSurveyIntro()), '', 0, 'L', 1, 1); $this->pdf->Ln(LINE_BREAK); //$this->pdf->drawLine(); $this->pdf->Ln(LINE_BREAK); } }*/ if ( $this->getGrupa() ) { $sqlGrupeString = "SELECT id FROM srv_grupa WHERE ank_id='".$this->anketa['id']."' AND id = '".$this->getGrupa()."' ORDER BY vrstni_red"; } else { $sqlGrupeString = "SELECT id FROM srv_grupa WHERE ank_id='".$this->anketa['id']."' ORDER BY vrstni_red"; } $sqlGrupe = sisplet_query($sqlGrupeString); 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 * 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 ($if_id > 0){ $sql1 = sisplet_query("SELECT * FROM srv_loop WHERE if_id = '$if_id'"); $row1 = mysqli_fetch_array($sql1); $this->loop_id = $this->findNextLoopId($row1['if_id']); $if = Cache::srv_if($if_id); $loop_title = $if['label']; // gremo cez vse spremenljivke v trenutnem loopu while($this->loop_id != null){ // Izrisemo naslov loopa $this->pdf->SetTextColor(0,0,200); $this->pdf->SetDrawColor(0,0,200); $this->pdf->setFont('','B',$this->font); $this->pdf->Write (0, $this->encodeText($this->dataPiping($loop_title)), '', 0, 'L', 1, 1); $this->pdf->SetTextColor(0,0,200); $this->pdf->SetDrawColor(0,0,200); $this->pdf->setFont('','',$this->font); $sqlSpremenljivke = sisplet_query("SELECT * 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 ( $this->checkSpremenljivka ($spremenljivka) /*|| $this->showIf == 1*/ ) { // lahko izrišemo spremenljivke // po potrebi obarvamo vprašanja $this->pdf->SetTextColor(0); if ($rowSpremenljivke['visible'] == 0) { if ($rowSpremenljivke['sistem'] == 1) { // če je oboje = vijolčno $this->pdf->SetTextColor(128,0,128); } else { // Če je skrito = rdeče $this->pdf->SetTextColor(255,0,0); } } else if ($rowSpremenljivke['sistem'] == 1) $this->pdf->SetTextColor(0,0,255); $this->pdf->SetTextColor(0,0,0); $this->pdf->SetDrawColor(0,0,0); // Izpis vprasalnika z rezultati // Ce imamo kombinirano tabelo pogledamo ce prikazujemo katero od podtabel if($rowSpremenljivke['tip'] == 24){ $subGrids = array(); $showGridMultiple = false; // Loop po podskupinah gridov $sqlSubGrid = sisplet_query("SELECT m.spr_id, s.tip, s.enota FROM srv_grid_multiple m, srv_spremenljivka s WHERE m.parent='".$spremenljivka."' AND m.spr_id=s.id"); while($rowSubGrid = mysqli_fetch_array($sqlSubGrid)){ if(in_array($rowSubGrid['spr_id'],$tmp_svp_pv) || count($tmp_svp_pv) == 0){ $showGridMultiple = true; break; } } } // ce je nastavljen profil s filtriranimi spremenljivkami if(in_array($spremenljivka,$tmp_svp_pv) || count($tmp_svp_pv) == 0 || ($rowSpremenljivke['tip'] == 24 && $showGridMultiple) || $rowSpremenljivke['tip'] == 5){ $this->currentHeight = 0; // NAVADEN IZPIS rezultatov spremenljivke - kratek samo pri radio, checkbox, multiradio, multicheckbox, besedilo //if( $this->type == 0 && in_array($rowSpremenljivke['tip'], array(1,2,3,6,16,21,7,8)) ){ if( $this->type == 0 && in_array($rowSpremenljivke['tip'], array(1,2,3,6,16,21,7,8,27)) ){ if($rowSpremenljivke['tip'] < 4) $this->outputVprasanjeValues($rowSpremenljivke); else $this->outputVprasanje($rowSpremenljivke); $this->outputSpremenljivkeValues($rowSpremenljivke); } // KRATEK IZPIS rezultatov spremenljivke elseif($this->type == 2 && $rowSpremenljivke['tip'] != 24){ $this->outputVprasanjeValues($rowSpremenljivke); $this->outputSpremenljivkeValues($rowSpremenljivke); } // DOLG IZPIS rezultatov else{ $this->outputVprasanje($rowSpremenljivke); $this->outputSpremenljivke($rowSpremenljivke); } $this->pdf->Ln(LINE_BREAK); } } } $this->loop_id = $this->findNextLoopId(); } } // Navadne spremenljivke ki niso v loopu else{ $sqlSpremenljivke = sisplet_query("SELECT * 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 ( $this->checkSpremenljivka ($spremenljivka) /*|| $this->showIf == 1*/ ) { // lahko izrišemo spremenljivke // po potrebi obarvamo vprašanja $this->pdf->SetTextColor(0); if ($rowSpremenljivke['visible'] == 0) { if ($rowSpremenljivke['sistem'] == 1) { // če je oboje = vijolčno $this->pdf->SetTextColor(128,0,128); } else { // Če je skrito = rdeče $this->pdf->SetTextColor(255,0,0); } } else if ($rowSpremenljivke['sistem'] == 1) $this->pdf->SetTextColor(0,0,255); $this->pdf->SetTextColor(0,0,0); $this->pdf->SetDrawColor(0,0,0); // Izpis vprasalnika z rezultati // Ce imamo kombinirano tabelo pogledamo ce prikazujemo katero od podtabel if($rowSpremenljivke['tip'] == 24){ $subGrids = array(); $showGridMultiple = false; // Loop po podskupinah gridov $sqlSubGrid = sisplet_query("SELECT m.spr_id, s.tip, s.enota FROM srv_grid_multiple m, srv_spremenljivka s WHERE m.parent='".$spremenljivka."' AND m.spr_id=s.id"); while($rowSubGrid = mysqli_fetch_array($sqlSubGrid)){ if(in_array($rowSubGrid['spr_id'],$tmp_svp_pv) || count($tmp_svp_pv) == 0){ $showGridMultiple = true; break; } } } // ce je nastavljen profil s filtriranimi spremenljivkami if(in_array($spremenljivka,$tmp_svp_pv) || count($tmp_svp_pv) == 0 || $rowSpremenljivke['tip'] == 5 || ($rowSpremenljivke['tip'] == 24 && $showGridMultiple)){ $this->currentHeight = 0; // NAVADEN IZPIS rezultatov spremenljivke - kratek samo pri radio, checkbox, multiradio, multicheckbox, besedilo if( $this->type == 0 && in_array($rowSpremenljivke['tip'], array(1,2,3,6,16,21,7,8)) ){ if($rowSpremenljivke['tip'] < 4) $this->outputVprasanjeValues($rowSpremenljivke); else $this->outputVprasanje($rowSpremenljivke); $this->outputSpremenljivkeValues($rowSpremenljivke); } // KRATEK IZPIS rezultatov spremenljivke elseif($this->type == 2 && $rowSpremenljivke['tip'] != 24){ $this->outputVprasanjeValues($rowSpremenljivke); $this->outputSpremenljivkeValues($rowSpremenljivke); } // DOLG IZPIS rezultatov else{ $this->outputVprasanje($rowSpremenljivke); $this->outputSpremenljivke($rowSpremenljivke); } $this->pdf->Ln(LINE_BREAK); } } } } } // če izpisujemo grupo, ne izpisujemo zakljucka if ( !$this->getGrupa() ){ if ( SurveyInfo::getInstance()->getSurveyShowConcl() && SurveyInfo::getInstance()->getSurveyConcl() ) { // ce obstaja footer izpisemo footer $this->pdf->Ln(LINE_BREAK); $this->pdf->drawLine(); $this->pdf->Ln(LINE_BREAK); $this->pdf->Write (0, $this->encodeText(SurveyInfo::getInstance()->getSurveyConcl()), '', 0, 'L', 1, 1); } } } function outputVprasanje($spremenljivke){ // razsiritev ce imamo landscape postavitev $expand_width = $this->landscape == 1 ? 1.5 : 1; // Izpisemo tekst vprasanja $this->pdf->SetFont(FNT_MAIN_TEXT, '', $this->font); $pozicija_vprasanja = $this->pdf->getY(); $sqlVrstic = sisplet_query("SELECT count(*) FROM srv_vrednost WHERE spr_id='".$spremenljivke['id']."'"); $rowVrstic = mysqli_fetch_row($sqlVrstic); $visina = round(($rowVrstic[0]+2) * 8); $naslov = $this->dataPiping($spremenljivke['naslov']); $linecount_vprasanja = $this->pdf->getNumLines($naslov, $this->pdf->getPageWidth()); if($pozicija_vprasanja + $linecount_vprasanja*4.7 /*+ $visina*/ > 240/$expand_width) { $this->pdf->AddPage(); } //izpis if-ov pri vprasanju if($this->showIf == 1){ /*$sqlIf = sisplet_query("SELECT * FROM srv_branching WHERE element_spr='$spremenljivke[id]'"); $rowIf = mysqli_fetch_array($sqlIf); if ($rowIf['parent'] > 0){ $rowb = Cache::srv_if($rowIf['parent']); if ($rowb['tip'] == 0) $this->displayIf($rowIf['parent']); }*/ // Po novem izpisemo pred vsakim vprasanjem vse ife znotraj katerih se nahaja $b = new Branching($this->anketa['id']); $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) { $this->displayIf($if); } } // stevilcenje vprasanj $numberingText = ($this->numbering == 1) ? $spremenljivke['variable'].' - ' : ''; $this->pdf->setFont('','B',$this->font); $this->pdf->Write (0, $numberingText . $this->encodeText($naslov), '', 0, 'l', 1, 1); /*$text = strip_tags($numberingText . $spremenljivke['naslov'], '