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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
<?php
/**
*
* Class ki skrbi za izvedbo ustreznega izvoza (prenešeno iz izvoz.php in dopolnjeno)
*
*
* Tipi izvoza:
* 'survey' - izvoz vprašalnika (ankete)
* - 'q_empty' - prazen vprašalnik
* - 'q_data' - vprašalnik z vnešenimi odgovori za 1 respondenta
* - 'q_data_all' - vprašalnik z vnešenimi odgovori za vse respondente
* - 'q_comment' - vprašalnik s komentarji
*
* 'analysis' - izvoz analiz
* - 'sums' - sumarnik
* - 'freq' - frekvence
* - 'desc' - opisne statistike
* - 'chart' - grafi
* - 'crosstab' - crosstabi
* - 'multicrosstab' - multi-crosstabi
* - 'mean' - povprečja
* - 'ttest' - ttest
* - 'break' - razbitje
* - 'heatmap' - heatmap
*
* 'creport' - izvoz poročila po meri sestavljenega iz različnih elementov analiz (custom report)
*
* 'status' - izvoz statusov (dashboard pod "Status->povzetek")
*
* 'data' - izvoz podatkov
* - 'full' - celotna tabela podatkov - potrebno prenesti iz SurveyExport - TO SE LAHKO PRENAŠA NAKNADNO
* - 'list' - kratek izpis podatkov - samo prvih 5 spremenljivk
*
* 'other' - poseben izvoz (Evoli, Hierarhija, MFDPS, MJU...)
* - 'usable' - uporabni respondenti
* - 'text_analysis' - analiza besedil v anketi
* - 'speeder' - speeder index
* - 'edits_analysis' - analiza urejanja ankete
* - 'evoli'
* - 'evoli_teammeter'
* - 'hierarhija'
* - 'mfdps'
* - 'adecco_360' - treba dodatno prenesti
* - '1ka_360' - treba dodatno prenesti
*
* 'gdpr' - izvoz gdpr porocil (ce je vklopljen gdpr v anketi)
* - 'individual' - podrobnosti o zbiranju osebnih podatkov
* - 'activity' - evidenca dejavnosti obdelav
*
* Formati izvoza:
* - 'pdf'
* - 'rtf'
* - 'xls'
* - 'csv'
* - 'txt'
* - 'html'
* - 'spss_syntax'
* - 'spss_sav'
* - 'ppt'
*
*
*/
//use Export\Latexclasses\LatexDocument as LatexDocument;
//include('../../function.php');
include('../../vendor/autoload.php');
include('export_definitions.php');
class ExportController{
var $anketa; // ID ankete
function __construct(){
global $site_path, $global_user_id, $admin_type, $lang;
# če pridemo iz rekodiranga urlja
if (!isset($_GET['anketa']) && isset($_GET['dc']) && $_GET['dc'] != null) {
$data = $_GET['dc'];
$data = base64_decode($data);
$data = unserialize($data);
foreach ($data AS $get_param => $value) {
if ($get_param != null && $get_param != '' && $value != null && $value != '' && $value != 'undefined') {
$_GET[$get_param] = $value;
}
}
}
// Nastavimo ID ankete
$this->anketa = $_GET['anketa'];
# PDF lahko vidijo vsi, ki kliknejo na link za kreacijo PDF-ja
# zato, kadar uporabnik ni logiran v CMS za pdf nastavimo $global_user_id kateri je enak avtorju ankete
if ($global_user_id === null || $global_user_id === 0) {
$sql = sisplet_query("SELECT insert_uid FROM srv_anketa WHERE id='$this->anketa'");
$row = mysqli_fetch_assoc($sql);
$global_user_id = $row['insert_uid'];
}
// nastavimo jezik
SurveyInfo::SurveyInit($this->anketa);
$lang_admin = SurveyInfo::getInstance()->getSurveyColumn('lang_admin');
//$file = '../../../lang/'.$lang_admin.'.php';
$file = $site_path.'lang/'.$lang_admin.'.php';
include($file);
}
// Izvedemo export
public function executeExport(){
global $site_path;
// Nastavimo tip, podtip in format izvoza
$export_type = $this->getExportType();
$export_format = $this->getExportFormat();
$exportType = $export_type['export_type'];
$subtype = $export_type['export_subtype'];
/* echo "anketa: ".$this->anketa."</br>";
echo "subtype: ".$subtype."</br>";
echo "exportType: ".$exportType."</br>";
echo "export_format: ".$export_format."</br>"; */
// Posebni izvozi, ki se izvajajo drugje (za npr. locene module - evoli, mfdps...)
if( $exportType == 'other' && in_array($subtype, array('evoli', 'evoli_teammeter', 'mfdps', 'heirarhija', 'text_analysis', 'usable', 'speeder')) ){
$this->exportOther($subtype);
}
else{
switch($export_format){
case 'pdf':
case 'rtf':
case 'html':
// Ustvarimo latex dokument
$document = new LatexDocument($this->anketa);
$document->createDocument($export_type['export_type'], $export_type['export_subtype'], $export_format, $_GET['sprID']);
break;
case 'xml':
// Ustvarimo xml dokument
$document = new XmlDocument($this->anketa);
$document->createXmlDocument($export_type['export_type'], $export_type['export_subtype'], $export_format);
break;
case 'xls': // Mogoce lahko tudi xls po novem naredimo preko html-ja iz latexa? Html tabele se naceloma vredu izpisejo v xls...
//Nov nacin izvoza xls iz Latex datoteke
//$document = new LatexDocument($this->anketa);
//$document->createDocument($export_type['export_type'], $export_type['export_subtype'], $export_format, $_GET['sprID']);
//Nov nacin izvoza xls iz Latex datoteke - konec
//Star nacin izvoza xls
switch($subtype){
case 'sums':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaSums.php';
include ($path);
$izvoz = new XlsIzvozAnalizaSums ($_GET['anketa'], $_GET['sprID'], $_GET['loop']);
break;
case 'desc':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaStatistics.php';
include ($path);
$izvoz = new XlsIzvozAnalizaStatistics ($_GET['anketa'], $_GET['sprID'], $_GET['loop']);
break;
case 'freq':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaFrekvenca.php';
include ($path);
$izvoz = new XlsIzvozAnalizaFrekvenca ($_GET['anketa'], $_GET['sprID'], $_GET['loop']);
break;
case 'crosstab':
//poberemo tabelo s podatki
$crossData1 = explode(",", $_GET['data1']);
$crossData2 = explode(",", $_GET['data2']);
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaCrosstab.php';
include ($path);
$izvoz = new XlsIzvozAnalizaCrosstab ($_GET['anketa'], $crossData1, $crossData2);
break;
case 'multicrosstab':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaMultiCrosstab.php';
include ($path);
$izvoz = new XlsIzvozAnalizaMultiCrosstab ($_GET['anketa']);
break;
case 'mean':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaMean.php';
include ($path);
$izvoz = new XlsIzvozAnalizaMean ($_GET['anketa']);
break;
case 'ttest':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaTTest.php';
include ($path);
$izvoz = new XlsIzvozAnalizaTTest ($_GET['anketa']);
break;
case 'break':
$path = $site_path.'admin/exportclases/class.xlsIzvozAnalizaBreak.php';
include ($path);
$izvoz = new XlsIzvozAnalizaBreak ($_GET['anketa']);
break;
}
$izvoz->createXls();
$izvoz->getFile('xls_analiza_'.$subtype.'_'.time().'.xls');
//Star nacin izvoza xls - konec
break;
case 'ppt':
switch($subtype){
case 'chart':
$path = $site_path.'admin/exportclases/class.pptIzvozAnalizaCharts.php';
include ($path);
$izvoz = new PptIzvozAnalizaCharts ($_GET['anketa'], $_GET['sprID'], $_GET['loop']);
$izvoz->createPpt();
$izvoz->getFile('ppt_analiza_'.$subtype.'_'.time().'.pptx');
break;
case 'heatmap':
$path = $site_path.'admin/exportclases/class.pptIzvozHeatmapImage.php';
include ($path);
$izvoz = new pptIzvozHeatmapImage ($_GET['anketa'], $_GET['sprID'], $_GET['loop']);
$izvoz->createPpt();
$izvoz->getFile('ppt_analiza_heatmap_image_'.$_GET['sprID'].'_'.time().'.ppt');
break;
}
break;
case 'csv':
case 'txt':
case 'spss_syntax':
case 'spss_sav':
break;
}
}
}
// Izvozi, ki se izvedejo drugje v locenih modulih (npr. evoli, mfdps, hierarhija...)
private function exportOther($subtype=''){
global $site_path;
switch($subtype){
case 'evoli':
$usr_id = (isset($_GET['usr_id']) && $_GET['usr_id'] > 0) ? $_GET['usr_id'] : 0;
$evoli = new SurveyEvoli($_GET['anketa']);
$evoli->executeExport($usr_id);
break;
case 'evoli_teammeter':
$skupina = (isset($_GET['skupina']) && $_GET['skupina'] > 0) ? $_GET['skupina'] : 0;
$evoli_tm = new SurveyTeamMeter($_GET['anketa']);
$evoli_tm->executeExport($skupina);
break;
case 'mfdps':
$usr_id = (isset($_GET['usr_id']) && $_GET['usr_id'] > 0) ? $_GET['usr_id'] : 0;
$evoli = new SurveyMFDPS($_GET['anketa']);
$evoli->executePDFExport($usr_id);
break;
case 'hierarhija':
//include ($site_path.'admin/survey/modules/mod_hierarhija/class/HierarhijaIzvozAnalize.php');
$izvoz = new \Hierarhija\HierarhijaIzvozAnalize($_GET['anketa']);
$izvoz->createPdf();
$izvoz->getFile('pdf_analiza1'.time().'.pdf');
break;
case 'text_analysis':
//include ($site_path.'admin/survey/classes/class.SurveyTextAnalysis.php');
$STA = new SurveyTextAnalysis($_GET['anketa']);
$STA->exportCSVTable($_GET['type']);
break;
case 'usable':
$path = $site_path.'admin/exportclases/class.xlsIzvozUsable.php';
include ($path);
$izvoz = new XlsIzvozUsable ($_GET['anketa']);
$izvoz->createXls();
$izvoz->getFile('xls_usable'.time().'.xls');
break;
case 'speeder':
include ($site_path.'admin/exportclases/class.xlsIzvozSpeeder.php');
$izvoz = new XlsIzvozSpeeder ($_GET['anketa']);
$izvoz->createXls();
$izvoz->getFile('xls_speeder'.time().'.xls');
break;
}
}
// Nastavimo tip izvoza
private function getExportType(){
global $site_path, $global_user_id, $admin_type, $lang;
switch ( $_GET['a'] ) {
case A_REPORT_VPRASALNIK_PDF:
case A_REPORT_VPRASALNIK_RTF:
$export_type = 'survey';
$export_subtype = 'q_empty';
break;
case A_REPORT_VPRASALNIK_XML:
$export_type = 'survey';
$export_subtype = 'q_empty_xml';
break;
case A_REPORT_PDF_RESULTS:
case A_REPORT_RTF_RESULTS:
$export_type = 'survey';
if(isset($_GET['usr_id']))
$export_subtype = 'q_data'; // če je definiran $_GET['usr_id'] izpisemo samo njegove odgovore
else
$export_subtype = 'q_data_all'; // če ni usr_id definiran vprasalnike z odgovori vseh respondentov enega za drugim
break;
case A_REPORT_PDF_COMMENT:
case A_REPORT_RTF_COMMENT:
$export_type = 'survey';
$export_subtype = 'q_comment';
break;
case A_REPORT_PDF_STATUS:
$export_type = 'status';
$export_subtype = 'status';
break;
case A_REPORT_PDF_EDITS_ANALYSIS:
$export_type = 'other';
$export_subtype = 'edits_analysis';
break;
case A_REPORT_PDF_LIST:
case A_REPORT_RTF_LIST:
case A_REPORT_XLS_LIST:
$export_type = 'data';
$export_subtype = 'list';
break;
case A_GDPR_PDF_INDIVIDUAL:
case A_GDPR_RTF_INDIVIDUAL:
$export_type = 'gdpr';
$export_subtype = 'individual';
break;
case A_GDPR_PDF_ACTIVITY:
case A_GDPR_RTF_ACTIVITY:
$export_type = 'gdpr';
$export_subtype = 'activity';
break;
}
switch ( $_GET['m'] ) {
// Kakšna je razlika med tema dvema izvozoma??
//case M_REPORT_ANALIZA_HEATMAP_IMAGE:
//case M_REPORT_PDF_HEATMAP_IMAGE:
case M_REPORT_ANALIZA_PPT_HEATMAP_IMAGE:
$export_type = 'analysis';
$export_subtype = 'heatmap';
break;
case M_REPORT_ANALIZA_HEATMAP_IMAGE:
$export_type = 'analysis';
$export_subtype = 'heatmap_image';
break;
case M_REPORT_PDF_HEATMAP_IMAGE:
case M_REPORT_ANALIZA_RTF_HEATMAP_IMAGE:
$export_type = 'analysis';
$export_subtype = 'heatmap_image_pdf';
break;
case M_REPORT_ANALIZA_PDF_SUMS:
case M_REPORT_ANALIZA_RTF_SUMS:
case M_REPORT_ANALIZA_XLS_SUMS:
$export_type = 'analysis';
$export_subtype = 'sums';
break;
case M_REPORT_ANALIZA_PDF_FREKVENCA:
case M_REPORT_ANALIZA_RTF_FREKVENCA:
case M_REPORT_ANALIZA_XLS_FREKVENCA:
$export_type = 'analysis';
$export_subtype = 'freq';
break;
case M_REPORT_ANALIZA_PDF_STAT:
case M_REPORT_ANALIZA_RTF_STAT:
case M_REPORT_ANALIZA_XLS_STAT:
$export_type = 'analysis';
$export_subtype = 'desc';
break;
case M_REPORT_ANALIZA_PDF_CHARTS:
case M_REPORT_ANALIZA_RTF_CHARTS:
case M_REPORT_ANALIZA_PPT_CHARTS:
$export_type = 'analysis';
$export_subtype = 'chart';
break;
case M_REPORT_ANALIZA_PDF_CROSSTAB_IZPIS:
case M_REPORT_ANALIZA_RTF_CROSSTAB_IZPIS:
case M_REPORT_ANALIZA_XLS_CROSSTAB_IZPIS:
$export_type = 'analysis';
$export_subtype = 'crosstab';
break;
case M_REPORT_ANALIZA_PDF_MULTICROSSTAB_IZPIS:
case M_REPORT_ANALIZA_RTF_MULTICROSSTAB_IZPIS:
case M_REPORT_ANALIZA_XLS_MULTICROSSTAB_IZPIS:
$export_type = 'analysis';
$export_subtype = 'multicrosstab';
break;
case M_REPORT_ANALIZA_PDF_MEAN_IZPIS:
case M_REPORT_ANALIZA_RTF_MEAN_IZPIS:
case M_REPORT_ANALIZA_XLS_MEAN_IZPIS:
$export_type = 'analysis';
$export_subtype = 'mean';
break;
case M_REPORT_ANALIZA_PDF_TTEST_IZPIS:
case M_REPORT_ANALIZA_RTF_TTEST_IZPIS:
case M_REPORT_ANALIZA_XLS_TTEST_IZPIS:
$export_type = 'analysis';
$export_subtype = 'ttest';
break;
case M_REPORT_ANALIZA_PDF_BREAK_IZPIS:
case M_REPORT_ANALIZA_RTF_BREAK_IZPIS:
case M_REPORT_ANALIZA_XLS_BREAK_IZPIS:
$export_type = 'analysis';
$export_subtype = 'break';
break;
case M_REPORT_ANALIZA_PDF_CREPORT:
case M_REPORT_ANALIZA_RTF_CREPORT:
$export_type = 'analysis';
$export_subtype = 'creport';
break;
case M_REPORT_PDF_EVOLI:
$export_type = 'other';
$export_subtype = 'evoli';
break;
case M_REPORT_PDF_TEAMMETER:
$export_type = 'other';
$export_subtype = 'evoli_teammeter';
break;
case M_REPORT_PDF_MFDPS:
$export_type = 'other';
$export_subtype = 'mfdps';
break;
case M_REPORT_HIERARHIJA_PDF_IZPIS:
$export_type = 'other';
$export_subtype = 'hierarhija';
break;
case A_REPORT_XLS_USABLE:
$export_type = 'other';
$export_subtype = 'usable';
break;
case A_REPORT_XLS_SPEEDER:
$export_type = 'other';
$export_subtype = 'speeder';
break;
case A_REPORT_XLS_TEXT_ANALYSIS:
case A_REPORT_CSV_TEXT_ANALYSIS:
$export_type = 'other';
$export_subtype = 'text_analysis';
break;
}
return array('export_type'=>$export_type, 'export_subtype'=>$export_subtype);
}
// Nastavimo format izvoza
private function getExportFormat(){
global $site_path, $global_user_id, $admin_type, $lang;
switch ( $_GET['a'] ) {
case A_REPORT_VPRASALNIK_PDF:
case A_REPORT_PDF_RESULTS:
case A_REPORT_PDF_COMMENT:
case A_REPORT_PDF_STATUS:
case A_REPORT_PDF_EDITS_ANALYSIS:
case A_REPORT_PDF_LIST:
case A_GDPR_PDF_INDIVIDUAL:
case A_GDPR_PDF_ACTIVITY:
$export_format = 'pdf';
break;
case A_REPORT_RTF_COMMENT:
case A_REPORT_VPRASALNIK_RTF:
case A_REPORT_RTF_RESULTS:
case A_REPORT_RTF_LIST:
case A_GDPR_RTF_INDIVIDUAL:
case A_GDPR_RTF_ACTIVITY:
$export_format = 'rtf';
break;
case A_REPORT_XLS_LIST:
$export_format = 'xls';
break;
case A_REPORT_VPRASALNIK_XML:
$export_format = 'xml';
break;
}
switch ( $_GET['m'] ) {
// Kakšna je razlika med tema dvema izvozoma??
case M_REPORT_ANALIZA_HEATMAP_IMAGE:
case M_REPORT_PDF_HEATMAP_IMAGE:
case M_REPORT_ANALIZA_PDF_FREKVENCA:
case M_REPORT_ANALIZA_PDF_CROSSTAB_IZPIS:
case M_REPORT_ANALIZA_PDF_MULTICROSSTAB_IZPIS:
case M_REPORT_ANALIZA_PDF_MEAN_IZPIS:
case M_REPORT_ANALIZA_PDF_TTEST_IZPIS:
case M_REPORT_ANALIZA_PDF_BREAK_IZPIS:
case M_REPORT_ANALIZA_PDF_STAT:
case M_REPORT_ANALIZA_PDF_SUMS:
case M_REPORT_ANALIZA_PDF_CHARTS:
case M_REPORT_ANALIZA_PDF_CREPORT:
case M_REPORT_PDF_EVOLI:
case M_REPORT_PDF_TEAMMETER:
case M_REPORT_PDF_MFDPS:
case M_REPORT_HIERARHIJA_PDF_IZPIS:
$export_format = 'pdf';
break;
case M_REPORT_ANALIZA_RTF_STAT:
case M_REPORT_ANALIZA_RTF_SUMS:
case M_REPORT_ANALIZA_RTF_FREKVENCA:
case M_REPORT_ANALIZA_RTF_CROSSTAB_IZPIS:
case M_REPORT_ANALIZA_RTF_MULTICROSSTAB_IZPIS:
case M_REPORT_ANALIZA_RTF_MEAN_IZPIS:
case M_REPORT_ANALIZA_RTF_TTEST_IZPIS:
case M_REPORT_ANALIZA_RTF_BREAK_IZPIS:
case M_REPORT_ANALIZA_RTF_CHARTS:
case M_REPORT_ANALIZA_RTF_CREPORT:
case M_REPORT_ANALIZA_RTF_HEATMAP_IMAGE:
$export_format = 'rtf';
break;
case M_REPORT_ANALIZA_XLS_FREKVENCA:
case M_REPORT_ANALIZA_XLS_CROSSTAB_IZPIS:
case M_REPORT_ANALIZA_XLS_MULTICROSSTAB_IZPIS:
case M_REPORT_ANALIZA_XLS_STAT:
case M_REPORT_ANALIZA_XLS_SUMS:
case M_REPORT_ANALIZA_XLS_MEAN_IZPIS:
case M_REPORT_ANALIZA_XLS_TTEST_IZPIS:
case M_REPORT_ANALIZA_XLS_BREAK_IZPIS:
case A_REPORT_XLS_USABLE:
case A_REPORT_XLS_SPEEDER:
case A_REPORT_XLS_TEXT_ANALYSIS:
$export_format = 'xls';
break;
case A_REPORT_CSV_TEXT_ANALYSIS:
$export_format = 'csv';
break;
case M_REPORT_ANALIZA_PPT_CHARTS:
case M_REPORT_ANALIZA_PPT_HEATMAP_IMAGE:
$export_format = 'ppt';
break;
}
return $export_format;
}
}
|