summaryrefslogtreecommitdiffstats
path: root/admin/survey/classes/tracking/CrossRoad.php
blob: 01f9475e00d4c7c64e24069c67066e0b642f5c21 (plain) (blame)
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
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of CrossRoad
 *
 * @author podkrizniku
 */

class CrossRoad {

    static function MainNavigation($anketa=null){

        // Status za tracking sprememb
        $status = -1;

        // Lokacija v navigaciji
        $first_action = '';
        $second_action = '';
        $third_action = '';

        // Layout strani glede na to kje se nahajamo (imamo levi meni in sirina holderja)
        $layout_menu = '';
        $layout_width = '';
        $hide_header = '';

        # ajaxa se poslje skupaj z ajaxom, da ob updatu vemo kaksen 'a' je bil na originalni strani
        # (drugace se ob updatu z ajaxom informacija o 'a'ju zgubi)
        $get = $_GET['a'];

        if (isset ($_GET['ajaxa']))
            $get = $_GET['ajaxa'];

        if ($get === null || trim($get) == '')
            $get = A_BRANCHING;


        //smo vezani na anketo
        if($anketa != null && $anketa > 0){

            switch ($get) {

                # STATUS
                case A_REPORTI:
                    $first_action = NAVI_STATUS;
                    $second_action = NAVI_STATUS_OSNOVNI;

                    $layout_width = 'wide';

                    $status = 3;

                    break;

                case A_NONRESPONSE_GRAPH:
                case A_USABLE_RESP:
                case A_KAKOVOST_RESP:
                case A_SPEEDER_INDEX:
                case A_TEXT_ANALYSIS:
                case A_GEOIP_LOCATION:
                case A_EDITS_ANALYSIS:
                case A_REMINDER_TRACKING:
                case A_UL_EVALVATION:
                case A_PARA_GRAPH:
                case 'langStatistic':
                case 'AAPOR':
                case A_STATUS_ADVANCED:
                    $first_action = NAVI_STATUS;
                    $second_action = NAVI_STATUS_OSNOVNI;

                    $layout_width = 'wide';
                    if ($_GET['m'] == 'advanced')
                        $layout_width = 'fullwidth';

                    $status = 4;

                    break;


                # UREJANJE ANKETE
                case A_BRANCHING:
                case A_GLASOVANJE:
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_BRANCHING;

                    $layout_width = 'fullwidth';

                    $status = 0;

                    break;


                # TESTIRANJE
                case A_TESTIRANJE:
                    $first_action = NAVI_TESTIRANJE;
                    $second_action = M_TESTIRANJE_DIAGNOSTIKA;
                    if ($_GET['m'] == M_TESTIRANJE_VNOSI) {
                        $second_action = NAVI_TESTIRANJE_VNOSI;
                    }
                    if ($_GET['m'] == M_TESTIRANJE_PREDVIDENI) {
                        $second_action = NAVI_TESTIRANJE_PREDVIDENI;
                    }
                    if ($_GET['m'] == M_TESTIRANJE_CAS) {
                        $second_action = NAVI_TESTIRANJE_CAS;
                    }

                    $layout_width = 'narrow';

                    if (isset($_GET['m']) && ($_GET['m'] == 'cas' || $_GET['m'] == 'predvidenicas')) {
                        $layout_width = 'wide';

                    }

                    $status = 4;

                    break;

        
                # NASTAVITVE ANKETE
                case A_KOMENTARJI:
                case A_KOMENTARJI_ANKETA:
                    $first_action = NAVI_TESTIRANJE;
                    $second_action = NAVI_TESTIRANJE_KOMENTARJI;

                    $layout_width = 'narrow';
                    if (isset($_GET['a']) && ($_GET['a'] == 'komentarji' || $_GET['a'] == 'komentarji_anketa'))
                        $layout_width = 'wide';

                    $layout_menu = '';

                    $status = 0;

                    break;
                    
                case A_SETTINGS:
                case A_OSNOVNI_PODATKI:
                case A_FORMA:
                case A_COOKIE:
                case A_TRAJANJE:
                case A_DOSTOP:
                case A_MISSING:
                case A_METADATA:
                case A_MOBILESETTINGS:
                case A_TABLESETTINGS:
                case A_JEZIK: # nastavitve jezik
                case A_UREJANJE: # nastavitve komentarjev
                case A_PRIKAZ: # nastavitve komentarjev
                case A_SKUPINE:
                case A_EXPORTSETTINGS:
                case A_GDPR:
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_ANKETA;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    $status = 0;

                    break;

                case A_TEMA: # nastavitve prevajanje
                case 'theme-editor': # nastavitve prevajanje
                case 'edit_css': # nastavitve prevajanje
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_TEMA;

                    $layout_width = 'wide';
                    if($_GET['t'] == 'upload')
                        $layout_width = 'narrow';

                    $status = 0;

                    break;

                case A_HIERARHIJA:
                    $first_action = NAVI_HIERARHIJA;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    break;

                case A_PREVAJANJE: # nastavitve prevajanje
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_PREVAJANJE;

                    $layout_width = 'fullwidth';

                    $status = 0;

                    break;

                case A_ALERT:
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_ANKETA;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    $status = 0;

                    break;

                case A_NAGOVORI:
                    $first_action = NAVI_UREJANJE;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    $status = 0;

                    break;


                # ARHIVI
                case A_ARHIVI:
                    $first_action = ($_GET['m'] == 'data') ? NAVI_RESULTS : NAVI_UREJANJE;  
                    $second_action = NAVI_ARHIVI;

                    if(isset($_GET['m']) && $_GET['m'] == 'survey')
                        $third_action = NAVI_UREJANJE_ARHIVI_EXPORT1;
                    elseif(isset($_GET['m']) && $_GET['m'] == 'survey_data')
                        $third_action = NAVI_UREJANJE_ARHIVI_EXPORT2;
                    elseif(!isset($_GET['m']) || $_GET['m'] != 'data')
                        $third_action = NAVI_UREJANJE_ARHIVI;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';


                    $status = 0;

                    break;

                case A_TRACKING:
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_ARHIVI;

                    if(isset($_GET['appendMerge']) && $_GET['appendMerge'] == '1')
                        $third_action = NAVI_UREJANJE_ARHIVI_TRACKING3;
                    elseif($_GET['m'] == 'tracking_data')
                        $third_action = NAVI_UREJANJE_ARHIVI_TRACKING2;
                    else
                        $third_action = NAVI_UREJANJE_ARHIVI_TRACKING1;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    $status = 0;

                    break;


                # OBJAVA, VABILA
                case A_VABILA:
                    $first_action = NAVI_OBJAVA;
                    $_GET['m'] == 'settings' ? $second_action = NAVI_OBJAVA_SETTINGS : (isset($_GET['m']) && $_GET['m'] == 'url' ? $second_action = NAVI_OBJAVA_URL : $second_action = '');

                    $layout_width = 'narrow';

                    $status = 5;

                    break;

                case A_EMAIL:
                    $first_action = NAVI_OBJAVA;
                    $second_action = NAVI_OBJAVA;

                    $layout_width = 'wide';

                    $status = 5;

                    break;

                case 'invitations':
                    $first_action = NAVI_OBJAVA;
                    $second_action = (isset($_GET['m']) && $_GET['m'] == 'view_archive') ? NAVI_ARHIVI : 'invitations';  

                    $layout_width = 'wide';
                    
                    if ($_GET['m'] == 'view_archive')
                        $layout_menu = "menu_left";

                    $status = 5;

                    break;

                case A_OTHER_INV:
                    $first_action = NAVI_OBJAVA;
                    $second_action = (isset($_GET['m']) && $_GET['m'] == 'view_archive') ? NAVI_ARHIVI : NAVI_OBJAVA;  

                    $layout_width = 'narrow';
                    
                    if ($_GET['m'] == 'view_archive')
                        $layout_menu = "menu_left";

                    $status = 5;

                    break;


                # ANALIZE, PODATKI
                case A_ANALYSIS:
                    $first_action = NAVI_ANALYSIS;

                    $second_action = NAVI_STATISTIC_ANALYSIS;
                    if ($_GET['m'] == M_ANALYSIS_LINKS) {
                        $second_action = NAVI_ANALYSIS_LINKS;
                    }
                    elseif($_GET['m'] == 'anal_arch'){
                        $second_action = NAVI_ARHIVI;  
                    }
                    
                    if ($_GET['m'] == 'sumarnik') {
                        $third_action = M_ANALYSIS_SUMMARY;
                    }
                    elseif ($_GET['m'] == 'descriptor') {
                        $third_action = M_ANALYSIS_DESCRIPTOR;
                    }
                    elseif ($_GET['m'] == 'frequency') {
                        $third_action = M_ANALYSIS_FREQUENCY;
                    }
                    elseif ($_GET['m'] == 'crosstabs') {
                        $third_action = M_ANALYSIS_CROSSTAB;
                    }
                    elseif ($_GET['m'] == 'multicrosstabs') {
                        $third_action = M_ANALYSIS_MULTICROSSTABS;
                    }
                    elseif ($_GET['m'] == 'means') {
                        $third_action = M_ANALYSIS_MEANS;
                    }
                    elseif ($_GET['m'] == 'ttest') {
                        $third_action = M_ANALYSIS_TTEST;
                    }
                    elseif ($_GET['m'] == 'break') {
                        $third_action = M_ANALYSIS_BREAK;
                    }

        
                    if  ($_GET['m'] == 'charts') {
                        $layout_width = 'narrow';
                    }
                    else{
                        $layout_width = 'wide';
                    }
                    
                    if  ($_GET['m'] == 'anal_arch') {
                        $layout_menu = 'menu_left';
                    }

                    $status = 2;

                    break;

                case A_COLLECT_DATA:
                    $first_action = NAVI_RESULTS;
                    $second_action = NAVI_DATA;

                    $layout_width = 'fullwidth';

                    if ($_GET['m'] == M_COLLECT_DATA_CALCULATION) {
                        $second_action = NAVI_DATA_CALC;
                        $third_action = NAVI_DATA_CALC_CALCULATION;

                        $layout_width = 'wide';
                        $layout_menu = 'menu_left';
                    }
                    elseif($_GET['m'] == M_COLLECT_DATA_CODING){
                        $second_action = NAVI_DATA_CALC;  
                        $third_action = NAVI_DATA_CALC_CODING;  

                        $layout_width = 'wide';
                        $layout_menu = 'menu_left';
                    }
                    elseif($_GET['m'] == M_COLLECT_DATA_CODING_AUTO){
                        $second_action = NAVI_DATA_CALC;  
                        $third_action = NAVI_DATA_CALC_CODING_AUTO;  

                        $layout_width = 'wide';
                        $layout_menu = 'menu_left';
                    }
                    elseif($_GET['m'] == M_COLLECT_DATA_RECODING){
                        $second_action = NAVI_DATA_CALC;  
                        $third_action = NAVI_DATA_CALC_RECODING;  

                        $layout_width = 'wide';
                        $layout_menu = 'menu_left';
                    }

                    elseif(isset($_GET['m']) && ($_GET['m'] == M_COLLECT_DATA_APPEND || $_GET['m'] == 'upload_xls' || $_GET['m'] == 'append_xls' || $_GET['m'] == 'merge_xls')){
                        $second_action = NAVI_DATA_IMPORT;  
                        $third_action = NAVI_DATA_IMPORT_APPEND;  

                        $layout_width = 'wide';
                        $layout_menu = 'menu_left';
                    }
                    elseif(isset($_GET['m']) && $_GET['m'] == M_COLLECT_DATA_MERGE){
                        $second_action = NAVI_DATA_IMPORT;  
                        $third_action = NAVI_DATA_IMPORT_MERGE;  

                        $layout_width = 'wide';
                        $layout_menu = 'menu_left';
                    }
                    elseif  (isset($_GET['m']) && $_GET['m'] == 'quick_edit') {
                        $layout_width = 'wide';
                    }
                    elseif  (isset($_GET['m']) && $_GET['m'] == 'variables') {
                        $layout_width = 'wide';
                    }

                    $status = 4;

                    break;


                # IZVOZI
                case A_COLLECT_DATA_EXPORT:
                    $first_action = NAVI_RESULTS;
                    $second_action = NAVI_DATA_EXPORT;

                    if(isset($_GET['m']) && $_GET['m'] == M_EXPORT_EXCEL){
                        $third_action = NAVI_DATA_EXPORT_EXCEL;  
                    }
                    elseif(isset($_GET['m']) && $_GET['m'] == M_EXPORT_EXCEL_XLS){
                        $third_action = NAVI_DATA_EXPORT_EXCEL_XLS;  
                    }
                    elseif(isset($_GET['m']) && $_GET['m'] == M_EXPORT_SAV){
                        $third_action = NAVI_DATA_EXPORT_SAV;  
                    }
                    elseif(isset($_GET['m']) && $_GET['m'] == M_EXPORT_TXT){
                        $third_action = NAVI_DATA_EXPORT_TXT;  
                    }
                    else{
                        $third_action = NAVI_DATA_EXPORT_SPSS;  
                    }

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    $status = 4;

                    if (isset($_GET['m']) && $_GET['m'] == A_COLLECT_DATA_EXPORT_ALL) {
                        $first_action = NAVI_RESULTS;
                        $second_action = NAVI_ANALYSIS_LINKS;
                        $third_action = ''; 

                        $status = 2;
                    }

                    break;


                # DODATNE NASTAVITVE
                case A_ADVANCED:
                case A_UPORABNOST:
                case A_HIERARHIJA_SUPERADMIN:
                case A_KVIZ:
                case A_VOTING:
                case A_ADVANCED_PARADATA:
                case A_ADVANCED_TIMESTAMPS:
                case A_JSON_SURVEY_EXPORT:
                case A_VNOS:
                case A_SOCIAL_NETWORK:
                case A_CHAT:
                case A_PANEL:
                case A_EMAIL_ACCESS:
                case A_SLIDESHOW:
                case A_360:
                case A_360_1KA:
                case A_MAZA:
                case A_WPN:
                case 'evoli':
                case 'evoli_teammeter':
                case 'evoli_quality_climate':
                case 'evoli_teamship_meter':
                case 'evoli_organizational_employeeship_meter':
                case 'evoli_employmeter':
                case 'mfdps':
                case 'borza':
                case 'mju':
                case 'excell_matrix':
                case 'fieldwork':
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_ANKETA;

                    $layout_width = 'wide';
                    $layout_menu = 'menu_left';

                    $status = 0;

                    break;

                case A_TELEPHONE:
                case A_PHONE:
                case T_PHONE:
                    $first_action = NAVI_UREJANJE;
                    $second_action = NAVI_UREJANJE_ANKETA;

                    $layout_width = 'wide';

                    // Anektar (telefonska anketa) nima leve navigacije
                    global $global_user_id;
			        if(!Common::isUserAnketar($anketa, $global_user_id))
                        $layout_menu = 'menu_left';

                    $status = 5;

                    break;

                default:
                    break;
            }

            // shrani tracking za anketo
            if(!isDemoSurvey($anketa) 
                && $third_action != NAVI_UREJANJE_ARHIVI_TRACKING1 
                && $third_action != NAVI_UREJANJE_ARHIVI_TRACKING2 
                && $third_action != NAVI_UREJANJE_ARHIVI_TRACKING3
            ){
                TrackingClass::update($anketa, $status);
            }
        }
        // Nismo vezani na anketo, tracking uporabnika
        else{

            switch ($get) {

                # AKTIVNOST in UPORABNIKI
                case 'diagnostics':

                    // Uporabniki
                    if(isset($_GET['t']) && $_GET['t'] == 'uporabniki'){
                        $layout_width = 'narrow';
                        if(!isset($_GET['m']) || $_GET['m'] == 'all' || $_GET['m'] == ''){
                            $layout_width = 'fullwidth';  
                        } 
                    }
                    // Ativnost
                    else{
                        $layout_width = 'narrow';
                    }

                    break;

                
                # KNJIZNICA
                case 'knjiznica':
                    $layout_width = 'wide';  

                    break;


                # NASTAVITVE
                case 'nastavitve':
                    $layout_width = 'narrow';  

                    break;


                # OBVESTILA
                case 'obvestila':
                    $layout_width = 'narrow';  

                    break;


                # GDPR
                case 'gdpr':
                    if (isset($_GET['m']) && $_GET['m'] == 'gdpr_requests')
                        $layout_width = 'wide';  
                    elseif (isset($_GET['m']) && $_GET['m'] == 'gdpr_requests_all')
                        $layout_width = 'fullwidth';  
                    else
                        $layout_width = 'narrow';  

                    break;


                # MODUL UL EVALVACIJE
                case 'ul_evalvation':
                    $layout_width = 'wide';  

                    break;

                    
                # MOJE ANKETE
                case 'pregledovanje':
                default:
                    $layout_width = 'wide';
                    
                    if ((isset($_GET['a']) && $_GET['a'] == 'ustvari_anketo') || (isset($_GET['b']) && $_GET['b'] == 'new_survey')) {
                        $layout_width = 'fullwidth';
                        $layout_menu = 'menu_left';
                        $hide_header = 'hide_header';
                    }

                    if ($_GET['a'] == 'narocila') {
                        $layout_width = 'narrow';
                    }

                    break;
            }

            // shrani tracking za userja
            TrackingClass::update_user();
        }

        // vrni podatke o navigaciji nazaj v SurveyAdmin
        return array(
            'first_action'  => $first_action, 
            'second_action' => $second_action, 
            'third_action'  => $third_action, 

            'layout_width'  => $layout_width,
            'layout_menu'   => $layout_menu,
            'hide_header'   => $hide_header,
        ); 
    }
}