diff options
Diffstat (limited to '')
-rw-r--r-- | main/survey/app/Controllers/Vprasanja/MultigridController.php | 85 |
1 files changed, 36 insertions, 49 deletions
diff --git a/main/survey/app/Controllers/Vprasanja/MultigridController.php b/main/survey/app/Controllers/Vprasanja/MultigridController.php index 85fd49d..cd8887c 100644 --- a/main/survey/app/Controllers/Vprasanja/MultigridController.php +++ b/main/survey/app/Controllers/Vprasanja/MultigridController.php @@ -113,6 +113,7 @@ class MultigridController extends Controller $display_trak_num_of_titles = 'style="display:none;"';
}
+ $trak_nadnaslov = array();
for($i = 1; $i <= $trak_num_of_titles; $i++){
$trak_nadnaslov[$i] = ($spremenljivkaParams->get('trak_nadnaslov_'.$i.'') ? $spremenljivkaParams->get('trak_nadnaslov_'.$i.'') : $lang['srv_new_text']);
}
@@ -159,8 +160,6 @@ class MultigridController extends Controller $spacesize = round(80 / $size / 4);
- $bg = 1;
-
// IZRIS TABELE
echo '<table class="grid_table multigrid">' . "\n";
@@ -220,8 +219,6 @@ class MultigridController extends Controller // Body tabele
echo '<tbody>';
- $bg++;
-
$orderby = Model::generate_order_by_field($spremenljivka, get('usr_id'));
# cache tabele srv_data_grid, da se ne dela vsakic posebej nov query (preberemo enkrat vse odgovore userja)
@@ -253,7 +250,7 @@ class MultigridController extends Controller }
# preverimo izbrano vrednost
- $grid_id = $srv_data_grid[$row1['id']]['grd_id'];
+ $grid_id = isset($srv_data_grid[$row1['id']]['grd_id']) ? $srv_data_grid[$row1['id']]['grd_id']: '';
# ugotovimo ali je na katerem gridu predhodno izbran missing
$is_missing = false;
@@ -351,7 +348,7 @@ class MultigridController extends Controller echo '<td class="category '.$tabelaSmeski. $_checked.' ' . $cssAlign . '">';
# ni missing vrednost
echo '<label for="vrednost_' . $row1['id'] . '_grid_' . $value . '">';
- echo '<input type="radio" ' . (!$hideName ? ' name="vrednost_' . $row1['id'] . '"' : '') . ' id="vrednost_' . $row1['id'] . '_grid_' . $value . '" value="' . $value . '"' . $_checked . ($is_missing ? ' disabled' : '') . ' data-calculation="' . $srv_grids[$i]['variable'] . '" vre_id = '.$row1['id'].' onclick="checkChecked(this); checkBranching(); setCheckedClass(this, null, ' . $row1['id'] . '); customRadioTableSelect(' . $row1['id'] . ', ' . $value. ');">';
+ echo '<input type="radio" ' . (!$hideName ? ' name="vrednost_' . $row1['id'] . '"' : '') . ' id="vrednost_' . $row1['id'] . '_grid_' . $value . '" value="' . $value . '"' . $_checked . ' data-calculation="' . $srv_grids[$i]['variable'] . '" vre_id = '.$row1['id'].' onclick="checkChecked(this); checkBranching(); setCheckedClass(this, null, ' . $row1['id'] . '); customRadioTableSelect(' . $row1['id'] . ', ' . $value. ');">';
if($row['enota'] == 11){
echo '<span class="enka-vizualna-skala siv-'.$row['grids'].$value.'"></span>';
@@ -377,6 +374,7 @@ class MultigridController extends Controller }
}
}
+
# dodamo še enoto
if ($row['enota'] == 1) {
// Datapiping
@@ -385,9 +383,8 @@ class MultigridController extends Controller echo ' <td></td>' . "\n";
echo ' <td class="differential question_trak">' . $row1['naslov2'] . '</td>' . "\n";
}
+
echo ' </tr>' . "\n";
-
- $bg++;
}
echo '</tbody>';
@@ -472,8 +469,6 @@ class MultigridController extends Controller echo '<tbody>';
- $bg++;
-
$orderby = Model::generate_order_by_field($spremenljivka, get('usr_id'));
// cache tabele srv_grid, da se ne bere vsakic znova
@@ -527,7 +522,7 @@ class MultigridController extends Controller }
- $grid_id = $srv_data_grid[$row1['id']]['grd_id'];
+ $grid_id = isset($srv_data_grid[$row1['id']]['grd_id']) ? $srv_data_grid[$row1['id']]['grd_id'] : '';
echo '<td ' . $cssAlign . '>';
@@ -568,8 +563,6 @@ class MultigridController extends Controller echo '</td>' . "\n";
echo '</tr>' . "\n";
-
- $bg++;
}
echo '</tbody>';
@@ -631,8 +624,6 @@ class MultigridController extends Controller echo '<tbody>';
- $bg++;
-
$orderby = Model::generate_order_by_field($spremenljivka, get('usr_id'));
$missingi = array();
@@ -681,9 +672,9 @@ class MultigridController extends Controller $otherHeight = ($spremenljivkaParams->get('otherHeight') ? $spremenljivkaParams->get('otherHeight') : 1);
if ($otherHeight > 1)
- echo ' <textarea name="textfield_' . $row1['id'] . '" rows="' . $otherHeight . '" style="' . ($otherWidth != -1 ? ' width:' . $otherWidth . '%;' : '') . '">' . $row3['text'] . '</textarea>';
+ echo ' <textarea name="textfield_' . $row1['id'] . '" rows="' . $otherHeight . '" style="' . ($otherWidth != -1 ? ' width:' . $otherWidth . '%;' : '') . '">' . (isset($row3['text']) ? $row3['text'] : '') . '</textarea>';
else
- echo ' <input type="text" name="textfield_' . $row1['id'] . '" value="' . $row3['text'] . '" style="' . ($otherWidth != -1 ? ' width:' . $otherWidth . '%;' : '') . '" />';
+ echo ' <input type="text" name="textfield_' . $row1['id'] . '" value="' . (isset($row3['text']) ? $row3['text'] : '') . '" style="' . ($otherWidth != -1 ? ' width:' . $otherWidth . '%;' : '') . '" />';
//echo ' <input type="text" name="textfield_'.$row1['id'].'" value="'.$row3['text'].'">';
}
@@ -692,7 +683,7 @@ class MultigridController extends Controller }
- $grid_id = $srv_data_grid[$row1['id']]['grd_id'];
+ $grid_id = isset($srv_data_grid[$row1['id']]['grd_id']) ? $srv_data_grid[$row1['id']]['grd_id'] : '';
echo '<td ' . $cssAlign . '>';
@@ -771,8 +762,6 @@ class MultigridController extends Controller echo '</td>' . "\n";
echo '</tr>' . "\n";
-
- $bg++;
}
echo '</tbody>';
@@ -893,8 +882,6 @@ class MultigridController extends Controller //$taWidth = 10;
$taWidth = round(50 / $size);
- $bg = 1;
-
// Header tabele
echo '<thead>';
@@ -905,8 +892,6 @@ class MultigridController extends Controller // Body tabele
echo '<tbody>';
- $bg++;
-
$orderby = Model::generate_order_by_field($spremenljivka, get('usr_id'));
$srv_data_cache = array();
@@ -924,7 +909,7 @@ class MultigridController extends Controller if ($naslov != '') $row1['naslov'] = $naslov;
# preverimo izbrano vrednost
- $grid_id = $srv_data_grid[$row1['id']]['grd_id'];
+ $grid_id = isset($srv_data_grid[$row1['id']]['grd_id']) ? $srv_data_grid[$row1['id']]['grd_id'] : '';
# ugotovimo ali je na katerem gridu predhodno izbran missing
$is_missing = false;
@@ -966,7 +951,7 @@ class MultigridController extends Controller $first_missing_value = true;
foreach ($srv_grids AS $i => $srv_grid) {
- $grid_id = $srv_data_cache[$row1['id']][$i]['grd_id'];
+ $grid_id = isset($srv_data_cache[$row1['id']][$i]['grd_id']) ? $srv_data_cache[$row1['id']][$i]['grd_id'] : '';
$value = $srv_grid['id'];
$vsebina = '';
@@ -1009,8 +994,6 @@ class MultigridController extends Controller }
echo ' </tr>' . "\n";
-
- $bg++;
}
echo '</tbody>';
@@ -1040,13 +1023,16 @@ class MultigridController extends Controller $row = Model::select_from_srv_spremenljivka($spremenljivka);
+ $multiple=array();
$sql1 = sisplet_query("SELECT spr_id FROM srv_grid_multiple WHERE parent='$spremenljivka' ORDER BY vrstni_red");
while ($row1 = mysqli_fetch_array($sql1)) {
$multiple[] = $row1['spr_id'];
}
- if (count($multiple) == 0)
+
+ if (count($multiple) == 0) {
return;
+ }
$spremenljivkaParams = new enkaParameters($row['params']);
// $gridWidth = (($spremenljivkaParams->get('gridWidth') > 0) ? $spremenljivkaParams->get('gridWidth') : 30);
@@ -1136,7 +1122,6 @@ class MultigridController extends Controller $spacesize = round(80 / $size / 4);
- $bg = 1;
echo '<table class="grid_table multigrid">' . "\n";
@@ -1153,7 +1138,7 @@ class MultigridController extends Controller /*for ($i = 1; $i <= $size; $i++)
echo '<col>';*/
foreach ($srv_grids as $grid){
- if($grid['gridmultiple_width'] > 0)
+ if(isset($grid['gridmultiple_width']) && $grid['gridmultiple_width'] > 0)
echo '<col style="width:'.$grid['gridmultiple_width'].'%;">';
else
echo '<col>';
@@ -1231,8 +1216,6 @@ class MultigridController extends Controller echo '<tbody>';
- $bg++;
-
$orderby = Model::generate_order_by_field($multiple[0], get('usr_id'));
# cache tabele srv_data_grid, da se ne dela vsakic posebej nov query (preberemo enkrat vse odgovore userja)
@@ -1323,7 +1306,8 @@ class MultigridController extends Controller $sbSize = ($spr_Params->get('sbSize') ? $spr_Params->get('sbSize') : 3);
$prvaVrstica = ($spr_Params->get('prvaVrstica') ? $spr_Params->get('prvaVrstica') : 1);
$prvaVrstica_roleta = ($spr_Params->get('prvaVrstica_roleta') ? $spr_Params->get('prvaVrstica_roleta') : 1);
- $grid_id = $srv_data_grid[$row_spr['id']][$row2['id']]['grd_id'];
+
+ $grid_id = isset($srv_data_grid[$row_spr['id']][$row2['id']]['grd_id']) ? $srv_data_grid[$row_spr['id']][$row2['id']]['grd_id'] : '';
echo '<td class="category ' . ($srv_grid['vrstni_red'] == 1 && $jj > 1 ? 'double' : '') . ' ' . $cssAlign . '">';
if ($row_spr['enota'] == 2) {//roleta
@@ -1369,9 +1353,9 @@ class MultigridController extends Controller }
echo '</select>';
echo '</td>';
- } else {
-
- $grid_id = $srv_data_grid[$row_spr['id']][$row2['id']]['grd_id'];
+ }
+ else {
+ $grid_id = isset($srv_data_grid[$row_spr['id']][$row2['id']]['grd_id']) ? $srv_data_grid[$row_spr['id']][$row2['id']]['grd_id'] : '';
echo '<td class="category ' . ($srv_grid['vrstni_red'] == 1 && $jj > 1 ? 'double' : '') . ' ' . $cssAlign . '">';
# ni missing vrednost
@@ -1384,7 +1368,6 @@ class MultigridController extends Controller echo '</label>';
echo '</td>' . "\n";
-
}
// multi
@@ -1398,7 +1381,8 @@ class MultigridController extends Controller if ($prvaVrstica != 1) {
$sbSize = $sbSize + 1;
}
- $grid_id = $srv_data_grid[$row_spr['id']][$row2['id']]['grd_id'];
+
+ $grid_id = isset($srv_data_grid[$row_spr['id']][$row2['id']]['grd_id']) ? $srv_data_grid[$row_spr['id']][$row2['id']]['grd_id'] : '';
echo '<td class="category ' . ($srv_grid['vrstni_red'] == 1 && $jj > 1 ? 'double' : '') . ' ' . $cssAlign . '">';
@@ -1427,9 +1411,11 @@ class MultigridController extends Controller }
echo '</select>';
echo '</td>';
- }//multi checkbox
+ }
+ //multi checkbox
elseif ($row_spr['enota'] != 6) {
- $grid_id = $srv_data_checkgrid[$row_spr['id']][$row2['id']][$value]['grd_id'];
+
+ $grid_id = isset($srv_data_checkgrid[$row_spr['id']][$row2['id']][$value]['grd_id']) ? $srv_data_checkgrid[$row_spr['id']][$row2['id']][$value]['grd_id'] : '';
echo '<td class="category ' . ($srv_grid['vrstni_red'] == 1 && $jj > 1 ? 'double' : '') . ' ' . $cssAlign . '">';
echo '<label for="multi_' . $row_spr['id'] . '_' . $row2['id'] . '_grid_' . $value . '">';
@@ -1456,7 +1442,7 @@ class MultigridController extends Controller $taWidth = $taWidth * 10; // da dobimo % (opcije se od 1 - 9)
}
- $vsebina = $srv_data_cache[$row_spr['id']][$row2['id']][$srv_grid['id']]['text'];
+ $vsebina = isset($srv_data_cache[$row_spr['id']][$row2['id']][$srv_grid['id']]['text']) ? $srv_data_cache[$row_spr['id']][$row2['id']][$srv_grid['id']]['text'] : "";
// datum
if ($spr_Params->get('multigrid-datum') == '1') {
@@ -1528,14 +1514,14 @@ class MultigridController extends Controller }
}
}
+
# dodamo še enoto
if ($row['enota'] == 1) {
echo ' <td></td>' . "\n";
echo ' <td class="differential">' . $row1['naslov2'] . '</td>' . "\n";
}
- echo ' </tr>' . "\n";
- $bg++;
+ echo ' </tr>' . "\n";
}
echo '</tbody>';
@@ -1552,9 +1538,9 @@ class MultigridController extends Controller echo '<tr '.$display_trak_num_of_titles.' class="display_trak_num_of_titles_respondent_'.$row['id'].'">';
if ($hideLabels == false) {
- echo ' <td></td>';
- echo ' <td></td>';
- }
+ echo ' <td></td>';
+ echo ' <td></td>';
+ }
for ($j = 1; $j <= $row['grids']; $j++) {
@@ -1568,7 +1554,8 @@ class MultigridController extends Controller $nadnaslov_floating = 'none';
}
- echo '<td class="trak_inline_nadnaslov" grd="gr_'.$j.'"><div id="trak_nadnaslov_'.$j.'_'.$spremenljivka.'" name="trak_nadnaslov_'.$j.'" class="trak_inline_nadnaslov" style="float:'.$nadnaslov_floating.'; display:inline" '.(strpos($trak_nadnaslov[$j], $lang['srv_new_text'])!==false || $this->lang_id!=null ?' default="1"':'').'>' . $trak_nadnaslov[$j] . '</div></td>';
+ if(isset($trak_nadnaslov[$j]))
+ echo '<td class="trak_inline_nadnaslov" grd="gr_'.$j.'"><div id="trak_nadnaslov_'.$j.'_'.$spremenljivka.'" name="trak_nadnaslov_'.$j.'" class="trak_inline_nadnaslov" style="float:'.$nadnaslov_floating.'; display:inline" '.(strpos($trak_nadnaslov[$j], $lang['srv_new_text'])!==false || get('lang_id')!=null ?' default="1"':'').'>' . $trak_nadnaslov[$j] . '</div></td>';
}
// Ce je diferencial
@@ -1644,7 +1631,7 @@ class MultigridController extends Controller }
// Izris naslovne vrstice tabele za checkbox tabelo
- private function displayMulticheckboxHeader($spremenljivka, $row, $srv_grids, $mv_count, $cssAlign, $middle_row=false, $hideLabels){
+ private function displayMulticheckboxHeader($spremenljivka, $row, $srv_grids, $mv_count, $cssAlign, $middle_row, $hideLabels){
global $lang;
// Preverimo, ce ponavljamo glavo - potem ji dodamo class in jo z JS ponovimo
|