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 '
';
}
@@ -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 '
';
}
}
@@ -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 '