From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- main/survey/app/Controllers/DisplayController.php | 169 +++++++++++++++------- 1 file changed, 117 insertions(+), 52 deletions(-) (limited to 'main/survey/app/Controllers/DisplayController.php') diff --git a/main/survey/app/Controllers/DisplayController.php b/main/survey/app/Controllers/DisplayController.php index c0cbf43..a783892 100644 --- a/main/survey/app/Controllers/DisplayController.php +++ b/main/survey/app/Controllers/DisplayController.php @@ -18,6 +18,8 @@ use SurveyInfo; use SurveySetting; use Common; use SurveyGorenje; +use SurveyPanel; +use AppSettings; class DisplayController extends Controller { @@ -39,8 +41,8 @@ class DisplayController extends Controller return new DisplayController(); } - public function logo() - { + public function logo(){ + // Za gorenje posebej prikazemo logo if(Common::checkModule('gorenje')){ SurveyGorenje::logoGorenje(get('anketa'), get('usr_id')); @@ -52,12 +54,31 @@ class DisplayController extends Controller // Logo prikazemo angleski v vseh primerih kjer respondentov jezik ni slovenscina in ce ni custom - popravimo tudi link na angleski frontend if (self::$lang['language'] != 'Slovenščina') { - $class = ' class="english"'; + + $class = 'english'; + if (strpos(self::$site_url, 'www.1ka.si') !== false) $url = self::$site_url.'d/en/'; } - echo ''; + // Ce gre za lastno namestitev ali virtualko prikazemo logo "namestitev" + if(isLastnaInstalacija() || isVirtual()){ + $class .= ' namestitev'; + } + // Ce gre za AAI prikazemo logo "arnes" + elseif(isAAI()){ + $class .= ' arnes'; + } + + // Ce imamo nastavljen custom logo za celo aplikacijo + $custom_logo_style = ''; + $custom_logo = AppSettings::getInstance()->getSetting('app_settings-custom_logo'); + if($custom_logo != false && $custom_logo != ''){ + $class = 'custom_logo'; + $custom_logo_style = 'style="background-image: url(\'../../../public/img/logo/custom_logo/'.$custom_logo.'\');"'; + } + + echo ''; } /** @@ -116,13 +137,39 @@ class DisplayController extends Controller // Prikaz opcije "nadaljuj kasneje" if ($row['continue_later'] == 1) { + SurveySetting::getInstance()->Init(get('anketa')); + if (get('lang_id') != null) $_lang = '_' . get('lang_id'); else $_lang = ''; $srv_continue_later = SurveySetting::getInstance()->getSurveyMiscSetting('srvlang_srv_continue_later' . $_lang); if ($srv_continue_later == '') $srv_continue_later = self::$lang['srv_continue_later']; + // Pri panelu v url samo vnesemo panel id respondenta, ker nimamo piskotkov + if(SurveyInfo::getInstance()->checkSurveyModule('panel')){ + + $sp = new SurveyPanel(get('anketa')); + $panel_id_name = $sp->getPanelSettings('user_id_name'); + + if ($panel_id_name != '') { + + $sqlPanel = sisplet_query("SELECT d.text AS panel_id + FROM srv_spremenljivka s, srv_data_text".get('db_table')." d + WHERE s.variable='".$panel_id_name."' AND s.id=d.spr_id AND d.usr_id='".get('usr_id')."' + "); + + if (mysqli_num_rows($sqlPanel) > 0) { + $rowPanel = mysqli_fetch_array($sqlPanel); + $panel_id = $rowPanel['panel_id']; + + $panel_url = SurveyInfo::getSurveyLink().'?'.$panel_id_name.'='.$panel_id; + + echo ''; + } + } + } + echo '
'; - echo ' ' . $srv_continue_later . ''; + echo ' ' . $srv_continue_later . ''; echo '
'; } @@ -138,8 +185,9 @@ class DisplayController extends Controller } // Prikaze ikono za izvoz pdf rezultatov v zakljucku - public function displayRespondetnPDF() - { + public function displayRespondetnPDF(){ + global $site_domain; + $row = SurveyInfo::getInstance()->getSurveyRow(); if ((int)$row['concl_PDF_link'] == 1) { @@ -182,7 +230,16 @@ class DisplayController extends Controller } echo '

'; - } + } + elseif( SurveyInfo::getInstance()->checkSurveyModule('nijz_radar_report') ){ + # parametre zapakiramo v array injih serializiramo in zakodiramo z base64 + $pdf_url = self::$site_url . 'admin/survey/izvoz.php?dc=' . base64_encode(serialize(array('m' => 'pdf_nijz', 'anketa' => get('anketa'), 'usr_id' => get('usr_id')))); + + #echo '
'; + echo '

'; + echo ' '.self::$lang['srv_report_pdf'].''; + echo '

'; + } else{ # parametre zapakiramo v array injih serializiramo in zakodiramo z base64 $pdf_url = self::$site_url . 'admin/survey/izvoz.php?dc=' . base64_encode(serialize(array('a' => 'pdf_results', 'anketa' => get('anketa'), 'usr_id' => get('usr_id'), 'type' => '0'))); @@ -205,10 +262,21 @@ class DisplayController extends Controller $return_url = $_POST['url'] . '&return=1'; $return_url = SurveyInfo::getSurveyLink() . get('cookie_url') . '&return=1'; - echo '

'; - echo self::$lang['srv_concl_return_edit_URL'].':
'; - echo ''.$return_url.''; - echo '

'; + echo '
'; + + echo '
'; + + echo '

'; + echo self::$lang['srv_concl_return_edit_URL'].':
'; + echo ' '.$return_url.''; + echo '

'; + + echo '
'; + + echo ' '; + echo '

' . self::$lang['srv_continue_later_email'] . ':

'; + + echo '
'; } } @@ -499,17 +567,23 @@ class DisplayController extends Controller $vprasanja = array(); $spr_ids = ''; - // Loop cez vsa ustrezna vprasanja in njihove vrednosti (jih zakesiramo) - $sqlS = sisplet_query("SELECT s.id AS spr_id, s.naslov AS spr_naslov, s.variable AS spr_variable - FROM srv_spremenljivka s, srv_grupa g + + // Loop cez vsa ustrezna vprasanja in njihove vrednosti (jih zakesiramo) in bloke v katerih se nahajajo (pohvale in izzivi morajo biti iz locenih blokov) + $sqlS = sisplet_query("SELECT s.id AS spr_id, s.naslov AS spr_naslov, s.variable AS spr_variable, i.label AS block_label, i.id AS block_id + FROM srv_spremenljivka s, srv_grupa g, srv_branching b, srv_if i WHERE g.ank_id='".get('anketa')."' AND s.gru_id=g.id AND s.variable LIKE 'R%' + AND b.ank_id='".get('anketa')."' AND b.element_spr=s.id AND i.id=b.parent AND i.tip='1' "); + if (!$sqlS) echo mysqli_error($GLOBALS['connect_db']); while($rowS = mysqli_fetch_array($sqlS)){ $vprasanje_number = substr($rowS['spr_variable'], 1); - $vprasanja[$rowS['spr_id']] = $vprasanje_number; + $vprasanja[$rowS['spr_id']]['number'] = $vprasanje_number; + + $vprasanja[$rowS['spr_id']]['block_id'] = $rowS['block_id']; + $vprasanja[$rowS['spr_id']]['block_label'] = $block_label; // ID-ji vprasanj za query $spr_ids .= $rowS['spr_id'].','; @@ -581,18 +655,28 @@ class DisplayController extends Controller echo '
'.$rowNagovor['naslov'].'
'; $i = 1; + $used_block_ids = array(); foreach($pohvale as $pohvala_vrednost => $vrednost){ + $spr_id = $vrednost['spr_id']; + + $block_id = $vprasanja[$spr_id]['block_id']; + + // Pohvala iz tega bloka je ze bila prikazana + if(in_array($block_id, $used_block_ids)) + continue; + + // Prikazane so bile ze 3 pohvale if($i > $max_odgovorov) break; - $spr_id = $vrednost['spr_id']; - $vprasanje_number = $vprasanja[$spr_id]; + $vprasanje_number = $vprasanja[$spr_id]['number']; echo '
'; echo '
'.$pohvale_besedilo[$vprasanje_number].'
'; echo '
'; + $used_block_ids[] = $block_id; $i++; } @@ -608,18 +692,28 @@ class DisplayController extends Controller echo '
'.$rowNagovor['naslov'].'
'; $i = 1; + $used_block_ids = array(); foreach($izzivi as $izziv_vrednost => $vrednost){ - + + $spr_id = $vrednost['spr_id']; + + $block_id = $vprasanja[$spr_id]['block_id']; + + // Izziv iz tega bloka je ze bil prikazan + if(in_array($block_id, $used_block_ids)) + continue; + + // Prikazani so bili ze 3 izzivi if($i > $max_odgovorov) break; - $spr_id = $vrednost['spr_id']; - $vprasanje_number = $vprasanja[$spr_id]; + $vprasanje_number = $vprasanja[$spr_id]['number']; echo '
'; echo '
'.$izzivi_besedilo[$vprasanje_number].'
'; echo '
'; + $used_block_ids[] = $block_id; $i++; } @@ -700,7 +794,7 @@ class DisplayController extends Controller $json_pohvale = json_encode($pohvale); $json_izzivi = json_encode($izzivi); - echo '

Pajkova mreža

'; + echo '

PAJKOVA MREŽA

'; // Nagovor za mrezo $sqlNagovor = sisplet_query("SELECT s.naslov, s.variable @@ -731,7 +825,7 @@ class DisplayController extends Controller $anketa = get('anketa'); - echo '
'; + echo '
'; echo '
'; echo '
'; @@ -781,35 +875,6 @@ class DisplayController extends Controller } } - /** - * @desc konstruktor - */ - public function PrintSurvey() - { - - if (isset($_GET['anketa'])) { - save('anketa', $_GET['anketa']); - - $rowa = SurveyInfo::getInstance()->getSurveyRow(); - - // uvodni nagovor - if ($rowa['show_intro'] != 0) { - Body::getInstance()->displayIntroduction(); - } - - // prikažemo ankete - do { - save('grupa', Find::getInstance()->findNextGrupa()); - - Body::getInstance()->displayAnketa(); - } while (get('grupa') != Find::getInstance()->findNextGrupa() && Find::getInstance()->findNextGrupa() > 0); - - // prikažemo konec - Body::getInstance()->displayKonec(); - } else - echo 'Ni podatkov o anketi!'; - } - /** * @desc prikaze chat okno za tawk chat, ce je modul vklopljen (js koda) -- cgit v1.2.3