displayMultitext($spremenljivka) ************************************************/ public function multitext($spremenljivka) { $row = Model::select_from_srv_spremenljivka($spremenljivka); $loop_id = get('loop_id') == null ? " IS NULL" : " = '" . get('loop_id') . "'"; // izracuni za sirino celic $size = $row['grids']; $spremenljivkaParams = new enkaParameters($row['params']); $hideLabels = false; $gridWidth = $spremenljivkaParams->get('gridWidth'); switch ($gridWidth) { case -2: $hideLabels = true; $gridWidth = 30; // just in case če se kje kaj računa, itak je skrit. break; case -1: case 0: $gridWidth = 30; break; } $gridAlign = (($spremenljivkaParams->get('gridAlign') > 0) ? $spremenljivkaParams->get('gridAlign') : 0); $cssAlign = ''; if ($gridAlign == 1) $cssAlign = ' alignLeft'; elseif ($gridAlign == 2) $cssAlign = ' alignRight'; //$css = ' style = "width: '.$gridWidth.'%;" '; if ($row['num_useMin'] == 1 && $row['num_useMax'] == 1 && $row['vsota_min'] == $row['vsota_limit']) $limit = '(' . $row['vsota_min'] . ')'; elseif ($row['num_useMin'] == 1 && $row['num_useMax'] == 1) $limit = '(min ' . $row['vsota_min'] . ', max ' . $row['vsota_limit'] . ')'; elseif ($row['num_useMin'] == 1) $limit = '(min ' . $row['vsota_min'] . ')'; elseif ($row['num_useMax'] == 1) $limit = '(max ' . $row['vsota_limit'] . ')'; else $limit = ''; //************Params za omejitev sliderjev //tvorjenje omejitve******************************************************************************** $slider_MinNumLabel = ($spremenljivkaParams->get('slider_MinNumLabel') ? $spremenljivkaParams->get('slider_MinNumLabel') : 0); $slider_MaxNumLabel = ($spremenljivkaParams->get('slider_MaxNumLabel') ? $spremenljivkaParams->get('slider_MaxNumLabel') : 100); $limit_slider_mobile = '(min ' . $slider_MinNumLabel . ', max ' . $slider_MaxNumLabel . ')'; //************ // omejitev vnosa if ($row['vsota_show'] == 1 && $row['ranking_k'] != '1' && $row['tip'] == 20) { echo ' '; } # polovimo vrednosti gridov, prevedmo naslove in hkrati preverimo ali imamo missinge $srv_grids = array(); $mv_count = 0; # koliko je stolpcev z manjkajočimi vrednostmi # če polje other != 0 je grid kot missing $sql_grid = sisplet_query("SELECT * FROM srv_grid WHERE spr_id='$row[id]' ORDER BY vrstni_red"); while ($row_grid = mysqli_fetch_assoc($sql_grid)) { # priredimo naslov če prevajamo anketo $naslov = Language::srv_language_grid($row['id'], $row_grid['id']); if ($naslov != '') { $row_grid['naslov'] = $naslov; } $srv_grids[$row_grid['id']] = $row_grid; # če je označena kot manjkajoča jo prištejemo k manjkajočim if ($row_grid['other'] != 0) { $mv_count++; } } echo '
' . "\n"; echo ' | ' . "\n"; } # če imamo mankajoče potem dodamo še en prazen stolpec za razmak if ($mv_count > 0) { $size += 1 + $mv_count; } # če imamo enoto povečamo št. stoplcev if ($row['enota'] == 1) { $size += 2; } //ce imamo nastavljno sirino prvega grida ostalih ne nastavljamo if ($gridWidth == 30) $cellsize = round(80 / $size); else $cellsize = 'auto'; $spacesize = round(80 / $size / 4); $taWidth = ($spremenljivkaParams->get('taWidth') ? $spremenljivkaParams->get('taWidth') : -1); $taHeight = ($spremenljivkaParams->get('taHeight') ? $spremenljivkaParams->get('taHeight') : 1); //default sirina if ($taWidth == -1) { $taWidth = 80; } else { //$taWidth = $taWidth * 10 * 2; // da dobimo % (opcije se od 1 - 5) $taWidth = $taWidth * 10; // da dobimo % (opcije se od 1 - 9) } $bg = 1; # Izpišemo TOP vrstico z labelami if (count($srv_grids) > 0) { $first_missing_value = true; foreach ($srv_grids AS $g_id => $srv_grid) { if ((string)$srv_grid['other'] != '0' && $first_missing_value == true) { # dodamo spejs pred manjkajočimi vrednostmi echo ' | '; $first_missing_value = false; } // Datapiping $srv_grid['naslov'] = Helper::dataPiping($srv_grid['naslov']); # izpišemo labelo grida echo ' | ' . $srv_grid['naslov'] . ' | ' . "\n"; } } echo '||||||
' . $row1['naslov']; if ($row1['other'] == 1) { $sql3 = sisplet_query("SELECT text FROM srv_data_text" . get('db_table') . " WHERE spr_id='$spremenljivka' AND vre_id='$row1[id]' AND usr_id='" . get('usr_id') . "' AND loop_id $loop_id"); $row3 = mysqli_fetch_array($sql3); $otherWidth = ($spremenljivkaParams->get('otherWidth') ? $spremenljivkaParams->get('otherWidth') : -1); $otherHeight = ($spremenljivkaParams->get('otherHeight') ? $spremenljivkaParams->get('otherHeight') : 1); if ($otherHeight > 1) echo ' '; else echo ' '; //echo ' '; } echo ' | ' . "\n"; echo '' . "\n"; } if (count($srv_grids) > 0) { $first_missing_value = true; foreach ($srv_grids AS $i => $srv_grid) { if ($srv_grid['other'] != 0) $grid_id = $srv_data_grid[$row1['id']]['grd_id']; else $grid_id = $srv_data_cache[$row1['id']][$i]['grd_id']; $value = $srv_grid['id']; $vsebina = ''; if ($grid_id == $value) { $vsebina = $srv_data_cache[$row1['id']][$i]['text']; //$row2 = mysqli_fetch_array($sql2); } if ((string)$srv_grid['other'] != '0' && $first_missing_value == true) { # dodamo spejs pred manjkajočimi vrednostmi echo ' | '; $first_missing_value = false; } # izpišemo labelo grida //multitext if ($row['tip'] == 19) { if ($srv_grid['other'] != 0) { # imamo missing nardimo radio echo ' | '; echo ''; echo ' | ' . "\n"; } else { echo ''; //echo ''; echo ''; echo ' | ' . "\n"; } //multinumber - rabimo JS checkNumber } else { if ($srv_grid['other'] != 0) { # imamo missing nardimo radio echo ''; echo ''; echo ' | ' . "\n"; } else { echo '';
echo '';
//multislider
//if ($row['ranking_k'] == 1 && get('mobile') == 0) {
if ($row['ranking_k'] == 1) { //slider na PC, tablici in mobilniku
$spremenljivkaParams = new enkaParameters($row['params']);
$slider_handle = ($spremenljivkaParams->get('slider_handle') ? $spremenljivkaParams->get('slider_handle') : 0);
$slider_window_number = ($spremenljivkaParams->get('slider_window_number') ? $spremenljivkaParams->get('slider_window_number') : 0);
$slider_nakazi_odgovore = ($spremenljivkaParams->get('slider_nakazi_odgovore') ? $spremenljivkaParams->get('slider_nakazi_odgovore') : 0); //za checkbox
$slider_MinMaxNumLabelNew = ($spremenljivkaParams->get('slider_MinMaxNumLabelNew') ? $spremenljivkaParams->get('slider_MinMaxNumLabelNew') : 0);
$slider_MinMaxLabel = ($spremenljivkaParams->get('slider_MinMaxLabel') ? $spremenljivkaParams->get('slider_MinMaxLabel') : 0);
$slider_VmesneNumLabel = ($spremenljivkaParams->get('slider_VmesneNumLabel') ? $spremenljivkaParams->get('slider_VmesneNumLabel') : 0);
$slider_VmesneDescrLabel = ($spremenljivkaParams->get('slider_VmesneDescrLabel') ? $spremenljivkaParams->get('slider_VmesneDescrLabel') : 0);
$slider_VmesneCrtice = ($spremenljivkaParams->get('slider_VmesneCrtice') ? $spremenljivkaParams->get('slider_VmesneCrtice') : 0);
$slider_handle_step = ($spremenljivkaParams->get('slider_handle_step') ? $spremenljivkaParams->get('slider_handle_step') : 1);
$slider_MinLabel = ($spremenljivkaParams->get('slider_MinLabel') ? $spremenljivkaParams->get('slider_MinLabel') : "Minimum");
$slider_MaxLabel = ($spremenljivkaParams->get('slider_MaxLabel') ? $spremenljivkaParams->get('slider_MaxLabel') : "Maximum");
//$slider_MinNumLabel = ($spremenljivkaParams->get('slider_MinNumLabel') ? $spremenljivkaParams->get('slider_MinNumLabel') : 0);
//$slider_MaxNumLabel = ($spremenljivkaParams->get('slider_MaxNumLabel') ? $spremenljivkaParams->get('slider_MaxNumLabel') : 100);
$slider_NumofDescrLabels = ($spremenljivkaParams->get('slider_NumofDescrLabels') ? $spremenljivkaParams->get('slider_NumofDescrLabels') : 5);
$slider_DescriptiveLabel_defaults = ($spremenljivkaParams->get('slider_DescriptiveLabel_defaults') ? $spremenljivkaParams->get('slider_DescriptiveLabel_defaults') : 0);
$slider_DescriptiveLabel_defaults_naslov1 = ($spremenljivkaParams->get('slider_DescriptiveLabel_defaults_naslov1') ? $spremenljivkaParams->get('slider_DescriptiveLabel_defaults_naslov1') : 0);
$displayMinMaxLabel = ($slider_MinMaxLabel == 0) ? ' style="display:none;"' : '';
if(get('lang_id') != null){
$lang_id = get('lang_id');
$ank_id = get('anketa');
$sqlString = "SELECT label, label_id FROM srv_language_slider WHERE ank_id='$ank_id' AND spr_id='$spremenljivka' AND lang_id='$lang_id' ORDER BY label_id";
$sqlSlider = sisplet_query($sqlString);
while ($rowsqlSlider = mysqli_fetch_array($sqlSlider)) {
if($rowsqlSlider['label_id'] == 1){
$MinLabel = $rowsqlSlider['label'];
}
elseif($rowsqlSlider['label_id'] == 2){
$MaxLabel = $rowsqlSlider['label'];
}elseif($row['label_id'] == 0){
$custom = $rowsqlSlider['label'];
}
}
if($slider_DescriptiveLabel_defaults && $custom==''){ //ce so prednalozene opisne labele drsnika in nimamo se prevoda
$custom_ar = explode(';', $slider_DescriptiveLabel_defaults_naslov1);
}else{ //ce so custom opisne labele drsnika
$custom_ar = explode('; ', $custom);
}
// Ce slucajno nimamo prevedeno uporabimo original
$MinLabel = ($MinLabel == '') ? ($spremenljivkaParams->get('MinLabel') ? $spremenljivkaParams->get('MinLabel') : self::$lang['srv_new_text']) : $MinLabel;
$MaxLabel = ($MaxLabel == '') ? ($spremenljivkaParams->get('MaxLabel') ? $spremenljivkaParams->get('MaxLabel') : self::$lang['srv_new_text']) : $MaxLabel;
}
else{
$MinLabel = ($spremenljivkaParams->get('MinLabel') ? $spremenljivkaParams->get('MinLabel') : self::$lang['srv_new_text']);
$MaxLabel = ($spremenljivkaParams->get('MaxLabel') ? $spremenljivkaParams->get('MaxLabel') : self::$lang['srv_new_text']);
}
//echo ' ';
echo ' ';
//$default_value = round(($row['vsota_limit']-$row['vsota_min']) / 2) + $row['vsota_min'];
$default_value = round(($slider_MaxNumLabel - $slider_MinNumLabel) / 2) + $slider_MinNumLabel;
$vrednost = ($vsebina == '') ? $default_value : $vsebina;
//labeli nad min in max drsnikov ############################################################
if (get('mobile') == 0 || get('mobile') == 2) {//ce PC ali tablica
echo '
'.$row['vsota_min'].' ';
//echo '';
//echo ''.$row['vsota_limit'].' ';
if (get('mobile') == 0 || get('mobile') == 2) {//ce PC ali tablica
echo '';
} else if (get('mobile') == 1) { //ce mobilnik
echo '';
}
echo '';
//za custom opisne labele
//moznosti urejanja opisnih label drsnika
if($slider_VmesneDescrLabel){
for($i=1; $i<=$slider_NumofDescrLabels; $i++){
if($custom == ''){ //ce nimamo prevoda opisnih label za drsnika
$slider_CustomDescriptiveLabelsTmp = ($spremenljivkaParams->get('slider_Labela_opisna_'.$i) ? $spremenljivkaParams->get('slider_Labela_opisna_'.$i) : '');
}else{ //ce mamo prevod opisnih label za drsnika
$slider_CustomDescriptiveLabelsTmp = $custom_ar[$i-1];
}
$slider_CustomDescriptiveLabelsTmp = preg_replace("/\s| /",' ',$slider_CustomDescriptiveLabelsTmp); //za odstranitev morebitnih presledkov, ki lahko delajo tezave pri polju za drsnik
if($i == 1){
$slider_CustomDescriptiveLabels = $slider_CustomDescriptiveLabelsTmp;
}else{
$slider_CustomDescriptiveLabels .= "; ".$slider_CustomDescriptiveLabelsTmp;
}
}
}
//za custom opisne labele - konec
?>
}
echo '' . "\n";
}
}
}
}
echo ' ' . "\n";
$bg++;
}
echo '';
echo '
';
echo self::$lang['srv_prevAnswers'].':';
echo ' ';
}
}';
//$sql = sisplet_query("SELECT text FROM srv_data_text" . get('db_table') . " WHERE spr_id='$spremenljivka' AND usr_id!='" . get('usr_id') . "' AND vre_id='$row1[id]' AND loop_id $loop_id");
$sql = sisplet_query("SELECT text FROM srv_data_text" . get('db_table') . " WHERE spr_id='".$spremenljivka."' AND usr_id!='".get('usr_id')."' ORDER BY id DESC limit 30");
while($row = mysqli_fetch_array($sql)){
echo ' ';
echo ''; echo $row['text']; echo ' '; } $sqlC = sisplet_query("SELECT count(*) FROM srv_data_text" . get('db_table') . " WHERE spr_id='".$spremenljivka."' AND usr_id!='".get('usr_id')."'"); $rowC = mysqli_fetch_array($sqlC); if($rowC['count(*)'] > 30){ // gumb "vec" da prikazemo vse echo '('.self::$lang['srv_more'].'...)'; // div za izris vseh echo ''; } echo ' |