Redesign - analize - povprecja

This commit is contained in:
pero1203 2022-02-04 10:26:29 +01:00
parent 64ac039f1a
commit 153f0677fe
5 changed files with 1947 additions and 1692 deletions

View File

@ -237,28 +237,26 @@ class SurveyMeans{
function displayDropdowns() {
global $lang;
$variables1 = $this->getVariableList(1);
$variables2 = $this->getVariableList(2);
echo '<div id="meansLeftDropdowns" >';
if ((int)$this->variabla1['0']['seq'] > 0) {
echo '<span class="pointer space_means_new" >&nbsp;</span>';
}
echo $lang['srv_means_label1'];
echo '<br />';
echo '<div id="meansLeftHolder">';
echo '<span class="title">'.$lang['srv_means_label1'].'</span>';
# iz header datoteke preberemo spremenljivke
#js: $("#means_variable_1, #means_variable_2").live('click', function() {})
if (count($this->variabla1) > 0) {
$br=null;
if ((int)$this->variabla1['0']['seq'] > 0) {
echo '<span class="pointer" id="means_add_new" onclick="means_add_new_variable(\'1\');"><span class="faicon add small icon-as_link" title=""></span></span>';
}
foreach($this->variabla1 AS $_key => $variabla1) {
echo $_br;
echo '<span id="v1_'.$_key.'">';
echo '<div id="meansLeftDropdowns">';
echo '<select name="means_variable_1" id="means_variable_1" onchange="change_means(); return false;" autocomplete="off">';
foreach($this->variabla1 AS $_key => $variabla1) {
echo '<div id="v1_'.$_key.'" class="variabla_line">';
echo '<select name="means_variable_1" id="means_variable_1" class="dropdown large" onchange="change_means(); return false;" autocomplete="off">';
# ce prva variabla ni izbrana, dodamo tekst za izbiro prve variable
if ( $variabla1['seq'] == null || $variabla1['seq'] == 0 ) {
@ -276,38 +274,39 @@ class SurveyMeans{
}
echo '</select>';
if (count($this->variabla1) > 1) {
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
} else {
#echo '<span class="space_means_new">&nbsp;</span>';
}
$_br = '<br/><span class="space_means_new">&nbsp;</span>';
echo '</span>';
if (count($this->variabla1) > 1) {
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle" title=""></span></span>';
}
echo '</div>';
}
echo '</div>';
// Gumb za dodajanje spremenljivke
if ((int)$this->variabla1['0']['seq'] > 0) {
echo '<button class="blue small" id="means_add_new" onclick="means_add_new_variable(\'1\');">'.$lang['srv_multicrosstabs_add'].'</span>';
}
$_br = null;
}
echo '</div>';
echo '<div id="meansRightDropdowns">';
if ((int)$this->variabla1['0']['seq'] > 0) {
echo '<span class="pointer space_means_new" >&nbsp;</span>';
}
echo $lang['srv_means_label2'];
echo '<br />';
echo '<div id="meansRightHolder">';
echo '<span class="title">'.$lang['srv_means_label2'].'</span>';
# 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="means_add_new" onclick="means_add_new_variable(\'2\');"><span class="faicon add small icon-as_link" title="'.'"></span></span>';
}
echo '<div id="meansRightDropdowns">';
foreach($this->variabla2 AS $_key => $variabla2) {
echo $_br;
echo '<span id="v2_'.$_key.'">';
echo '<select name="means_variable_2" id="means_variable_2" onchange="change_means(); return false;" autocomplete="off"'
echo '<div id="v2_'.$_key.'" class="variabla_line">';
echo '<select name="means_variable_2" id="means_variable_2" class="dropdown large" onchange="change_means(); return false;" autocomplete="off"'
. ((int)$this->variabla1['0']['seq'] > 0 ? '' : ' disabled="disabled" ')
.'>';
@ -332,29 +331,45 @@ class SurveyMeans{
}
echo '</select>';
if (count($this->variabla2) > 1) {
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
} else {
echo '<span class="space_means_new">&nbsp;</span>';
}
}
$_br = '<br/><span class="space_means_new">&nbsp;</span>';
echo '</span>';
echo '</div>';
}
echo '</div>';
// Gumb za dodajanje spremenljivke
if ((int)$this->variabla1['0']['seq'] > 0) {
echo '<button class="blue small" id="means_add_new" onclick="means_add_new_variable(\'2\');">'.$lang['srv_multicrosstabs_add'].'</button>';
}
}
echo '</div>';
echo '<span id="meansSubSetting" class="floatLeft spaceLeft">';
if (count($this->variabla2) > 1) {
echo '<label><input id="chkMeansSeperate" type="checkbox" onchange="changeMeansSubSetting();" '.($this->sessionData['means']['meansSeperateTables']==true?' checked="checked"':'' ).'> '.$lang['srv_means_setting_1'].'</label>';
echo '<br /><span id="spanMeansJoinPercentage"'.($this->sessionData['means']['meansSeperateTables']!=true?'':' class="displayNone"').'><label><input id="chkMeansJoinPercentage" type="checkbox" onchange="changeMeansSubSetting();" '.($this->sessionData['means']['meansJoinPercentage']==true?' checked="checked"':'' ).'> '.$lang['srv_means_setting_2'].'</label></span>';
}
echo '<br /><label><input id="showChart" type="checkbox" onchange="showTableChart(\'mean\');" '.($this->sessionData['mean_charts']['showChart']==true?' checked="checked"':'' ).'> '.$lang['srv_show_charts'].'</label>';
echo '</span>';
echo '<br class="clr"/>';
echo '<div id="meansSubSetting">';
echo '<span class="title">'.$lang['settings'].':</span>';
if (count($this->variabla2) > 1) {
echo '<div class="setting_line">';
echo ' <input id="chkMeansSeperate" type="checkbox" onchange="changeMeansSubSetting();" '.($this->sessionData['means']['meansSeperateTables']==true?' checked="checked"':'' ).'><label for="chkMeansSeperate">'.$lang['srv_means_setting_1'].'</label>';
echo '</div>';
echo '<div class="setting_line">';
echo ' <span id="spanMeansJoinPercentage"'.($this->sessionData['means']['meansSeperateTables']!=true?'':' class="displayNone"').'><input id="chkMeansJoinPercentage" type="checkbox" onchange="changeMeansSubSetting();" '.($this->sessionData['means']['meansJoinPercentage']==true?' checked="checked"':'' ).'><label for="chkMeansJoinPercentage">'.$lang['srv_means_setting_2'].'</label></span>';
echo '</div>';
}
echo '<div class="setting_line">';
echo ' <input id="showChart" type="checkbox" onchange="showTableChart(\'mean\');" '.($this->sessionData['mean_charts']['showChart']==true?' checked="checked"':'' ).'><label for="showChart">'.$lang['srv_show_charts'].'</label>';
echo '</div>';
echo '</div>';
// Ikone za izvoz (so tukaj da se refreshajo ob ajax klicu)
$this->displayExport();
}
@ -363,7 +378,6 @@ class SurveyMeans{
global $lang;
global $admin_type;
$br='';
$means = array();
# če ne uporabljamo privzetega časovnega profila izpišemo opozorilo
@ -379,6 +393,7 @@ class SurveyMeans{
$SR = new SurveyRecoding($this->sid);
$SR -> getProfileString();
if ($this->getSelectedVariables(1) !== null && $this->getSelectedVariables(2) !== null) {
$variables1 = $this->getSelectedVariables(2);
$variables2 = $this->getSelectedVariables(1);
@ -423,21 +438,25 @@ class SurveyMeans{
if (is_array($means) && count($means) > 0) {
$counter=0;
foreach ($means AS $mean_sub_grup) {
echo($br);
$this->displayMeansTable($mean_sub_grup);
$br='<br />';
// Zvezdica za vkljucitev v porocilo
echo '<div class="means_table_holder">';
// Zvezdica za vkljucitev v porocilo
$spr2 = $mean_sub_grup[0]['v1']['seq'].'-'.$mean_sub_grup[0]['v1']['spr'].'-'.$mean_sub_grup[0]['v1']['grd'];
$spr1 = $mean_sub_grup[0]['v2']['seq'].'-'.$mean_sub_grup[0]['v2']['spr'].'-'.$mean_sub_grup[0]['v2']['grd'];
SurveyAnalysis::Init($this->sid);
SurveyAnalysis::addCustomReportElement($type=6, $sub_type=0, $spr1, $spr2);
// Izris tabele
$this->displayMeansTable($mean_sub_grup);
// Izrisemo graf za tabelo - zaenkrat samo admin
if($this->sessionData['mean_charts']['showChart'] && $_GET['m'] != 'analysis_creport'){
$tableChart = new SurveyTableChart($this->sid, $this, 'mean', $counter);
$tableChart = new SurveyTableChart($this->sid, $this, 'mean', $counter);
$tableChart->display();
}
echo '</div>';
$counter++;
}
@ -472,14 +491,19 @@ class SurveyMeans{
$href_pdf = makeEncodedIzvozUrlString('izvoz.php?b=export&m=mean_izpis&anketa=' . $this->sid);
$href_rtf = makeEncodedIzvozUrlString('izvoz.php?b=export&m=mean_izpis_rtf&anketa=' . $this->sid);
$href_xls = makeEncodedIzvozUrlString('izvoz.php?b=export&m=mean_izpis_xls&anketa=' . $this->sid);
echo '<script>';
echo '<script>';
# nastavimopravilne linke
echo '$("#secondNavigation_links a#meansDoPdf").attr("href", "'.$href_pdf.'");';
echo '$("#secondNavigation_links a#meansDoRtf").attr("href", "'.$href_rtf.'");';
echo '$("#secondNavigation_links a#meansDoXls").attr("href", "'.$href_xls.'");';
# prikažemo linke
echo '$("#hover_export_icon").removeClass("hidden");';
echo '$("#secondNavigation_links a").removeClass("hidden");';
echo '</script>';
}
}
@ -1071,68 +1095,65 @@ class SurveyMeans{
$showSingleUnits = $this->sessionData['means']['meansJoinPercentage']==true && $this->sessionData['means']['meansSeperateTables'] == false;
# izrišemo tabelo
echo '<table class="anl_tbl_crosstab fullWidth" style="margin-top:10px;">';
echo '<colgroup>';
echo '<col style="width:auto; min-width:30px;" />';
echo '<col style="width:auto; min-width:30px; " />';
for ($i = 0; $i < $cols; $i++) {
echo '<col style="width:auto; min-width:30px;" />';
if ($showSingleUnits == false) {
echo '<col style="width:auto; min-width:30px;" />';
}
}
if ($showSingleUnits == true) {
echo '<col style="width:auto; min-width:30px;" />';
}
echo '</colgroup>';
echo '<tr>';
#echo '<td>xx&nbsp;</td>';
# izrišemo tabelo
echo '<table class="table_means">';
echo '<tr class="row1">';
# ime variable
# teksti labele:
$label2 = $this->getSpremenljivkaTitle($_means[0]['v2']);
if ($showSingleUnits == false) {
$span = ' colspan="2"';
}
echo '<td class="anl_bt anl_bl anl_ac rsdl_bck_title ctbCll" rowspan="2">';
echo '<td class="cell_question" rowspan="2">';
echo $label2;
echo '</td>';
for ($i = 0; $i < $cols; $i++) {
echo '<td class="anl_bt anl_bl anl_br anl_ac rsdl_bck_title ctbCll"'.$span.'>';
echo '<td class="cell_question" '.$span.'>';
$label1 = $this->getSpremenljivkaTitle($_means[$i]['v1']);
echo $label1;
echo '</td>';
}
if ($showSingleUnits == true) {
echo '<td class="anl_bl ">&nbsp;</td>';
echo '<td class="anl_bl">&nbsp;</td>';
}
echo '</tr>';
echo '<tr>';
echo '<tr class="row2">';
for ($i = 0; $i < $cols; $i++) {
#Povprečje
echo '<td class="anl_bt anl_bl anl_br anl_ac rsdl_bck_variable1 ctbCll" >';
echo '<td class="cell_value">';
echo $lang['srv_means_label'];
echo '</td>';
#enote
if ($showSingleUnits == false) {
echo '<td class="anl_bl anl_bt anl_br anl_ac red anl_ita anl_bck_text_0 rsdl_bck_variable1 ctbCll">'.$lang['srv_means_label4'].'</td>';
echo '<td class="cell_value">'.$lang['srv_means_label4'].'</td>';
}
}
if ($showSingleUnits == true) {
echo '<td class="anl_bl anl_bt anl_br anl_ac red anl_ita anl_bck_text_0 rsdl_bck_variable1 ctbCll">'.$lang['srv_means_label4'].'</td>';
echo '<td class="cell_value">'.$lang['srv_means_label4'].'</td>';
}
echo '</tr>';
if (count($_means[0]['options']) > 0) {
foreach ($_means[0]['options'] as $ckey2 =>$crossVariabla2) {
$units_per_row = 0;
echo '<tr>';
echo '<td class="anl_bt anl_bl anl_ac rsdl_bck_variable1 ctbCll">';
echo '<td class="cell_question">';
echo $crossVariabla2['naslov'];
# če ni tekstovni odgovor dodamo key
if ($crossVariabla2['type'] !== 't' ) {
@ -1145,48 +1166,61 @@ class SurveyMeans{
}
}
echo '</td>';
# celice z vsebino
for ($i = 0; $i < $cols; $i++) {
echo '<td class="ct_in_cell anl_br'.'" k1="'.$ckey1.'" k2="'.$ckey2.'" n1="'.$crossVariabla1['naslov'].'" n2="'.$crossVariabla2['naslov'].'" v1="'.$crossVariabla1['vr_id'].'" v2="'.$crossVariabla2['vr_id'].'">';
echo '<td class="cell_value" k1="'.$ckey1.'" k2="'.$ckey2.'" n1="'.$crossVariabla1['naslov'].'" n2="'.$crossVariabla2['naslov'].'" v1="'.$crossVariabla1['vr_id'].'" v2="'.$crossVariabla2['vr_id'].'">';
echo $this->formatNumber($_means[$i]['result'][$ckey2], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'));
echo '</td>';
if ($showSingleUnits == false) {
echo '<td class="anl_ac anl_bl anl_bt anl_br rsdl_bck0 crostabSuma">';
echo '<td class="cell_value">';
echo (int)$_means[$i]['sumaVrstica'][$ckey2];
echo '</td>';
} else {
}
else {
$units_per_row = max($units_per_row,(int)$_means[$i]['sumaVrstica'][$ckey2]);
}
}
if ($showSingleUnits == true) {
echo '<td class="anl_ac anl_bl anl_bt anl_br rsdl_bck0 crostabSuma">';
echo '<td class="cell_value">';
echo $units_per_row;
echo '</tr>';
}
echo '</tr>';
$max_units += $units_per_row;
}
}
echo '<tr>';
echo '<td class="anl_bb anl_bt anl_bl anl_ac red anl_ita anl_bck_text_0 rsdl_bck_variable1 ctbCll">'.$lang['srv_means_label3'].'</td>';
echo '<td class="cell_value">'.$lang['srv_means_label3'].'</td>';
for ($i = 0; $i < $cols; $i++) {
echo '<td class="anl_ac anl_bt anl_bl anl_br anl_bb rsdl_bck0 crostabSuma">';
echo '<td class="cell_value">';
echo $this->formatNumber($_means[$i]['sumaMeans'], SurveyDataSettingProfiles :: getSetting('NUM_DIGIT_RESIDUAL'));
echo '</td>';
if ($showSingleUnits == false) {
echo '<td class="anl_ac anl_bt anl_bl anl_br anl_bb rsdl_bck0 crostabSuma">';
echo '<td class="cell_value">';
echo (int)$_means[$i]['sumaSkupna'];
echo '</td>';
}
}
if ($showSingleUnits == true) {
echo '<td class="anl_ac anl_bt anl_bl anl_br anl_bb rsdl_bck0 crostabSuma">';
echo '<td class="cell_value">';
echo $max_units;
echo '</tr>';
echo '</td>';
}
echo '</tr>';
echo '</table>';
}
@ -1233,14 +1267,14 @@ class SurveyMeans{
$which = $_POST['which'];
$variables = $this->getVariableList($which);
$multiple = true;
if ($which == '1') {
echo '<br/>';
echo '<span class="space_means_new">&nbsp;</span>';
echo '<select name="means_variable_'.$which.'" id="means_variable_'.$which.'" onchange="change_means(); return false;" autocomplete="off"'
.'>';
# ce prva variabla ni izbrana, dodamo tekst za izbiro prve variable
echo '<div class="variabla_line">';
echo '<select name="means_variable_'.$which.'" id="means_variable_'.$which.'" class="dropdown large" onchange="change_means(); 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>';
}
@ -1254,20 +1288,23 @@ class SurveyMeans{
. $variable['variableNaslov'] . '</option>';
}
echo '</select>';
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
} else {
# which = 2
echo '<br/>';
echo '<span class="space_means_new">&nbsp;</span>';
echo '<select name="means_variable_'.$which.'" id="means_variable_'.$which.'" onchange="change_means(); return false;" autocomplete="off"'
.'>';
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle" title=""></span></span>';
echo '</div>';
}
else {
echo '<div class="variabla_line">';
echo '<select name="means_variable_'.$which.'" id="means_variable_'.$which.'" class="dropdown large" onchange="change_means(); 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>';
}
@ -1282,7 +1319,10 @@ class SurveyMeans{
}
echo '</select>';
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle icon-orange_link" title=""></span></span>';
echo '<span class="pointer" id="means_remove" onclick="means_remove_variable(this);"><span class="faicon delete_circle" title=""></span></span>';
echo '</div>';
}
}

View File

@ -68,15 +68,10 @@ function means_add_new_variable(which) {
var spr = new Array();
var grid = new Array();
if (which == '2' ) {
//$('#crossRightHolder #crosstab_add_new').hide();
} else {
//$('#crossLeftHolder #crosstab_add_new').hide();
}
$('select[name=means_variable_'+which+']').each(function(index,el) {
sequence.push($(el).val());
});
$('select[name=means_variable_'+which+'] option:selected').each(function(index,el) {
spr.push($(el).attr("spr_id"));
grid.push($(el).attr("grd_id"));
@ -94,9 +89,9 @@ function means_add_new_variable(which) {
function means_remove_variable(what) {
$(what).parent().remove();
if ( $(what).parent().find('select').val() > 0 ) {
//if ( $(what).parent().find('select').val() > 0 ) {
change_means();
}
//}
}
function changeMeansSubSetting() {
var chkMeansSeperate = $("#chkMeansSeperate").is(':checked') ? 1 : 0;

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
#div_analiza_data {
#div_analiza_data,
#div_means_data{
.div_analiza_holder {
display: flex;

View File

@ -1,70 +1,146 @@
.space_means_new {
text-align: center;
vertical-align: middle;
display: inline-block;
width: 20px;
}
#means_add_new {
text-align: center;
vertical-align: middle;
display: inline-block;
width: 20px;
}
#means_remove {
text-align: center;
vertical-align: middle;
display: inline-block;
width: 20px;
#div_means_dropdowns{
display: flex;
justify-content: center;
.title{
margin-bottom: 4px;
}
#meansLeftHolder,
#meansRightHolder{
display: flex;
flex-direction: column;
margin-right: 64px;
#meansLeftDropdowns,
#meansRightDropdowns{
display: flex;
flex-direction: column;
.variabla_line{
display: flex;
align-items: center;
.faicon{
cursor: pointer;
margin-left: 8px;
&::before{
color: $blue;
}
}
}
}
button{
width: 190px;
margin-top: 16px;
}
}
#meansSubSetting{
display: flex;
flex-direction: column;
.setting_line{
margin-bottom: 6px;
}
}
}
#div_means_data {
margin-top: 10px;
}
#meansLeftDropdowns {
float: left;
padding-right: 10px;
select {
width: 240px;
font-size: 12px;
option {
overflow: hidden;
font-size: 12px;
}
}
}
#meansRightDropdowns {
float: left;
padding-right: 10px;
select {
width: 240px;
font-size: 12px;
option {
overflow: hidden;
font-size: 12px;
}
}
}
.space_means_new {
text-align: center;
vertical-align: middle;
display: inline-block;
width: 20px;
}
#means_add_new {
text-align: center;
vertical-align: middle;
display: inline-block;
width: 20px;
}
#means_remove {
text-align: center;
vertical-align: middle;
display: inline-block;
width: 20px;
}
#meansImgHolder {
float: left;
padding: 0px 3px;
display: inline-block;
display: flex;
flex-direction: column;
margin-top: 64px;
.means_table_holder{
margin-bottom: 16px;
border-bottom: 1px $gray solid;
&:last-child{
margin-bottom: 0;
border: 0;
}
}
.tableChart{
margin: 16px auto;
}
.custom_report_include{
display: flex;
justify-content: flex-end;
margin-bottom: 8px;
a{
text-decoration: none;
}
}
table.table_means{
margin: 0;
padding: 0;
tr{
&.row1{
}
&.row2{
td.cell_value{
font-size: 14px;
font-weight: 400;
background-color: $light-gray2;
}
}
td{
border: 1px $gray solid;
&.cell_var{
width: 260px;
text-align: left;
}
&.cell_question{
a{
text-decoration: none;
color: $black;
}
}
&.cell_value{
text-align: center;
}
}
}
table.cell_table{
> tbody > tr{
border-bottom: 1px $gray dashed;
&:last-child{
border-bottom: 0;
}
table.cell_table tr td{
border-right: 1px $yellow solid;
&:last-child{
border-right: 0;
}
}
}
}
}
}