summaryrefslogtreecommitdiffstats
path: root/main/survey/app/Controllers/DisplayController.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /main/survey/app/Controllers/DisplayController.php
parentprvi-commit (diff)
download1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip
Diffstat (limited to 'main/survey/app/Controllers/DisplayController.php')
-rw-r--r--main/survey/app/Controllers/DisplayController.php169
1 files changed, 117 insertions, 52 deletions
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 '<div id="logo" ' . $class . '><a href="' . $url . '" title="' . self::$lang['srv_1cs'] . ' ' . self::$lang['srv_footer_1ka'] . '" target="_blank">' . self::$lang['srv_1cs'] . '</a><div id="logo_right"></div></div>';
+ // 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 '<div id="logo" class="'.$class.'" '.$custom_logo_style.'><a href="'.$url.'" title="'.self::$lang['srv_1cs'].' ' .self::$lang['srv_footer_1ka'].'" target="_blank">'.self::$lang['srv_1cs'].'</a><div id="logo_right"></div></div>';
}
/**
@@ -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 '<input type="hidden" id="panel_url" name="panel_url" value="'.$panel_url.'">';
+ }
+ }
+ }
+
echo '<div class="continue_later_setting">';
- echo ' <a href="#" onclick="continue_later(\'' . self::$site_url . '\', \'' . get('lang_id') . '\'); return false;">' . $srv_continue_later . '</a>';
+ echo ' <a href="#" onclick="continue_later(\'' . self::$site_url . '\', \'' . self::$lang['id'] . '\'); return false;">' . $srv_continue_later . '</a>';
echo '</div>';
}
@@ -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 '</p></div>';
- }
+ }
+ 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 '<div id="icon_bar">';
+ echo '<br class="clr"/><div><p>';
+ echo '<a href="' . $pdf_url . '" class="pdfExport" target="_blank"><span class="sprites pdf_white"></span> '.self::$lang['srv_report_pdf'].'</a>';
+ echo '</p></div>';
+ }
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 '<br class="clr"/><div class="return_edit_url"><p>';
- echo self::$lang['srv_concl_return_edit_URL'].':<br />';
- echo '<a href="'.$return_url.'" title="'.self::$lang['srv_concl_return_edit_URL'].'"><span>'.$return_url.'</span></a>';
- echo '</p></div>';
+ echo '<br class="clr"/>';
+
+ echo '<div id="return_edit" class="return_edit_url">';
+
+ echo ' <p>';
+ echo self::$lang['srv_concl_return_edit_URL'].':<br />';
+ echo ' <a href="'.$return_url.'" title="'.self::$lang['srv_concl_return_edit_URL'].'"><span>'.$return_url.'</span></a>';
+ echo ' </p>';
+
+ echo '<br class="clr"/>';
+
+ echo ' <input type="hidden" name="url" id="url" value="' . $return_url . '">';
+ echo ' <p id="return_edit_email">' . self::$lang['srv_continue_later_email'] . ': <input type="email" name="email" id="email" value="" placeholder="' . self::$lang['srv_email_example2'] . '"> <button type="submit" class="blue" onclick="return_edit_send(\'' . self::$site_url . '\', \'' . get('lang_id') . '\'); return false;">' . self::$lang['srv_forma_send'] . '</button></p>';
+
+ echo '</div>';
}
}
@@ -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 '<div class="spremenljivka" style="border-bottom:0;"><div class="naslov">'.$rowNagovor['naslov'].'</div></div>';
$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 '<div class="spremenljivka">';
echo ' <div class="naslov">'.$pohvale_besedilo[$vprasanje_number].'</div>';
echo '</div>';
+ $used_block_ids[] = $block_id;
$i++;
}
@@ -608,18 +692,28 @@ class DisplayController extends Controller
echo '<div class="spremenljivka" style="border-bottom:0;"><div class="naslov">'.$rowNagovor['naslov'].'</div></div>';
$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 '<div class="spremenljivka">';
echo ' <div class="naslov">'.$izzivi_besedilo[$vprasanje_number].'</div>';
echo '</div>';
+ $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 '<br><h2 style="padding-left: 20px;">Pajkova mreža</h2>';
+ echo '<br><h2 style="padding-left: 20px;">PAJKOVA MREŽA</h2>';
// Nagovor za mrezo
$sqlNagovor = sisplet_query("SELECT s.naslov, s.variable
@@ -731,7 +825,7 @@ class DisplayController extends Controller
$anketa = get('anketa');
- echo '<div class="outercontainer_holder"><div class="outercontainer_holder_top"></div>';
+ echo '<div class="outercontainer_holder error"><div class="outercontainer_holder_top"></div>';
echo '<div id="outercontainer">';
echo ' <div class="outercontainer_header"></div>';
@@ -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)