summaryrefslogtreecommitdiffstats
path: root/main/survey/app/Controllers/Vprasanja/VprasanjaController.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/Vprasanja/VprasanjaController.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/Vprasanja/VprasanjaController.php')
-rw-r--r--main/survey/app/Controllers/Vprasanja/VprasanjaController.php153
1 files changed, 103 insertions, 50 deletions
diff --git a/main/survey/app/Controllers/Vprasanja/VprasanjaController.php b/main/survey/app/Controllers/Vprasanja/VprasanjaController.php
index c34b1c3..baeb207 100644
--- a/main/survey/app/Controllers/Vprasanja/VprasanjaController.php
+++ b/main/survey/app/Controllers/Vprasanja/VprasanjaController.php
@@ -227,21 +227,17 @@ class VprasanjaController extends Controller
$zaporedna++;
}
-
+
// JS za mobilno razpiranje tabel
- SurveySetting::getInstance()->Init(get('anketa'));
- $mobile_tables = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_tables');
- if($mobile_tables == 2){
-
- echo '<script>
- $(document).ready(
- function(){
- mobileMultigridExpandable();
- }
- );
- </script>';
- }
+ echo '<script>
+ $(document).ready(
+ function(){
+ mobileMultigridExpandable();
+ }
+ );
+ </script>';
+
// JS za razpiranje tabel znotraj bloka s to nastavitvijo
echo '<script>
$(document).ready(
@@ -251,12 +247,12 @@ class VprasanjaController extends Controller
);
</script>';
-
+
echo '<script>
var comments = init_comments_save();
// GDPR popup
- $(".gdpr_popup_trigger").click(function(){ show_gdpr_about(\''.get('lang_id').'\'); });
+ $(".gdpr_popup_trigger").click(function(){ show_gdpr_about(\''. self::$lang['id'] .'\'); });
</script>';
}
@@ -323,12 +319,22 @@ class VprasanjaController extends Controller
$sql = sisplet_query("SELECT text FROM srv_data_text" . get('db_table') . " WHERE spr_id='0' AND vre_id='$spremenljivka' AND usr_id='" . get('usr_id') . "' AND loop_id $loop_id");
$row = mysqli_fetch_array($sql);
- echo '<div class="comment red" onclick="$(\'#question_resp_comment_' . $spremenljivka . '\').toggle();" >' . $comment . '</div>
- <div class="variable_holder ' . ($question_resp_comment_show_open == 1 ? 'display_none' : '') . '" id="question_resp_comment_' . $spremenljivka . '">
- <div class="variabla question_comment">
- <textarea name="question_comment_' . $spremenljivka . '" id="question_comment_' . $spremenljivka . '">' . $row['text'] . '</textarea>
- </div>
- </div>';
+
+ echo '<div class="comment_holder">';
+
+ echo ' <div class="comment red" onclick="$(\'#question_resp_comment_' . $spremenljivka . '\').toggle();" >' . $comment . '</div>';
+
+ echo ' <div class="variable_holder ' . ($question_resp_comment_show_open == 1 ? 'display_none' : '') . '" id="question_resp_comment_' . $spremenljivka . '">';
+ echo ' <div class="variabla question_comment">';
+ echo ' <textarea name="question_comment_' . $spremenljivka . '" id="question_comment_' . $spremenljivka . '">' . $row['text'] . '</textarea>';
+ echo ' </div>';
+ echo ' </div>';
+
+ echo ' <div class="comment_autosave">';
+ echo ' <span class="faicon bottom_saving"></span>'.self::$lang['srv_vprasalnik_autosave'];
+ echo ' </div>';
+
+ echo '</div>';
}
/**
@@ -342,9 +348,9 @@ class VprasanjaController extends Controller
$row = Model::select_from_srv_spremenljivka($spremenljivka);
$rowl = Language::srv_language_spremenljivka($spremenljivka);
- if (strip_tags($rowl['naslov']) != '') $row['naslov'] = $rowl['naslov'];
- if (strip_tags($rowl['info']) != '') $row['info'] = $rowl['info'];
- if ($rowl['vsota'] != '') $row['vsota'] = $rowl['vsota'];
+ if (isset($rowl['naslov']) && strip_tags($rowl['naslov']) != '') $row['naslov'] = $rowl['naslov'];
+ if (isset($rowl['info']) && strip_tags($rowl['info']) != '') $row['info'] = $rowl['info'];
+ if (isset($rowl['vsota']) && $rowl['vsota'] != '') $row['vsota'] = $rowl['vsota'];
// da dela tudi userjem brez JS, po defaultu vedno prikazemo vsa vprasanja, ki jih potem skrivamo z JS
@@ -534,8 +540,9 @@ class VprasanjaController extends Controller
echo '<div class="variable_holder vodoravno_ob_vprasanju '.$oblika['divClear'].'" '.($row['hidden_default'] == 1 ? 'style="display:none"' : '').'>';
}
else{
+ $visual_scale = ($row['tip'] == 1 && $row['orientation'] == 11) ? 'analog_visual_scale' : '';
//echo '<div class="variable_holder '.$oblika['divClear'].'" ' . ($row['hidden_default'] == 1 ? 'style="display:none"' : 'style="display:inline"').'>';
- echo '<div class="variable_holder '.$oblika['divClear'].'" ' . ($row['hidden_default'] == 1 ? 'style="display:none"' : '').'>';
+ echo '<div class="variable_holder '.$oblika['divClear'].' '.$visual_scale.'" ' . ($row['hidden_default'] == 1 ? 'style="display:none"' : '').'>';
}
}
@@ -701,11 +708,11 @@ class VprasanjaController extends Controller
// Tabela - radio
case 6:
-
- SurveySetting::getInstance()->Init(get('anketa'));
- $mobile_tables = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_tables');
- // Izris multigrida s postopnim resevanjem
+ // Pridobimo nastavitve za prikaz tabele
+ $tables_setting = MultigridMobile::getInstance()->getTableSettings($spremenljivkaParams);
+
+ // Izris multigrida s postopnim resevanjem - ostanek za stare ankete
if($row['dynamic_mg'] > 0 && !get('printPreview')){
if ($row['dynamic_mg'] == 1 || $row['dynamic_mg'] == 3 || $row['dynamic_mg'] == 5)
@@ -713,16 +720,23 @@ class VprasanjaController extends Controller
else
Dynamic::getInstance()->verticalMultigrid($spremenljivka);
}
- // Izris radio multigrida na mobitelu
- elseif (get('mobile') == 1 && $mobile_tables > 0) {
-
- // Dvojni multigrid
- if($row['enota'] == 3)
- MultigridMobile::getInstance()->radioDoubleMultigrid($spremenljivka);
- else
- MultigridMobile::getInstance()->radioMultigrid($spremenljivka);
+ // Izris multigrida na mobitelu
+ elseif (get('mobile') == 1 && $tables_setting > 0) {
+
+ // Prilagojena tabela s horizontalnim pomikanjem
+ if ($tables_setting == 3) {
+ MultigridMobile::getInstance()->radioHorizontalDynamicMultigrid($spremenljivka);
+ }
+ else{
+
+ // Dvojni multigrid
+ if($row['enota'] == 3)
+ MultigridMobile::getInstance()->radioDoubleMultigrid($spremenljivka);
+ else
+ MultigridMobile::getInstance()->radioMultigrid($spremenljivka);
+ }
}
- // Ostali podtipi tabel
+ // Podtipi tabel
else{
// Izris glede na podtip
@@ -735,7 +749,19 @@ class VprasanjaController extends Controller
// Dvojni multigrid
case 3:
- Double::getInstance()->grid($spremenljivka);
+
+ // Prilagojena tabela
+ if ($tables_setting == 1 || $tables_setting == 2) {
+ MultigridMobile::getInstance()->radioDoubleMultigrid($spremenljivka);
+ }
+ // Prilagojena tabela s horizontalnim pomikanjem
+ elseif ($tables_setting == 3) {
+ MultigridMobile::getInstance()->radioHorizontalDynamicMultigrid($spremenljivka);
+ }
+ else{
+ Double::getInstance()->grid($spremenljivka);
+ }
+
break;
// OneAgainstAnother
@@ -765,7 +791,19 @@ class VprasanjaController extends Controller
// Navaden multigrid
default:
- Multigrid::getInstance()->display($spremenljivka);
+
+ // Prilagojena tabela
+ if (($tables_setting == 1 || $tables_setting == 2) && !get('printPreview')) {
+ MultigridMobile::getInstance()->radioMultigrid($spremenljivka);
+ }
+ // Prilagojena tabela s horizontalnim pomikanjem
+ elseif ($tables_setting == 3 && !get('printPreview')) {
+ MultigridMobile::getInstance()->radioHorizontalDynamicMultigrid($spremenljivka);
+ }
+ else{
+ Multigrid::getInstance()->display($spremenljivka);
+ }
+
break;
}
}
@@ -776,11 +814,11 @@ class VprasanjaController extends Controller
// Tabela - checkbox
case 16:
- SurveySetting::getInstance()->Init(get('anketa'));
- $mobile_tables = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_tables');
+ // Pridobimo nastavitve za prikaz tabele
+ $tables_setting = MultigridMobile::getInstance()->getTableSettings($spremenljivkaParams);
// Izris checkbox multigrida na mobitelu
- if (get('mobile') == 1 && $mobile_tables > 0) {
+ if (get('mobile') == 1 && $tables_setting > 0) {
// Dvojni multigrid
if($row['enota'] == 3)
@@ -794,7 +832,15 @@ class VprasanjaController extends Controller
// Dvojni multicheckboxa
case 3:
- Double::getInstance()->checkGrid($spremenljivka);
+
+ // Prilagojena tabela
+ if ($tables_setting > 0) {
+ MultigridMobile::getInstance()->checkboxDoubleMultigrid($spremenljivka);
+ }
+ else{
+ Double::getInstance()->checkGrid($spremenljivka);
+ }
+
break;
// SelectBox
@@ -804,7 +850,15 @@ class VprasanjaController extends Controller
// Navaden checkbox
case 0:
- Multigrid::getInstance()->checkbox($spremenljivka);
+
+ // Prilagojena tabela
+ if ($tables_setting > 0 && !get('printPreview')) {
+ MultigridMobile::getInstance()->checkboxDoubleMultigrid($spremenljivka);
+ }
+ else{
+ Multigrid::getInstance()->checkbox($spremenljivka);
+ }
+
break;
// Grid drag and drop
@@ -821,14 +875,13 @@ class VprasanjaController extends Controller
case 19:
case 20:
- SurveySetting::getInstance()->Init(get('anketa'));
- $mobile_tables = SurveySetting::getInstance()->getSurveyMiscSetting('mobile_tables');
+ // Pridobimo nastavitve za prikaz tabele
+ $tables_setting = MultigridMobile::getInstance()->getTableSettings($spremenljivkaParams);
- // Izris text in number multigrida na mobitelu
- if (get('mobile') == 1 && $mobile_tables > 0) {
+ // Prilagojena tabela
+ if ($tables_setting > 0) {
MultigridMobile::getInstance()->textMultigrid($spremenljivka);
}
- // Izris navadnega text in number multigrida
else{
Text::getInstance()->multitext($spremenljivka);
}