1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
/** Skripte potrebne za Tabele (crosstabs - Analiza)
*/
function crosstab_init() {
$("td.ct_inspect").live("click", function(event) {
doInspectFromCrosstab(this,event);
return false;
});
}
function add_new_variable(which) {
var sequence = new Array();
var spr = new Array();
var grid = new Array();
if (which == '2' ) {
//$('#crossRightHolder #crosstab_add_new').hide();
} else {
//$('#crossLeftHolder #crosstab_add_new').hide();
}
$('select[name=crosstab_variable_'+which+']').each(function(index,el) {
sequence.push($(el).val());
});
$('select[name=crosstab_variable_'+which+'] option:selected').each(function(index,el) {
spr.push($(el).attr("spr_id"));
grid.push($(el).attr("grd_id"));
});
var crossNavVsEno = $('#crossNavVsEno1').is(':checked') ? '1' : '0';
$.post("ajax.php?t=crosstab&a=add_new_variable", {anketa:srv_meta_anketa_id, which:which, sequence:sequence, spr:spr, grid:grid, crossNavVsEno:crossNavVsEno}, function(response) {
if (which == '2' ) {
$(response).appendTo('#crossRightHolder');
} else {
$(response).appendTo('#crossLeftHolder');
}
});
}
function crs_remove_variable(what) {
$(what).parent().remove();
if ( $(what).parent().find('select').val() > 0 ) {
change_crosstab();
}
}
function change_crosstab (action) {
var sequence1 = new Array();
var spr1 = new Array();
var grid1 = new Array();
var sequence2 = new Array();
var spr2 = new Array();
var grid2 = new Array();
if (action == 'rotate') {
// obrnemo dropdown variabli
// var sequence1 = $("#crosstab_variable_2").val();
// polovimo še id spremenljivke od variable
// var spr1 = $("#crosstab_variable_2 option:selected").attr("spr_id");
// var grid1 = $("#crosstab_variable_2 option:selected").attr("grd_id");
// var sequence2= $("#crosstab_variable_1").val();
// var spr2 = $("#crosstab_variable_1 option:selected").attr("spr_id");
// var grid2 = $("#crosstab_variable_1 option:selected").attr("grd_id");
$('select[name=crosstab_variable_2]').each(function(index,el) {
sequence1.push($(el).val());
});
$('select[name=crosstab_variable_2] option:selected').each(function(index,el) {
spr1.push($(el).attr("spr_id"));
grid1.push($(el).attr("grd_id"));
});
$('select[name=crosstab_variable_1]').each(function(index,el) {
sequence2.push($(el).val());
});
$('select[name=crosstab_variable_1] option:selected').each(function(index,el) {
spr2.push($(el).attr("spr_id"));
grid2.push($(el).attr("grd_id"));
});
} else {
// prebereomo dropdown variabli
// var sequence1 = $("#crosstab_variable_1").val();
// polovimo še id spremenljivke od variable
// var spr1 = $("#crosstab_variable_2 option:selected").attr("spr_id");
// var grid1 = $("#crosstab_variable_2 option:selected").attr("grd_id");
// var sequence2= $("#crosstab_variable_2").val();
// var spr2 = $("#crosstab_variable_2 option:selected").attr("spr_id");
// var grid2 = $("#crosstab_variable_2 option:selected").attr("grd_id");
$('select[name=crosstab_variable_1]').each(function(index,el) {
sequence1.push($(el).val());
});
$('select[name=crosstab_variable_1] option:selected').each(function(index,el) {
spr1.push($(el).attr("spr_id"));
grid1.push($(el).attr("grd_id"));
});
$('select[name=crosstab_variable_2]').each(function(index,el) {
sequence2.push($(el).val());
});
$('select[name=crosstab_variable_2] option:selected').each(function(index,el) {
spr2.push($(el).attr("spr_id"));
grid2.push($(el).attr("grd_id"));
});
}
var crossNavVsEno = $('#crossNavVsEno1').is(':checked') ? '1' : '0';
$("#crosstab_drobdowns").fadeTo(100, 0.2);
$("#crosstab_table").fadeTo(100, 0.2);
$("#crosstab_drobdowns").load("ajax.php?t=crosstab&a=changeDropdown", {anketa:srv_meta_anketa_id, sequence1:sequence1, sequence2:sequence2,
spr1:spr1, spr2:spr2 , crossNavVsEno:crossNavVsEno, grid1:grid1, grid2:grid2}, function() {
if (isNaN(spr1) && isNaN(spr2)) {
$("#div_analiza_data").load("ajax.php?t=crosstab&a=change", {anketa:srv_meta_anketa_id, sequence1:sequence1, sequence2:sequence2,
spr1:spr1, spr2:spr2 , crossNavVsEno:crossNavVsEno, grid1:grid1, grid2:grid2}, function() {
});
} else {
$("#crosstab_drobdowns").fadeTo(100, 1);
$("#crosstab_table").fadeTo(100, 1);
}
});
}
function change_crosstab_cb () {
$("#crosstab_drobdowns").fadeTo(100, 0.2);
$("#crosstab_table").fadeTo(100, 0.2);
// prebereomo dropdown variabli
var sequence1 = $("#crosstab_variable_1").val();
var sequence2= $("#crosstab_variable_2").val();
// polovimo še id spremenljivke od variable
var spr1 = $("#crosstab_variable_1 option:selected").attr("spr_id");
var spr2 = $("#crosstab_variable_2 option:selected").attr("spr_id");
if ($("#crosstab_variable_1 option:selected").attr("grd_id") !== undefined) {
var grid1 = $("#crosstab_variable_1 option:selected").attr("grd_id");
} else {
var grid1 = '';
}
if ($("#crosstab_variable_2 option:selected").attr("grd_id") !== undefined) {
var grid2 = $("#crosstab_variable_2 option:selected").attr("grd_id");
} else {
var grid2 = '';
}
var crossNavVsEno = $('#crossNavVsEno1').is(':checked') ? '1' : '0';
$("#crosstab_table").load("ajax.php?t=crosstab&a=change_cb", {anketa:srv_meta_anketa_id, sequence1:sequence1, sequence2:sequence2,
//crossChk0:crossChk0, crossChk1:crossChk1, crossChk2:crossChk2, crossChk3:crossChk3,
//crossChkEC:crossChkEC, crossChkRE:crossChkRE,crossChkSR:crossChkSR,crossChkAR:crossChkAR, doColor:doColor,
spr1:spr1, spr2:spr2, crossNavVsEno:crossNavVsEno, grid1:grid1, grid2:grid2 }, function () {
$("#crosstab_drobdowns").fadeTo(100, 1);
$("#crosstab_table").fadeTo(100, 1);
});
}
function change_crosstab_percent () {
var crossChk1 = $("#crossCheck1").is(':checked');
$.post("ajax.php?t=crosstab&a=change_cb_percent", {anketa:srv_meta_anketa_id, crossChk1:crossChk1}, function() {
change_crosstab();
});
}
function change_crosstab_color () {
var doColor = $("#crossDoColor").is(':checked');
if (doColor) {
$("#span_color_residual_legend").show();
} else {
$("#span_color_residual_legend").hide();
}
$.post("ajax.php?t=crosstab&a=change_cb_color", {anketa:srv_meta_anketa_id, doColor:doColor}, function() {
change_crosstab();
});
}
function doInspectFromCrosstab(el,event) {
var k1 = $(el).attr('k1');
var k2 = $(el).attr('k2');
var n1 = $(el).attr('n1');
var n2 = $(el).attr('n2');
var v1 = $(el).attr('v1');
var v2 = $(el).attr('v2');
var sp1 = $(el).parent().closest('table').attr('sp1');
var sp2 = $(el).parent().closest('table').attr('sp2');
var sq1 = $(el).parent().closest('table').attr('sq1');
var sq2 = $(el).parent().closest('table').attr('sq2');
var gd1 = $(el).parent().closest('table').attr('gd1');
var gd2 = $(el).parent().closest('table').attr('gd2');
// $("#inspect").load("ajax.php?t=crosstab&a=prepareInspect", {anketa:srv_meta_anketa_id,k1:k1,k2:k2,n1:n1,n2:n2,v1:v1,v2:v2,sp1:sp1,sp2:sp2,sq1:sq1,sq2:sq2,gd1:gd1,gd2:gd2}, function(response) {
$.post("ajax.php?t=crosstab&a=prepareInspect", {anketa:srv_meta_anketa_id,k1:k1,k2:k2,n1:n1,n2:n2,v1:v1,v2:v2,sp1:sp1,sp2:sp2,sq1:sq1,sq2:sq2,gd1:gd1,gd2:gd2, from_podstran:srv_meta_podstran}, function(response) {
//window.open("index.php?anketa="+srv_meta_anketa_id+"&a=data", '_blank');
window.location = "index.php?anketa="+srv_meta_anketa_id+response;//"&a=data";
});
}
function doArchiveCrosstab() {
//preverimo ali obstaja vsebina crosstaba
if ($("#crosstab_table").length > 0 && $("#crosstab_table").html() != '') {
$("#fullscreen").load('ajax.php?a=doArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran}, function() {
$('#fade').fadeTo('slow', 1);
$('#fullscreen').show();
});
} else {
alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.');
}
}
function createArchiveCrosstabBeforeEmail() {
//preverimo ali obstaja vsebina crosstaba
if ($("#crosstab_table").length > 0 && $("#crosstab_table").html() != '') {
var content = $("#crosstab_table").html();
//global replace
var regex = new RegExp('ct_inspect', "g");
content = content.replace(regex, '');
//$("#fullscreen").load('ajax.php?a=submitArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, content:content, name:name, note:note, access:access, duration:duration, durationType:durationType}, function() {
$.post('ajax.php?a=createArchiveCrosstabBeforeEmail', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, content:content}, function(response) {
if (parseInt(response) > 0) {
var aid = parseInt(response);
$("#fullscreen").load('ajax.php?a=emailArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, aid:aid}, function() {
$('#fullscreen').show();
});
} else {
if (parseInt(response) == -1) {
alert("Nothing to archive!"+response);
} else {
alert("Error while creating archive!"+response);
}
$('#fullscreen').hide();
$('#fade').fadeOut('slow');
}
});
} else {
alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.');
}
}
function submitArchiveCrosstabs() {
//preverimo ali obstaja vsebina crosstaba
if ($("#crosstab_table").length > 0 && $("#crosstab_table").html() != '') {
var content = $("#crosstab_table").html();
//global replace
var regex = new RegExp('ct_inspect', "g");
content = content.replace(regex, '');
var name = $("#newAnalysisArchiveName").val();
var note = $("#newAnalysisArchiveNote").val();
var access = $("[name=newAnalysisArchiveAccess]:checked").val();
var duration = $("#newAnalysisArchiveDuration").val();
var durationType = $("[name=newAADurationType]:checked").val();
//$("#fullscreen").load('ajax.php?a=submitArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, content:content, name:name, note:note, access:access, duration:duration, durationType:durationType}, function() {
$("#fullscreen").load('ajax.php?a=submitArchiveAnaliza', {anketa: srv_meta_anketa_id, podstran: srv_meta_podstran, name:name, note:note, access:access, duration:duration, durationType:durationType, content:content}, function() {
$("#fullscreen").show();
});
} else {
alert ('Ni podatkov za arhiv! Najprej kreirajte tabele.');
}
}
function changeSessionInspect() {
$("#spanSessionInspect").load("ajax.php?t=crosstab&a=changeSessionInspect", {anketa:srv_meta_anketa_id}, function() {
change_crosstab();
});
}
|