summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php')
-rw-r--r--admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php977
1 files changed, 517 insertions, 460 deletions
diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php b/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php
index e0f4e85..532fc5c 100644
--- a/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php
+++ b/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php
@@ -5,12 +5,12 @@
*
*/
-define("EXPORT_FOLDER", "admin/survey/SurveyData");
+if(!defined("EXPORT_FOLDER")) define("EXPORT_FOLDER", "admin/survey/SurveyData");
# mejne vrednosti za barvanje residualov
-define("RESIDUAL_COLOR_LIMIT1", 1.00);
-define("RESIDUAL_COLOR_LIMIT2", 2.00);
-define("RESIDUAL_COLOR_LIMIT3", 3.00);
-define("AUTO_HIDE_ZERRO_VALUE", 20); # nad koliko kategorij skrivamo ničelne vrednosti
+if(!defined("RESIDUAL_COLOR_LIMIT1")) define("RESIDUAL_COLOR_LIMIT1", 1.00);
+if(!defined("RESIDUAL_COLOR_LIMIT2")) define("RESIDUAL_COLOR_LIMIT2", 2.00);
+if(!defined("RESIDUAL_COLOR_LIMIT3")) define("RESIDUAL_COLOR_LIMIT3", 3.00);
+if(!defined("AUTO_HIDE_ZERRO_VALUE")) define("AUTO_HIDE_ZERRO_VALUE", 20); # nad koliko kategorij skrivamo ničelne vrednosti
@session_start();
@@ -104,9 +104,13 @@ class SurveyCrosstabs {
# polovimo vrsto tabel (aktivne / neaktivne)
SurveyInfo :: getInstance()->SurveyInit($this->sid);
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) {
- $this->db_table = '_active';
- }
+ $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
+
+ // Pri glasovanju tega ne pustimo
+ if(SurveyInfo::getInstance()->getSurveyColumn("survey_type") == 0){
+ die();
+ }
+
$this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/';
# Inicializiramo in polovimo nastavitve missing profila
@@ -198,11 +202,11 @@ class SurveyCrosstabs {
$this->variablesList = array();
# zloopamo skozi header in dodamo variable (potrebujemo posamezne sekvence)
foreach ($this->_HEADERS AS $skey => $spremenljivka) {
- if ((int)$spremenljivka['hide_system'] == 1 && in_array($spremenljivka['variable'],array('email','ime','priimek','telefon','naziv','drugo'))) {
+ if (isset($spremenljivka['hide_system']) && (int)$spremenljivka['hide_system'] == 1 && in_array($spremenljivka['variable'],array('email','ime','priimek','telefon','naziv','drugo'))) {
continue;
}
- $tip = $spremenljivka['tip'];
+ $tip = isset($spremenljivka['tip']) ? $spremenljivka['tip'] : null;
if (is_numeric($tip)
# tekstovnih tipov ne dodajamo
@@ -299,7 +303,7 @@ class SurveyCrosstabs {
# imamo več gridov - tabele
foreach($spremenljivka['grids'] AS $gid => $grid) {
$sub = 0;
- if ($grid['variable'] != '') {
+ if (isset($grid['variable']) && $grid['variable'] != '') {
$sub++;
$this->variablesList[] = array(
'tip'=>$tip,
@@ -367,76 +371,105 @@ class SurveyCrosstabs {
*
*/
function Display() {
+ global $lang;
+
# preberemo prednastavljene variable iz seje, če obstajajo
$this->presetVariables();
if ($this->dataFileStatus == FILE_STATUS_NO_DATA
- || $this->dataFileStatus == FILE_STATUS_NO_FILE
- || $this->dataFileStatus == FILE_STATUS_SRV_DELETED){
+ || $this->dataFileStatus == FILE_STATUS_NO_FILE
+ || $this->dataFileStatus == FILE_STATUS_SRV_DELETED){
+
return false;
}
- global $lang;
- # polovimo nastavtve missing profila
- //$this->missingProfileData = SurveyMissingProfiles::getProfile($this->currentMissingProfile);
+ echo '<div class="crosstab_top_holder">';
+ // Izbira spremenljivk
echo '<div id="crosstab_drobdowns">';
$resultIsCheckbox = $this->DisplayDropdows();
echo '</div>';
- echo '<div id="div_crossCheck" class="floatLeft spaceLeft">' ;
+
+
+ // Nastavitve
+ echo '<div id="crosstab_settings" class="crosstab_settings">';
+
+ echo ' <div class="setting_line">';
+ echo $lang['srv_analiza_crosstab_table_settings'].':';
+ echo ' </div>';
+
$this->displayLinePercent();
$this->displayResidual();
$this->displayShowChart();
+
+ echo '</div>';
+
+
+ // Nastavitve 2
if ( $resultIsCheckbox['is_check']) {
- echo '<div id="crossNavedbeVsENote">';
- echo '<input type="radio" name="crossNavVsEno" id="crossNavVsEno0" vlaue="0" '.($this->crossNavVsEno == 0 ? ' checked="checked" ' : '' ).' onchange="change_crosstab(); return false;" autocomplete="off">'.
- '<label for="crossNavVsEno0">'.$lang['srv_analiza_crosstab_navedbe'].'</label>';
- echo '<input type="radio" name="crossNavVsEno" id="crossNavVsEno1" vlaue="1" '.($this->crossNavVsEno == 1? ' checked="checked" ' : '' ).' onchange="change_crosstab(); return false;" autocomplete="off">'.
- '<label for="crossNavVsEno1">'.$lang['srv_analiza_crosstab_enote'].'</label>';
- echo '</div>';
+
+ echo '<div id="crosstab_settings_2" class="crosstab_settings">';
+
+ echo ' <div class="setting_line">';
+ echo $lang['srv_analiza_crosstab_answer_settings'].':';
+ echo ' </div>';
+
+ echo ' <div class="setting_line">';
+ echo ' <input type="radio" name="crossNavVsEno" id="crossNavVsEno0" vlaue="0" '.($this->crossNavVsEno == 0 ? ' checked="checked" ' : '' ).' onchange="change_crosstab(); return false;" autocomplete="off">';
+ echo ' <label for="crossNavVsEno0">'.$lang['srv_analiza_crosstab_navedbe'].'</label>';
+ echo ' </div>';
+
+ echo ' <div class="setting_line">';
+ echo ' <input type="radio" name="crossNavVsEno" id="crossNavVsEno1" vlaue="1" '.($this->crossNavVsEno == 1? ' checked="checked" ' : '' ).' onchange="change_crosstab(); return false;" autocomplete="off">';
+ echo ' <label for="crossNavVsEno1">'.$lang['srv_analiza_crosstab_enote'].'</label>';
+ echo ' </div>';
+
+ echo '</div>';
}
- echo '</div>';
-
+
+ echo '</div>';
- $this->displayExport();
- $this->displayCrosstabCheckboxes();
- echo '<div id="crosstab_table">';
+
+ // Tabele
+ echo '<div id="crosstab_tables">';
$this->displayCrosstabsTables();
echo '</div>';
}
function DisplayDropdows() {
global $lang;
+
$variables = $this->getVariableList();
$multiple = true;
- echo '<div id="crossLeftHolder" >';
+
+ echo '<div id="crossLeftHolder">';
# iz header datoteke preberemo spremenljivke
#js: $("#crosstab_variable_1, #crosstab_variable_2").live('click', function() {})
if (count($this->variabla1) > 0) {
- $br=null;
- echo $lang['srv_crosstab_label1'].'<br/>';
- if ((int)$this->variabla1['0']['seq'] > 0) {
- echo '<span class="pointer" id="crosstab_add_new" onclick="add_new_variable(\'1\');"><span class="faicon add small icon-as_link" title=""></span></span>';
- }
+
+ echo '<div class="title">'.$lang['srv_crosstab_label1'].'</div>';
+
+ echo '<div id="crossLeftDropdowns">';
+
foreach($this->variabla1 AS $_key => $variabla1) {
- echo $_br;
- echo '<span id="v1_'.$_key.'">';
+
+ echo '<div id="v1_'.$_key.'" class="variabla_line">';
- echo '<select name="crosstab_variable_1" id="crosstab_variable_1" onchange="change_crosstab(); return false;" autocomplete="off">';
+ echo '<select name="crosstab_variable_1" id="crosstab_variable_1" class="dropdown large" onchange="change_crosstab(); return false;" autocomplete="off">';
# ce prva variabla ni izbrana, dodamo tekst za izbiro prve variable
if ( $variabla1['seq'] == null || $variabla1['seq'] == 0 ) {
echo '<option value="0" selected="selected" >'. $lang['srv_analiza_crosstab_izberi_prvo'] . '</option>';
}
foreach ($variables as $variable) {
- echo '<option value="' . $variable['sequence'] . '" spr_id="'.$variable['spr_id'].'" '
+ echo '<option value="' . (isset($variable['sequence']) ? $variable['sequence'] : '') . '" spr_id="'.(isset($variable['spr_id']) ? $variable['spr_id'] : '').'" '
. ( isset($variable['grd_id']) ? ' grd_id="'.$variable['grd_id'].'" ' : '')
. (( (int)$variable['canChoose'] == 1) ? '' : ' disabled="disabled" ')
- . ( ($variabla1['seq'] > 0 &&$variabla1['seq'] == $variable['sequence']) ? ' selected="selected" ' : '')
+ . ( ($variabla1['seq'] > 0 && isset($variable['sequence']) && $variabla1['seq'] == $variable['sequence']) ? ' selected="selected" ' : '')
. '> '
. ( (int)$variable['sub'] == 0 ? '' : ( (int)$variable['sub'] == 1 ? '&nbsp;&nbsp;' : '&nbsp;&nbsp;&nbsp;&nbsp;' ))
. $variable['variableNaslov'] . '</option>';
@@ -444,41 +477,54 @@ class SurveyCrosstabs {
}
echo '</select>';
+
+ // Gumb odstrani
+ echo '<div class="crosstab_remove_holder">';
if (count($this->variabla1) > 1) {
- echo '<span class="pointer" id="crosstab_remove" onclick="crs_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
- } else {
- #echo '<span class="space_crosstab_new">&nbsp;</span>';
- }
+ echo '<span class="faicon delete_circle" id="crosstab_remove" onclick="crs_remove_variable(this);"></span>';
+ }
+ echo '</div>';
+
+ echo '</div>';
+ }
+
+ echo '</div>';
+
- $_br = '<br/><span class="space_crosstab_new">&nbsp;</span>';
- echo '</span>';
+ if ((int)$this->variabla1['0']['seq'] > 0) {
+ echo '<button class="blue small" id="crosstab_add_new" onclick="add_new_variable(\'1\');">'.$lang['srv_multicrosstabs_add'].'</button>';
}
- $_br = null;
}
echo '</div>';
+
+
echo '<div id="crossImgHolder">';
- echo '<br/>';
+
if ($this->isSelectedBothVariables()) {
- echo '<span class="faicon replace icon-as_link" title="'.$lang['srv_replace'].'" onclick="change_crosstab(\'rotate\');return false;" />';
- } else {
- echo '<span class="faicon replace icon-grey_normal" title="'.$lang['srv_replace'].'" />';
+ echo '<span class="faicon replace" title="'.$lang['srv_replace'].'" onclick="change_crosstab(\'rotate\');return false;" />';
+ }
+ else {
+ echo '<span class="faicon replace gray" title="'.$lang['srv_replace'].'" />';
}
+
echo '</div>';
+
echo '<div id="crossRightHolder">';
- echo $lang['srv_crosstab_label2'].'<br/>';
+
+ echo '<div class="title">'.$lang['srv_crosstab_label2'].'</div>';
+
# za vsako novo spremenljivko 2 nardimo svoj select
if (count($this->variabla2) > 0) {
- if ((int)$this->variabla1['0']['seq'] > 0) {
- echo '<span class="pointer" id="crosstab_add_new" onclick="add_new_variable(\'2\');"><span class="faicon add small icon-as_link" title="'.'"></span></span>';
- }
-
+
+ echo '<div id="crossRightDropdowns">';
+
foreach($this->variabla2 AS $_key => $variabla2) {
- echo $_br;
- echo '<span id="v2_'.$_key.'">';
+
+ echo '<div id="v2_'.$_key.'" class="variabla_line">';
- echo '<select name="crosstab_variable_2" id="crosstab_variable_2" onchange="change_crosstab(); return false;" autocomplete="off"'
+ echo '<select name="crosstab_variable_2" id="crosstab_variable_2" class="dropdown large" onchange="change_crosstab(); return false;" autocomplete="off"'
. ((int)$this->variabla1['0']['seq'] > 0 ? '' : ' disabled="disabled" ')
.'>';
@@ -493,33 +539,44 @@ class SurveyCrosstabs {
}
foreach ($variables as $variable) {
- echo '<option value="' . $variable['sequence'] . '" spr_id="'.$variable['spr_id'].'" '
+ echo '<option value="' . (isset($variable['sequence'])?$variable['sequence']:'') . '" spr_id="'.(isset($variable['spr_id'])?$variable['spr_id']:'').'" '
. ( isset($variable['grd_id']) ? ' grd_id="'.$variable['grd_id'].'" ' : '')
. (( (int)$variable['canChoose'] == 1) ? '' : ' disabled="disabled" ')
- . ( $variabla2['seq'] > 0 && $variabla2['seq'] == $variable['sequence'] ? ' selected="selected" ' : '')
+ . ( $variabla2['seq'] > 0 && isset($variable['sequence']) && $variabla2['seq'] == $variable['sequence'] ? ' selected="selected" ' : '')
. '> '
. ( (int)$variable['sub'] == 0 ? '' : ( (int)$variable['sub'] == 1 ? '&nbsp;&nbsp;' : '&nbsp;&nbsp;&nbsp;&nbsp;' ))
. $variable['variableNaslov'] .'</option>';
}
+
echo '</select>';
+
+ // Gumb odstrani
+ echo '<div class="crosstab_remove_holder">';
if (count($this->variabla2) > 1) {
- echo '<span class="pointer" id="crosstab_remove" onclick="crs_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
- } else {
- echo '<span class="space_crosstab_new">&nbsp;</span>';
- }
+ echo '<span class="faicon delete_circle" id="crosstab_remove" onclick="crs_remove_variable(this);"></span>';
+ }
+ echo '</div>';
+
+ echo '</div>';
+ }
+
+ echo '</div>';
- $_br = '<br/><span class="space_crosstab_new">&nbsp;</span>';
- echo '</span>';
+
+ if ((int)$this->variabla1['0']['seq'] > 0) {
+ echo '<button class="blue small" id="crosstab_add_new" onclick="add_new_variable(\'2\');">'.$lang['srv_multicrosstabs_add'].'</button>';
}
}
+
echo '</div>';
+
# če je katera od variabel checkbox, ponudimo možnodt izbire ali po enotah ali po navedbah
$is_check = false;
if (count($this->variabla2) > 0) {
foreach ($this->variabla2 AS $key => $var) {
- $spr_tip = $this->_HEADERS[$var['spr']]['tip'];
+ $spr_tip = isset($this->_HEADERS[$var['spr']]['tip']) ? $this->_HEADERS[$var['spr']]['tip'] : null;
if ( $spr_tip == 2 || $spr_tip == 16 ) {
$is_check = true;
}
@@ -527,7 +584,7 @@ class SurveyCrosstabs {
}
if (count($this->variabla1) > 0 && $is_check == false ) { # če še ni bil checkbox
foreach ($this->variabla1 AS $key => $var) {
- $spr_tip = $this->_HEADERS[$var['spr']]['tip'];
+ $spr_tip = isset($this->_HEADERS[$var['spr']]['tip']) ? $this->_HEADERS[$var['spr']]['tip'] : null;
if ( $spr_tip == 2 || $spr_tip == 16 ) {
$is_check = true;
}
@@ -546,10 +603,12 @@ class SurveyCrosstabs {
if ($which == '1') {
- echo '<br/>';
- echo '<span class="space_crosstab_new">&nbsp;</span>';
- echo '<select name="crosstab_variable_1" id="crosstab_variable_1" onchange="change_crosstab(); return false;" autocomplete="off">';
- # ce prva variabla ni izbrana, dodamo tekst za izbiro prve variable
+
+ echo '<div class="variabla_line">';
+
+ echo '<select name="crosstab_variable_1" id="crosstab_variable_1" class="dropdown large" onchange="change_crosstab(); return false;" autocomplete="off">';
+
+ # ce prva variabla ni izbrana, dodamo tekst za izbiro prve variable
if ( $variabla1['seq'] == null || $variabla1['seq'] == 0 ) {
echo '<option value="0" selected="selected" >'. $lang['srv_analiza_crosstab_izberi_more'] . '</option>';
}
@@ -564,18 +623,25 @@ class SurveyCrosstabs {
}
echo '</select>';
- echo '<span class="pointer" id="crosstab_remove" onclick="crs_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
-
- } else {
- echo '<br/>';
- echo '<span class="space_crosstab_new">&nbsp;</span>';
- echo '<select name="crosstab_variable_'.$which.'" id="crosstab_variable_'.$which.'" onchange="change_crosstab(); return false;" autocomplete="off"'
- .'>';
+
+ // Gumb odstrani
+ echo '<div class="crosstab_remove_holder">';
+ echo ' <span class="faicon delete_circle" id="crosstab_remove" onclick="crs_remove_variable(this);"></span>';
+ echo '</div>';
+
+ echo '</div>';
+ }
+ else {
+
+ echo '<div class="variabla_line">';
+
+ echo '<select name="crosstab_variable_'.$which.'" id="crosstab_variable_'.$which.'" class="dropdown large" onchange="change_crosstab(); return false;" autocomplete="off">';
# ce prva variabla ni izbrana, dodamo tekst za izbiro prve variable
if ((int)$this->variabla1['0']['seq'] > 0) {
echo '<option value="0" selected="selected" >'. $lang['srv_analiza_crosstab_najprej_prvo'] . '</option>';
- } else {
+ }
+ else {
# če druga variabla ni izbrana dodamo tekst za izbiro druge variable
echo '<option value="0" selected="selected">'. $lang['srv_analiza_crosstab_izberi_more'] . '</option>';
}
@@ -589,8 +655,15 @@ class SurveyCrosstabs {
. $variable['variableNaslov'] .$variable['sequence']. '</option>';
}
+
echo '</select>';
- echo '<span class="pointer" id="crosstab_remove" onclick="crs_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
+
+ // Gumb odstrani
+ echo '<div class="crosstab_remove_holder">';
+ echo ' <span class="faicon delete_circle" id="crosstab_remove" onclick="crs_remove_variable(this);"></span>';
+ echo '</div>';
+
+ echo '</div>';
}
}
/**
@@ -599,83 +672,56 @@ class SurveyCrosstabs {
function displayCrosstabCheckboxes () {
global $lang;
- echo '<div id="div_color_residual_legend" '.($this->isSelectedBothVariables() && $this->doColor ? '' : ' class="hidden"').'>' ;
+ echo '<div id="crosstab_legend" '.($this->isSelectedBothVariables() && $this->doColor ? '' : ' class="hidden"').'>' ;
- echo '<span id="span_color_residual_legend" class="floatLeft">';
- echo '<span id="span_color_residual_legend1" class="floatLeft">';
- echo '<span class="floatLeft">';
- echo '<label>'.$lang['srv_analiza_crosstab_adjs_residual_short'].'</label>';
- echo '</span>';
- echo '<span class="floatLeft">';
- echo '<table id="tbl_color_residual_legend" >';
- echo '<tr>';
- echo '<td style="width:15px !important; text-align: center !important; font-weight: bold !important;">-</td>';
- echo '<td class="rsdl_bck6" title="'.$lang['srv_crosstab_residual_1'].'">&nbsp;</td>';
- echo '<td class="rsdl_bck5" title="'.$lang['srv_crosstab_residual_2'].'">&nbsp;</td>';
- echo '<td class="rsdl_bck4" title="'.$lang['srv_crosstab_residual_3'].'">&nbsp;</td>';
- echo '<td class="rsdl_bck1" title="'.$lang['srv_crosstab_residual_4'].'">&nbsp;</td>';
- echo '<td class="rsdl_bck2" title="'.$lang['srv_crosstab_residual_5'].'">&nbsp;</td>';
- echo '<td class="rsdl_bck3" title="'.$lang['srv_crosstab_residual_6'].'">&nbsp;</td>';
- echo '<td style="width:15px !important; text-align: center !important; font-weight: bold !important;">+</td>';
- //echo '<td style="width:40px !important; text-align: center !important;"><span id="span_rsdl_legend_togle" class="as_link">'.$lang['srv_more'].'</span></td>';
- echo '</tr>';
- echo '</table>';
- echo '</span>';
- echo '<span class="floatLeft" style="padding-top:2px;">';
- echo Help :: display('srv_crosstab_residual');
- echo '</span>';
+
+ echo '<div id="span_color_residual_legend1" class="crosstab_legend_line">';
+
+ echo '<span class="title">'.$lang['srv_analiza_crosstab_adjs_residual_short'].' '.Help :: display('srv_crosstab_residual').':</span>';
+
+ echo '<div class="trak">';
+ echo ' <div class="minus">-</div>';
+ echo ' <div class="rsdl_bck6" title="'.$lang['srv_crosstab_residual_1'].'"></div>';
+ echo ' <div class="rsdl_bck5" title="'.$lang['srv_crosstab_residual_2'].'"></div>';
+ echo ' <div class="rsdl_bck4" title="'.$lang['srv_crosstab_residual_3'].'"></div>';
+ echo ' <div class="rsdl_bck1" title="'.$lang['srv_crosstab_residual_4'].'"></div>';
+ echo ' <div class="rsdl_bck2" title="'.$lang['srv_crosstab_residual_5'].'"></div>';
+ echo ' <div class="rsdl_bck3" title="'.$lang['srv_crosstab_residual_6'].'"></div>';
+ echo ' <div class="plus">+</div>';
+ echo '</div>';
- echo '</span>';
+ echo '</div>';
+
- echo '<span id="span_color_residual_legend2" class="floatLeft displayNone">';
- echo '<span class="floatLeft">';
- echo '<label></label>';
- echo '</span>';
- echo '<span class="floatLeft">';
+ /*echo '<div id="span_color_residual_legend2" class="crosstab_legend_line displayNone">';
+
+ echo '<span class="title">'.Help :: display('srv_crosstab_residual').'</span>';
+
echo '<table id="tbl_color_residual" class="residual">';
- echo '<tr><td>'.$lang['srv_analiza_crosstab_adjs_residual_long'].':&nbsp;&nbsp;&nbsp;&nbsp;</td><th>+</th><th>-</th></tr>';
- echo '<tr><td class="anl_al">&nbsp;&nbsp;'.$lang['srv_crosstab_residual_3_0'].'</td><td class="rsdl_bck1 anl_dash_ba" title="'.$lang['srv_crosstab_residual_4'].'">&nbsp;</td><td class="rsdl_bck4 anl_dash_bt anl_dash_br anl_dash_bb" title="'.$lang['srv_crosstab_residual_3'].'">&nbsp;</td></tr>';
- echo '<tr><td class="anl_al">&nbsp;&nbsp;'.$lang['srv_crosstab_residual_2_0'].'</td><td class="rsdl_bck2 anl_dash_bl anl_dash_bb" title="'.$lang['srv_crosstab_residual_5'].'">&nbsp;</td><td class="rsdl_bck5 anl_dash_br anl_dash_bb" title="'.$lang['srv_crosstab_residual_2'].'">&nbsp;</td></tr>';
- echo '<tr><td class="anl_al">&nbsp;&nbsp;'.$lang['srv_crosstab_residual_1_0'].'</td><td class="rsdl_bck3 anl_dash_bl anl_dash_bb" title="'.$lang['srv_crosstab_residual_6'].'">&nbsp;</td><td class="rsdl_bck6 anl_dash_br anl_dash_bb" title="'.$lang['srv_crosstab_residual_1'].'">&nbsp;</td></tr>';
+ echo ' <tr><td>'.$lang['srv_analiza_crosstab_adjs_residual_long'].':&nbsp;&nbsp;&nbsp;&nbsp;</td><th>+</th><th>-</th></tr>';
+ echo ' <tr><td class="anl_al">&nbsp;&nbsp;'.$lang['srv_crosstab_residual_3_0'].'</td><td class="rsdl_bck1 anl_dash_ba" title="'.$lang['srv_crosstab_residual_4'].'">&nbsp;</td><td class="rsdl_bck4 anl_dash_bt anl_dash_br anl_dash_bb" title="'.$lang['srv_crosstab_residual_3'].'">&nbsp;</td></tr>';
+ echo ' <tr><td class="anl_al">&nbsp;&nbsp;'.$lang['srv_crosstab_residual_2_0'].'</td><td class="rsdl_bck2 anl_dash_bl anl_dash_bb" title="'.$lang['srv_crosstab_residual_5'].'">&nbsp;</td><td class="rsdl_bck5 anl_dash_br anl_dash_bb" title="'.$lang['srv_crosstab_residual_2'].'">&nbsp;</td></tr>';
+ echo ' <tr><td class="anl_al">&nbsp;&nbsp;'.$lang['srv_crosstab_residual_1_0'].'</td><td class="rsdl_bck3 anl_dash_bl anl_dash_bb" title="'.$lang['srv_crosstab_residual_6'].'">&nbsp;</td><td class="rsdl_bck6 anl_dash_br anl_dash_bb" title="'.$lang['srv_crosstab_residual_1'].'">&nbsp;</td></tr>';
echo '</table>';
- //echo '<span class="residual_link"><a href="http://www.1ka.si/db/19/308/Pogosta%20vprasanja/Kaj_pomenijo_residuali/?&p1=226&p2=735&p3=789&p4=0&p5=0&id=789&from1ka=1" target="_blank">'.$lang['srv_residual_link_faq'].'</a></span>';
- echo '</span>';
- echo '<span id="span_rsdl_legend_togle" class="floatLeft spaceLeft as_link">'.$lang['srv_less'].'</span>';
- echo '<span class="floatLeft spaceLeft" style="padding-top:0px;">';
- echo Help :: display('srv_crosstab_residual');
- echo '</span>';
-
- echo '</span>';
+
+ echo '</div>';*/
+
+ echo '<div id="span_color_residual_legend3" class="crosstab_legend_line '.($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR == 4 ? '' : ' displayNone').'">';
- echo '<br />';
- echo '<span id="span_color_residual_legend3" class="floatLeft '.($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR == 4 ? '' : ' displayNone"').'" style="margin-top:10px; padding-left:18px;">';
- echo '<span class="floatLeft">';
- echo '<label>'.$lang['srv_analiza_crosstab_residuals'].'</label>';
- echo '</span>';
- echo '<span class="floatLeft">';
- echo '<table id="tbl_color_residual_legend" >';
- echo '<tr>';
- echo '<td style="width:10px !important; text-align: center !important; font-weight: bold !important;"></td>';
- echo '<td class="crossCheck_EC" title="'.$lang['srv_analiza_crosstab_expected_count'].'">&nbsp;</td>';
- echo '<td class="crossCheck_RE" title="'.$lang['srv_analiza_crosstab_residual'].'">&nbsp;</td>';
- echo '<td class="crossCheck_SR" title="'.$lang['srv_analiza_crosstab_stnd_residual'].'">&nbsp;</td>';
- echo '<td class="crossCheck_AR" title="'.$lang['srv_analiza_crosstab_adjs_residual'].'">&nbsp;</td>';
- echo '<td style="width:10px !important; text-align: center !important; font-weight: bold !important;"></td>';
- echo '</tr>';
- echo '</table>';
- echo '</span>';
- echo '<span class="floatLeft" style="padding-top:2px;">';
- echo Help :: display('srv_crosstab_residual2');
- echo '</span>';
+ echo '<span class="title">'.$lang['srv_analiza_crosstab_residuals'].' '.Help::display('srv_crosstab_residual2').':</span>';
+
+ echo '<div class="trak">';
+ echo ' <div class="crossCheck_EC" title="'.$lang['srv_analiza_crosstab_expected_count'].'"></div>';
+ echo ' <div class="crossCheck_RE" title="'.$lang['srv_analiza_crosstab_residual'].'"></div>';
+ echo ' <div class="crossCheck_SR" title="'.$lang['srv_analiza_crosstab_stnd_residual'].'"></div>';
+ echo ' <div class="crossCheck_AR" title="'.$lang['srv_analiza_crosstab_adjs_residual'].'"></div>';
+ echo '</div>';
- echo '</span>';
+ echo '</div>';
- echo '</span>';
-
echo '</div>';
- echo '<br class="clr"/>';
}
public function displayCrosstabsTables() {
@@ -694,26 +740,26 @@ class SurveyCrosstabs {
$SR -> getProfileString();
# preverimo ali imamo izbrano tretjo variablo
- if ( $this->variabla_third == null || (int)$this->variabla_third == 0) {
+ /*if ( $this->variabla_third == null || (int)$this->variabla_third == 0) {
# tretja variabla ni izbrana, nardimo navadne loope če obstajajo
$this->_LOOPS = SurveyZankaProfiles::getFiltersForLoops();
} else {
# tretja variabla je izbrana, zamenjamo loope z tretjo variablo
$this->_LOOPS = SurveyZankaProfiles::setLoopsForCrostabs($this->variabla_third);
- }
+ } */
- if (count($this->_LOOPS) > 0) {
+ /* if (count($this->_LOOPS) > 0) {
# če mamo zanke
foreach ( $this->_LOOPS AS $loop) {
$this->_CURRENT_LOOP = $loop;
echo '<h2>'.$lang['srv_zanka_note'].$loop['text'].'</h2>';
$this->displayCrosstabsTable();
- echo '<br/>';
}
- } else {
+ }
+ else { */
$this->displayCrosstabsTable();
- }
+ //}
}
public function displayCrosstabsTable() {
@@ -721,9 +767,11 @@ class SurveyCrosstabs {
global $admin_type;
if ($this->getSelectedVariables(1) !== null && $this->getSelectedVariables(2) !== null) {
+
$variables1 = $this->getSelectedVariables(2);
$variables2 = $this->getSelectedVariables(1);
$counter = 0;
+
foreach ($variables1 AS $v_first) {
foreach ($variables2 AS $v_second) {
@@ -738,8 +786,8 @@ class SurveyCrosstabs {
$spr1 = $this->_HEADERS[$v_first['spr']];
$spr2 = $this->_HEADERS[$v_second['spr']];
- $grid1 = $spr1['grids'][$v_first['grd']];
- $grid2 = $spr2['grids'][$v_second['grd']];
+ $grid1 = isset($spr1['grids'][$v_first['grd']])?$spr1['grids'][$v_first['grd']]:array();
+ $grid2 = isset($spr2['grids'][$v_second['grd']])?$spr2['grids'][$v_second['grd']]:array();
#število vratic in število kolon
$cols = count($crosstabs['options1']);
@@ -755,19 +803,22 @@ class SurveyCrosstabs {
$numColumnPercent = $this->crossChk1 + $this->crossChk2 + $this->crossChk3;
$numColumnResidual = $this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR;
$tblColumn = max($numColumnPercent,$numColumnResidual);
- } else if ($this->crossChk1 || $this->crossChk2 || $this->crossChk3) {
+ }
+ else if ($this->crossChk1 || $this->crossChk2 || $this->crossChk3) {
# imamo samo procente
$rowSpan = 2;
$numColumnPercent = $this->crossChk1 + $this->crossChk2 + $this->crossChk3;
$numColumnResidual = 1;
$tblColumn = $numColumnPercent;
- } else if ($this->crossChkEC || $this->crossChkRE || $this->crossChkSR || $this->crossChkAR) {
+ }
+ else if ($this->crossChkEC || $this->crossChkRE || $this->crossChkSR || $this->crossChkAR) {
# imamo samo residuale
$rowSpan = 2;
$numColumnPercent = 1;
$numColumnResidual = $this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR;
$tblColumn = $numColumnResidual;
- } else {
+ }
+ else {
#prikazujemo samo podatke
$rowSpan = 1;
$numColumnPercent = 1;
@@ -782,20 +833,24 @@ class SurveyCrosstabs {
foreach ($spr1['grids'] AS $grid) {
foreach ($grid['variables'] AS $variable) {
if ($variable['sequence'] == $v_first['seq']) {
- $sub_q1 = '<span class="anl_variabla'.$sccFloat.'">';
+ $sub_q1 = '<span class="anl_variabla">';
$sub_q1 .= '<a href="/" title="' . $lang['srv_predogled_spremenljivka'] . '" onclick="showspremenljivkaSingleVarPopup(\'' . $v_first['spr'] . '\'); return false;">';
$sub_q1 .= strip_tags($spr1['naslov']);
+
if ($show_variables_values == true ) {
- $sub_q1 .= '<span class="anl_variabla'.$sccFloat.'">';
+ $sub_q1 .= '<span class="anl_variabla">';
$sub_q1 .= '&nbsp;('.strip_tags($spr1['variable']).')';
$sub_q1 .= '</span>';
}
+
if ($spr1['tip'] == '16') {
$sub_q1 .= '<br/>' . strip_tags($grid1['naslov']) . ($show_variables_values == true ? '&nbsp;(' . strip_tags($grid1['variable']) . ')' : '');
- } else {
- $sub_q1 .= '<br/>' . strip_tags($variable['naslov']) . ($show_variables_values == true ? '&nbsp;(' . strip_tags($variable['variable']) . ')' : '');
+ }
+ else {
+ if(strip_tags($variable['naslov']) != $lang['srv_new_text'] && strip_tags($variable['naslov']) != $lang['srv_new_vprasanje'])
+ $sub_q1 .= '<br/>' . strip_tags($variable['naslov']) . ($show_variables_values == true ? '&nbsp;(' . strip_tags($variable['variable']) . ')' : '');
}
$sub_q1 .= '</a>';
$sub_q1 .= '</span>' . NEW_LINE;
@@ -804,7 +859,7 @@ class SurveyCrosstabs {
}
}
if ($sub_q1 == null) {
- $sub_q1 = '<span class="anl_variabla'.$sccFloat.'">';
+ $sub_q1 = '<span class="anl_variabla">';
$sub_q1 .= '<a href="/" title="' . $lang['srv_predogled_spremenljivka'] . '" onclick="showspremenljivkaSingleVarPopup(\'' . $v_first['spr'] . '\'); return false;">';
$sub_q1 .= strip_tags($spr1['naslov']);
$sub_q1 .= ($show_variables_values == true ? '&nbsp;('.strip_tags($spr1['variable']).')' : '');
@@ -815,11 +870,11 @@ class SurveyCrosstabs {
foreach ($spr2['grids'] AS $grid) {
foreach ($grid['variables'] AS $variable) {
if ($variable['sequence'] == $v_second['seq']) {
- $sub_q2 = '<span class="anl_variabla'.$sccFloat.'">';
+ $sub_q2 = '<span class="anl_variabla">';
$sub_q2 .= '<a href="/" title="' . $lang['srv_predogled_spremenljivka'] . '" onclick="showspremenljivkaSingleVarPopupiza(\'' . $v_second['spr'] . '\'); return false;">';
$sub_q2 .= strip_tags($spr2['naslov']);
if ($show_variables_values == true) {
- $sub_q2 .= '<span class="anl_variabla'.$sccFloat.'">';
+ $sub_q2 .= '<span class="anl_variabla">';
$sub_q2 .= '&nbsp;('.strip_tags($spr2['variable']).')';
@@ -827,8 +882,10 @@ class SurveyCrosstabs {
}
if ($spr2['tip'] == '16') {
$sub_q2.= '<br/>' . strip_tags($grid2['naslov']) . ($show_variables_values == true ? '&nbsp;(' . strip_tags($grid2['variable']) . ')' : '');
- } else {
- $sub_q2.= '<br/>' . strip_tags($variable['naslov']) . ($show_variables_values == true ? '&nbsp;(' . strip_tags($variable['variable']) . ')' : '');
+ }
+ else {
+ if(strip_tags($variable['naslov']) != $lang['srv_new_text'] && strip_tags($variable['naslov']) != $lang['srv_new_vprasanje'])
+ $sub_q2.= '<br/>' . strip_tags($variable['naslov']) . ($show_variables_values == true ? '&nbsp;(' . strip_tags($variable['variable']) . ')' : '');
}
$sub_q2 .= '</a>';
$sub_q2 .= '</span>' . NEW_LINE;
@@ -837,123 +894,119 @@ class SurveyCrosstabs {
}
}
if ($sub_q2 == null) {
- $sub_q2 = '<span class="anl_variabla'.$sccFloat.'">';
+ $sub_q2 = '<span class="anl_variabla">';
$sub_q2 .= '<a href="/" title="' . $lang['srv_predogled_spremenljivka'] . '" onclick="showspremenljivkaSingleVarPopup(\'' . $v_second['spr'] . '\'); return false;">';
$sub_q2 .= strip_tags($spr2['naslov']);
$sub_q2 .= ($show_variables_values == true ? '&nbsp;('.strip_tags($spr2['variable']).')' : '');
$sub_q2 .= '</a>';
$sub_q2 .= '</span>' . NEW_LINE;
}
+
+
# izrišemo tabelo
- # najprej izrišemo naslovne vrstice
- #echo '<table class="anl_tbl_crosstab fullWidth fullHeight">';
- echo $_br.'<br/>';
-# $_br = '<br/>';
-# echo '<div class="floatLeft">'.$sub_q1. '</div><div class="floatLeft spaceLeft spaceRight"> ==&gt; </div><div class="floatLeft">'. $sub_q2.'</div><br class="clr" />';
+ echo '<div class="table_holder">';
+
+ // Zgornja vrstca
+ echo '<div class="top_line">';
+
+ // hi2
+ echo '<div class="hi2">';
+ if ($this->displayHi2 == true) {
+ echo '&#x3A7;<sup>2</sup> = ';
+ echo $this->formatNumber($crosstabs['hi2'], 3, '');
+ }
+ echo '</div>';
+
+ // Zvezdica za vkljucitev v porocilo
+ $spr2 = $v_first['seq'].'-'.$v_first['spr'].'-'.$v_first['grd'];
+ $spr1 = $v_second['seq'].'-'.$v_second['spr'].'-'.$v_second['grd'];
+
+ SurveyAnalysisHelper::getInstance()->addCustomReportElement($type=5, $sub_type=0, $spr1, $spr2);
+
+ echo '</div>';
+
+
+ # najprej izrišemo naslovne vrstice
#Zadnja kolona: Če imamo vodoravno checkboxe in gledamo enote, potem kolono s summo malo razmaknemo
if ( $crosstabs['isCheckbox']['spr1'] == true && $this->crossNavVsEno == true) {
$addVerticalSpace = 1;
- } else {
+ }
+ else {
$addVerticalSpace = 0;
}
-
- # hi2
- if ($this->displayHi2 == true) {
- echo '&#x3A7;<sup>2</sup> = ';
- echo $this->formatNumber($crosstabs['hi2'], 3, '');
- }
- echo '<table class="anl_tbl_crosstab" style="padding:0px; margin:0px; margin-top:10px;"'
- . ' sq1="'.$v_first['seq'].'" sp1="'.$v_first['spr'].'" gd1="'.$v_first['grd'].'" sq2="'.$v_second['seq'].'" sp2="'.$v_second['spr'].'" gd2="'.$v_second['grd'].'" >';
+ echo '<div class="table_crosstab_div">';
+ echo '<table class="table_crosstab" sq1="'.$v_first['seq'].'" sp1="'.$v_first['spr'].'" gd1="'.$v_first['grd'].'" sq2="'.$v_second['seq'].'" sp2="'.$v_second['spr'].'" gd2="'.$v_second['grd'].'">';
- if ($this->fromBreak == false) {
- echo '<colgroup>';
- #echo '<col style="width:auto; min-width:150px;" />';
- echo '<col style="width:auto; min-width:100px;" />';
- if (count($crosstabs['options1']) > 0 ) {
- $_width_percent = round(100 / count($crosstabs['options1'],2));
- foreach ($crosstabs['options1'] as $ckey1 =>$crossVariabla) {
- echo '<col style="width:'.$_width_percent.'%;" />';
- }
- }
- if ($addVerticalSpace == 1) {
- echo '<col style="width:10px;" />';
- }
- echo '<col style="width:auto;" />';
- echo '</colgroup>';
- }
- echo '<tr>';
- echo '<td class="anl_bt anl_bl anl_ac rsdl_bck_title ctbCll" rowspan="2" >';
- #if ($cntY == 1) {
- # ime variable
- #echo '<td rowspan="' . $rows . '">';
+ echo '<tr class="row1">';
+
+ echo '<td class="cell_var" rowspan="2">';
echo $sub_q2;
- #echo '</td>';
- #}
echo '</td>';
- echo '<td class="anl_bt anl_bl anl_ac rsdl_bck_title ctbCll" colspan="' . $cols . '" >';
+
+ echo '<td class="cell_question" colspan="'.($cols+1).'">';
echo $sub_q1;
echo '</td>';
- echo '<td class="anl_bl">&nbsp;</td>';
if ($this->fromBreak == true && $this->showAverage == true) {
# če smo v break-u dodamo še povprečja
- echo '<td class="">&nbsp;</td>';
+ echo '<td class="cell_space">&nbsp;</td>';
}
+
echo '</tr>';
- echo '<tr>';
+
+
+ echo '<tr class="row3">';
+
$col_cnt=0;
if (count($crosstabs['options1']) > 0 ) {
foreach ($crosstabs['options1'] as $ckey1 =>$crossVariabla) {
$col_cnt++;
+
#ime variable
- //$css_backX = 'rsdl_bck_variable'.($col_cnt & 1);
- $css_backX = ' rsdl_bck_variable1';
- echo '<td class="anl_bt anl_bl anl_ac'.$css_backX.' ctbCll" >';
+ echo '<td class="cell_grid">';
+
echo $crossVariabla['naslov'];
+
# če ni tekstovni odgovor dodamo key
if ($crossVariabla['type'] != 't' && $show_variables_values == true) {
- if ($crossVariabla['vr_id'] == null ) {
+ if (!isset($crossVariabla['vr_id'])||$crossVariabla['vr_id'] == null ) {
echo '<br/> ( '.$ckey1.' )';
- } else {
+ }
+ else {
echo '<br/> ( '.$crossVariabla['vr_id'].' )';
}
}
+
echo '</td>';
}
}
$col_cnt++;
- //$css_backX = 'rsdl_bck_variable'.($col_cnt & 1);
- if ($addVerticalSpace == 1) {
- echo '<td class="anl_bl">&nbsp;</td>';
- }
- $css_backX = ' rsdl_bck_variable1';
-
- echo '<td class="anl_bl anl_bt anl_br anl_ac red anl_ita anl_bck_text_0'.$css_backX.' ctbCll">' . $lang['srv_analiza_crosstab_skupaj'] . '</td>';
+
+ echo '<td class="cell_value">' . $lang['srv_analiza_crosstab_skupaj'] . '</td>';
if ($this->fromBreak == true && $this->showAverage == true) {
# če smo v break-u dodamo še povprečja
- echo '<td class="anl_bl anl_bt anl_br anl_ac anl_ita anl_bck_text_0'.$css_backX.' ctbCll">' . $lang['srv_analiza_crosstab_average'] . '</td>';
+ echo '<td class="cell_value">' . $lang['srv_analiza_crosstab_average'] . '</td>';
}
+
echo '</tr>';
+
$cntY = 0;
if (count($crosstabs['options2']) > 0) {
foreach ($crosstabs['options2'] as $ckey2 =>$crossVariabla2) {
$cntY++;
- echo '<tr>';
-
-
- //$css_backY = 'rsdl_bck_variable'.($cntY & 1);
- $css_backY = ' rsdl_bck_variable1';
+
+ echo '<tr class="row_var">';
- echo '<td class="anl_bt anl_bl anl_ac'.$css_backY.' ctbCll">';
+ echo '<td class="cell_var">';
echo $crossVariabla2['naslov'];
# če ni tekstovni odgovor dodamo key
if ($crossVariabla2['type'] !== 't' && $show_variables_values == true ) {
- if ($crossVariabla2['vr_id'] == null) {
+ if (!isset($crossVariabla2['vr_id']) || $crossVariabla2['vr_id'] == null) {
echo '<br/> ( '.$ckey2.' )';
} else {
echo '<br/> ( '.$crossVariabla2['vr_id'].' )';
@@ -963,150 +1016,147 @@ class SurveyCrosstabs {
echo '</td>';
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
- echo '<td class="ct_in_cell'.($this->enableInspect && ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? ' ct_inspect' : '').'" k1="'.$ckey1.'" k2="'.$ckey2.'" n1="'.$crossVariabla1['naslov'].'" n2="'.$crossVariabla2['naslov'].'" v1="'.$crossVariabla1['vr_id'].'" v2="'.$crossVariabla2['vr_id'].'">';
- # celica z vebino
- {
- # prikazujemo eno ali več od: frekvenc, odstotkov, residualov
- echo '<table class="ct_in_tbl">';
- if ($this->crossChk0) {
- # izpišemo frekvence crostabov
- echo '<tr>';
- echo '<td class="anl_ac '.($crosstabs['color'][$ckey1][$ckey2]).' ctbCll">';
- echo ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
- # .$crossTab[$crossVariabla1[cell_id]][$ckey2]
- #
-
- echo '</td>';
- echo '</tr>';
- }
-
- if ($this->crossChk1 || $this->crossChk2 || $this->crossChk3) {
- # sirina celice v %
- if ( ($this->crossChk1 + $this->crossChk2 + $this->crossChk3) == 3 )
- $css_width = ' ctb_w33p';
- elseif (($this->crossChk1 + $this->crossChk2 + $this->crossChk3) == 2 )
- $css_width = ' ctb_w50p';
- else
- $css_width = '';
- $css_bt = ( $this->crossChk0 ) ? 'anl_dash_bt' : '';
- # izpisemo procente
- echo '<tr>';
- echo '<td class="'.$css_bt.'">';
-
- echo '<table class="anl_tbl_crosstab fullWidth fullHeight" style="padding:0px; margin:0px;">';
- echo '<tr>';
- $col=0;
-
- if ($this->crossChk1) {
- #procent vrstica
- $col++;
-
- $css_color = ($this->doColor == 'true') ? 'ctbChck_sp1' : 'ctbChck_sp0';
- $css_br = $numColumnPercent > $col ? ' anl_dash_br' : '';
- echo '<td class="'.$css_color.$css_br.$css_width.' ctbCll">';
- echo $this->formatNumber($this->getCrossTabPercentage($crosstabs['sumaVrstica'][$ckey2], $crosstabs_value[$ckey1][$ckey2]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
- echo '</td>';
- }
- if ($this->crossChk2) {
- #procent stolpec
- $col++;
- $css_br = $numColumnPercent > $col ? ' anl_dash_br' : '';
- $css_color = ($this->doColor == 'true') ? 'ctbChck_sp2' : 'ctbChck_sp0';
- echo '<td class="'.$css_color.$css_br.$css_width.' ctbCll">';
-
- echo $this->formatNumber($this->getCrossTabPercentage($crosstabs['sumaStolpec'][$ckey1], $crosstabs_value[$ckey1][$ckey2]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
- echo '</td>';
- }
- if ($this->crossChk3) {
- #procent skupni
- $col++;
- $css_br = $numColumnPercent > $col ? ' anl_dash_br' : '';
- $css_color = ($this->doColor == 'true') ? 'ctbChck_sp3' : 'ctbChck_sp0';
- echo '<td'.$css_br.$css_width.' class="'.$css_color.$css_br.' ctbCll">';
-
- echo $this->formatNumber($this->getCrossTabPercentage($crosstabs['sumaSkupna'], $crosstabs_value[$ckey1][$ckey2]), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
- echo '</td>';
- }
- echo '</tr>';
- echo '</table>';
+
+ # celica z vebino
+ echo '<td class="cell_noPadding '.($this->enableInspect && ((int)$crosstabs_value[$ckey1][$ckey2] > 0) ? ' ct_inspect' : '').'" k1="'.$ckey1.'" k2="'.$ckey2.'" n1="'.$crossVariabla1['naslov'].'" n2="'.$crossVariabla2['naslov'].'" v1="'.(isset($crossVariabla1['vr_id'])?$crossVariabla1['vr_id']:'').'" v2="'.(isset($crossVariabla2['vr_id'])?$crossVariabla2['vr_id']:'').'">';
+
+ # prikazujemo eno ali več od: frekvenc, odstotkov, residualov
+ echo '<table class="cell_table">';
+
+ if ($this->crossChk0) {
+ # izpišemo frekvence crostabov
+ echo '<tr>';
+
+ echo '<td class="cell_value '.(isset($crosstabs['color'][$ckey1][$ckey2])?$crosstabs['color'][$ckey1][$ckey2]:'').'">';
+ echo (isset($crosstabs_value[$ckey1][$ckey2])&&(int)$crosstabs_value[$ckey1][$ckey2] > 0) ? $crosstabs_value[$ckey1][$ckey2] : 0;
+ echo '</td>';
+
+ echo '</tr>';
+ }
+
+ if ($this->crossChk1 || $this->crossChk2 || $this->crossChk3) {
+ # sirina celice v %
+ if ( ($this->crossChk1 + $this->crossChk2 + $this->crossChk3) == 3 )
+ $css_width = ' ctb_w33p';
+ elseif (($this->crossChk1 + $this->crossChk2 + $this->crossChk3) == 2 )
+ $css_width = ' ctb_w50p';
+ else
+ $css_width = '';
+ $css_bt = ( $this->crossChk0 ) ? 'anl_dash_bt' : '';
+ # izpisemo procente
+ echo '<tr>';
+ echo '<td class="cell_noPadding '.$css_bt.'">';
+
+ echo '<table class="cell_table">';
+ echo '<tr>';
+ $col=0;
+
+ if ($this->crossChk1) {
+ #procent vrstica
+ $col++;
+
+ $css_color = ($this->doColor == 'true') ? 'ctbChck_sp1' : 'ctbChck_sp0';
+ $css_br = $numColumnPercent > $col ? ' anl_dash_br' : '';
+ echo '<td class="cell_value '.$css_color.$css_br.$css_width.' ctbCll">';
+ echo $this->formatNumber($this->getCrossTabPercentage((isset($crosstabs['sumaVrstica'][$ckey2])?$crosstabs['sumaVrstica'][$ckey2]:0), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:0)), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
+ echo '</td>';
+ }
+ if ($this->crossChk2) {
+ #procent stolpec
+ $col++;
+ $css_br = $numColumnPercent > $col ? ' anl_dash_br' : '';
+ $css_color = ($this->doColor == 'true') ? 'ctbChck_sp2' : 'ctbChck_sp0';
+ echo '<td class=" cell_value'.$css_color.$css_br.$css_width.' ctbCll">';
+
+ echo $this->formatNumber($this->getCrossTabPercentage((isset($crosstabs['sumaStolpec'][$ckey1])?$crosstabs['sumaStolpec'][$ckey1]:0), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:0)), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
+ echo '</td>';
+ }
+ if ($this->crossChk3) {
+ #procent skupni
+ $col++;
+ $css_br = $numColumnPercent > $col ? ' anl_dash_br' : '';
+ $css_color = ($this->doColor == 'true') ? 'ctbChck_sp3' : 'ctbChck_sp0';
+ echo '<td'.$css_br.$css_width.' class="cell_value '.$css_color.$css_br.' ctbCll">';
+
+ echo $this->formatNumber($this->getCrossTabPercentage((isset($crosstabs['sumaSkupna'])?$crosstabs['sumaSkupna']:0), (isset($crosstabs_value[$ckey1][$ckey2])?$crosstabs_value[$ckey1][$ckey2]:0)), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
+ echo '</td>';
+ }
+ echo '</tr>';
+ echo '</table>';
+
+ echo '</td>';
+ echo '</tr>';
+ }
+ # izpisemo residuale
+ if ($this->crossChkEC || $this->crossChkRE || $this->crossChkSR || $this->crossChkAR) {
+ # sirina celice v %
+ if ( ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR) == 4 )
+ $css_width = ' ctb_w25p';
+ elseif ( ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR) == 3 )
+ $css_width = ' ctb_w33p';
+ elseif ( ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR) == 2 )
+ $css_width = ' ctb_w50p';
+ else
+ $css_width = '';
+ $css_bt = ( $this->crossChk0 || ($this->crossChk1 && $this->crossChk2 && $this->crossChk3)) ? 'anl_dash_bt' : '';
+ echo '<tr>';
+
+ echo '<td class="cell_noPadding '.$css_bt.'">';
+ echo '<table class="cell_table">';
+ echo '<tr>';
+ $col=0;
+
+ if ($this->crossChkEC) {
+ $col++;
+ $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
+ $css_color = ($this->doColor == 'true') ? 'crossCheck_EC' : 'ctbChck_sp0';
+ echo '<td class="cell_value '.$css_color.$css_br.$css_width.' ctbCll">';
+ echo $this->formatNumber((isset($crosstabs['exC'][$ckey1][$ckey2])?$crosstabs['exC'][$ckey1][$ckey2]:null), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
+ echo '</td>';
+ }
+ if ($this->crossChkRE) {
+ $col++;
+ $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
+ $css_color = ($this->doColor == 'true') ? 'crossCheck_RE' : 'ctbChck_sp0';
+ echo '<td class="cell_value '.$css_color.$css_br.$css_width.' ctbCll">';
+ echo $this->formatNumber((isset($crosstabs['res'][$ckey1][$ckey2])?$crosstabs['res'][$ckey1][$ckey2]:null), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
+ echo '</td>';
+ }
+ if ($this->crossChkSR) {
+ $col++;
+ $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
+ $css_color = ($this->doColor == 'true') ? 'crossCheck_SR' : 'ctbChck_sp0';
+ echo '<td class="cell_value '.$css_color.$css_br.$css_width.' ctbCll">';
+ echo $this->formatNumber((isset($crosstabs['stR'][$ckey1][$ckey2])?$crosstabs['stR'][$ckey1][$ckey2]:null), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
+ echo '</td>';
+ }
+ if ($this->crossChkAR) {
+ $col++;
+ $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
+ $css_color = ($this->doColor == 'true') ? 'crossCheck_AR' : 'ctbChck_sp0';
+ echo '<td class="cell_value '.$css_color.$css_br.$css_width.' ctbCll">';
+ echo $this->formatNumber((isset($crosstabs['adR'][$ckey1][$ckey2])?$crosstabs['adR'][$ckey1][$ckey2]:null), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
+ echo '</td>';
+ }
+ echo '</tr>';
+ echo '</table>';
+ echo '</td>';
+ echo '</tr>';
+ }
+ echo '</table>';
- echo '</td>';
- echo '</tr>';
- }
- # izpisemo residuale
- if ($this->crossChkEC || $this->crossChkRE || $this->crossChkSR || $this->crossChkAR) {
- # sirina celice v %
- if ( ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR) == 4 )
- $css_width = ' ctb_w25p';
- elseif ( ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR) == 3 )
- $css_width = ' ctb_w33p';
- elseif ( ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR) == 2 )
- $css_width = ' ctb_w50p';
- else
- $css_width = '';
- $css_bt = ( $this->crossChk0 || ($this->crossChk1 && $this->crossChk2 && $this->crossChk3)) ? 'anl_dash_bt' : '';
- echo '<tr>';
-
- echo '<td class="'.$css_bt.'" style="padding:0px 0px;">';
- echo '<table class="anl_tbl_crosstab fullWidth fullHeight" style="padding:0px; margin:0px;">';
- echo '<tr>';
- $col=0;
-
- if ($this->crossChkEC) {
- $col++;
- $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
- $css_color = ($this->doColor == 'true') ? 'crossCheck_EC' : 'ctbChck_sp0';
- echo '<td class="'.$css_color.$css_br.$css_width.' ctbCll">';
- echo $this->formatNumber($crosstabs['exC'][$ckey1][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
- echo '</td>';
- }
- if ($this->crossChkRE) {
- $col++;
- $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
- $css_color = ($this->doColor == 'true') ? 'crossCheck_RE' : 'ctbChck_sp0';
- echo '<td class="'.$css_color.$css_br.$css_width.' ctbCll">';
- echo $this->formatNumber($crosstabs['res'][$ckey1][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
- echo '</td>';
- }
- if ($this->crossChkSR) {
- $col++;
- $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
- $css_color = ($this->doColor == 'true') ? 'crossCheck_SR' : 'ctbChck_sp0';
- echo '<td class="'.$css_color.$css_br.$css_width.' ctbCll">';
- echo $this->formatNumber($crosstabs['stR'][$ckey1][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
- echo '</td>';
- }
- if ($this->crossChkAR) {
- $col++;
- $css_br = $numColumnResidual > $col ? ' anl_dash_br' : '';
- $css_color = ($this->doColor == 'true') ? 'crossCheck_AR' : 'ctbChck_sp0';
- echo '<td class="'.$css_color.$css_br.$css_width.' ctbCll">';
- echo $this->formatNumber($crosstabs['adR'][$ckey1][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'), '');
- echo '</td>';
- }
- echo '</tr>';
- echo '</table>';
- echo '</td>';
- echo '</tr>';
- }
- echo '</table>';
- }
# konec celice z vsebino
echo '</td>';
}
- # če mamo checkboxe in sumo malo razmaknemo
- if ($addVerticalSpace == 1) {
- echo '<td class="anl_bl">&nbsp;</td>';
- }
// vedno rišemo zadnji stolpec.
- echo '<td class="anl_ac anl_bl anl_bt anl_br rsdl_bck0 anl_bb" >';
- echo '<table class="anl_tbl_crosstab fullWidth fullHeight" style="padding:0px; margin:0px;">';
+ echo '<td class="cell_noPadding">';
+ echo '<table class="cell_table">';
if ($this->crossChk0) {
echo '<tr>';
- echo '<td class="anl_ac ctbCll crostabSuma" colspan="' . ( $this->crossChk1 + $this->crossChk2 + $this->crossChk3 ).'">';
+ echo '<td class="cell_value ctbCll crostabSuma" colspan="' . ( $this->crossChk1 + $this->crossChk2 + $this->crossChk3 ).'">';
# suma po vrsticah
- echo (int)$crosstabs['sumaVrstica'][$ckey2];
+ echo (isset($crosstabs['sumaVrstica'][$ckey2])?(int)$crosstabs['sumaVrstica'][$ckey2]:0);
echo '</td>';
echo '</tr>';
}
@@ -1123,21 +1173,21 @@ class SurveyCrosstabs {
echo '<tr>';
if ($this->crossChk1) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp1' : 'ctbChck_sp0';
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.$css_width.'">';
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.$css_width.'">';
echo $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
if ($this->crossChk2) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp2' : 'ctbChck_sp0';
$css_border = ($this->crossChk1 ? ' anl_dash_bl ' : '');
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.$css_border.$css_width.'">';
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.$css_border.$css_width.'">';
echo $this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
if ($this->crossChk3) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp3' : 'ctbChck_sp0';
$css_border = ($this->crossChk1 || $this->crossChk2 ? ' anl_dash_bl ' : '');
- echo '<td class="anl_ac'.$css_color.$css_bt.$css_border.$css_width.' ctbCll">';
+ echo '<td class="cell_value '.$css_color.$css_bt.$css_border.$css_width.' ctbCll">';
echo $this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaVrstica'][$ckey2] / $crosstabs['sumaSkupna']) : 0), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
@@ -1149,45 +1199,34 @@ class SurveyCrosstabs {
echo '</td>';
if ($this->fromBreak == true && $this->showAverage == true) {
# če smo v break dodamo še povprečja
- echo '<td class="anl_ac anl_bl anl_bt anl_br anl_bb rsdl_bck_variable1" >';
+ echo '<td class="cell_value">';
echo $this->formatNumber( $crosstabs['avgVrstica'][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'), '');
echo '</td>';
}
echo '</tr>';
}
}
- #Zadnja vrstica. Če imamo navpično checkboxe in gledamo enote, potem vrstico z summo malo razmaknemo
- $cssBT = 'anl_bt';
- if ( $crosstabs['isCheckbox']['spr2'] == true && $this->crossNavVsEno == true) {
- echo '<tr>';
- echo '<td class="'.$cssBT.'">&nbsp;</th>';
- echo '<td class="'.$cssBT.'">&nbsp;</th>';
- echo '<td class="'.$cssBT.'" colspan="'.count($crosstabs['options1']).'">&nbsp;</th>';
- if ($addVerticalSpace == 1) {
- echo '<td class="">&nbsp;</td>';
- }
-
- echo '<td class="'.$cssBT.'">&nbsp;</th>';
- echo '</tr>';
- $cssBT = '';
- }
+
$cntY++;
+
echo '<tr>';
+
$css_backY = ' rsdl_bck_variable1';
echo '<td class="anl_bb anl_bt anl_bl anl_ac red anl_ita anl_bck_text_0'.$css_backY.' ctbCll">' . $lang['srv_analiza_crosstab_skupaj'] . '</td>';
- // skupni sestevki po stolpcih
+
+ // skupni sestevki po stolpcih
if (count($crosstabs['options1']) > 0)
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
- echo '<td class="anl_ac anl_bb anl_bt anl_bl rsdl_bck0" >';
+ echo '<td class="cell_noPadding">';
{
# prikazujemo eno od treh možnosti
- echo '<table class="anl_tbl_crosstab fullWidth fullHeight" style="padding:0px; margin:0px;">';
+ echo '<table class="cell_table">';
if ($this->crossChk0) {
echo '<tr>';
- echo '<td class="anl_ac ctbCll crostabSuma" colspan="'.($this->crossChk1 + $this->crossChk2 + $this->crossChk3).'">';
+ echo '<td class="cell_value ctbCll crostabSuma" colspan="'.($this->crossChk1 + $this->crossChk2 + $this->crossChk3).'">';
# suma po stolpcih
- echo (int)$crosstabs['sumaStolpec'][$ckey1];
+ echo isset($crosstabs['sumaStolpec'][$ckey1])?(int)$crosstabs['sumaStolpec'][$ckey1]:0;
echo '</td>';
echo '</tr>';
}
@@ -1197,21 +1236,21 @@ class SurveyCrosstabs {
echo '<tr>';
if ($this->crossChk1) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp1' : 'ctbChck_sp0';
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.'">';
- echo $this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.'">';
+ echo $this->formatNumber( (isset($crosstabs['sumaStolpec'][$ckey1])&&$crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
if ($this->crossChk2) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp2' : 'ctbChck_sp0';
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.($this->crossChk1 ? ' anl_dash_bl' : '').'">';
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.($this->crossChk1 ? ' anl_dash_bl' : '').'">';
echo $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
if ($this->crossChk3)
{
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp3' : 'ctbChck_sp0';
- echo '<td class="anl_ac'.$css_color.$css_bt.($this->crossChk2 ? ' anl_dash_bl' : '').' ctbCll">';
- echo $this->formatNumber( ($crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
+ echo '<td class="cell_value '.$css_color.$css_bt.($this->crossChk2 ? ' anl_dash_bl' : '').' ctbCll">';
+ echo $this->formatNumber( (isset($crosstabs['sumaStolpec'][$ckey1])&&$crosstabs['sumaSkupna'] > 0 ? (100 * $crosstabs['sumaStolpec'][$ckey1] / $crosstabs['sumaSkupna']) : 0), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
echo '</tr>';
@@ -1220,18 +1259,14 @@ class SurveyCrosstabs {
}
echo '</td>';
}
- # če mamo checkboxe in sumo malo razmaknemo
- if ($addVerticalSpace == 1) {
- echo '<td class="anl_bl">&nbsp;</td>';
- }
# zadnja celica z skupno sumo
- echo '<td class="anl_ac anl_bt anl_bl anl_br anl_bb rsdl_bck0">';
+ echo '<td class="cell_noPadding">';
{
- echo '<table class="anl_tbl_crosstab fullWidth fullHeight" style="padding:0px; margin:0px;">';
+ echo '<table class="cell_table">';
if ($this->crossChk0) {
echo '<tr>';
- echo '<td class="anl_ac ctbCll crostabSuma" colspan="'.($this->crossChk1 + $this->crossChk2 + $this->crossChk3).'">';
+ echo '<td class="cell_value ctbCll crostabSuma" colspan="'.($this->crossChk1 + $this->crossChk2 + $this->crossChk3).'">';
# skupna suma
echo (int)$crosstabs['sumaSkupna'];
echo '</td>';
@@ -1244,20 +1279,20 @@ class SurveyCrosstabs {
if ($this->crossChk1) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp1' : 'ctbChck_sp0';
$css_border = ($this->crossChk2 || $this->crossChk3) ? ' anl_dash_br' : '';
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.$css_border.'">';
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.$css_border.'">';
echo $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
if ($this->crossChk2) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp2' : 'ctbChck_sp0';
$css_border = ($this->crossChk3) ? ' anl_dash_br' : '';
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.$css_border.'">';
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.$css_border.'">';
echo $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
if ($this->crossChk3) {
$css_color = ($this->doColor == 'true') ? ' ctbChck_sp3' : 'ctbChck_sp0';
- echo '<td class="anl_ac ctbCll'.$css_color.$css_bt.'">';
+ echo '<td class="cell_value ctbCll'.$css_color.$css_bt.'">';
echo $this->formatNumber(100, SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_PERCENT'), '%');
echo '</td>';
}
@@ -1282,15 +1317,11 @@ class SurveyCrosstabs {
// skupni sestevki po stolpcih
if (count($crosstabs['options1']) > 0) {
foreach ($crosstabs['options1'] as $ckey1 => $crossVariabla1) {
- echo '<td class="anl_ac anl_bb anl_bt anl_br rsdl_bck_variable1" >';
- echo $this->formatNumber( $crosstabs['avgStolpec'][$ckey1], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'), '');
+ echo '<td class="cell_value anl_bb anl_bt anl_br rsdl_bck_variable1" >';
+ echo $this->formatNumber( (isset($crosstabs['avgStolpec'][$ckey1])?$crosstabs['avgStolpec'][$ckey1]:null), SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_AVERAGE'), '');
echo '</td>';
}
}
- # če mamo checkboxe in sumo malo razmaknemo
- if ($addVerticalSpace == 1) {
- echo '<td>&nbsp;</td>';
- }
# zadnja celica z skupno sumo
echo '<td>&nbsp;</td>';
@@ -1298,37 +1329,43 @@ class SurveyCrosstabs {
# če smo v break dodamo še povprečja
echo '<td>&nbsp;</td>';
}
+
echo '</tr>';
}
+
echo '</table>';
+ echo '</div>';
+
+
+ $this->displayExport();
+
+ // Izrisemo legendo
+ $this->displayCrosstabCheckboxes();
+
- // Zvezdica za vkljucitev v porocilo
- $spr2 = $v_first['seq'].'-'.$v_first['spr'].'-'.$v_first['grd'];
- $spr1 = $v_second['seq'].'-'.$v_second['spr'].'-'.$v_second['grd'];
-
- SurveyAnalysisHelper::getInstance()->addCustomReportElement($type=5, $sub_type=0, $spr1, $spr2);
- #SurveyAnalysis::addCustomReportElement($type=5, $sub_type=0, $spr1, $spr2);
-
// Izrisemo graf za tabelo
if($this->showChart && !$this->fromBreak){
$tableChart = new SurveyTableChart($this->sid, $this, 'crosstab', $counter);
$tableChart->display();
}
+
+ echo '</div>';
$counter++;
}
}
- } else {
+ }
+ else {
# crostab variables not set
echo $lang['srv_crosstab_note0'];
- #print_r("Crosstab variables not set!");
}
}
- /**
+ /**
* @desc prikaze izvoz za PDF/RTF
*/
function displayExport () {
+
# z javascriptom prikažemo ikonce za arhiviranje, emaijlanje arhivov, pdf, rtf, excel...
if ($this->isSelectedBothVariables()) {
$data1 = '';
@@ -1348,18 +1385,20 @@ class SurveyCrosstabs {
$href_pdf = makeEncodedIzvozUrlString('izvoz.php?b=export&m=crosstabs_izpis&anketa=' . $this->sid . '&data1='.$data1.'&data2='.$data2);
$href_rtf = makeEncodedIzvozUrlString('izvoz.php?b=export&m=crosstabs_izpis_rtf&anketa=' . $this->sid . '&data1='.$data1.'&data2='.$data2);
$href_xls = makeEncodedIzvozUrlString('izvoz.php?b=export&m=crosstabs_izpis_xls&anketa=' . $this->sid . '&data1='.$data1.'&data2='.$data2);
- echo '<script>';
- # nastavimopravilne linke
+
+ echo '<script>';
+
+ # nastavimopravilne linke
echo '$("#secondNavigation_links a#crosstabDoPdf").attr("href", "'.$href_pdf.'");';
echo '$("#secondNavigation_links a#crosstabDoRtf").attr("href", "'.$href_rtf.'");';
echo '$("#secondNavigation_links a#crosstabDoXls").attr("href", "'.$href_xls.'");';
- # prikažemo linke
+
+ # prikažemo linke
echo '$("#hover_export_icon").removeClass("hidden");';
echo '$("#secondNavigation_links a").removeClass("hidden");';
- echo '</script>';
-
- }
-
+
+ echo '</script>';
+ }
}
/** kadar kličemo iz Break, ali pri radio grupi dodamo še povprečje po stolpcih
@@ -1393,8 +1432,8 @@ class SurveyCrosstabs {
$spr1 = $this->_HEADERS[$v_first['spr']];
$spr2 = $this->_HEADERS[$v_second['spr']];
- $grid1 = $spr1['grids'][$v_first['grd']];
- $grid2 = $spr2['grids'][$v_second['grd']];
+ $grid1 = isset($spr1['grids'][$v_first['grd']]) ? $spr1['grids'][$v_first['grd']] : array();
+ $grid2 = isset($spr2['grids'][$v_second['grd']]) ? $spr2['grids'][$v_second['grd']] : array();
$sequence1 = $v_first['seq'];
$sequence2 = $v_second['seq'];
@@ -1463,9 +1502,9 @@ class SurveyCrosstabs {
# dodamo status filter za vse sekvence checkbox-a da so == 1
- if ($additional_status_filter != null) {
+ /* if ($additional_status_filter != null) {
$status_filter .= $additional_status_filter;
- }
+ } */
# odstranimo vse zapise, kjer katerakoli od variabel vsebuje missing
$_allMissing_answers = SurveyMissingValues::GetMissingValuesForSurvey(array(1,2,3));
@@ -1474,7 +1513,7 @@ class SurveyCrosstabs {
# polovimo obe sequenci
$tmp_file = $folder . 'tmp_crosstab_'.$this->sid.'.TMP';
$file_handler = fopen($tmp_file,"w");
- fwrite($file_handler,"<?php\n");
+ fwrite($file_handler,"<?php\n\$crosstab=array();\n");
fclose($file_handler);
if (count($sekvences1)>0)
foreach ($sekvences1 AS $sequence1) {
@@ -1512,11 +1551,14 @@ class SurveyCrosstabs {
}
if (IS_WINDOWS) {
- #$command = 'awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} '.$_status_filter.' { print \"$crosstab[\x27\",$'.$sequence1.',\"\x27][\x27\",$'.$sequence2.',\"\x27]++; $options1[\x27\",$'.$sequence1.',\"\x27]++; $options2[\x27\",$'.$sequence2.',\"\x27]++;\"}" '.$this->dataFileName.' >> '.$tmp_file;
$command = 'awk -F"|" "BEGIN {{OFS=\"\"} {ORS=\"\n\"}} '.$status_filter.$additional_filter.' { print \"$crosstab[\x27\",'.$_seq_1_text.',\"\x27][\x27\",'.$_seq_2_text.',\"\x27]++;\"}" '.$this->dataFileName.' >> '.$tmp_file;
} else {
- #$command = 'awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} '.$_status_filter.' { print "$crosstab[\x27",$'.$sequence1.',"\x27][\x27",$'.$sequence2.',"\x27]++; $options1[\x27",$'.$sequence1.',"\x27]++; $options2[\x27",$'.$sequence2.',"\x27]++;"}\' '.$this->dataFileName.' >> '.$tmp_file;
$command = 'awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} '.$status_filter.$additional_filter.' { print "$crosstab[\x27",'.$_seq_1_text.',"\x27][\x27",'.$_seq_2_text.',"\x27]++;"}\' '.$this->dataFileName.' >> '.$tmp_file;
+
+ //$command = 'awk -F"|" \'BEGIN {{OFS=""} {ORS="\n"}} '.$status_filter.$additional_filter.' { print "if( array_key_exists('.$_seq_1_text.', $crosstab) ){ $crosstab[\x27",'.$_seq_1_text.',"\x27][\x27",'.$_seq_2_text.',"\x27]++;"}}\' '.$this->dataFileName.' >> '.$tmp_file;
+ //$command = 'awk -F"|" \'BEGIN {OFS=""; ORS="\n"} ' . $status_filter . $additional_filter . ' { print "if( !isset(crosstab) ){ $crosstab[\x27",' . $_seq_1_text . ',"\x27][\x27",' . $_seq_2_text . ',"\x27]++;"} }\' ' . $this->dataFileName . ' >> ' . $tmp_file;
+ //echo $command;
+
}
$out = shell_exec($command);
@@ -1532,23 +1574,25 @@ class SurveyCrosstabs {
unlink($tmp_file);
}
+ //print_r($crosstab);
+
#ker z awk ne gre nardit tolower zaradi šumnikov, nardimo ročno v loopu
$caseInsensitiveCrosstab = array();
- if (count($crosstab) > 0) {
+ if (is_countable($crosstab) && count($crosstab) > 0) {
foreach ($crosstab as $fkey => $fvalue) {
$fkey = mb_strtolower($fkey,'UTF-8');
if (count($fvalue) > 0) {
foreach ($fvalue as $skey => $svalue) {
$skey = mb_strtolower($skey,'UTF-8');
- $caseInsensitiveCrosstab[$fkey][$skey] += $svalue;
+ $caseInsensitiveCrosstab[$fkey][$skey] = (isset($caseInsensitiveCrosstab[$fkey][$skey])? $caseInsensitiveCrosstab[$fkey][$skey] += $svalue : $svalue);
}
}
}
}
$crosstab = $caseInsensitiveCrosstab;
# poiščemo pripadajočo spremenljivko
- $var_options1 = $this->_HEADERS[$v_first['spr']]['options'];
- $var_options2 = $this->_HEADERS[$v_second['spr']]['options'];
+ $var_options1 = isset($this->_HEADERS[$v_first['spr']]['options'])?$this->_HEADERS[$v_first['spr']]['options']:array();
+ $var_options2 = isset($this->_HEADERS[$v_second['spr']]['options'])?$this->_HEADERS[$v_second['spr']]['options']:array();
# inicializacija
$_all_options1 = array();
@@ -1560,12 +1604,12 @@ class SurveyCrosstabs {
# najprej poiščemo (združimo) vse opcije ki so definirane kot opcije spremenljivke in vse ki so v crosstabih
if (count($var_options1) > 0 && $spr_1_checkbox !== true ) {
foreach ($var_options1 as $okey => $opt) {
- $_all_options1[$okey] = array('naslov'=>$opt, 'cnt'=>$options1[$okey], 'type'=>'o');
+ $_all_options1[$okey] = array('naslov'=>$opt, 'cnt'=>/* $options1[$okey] */0, 'type'=>'o');
}
}
if (count($var_options2) > 0 && $spr_2_checkbox !== true) {
foreach ($var_options2 as $okey => $opt) {
- $_all_options2[$okey] = array('naslov'=>$opt, 'cnt'=>$options2[$okey], 'type'=>'o');
+ $_all_options2[$okey] = array('naslov'=>$opt, 'cnt'=>/* $options2[$okey] */0, 'type'=>'o');
}
}
# za checkboxe dodamo posebej vse opcije
@@ -1598,18 +1642,19 @@ class SurveyCrosstabs {
foreach ($crosstab AS $_kvar1=>$_var1) {
# missingov ne dodajamo še zdaj, da ohranimo pravilen vrstni red
if (!isset($_allMissing_answers[$_kvar1]) && !isset($_all_options1[$_kvar1])) {
- $_all_options1[$_kvar1] = array('naslov'=>$_kvar1, 'cnt'=>($_all_options1[$_kvar1]['cnt']+1), 'type'=>'t');
+ $_all_options1[$_kvar1] = array('naslov'=>$_kvar1, 'cnt'=>(isset($_all_options1[$_kvar1]['cnt'])?$_all_options1[$_kvar1]['cnt']+1:1), 'type'=>'t');
}
foreach ($_var1 AS $_kvar2=>$_var2) {
if (!isset($_allMissing_answers[$_kvar1]) || (isset($_allMissing_answers[$_kvar1]) && isset($_pageMissing_answers[$_kvar1]))) {
- $sumaStolpec[$_kvar1] += $_var2;
+ $sumaStolpec[$_kvar1] = (isset($sumaStolpec[$_kvar1]) ? $sumaStolpec[$_kvar1] += $_var2 : $_var2);
}
if (!isset($_allMissing_answers[$_kvar2]) || (isset($_allMissing_answers[$_kvar2]) && isset($_pageMissing_answers[$_kvar2]))) {
- $sumaVrstica[$_kvar2] += $_var2;
+ $sumaVrstica[$_kvar2] = (isset($sumaVrstica[$_kvar2]) ? $sumaVrstica[$_kvar2] += $_var2 : $_var2);
}
# missingov ne dodajamo še zdaj, da ohranimo pravilen vrstni red
- if (!isset($_allMissing_answers[$_kvar2]) && !isset($_all_options2[$_kvar2])) {
+ //if (!isset($_allMissing_answers[$_kvar2]) && !isset($_all_options2[$_kvar2])) {
+ if (array_key_exists($_kvar2, $_allMissing_answers) && array_key_exists($_kvar2, $_all_options2)) {
$_all_options2[$_kvar2] = array('naslov'=>$_kvar2, 'cnt'=>($_all_options1[$_kvar2]['cnt']+1), 'type'=>'t');
}
@@ -1633,10 +1678,10 @@ class SurveyCrosstabs {
foreach ($_allMissing_answers AS $miskey => $_missing) {
if (!isset($_pageMissing_answers[$miskey])) {
if ( $spr_1_checkbox !== true) {
- $_all_options1[$miskey] = array('naslov'=>$_missing, 'cnt'=>(int)$options1[$miskey], 'type'=>'m');
+ $_all_options1[$miskey] = array('naslov'=>$_missing, 'cnt'=>/* (int)$options1[$miskey] */null, 'type'=>'m');
}
if ( $spr_2_checkbox !== true ) {
- $_all_options2[$miskey] = array('naslov'=>$_missing, 'cnt'=>(int)$options2[$miskey], 'type'=>'m');
+ $_all_options2[$miskey] = array('naslov'=>$_missing, 'cnt'=>/* (int)$options2[$miskey] */null, 'type'=>'m');
}
}
}
@@ -1784,22 +1829,24 @@ class SurveyCrosstabs {
# gremo skozi vsako celico
if ($cnt1 > 0 && $cnt2) {
foreach ($_all_options1 as $ckey1 => $crossVariabla1) {
- if($sumaStolpec[$ckey1]!=null) {
+ if(isset($sumaStolpec[$ckey1])&&$sumaStolpec[$ckey1]!=null) {
foreach ($_all_options2 as $ckey2 => $crossVariabla2) {
- if($sumaVrstica[$ckey2]!=null) {
+ if(isset($sumaVrstica[$ckey2]) && $sumaVrstica[$ckey2]!=null) {
# skupna suma
$_w = $sumaSkupna;
#frekvenca celice
- $_fij = $crosstab[$ckey1][$ckey2];
+ $_fij = isset($crosstab[$ckey1][$ckey2]) ? $crosstab[$ckey1][$ckey2] : 0;
#suma vrstice
$_ri = $sumaVrstica[$ckey2];
#suma stolpca
$_cj = $sumaStolpec[$ckey1];
# povprečje vrstice
+ if(!isset($sum_avgi[$ckey2])) $sum_avgi[$ckey2] = 0;
$sum_avgi[$ckey2] += ((int)$_ri != 0) ? ((int)$_fij * (int)$ckey1 / (int)$_ri) : 0;
# povprečje stolpcev
+ if(!isset($sum_avgj[$ckey1])) $sum_avgj[$ckey1] = 0;
$sum_avgj[$ckey1] += ((int)$_cj != 0) ? ((int)$_fij * (int)$ckey2 / (int)$_cj) : 0;
# exC - expected count (pricakovana vrednost
@@ -1850,8 +1897,8 @@ class SurveyCrosstabs {
if ($cnt1 > 0 && $cnt2)
foreach ($_all_options1 as $ckey1 => $crossVariabla1) {
foreach ($_all_options2 as $ckey2 => $crossVariabla2) {
- $fr = (float)$crosstab[$ckey1][$ckey2];
- $exp = (float)$exC[$ckey1][$ckey2];
+ $fr = isset($crosstab[$ckey1][$ckey2])?(float)$crosstab[$ckey1][$ckey2]:0;
+ $exp = isset($exC[$ckey1][$ckey2])?(float)$exC[$ckey1][$ckey2]:0;
if ($exp != 0) {
$hi2 += pow(($fr - $exp),2) / $exp;
}
@@ -1883,7 +1930,6 @@ class SurveyCrosstabs {
}
-
/** Sestavi array nepravilnih odgovorov
*
*/
@@ -2105,7 +2151,7 @@ class SurveyCrosstabs {
}
# če smo radio enableInspect
- if ($sdsp['enableInspect'] == '1' || (isset($_SESSION['enableInspect']) && $_SESSION['enableInspect'] == true)) {
+ if (isset($sdsp['enableInspect']) && $sdsp['enableInspect'] == '1' || (isset($_SESSION['enableInspect']) && $_SESSION['enableInspect'] == true)) {
$this->enableInspect = true;
} else {
# če ne preberemo iz profila
@@ -2561,8 +2607,10 @@ class SurveyCrosstabs {
$this->displaySessionInspectCheckbox();
}
+
function displaySessionInspectCheckbox() {
global $lang;
+
echo '<input type="checkbox" id="session_inspect" '.($this->enableInspect == true ? ' checked="checekd"' : '').' onClick="changeSessionInspect();">'.$lang['srv_inspect_setting'];
echo Help :: display('srv_crosstab_inspect');
}
@@ -2571,10 +2619,15 @@ class SurveyCrosstabs {
function displayLinePercent() {
global $lang;
- echo '<input id="crossCheck1" name="crossCheck1" onchange="change_crosstab_percent();" type="checkbox" ' . ($this->crossChk1 == true ? ' checked="checked" ' : '') . ' autocomplete="off"/>';
- echo '<label for="crossCheck1" id="spn_residual_sp1" class="ctbChck_sp1">' . $lang['srv_analiza_crosstab_odstotek_vrstice_short'].'</label>';
- echo '<input id="crossDoColor" name="crossDoColor" onchange="change_crosstab_color();" type="checkbox" ' . ($this->doColor == true ? ' checked="checked" ' : '') . ' autocomplete="off"/>';
- echo '<label for="crossDoColor" id="spn_residual_sp1" class="ctbChck_sp1">' . $lang['srv_analiza_crosstab_color'].'</label>';
+ echo '<div class="setting_line">';
+ echo ' <input id="crossCheck1" name="crossCheck1" onchange="change_crosstab_percent();" type="checkbox" ' . ($this->crossChk1 == true ? ' checked="checked" ' : '') . ' autocomplete="off"/>';
+ echo ' <label for="crossCheck1" id="spn_residual_sp1">' . $lang['srv_analiza_crosstab_odstotek_vrstice_short'].'</label>';
+ echo '</div>';
+
+ echo '<div class="setting_line">';
+ echo ' <input id="crossDoColor" name="crossDoColor" onchange="change_crosstab_color();" type="checkbox" ' . ($this->doColor == true ? ' checked="checked" ' : '') . ' autocomplete="off"/>';
+ echo ' <label for="crossDoColor" id="spn_residual_sp1">' . $lang['srv_analiza_crosstab_color'].'</label>';
+ echo '</div>';
}
function displayResidual(){
@@ -2582,15 +2635,19 @@ class SurveyCrosstabs {
$selected = ($this->crossChkEC + $this->crossChkRE + $this->crossChkSR + $this->crossChkAR == 4) ? true : false;
- echo '<input id="crossResiduals" name="crossResiduals" onchange="saveResidualProfileSetting(\''.SurveyDataSettingProfiles::getCurentProfileId().'\', this.checked); return false;" type="checkbox" ' . ($selected ? ' checked="checked" ' : '') . ' autocomplete="off"/>';
- echo '<label for="crossResiduals" id="crossResiduals" class="show_residual">' . $lang['srv_analiza_crosstab_residuals'].'</label>';
+ echo '<div class="setting_line">';
+ echo ' <input id="crossResiduals" name="crossResiduals" onchange="saveResidualProfileSetting(\''.SurveyDataSettingProfiles::getCurentProfileId().'\', this.checked); return false;" type="checkbox" ' . ($selected ? ' checked="checked" ' : '') . ' autocomplete="off"/>';
+ echo ' <label for="crossResiduals" id="crossResiduals">' . $lang['srv_analiza_crosstab_residuals'].'</label>';
+ echo '</div>';
}
function displayShowChart() {
global $lang;
- echo '<input id="showChart" name="showChart" onchange="showTableChart(\'crosstab\');" type="checkbox" ' . ($this->showChart == true ? ' checked="checked" ' : '') . ' />';
- echo '<label for="showChart" id="showChart" class="showChart">'.$lang['srv_show_charts'].'</label>';
+ echo '<div class="setting_line">';
+ echo ' <input id="showChart" name="showChart" onchange="showTableChart(\'crosstab\');" type="checkbox" ' . ($this->showChart == true ? ' checked="checked" ' : '') . ' />';
+ echo ' <label for="showChart" id="showChart">'.$lang['srv_show_charts'].'</label>';
+ echo '</div>';
}
function presetVariables() {