summaryrefslogblamecommitdiffstats
path: root/admin/survey/modules/mod_uporabnost/class.SurveyUporabnost.php
blob: 44eae0aea2205fed0cdab301602cac26aa581e2c (plain) (tree)
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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021



















































                                                                                                                                                                                        
                                                                                                 







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                       
<?php

define("TEMP_FOLDER", "admin/survey/modules/mod_uporabnost/temp");
define("SCRIPT_FOLDER", "admin/survey/modules/mod_uporabnost/R");
define("RESULTS_FOLDER", "admin/survey/modules/mod_uporabnost/results");

class SurveyUporabnost{

	var $anketa;				# id ankete
	var $db_table = '';	
	
	private $displayEditIconsSettings = false;			# ali prikazujemo okno s checkboxi za nastavitve tabele s podatki	
	
	private $cols_with_value = array();					# kateri stolpci imajo vrednosti
	private $show_with_zero = false;					# Ali prikazujemo stolpce z vrednostmi 0
	private $show_details = false;						# Ali prikazujemo stolpce s podrobnimi vrednostmi (-1, -2...)
	private $show_calculations = false;					# Ali prikazujemo stolpce s podrobnimi izracuni (UML, UNL...)
	private $show_with_other = true;					# Ali prikazujemo vrstice "Drugo"
	private $show_with_text = true;						# Ali prikazujemo vrstice tipa "besedilo"
	
	public $bottom_usable_limit = 50;					# Spodnja meja za usable respondente (def. 50%)
	public $top_usable_limit = 80;						# Zgornja meja za usable respondente (def. 80%) - unusable (50-), partially usable (50-80), usable(80+)
	
	public $_HEADERS = array();							# shranimo podatke vseh variabel
	private $headFileName = null;						# pot do header fajla
	private $dataFileName = null;						# pot do data fajla
	private $dataFileStatus = null;						# status data datoteke
	private $SDF = null;								# class za inkrementalno dodajanje fajlov

	public $variablesList = null; 					 	# Seznam vseh variabel nad katerimi lahko izvajamo (zakeširamo)

	public $_CURRENT_STATUS_FILTER = ''; 				# filter po statusih, privzeto izvažamo 6 in 5
	public $_PROFILE_ID_VARIABLE = ''; 					# filter po statusih, privzeto izvažamo 6 in 5

	public $_HAS_TEST_DATA = false;						# ali anketa vsebuje testne podatke
	
	private $usability = array();						# array z vsemi podatki
	
	private $sortField = 'recnum';						# Polje po katerem sortiramo tabelo
	private $sortType = 0;								# Nacin sortiranja (narascajoce/padajoce)

	
	function __construct($anketa){
		global $site_url;

		// Ce imamo anketo, smo v status->ul evealvacija
		if ((int)$anketa > 0){

			$this->anketa = $anketa;

			# polovimo vrsto tabel (aktivne / neaktivne)
			SurveyInfo :: getInstance()->SurveyInit($this->anketa);
			$this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
			
			SurveyAnalysisHelper::getInstance()->Init($this->anketa);

			$this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/';

			Common::deletePreviewData($this->anketa);
			         
            // Poskrbimo za datoteko s podatki
            $SDF = SurveyDataFile::get_instance();
            $SDF->init($this->anketa); 
            
            if($generateDataFile)
                $SDF->prepareFiles();  

            $this->headFileName = $SDF->getHeaderFileName();
            $this->dataFileName = $SDF->getDataFileName();
            $this->dataFileStatus = $SDF->getStatus();

			if ( $this->dataFileStatus == FILE_STATUS_NO_DATA || $this->dataFileStatus == FILE_STATUS_SRV_DELETED) {
				Common::noDataAlert();
				exit();
			}		
			
			# Inicializiramo in polovimo nastavitve missing profila
			SurveyStatusProfiles::Init($this->anketa);
			SurveyUserSetting::getInstance()->Init($this->anketa, $global_user_id);
			SurveyConditionProfiles :: Init($this->anketa, $global_user_id);
			SurveyTimeProfiles :: Init($this->anketa, $global_user_id);
			SurveyVariablesProfiles :: Init($this->anketa, $global_user_id);
			SurveyDataSettingProfiles :: Init($this->anketa);


			// preberemo nastavitve iz baze (prej v sessionu)
			SurveyUserSession::Init($this->anketa);
			$this->sessionData = SurveyUserSession::getData();

			if(isset($_SESSION['sid_'.$this->anketa]['usabilityIcons_settings']))
				$this->displayEditIconsSettings = ($_SESSION['sid_'.$this->anketa]['usabilityIcons_settings']);

			if (file_exists($this->headFileName) && $this->headFileName !== null && $this->headFileName != ''){
				$this->_HEADERS = unserialize(file_get_contents($this->headFileName));
			}

			# nastavimo vse filtre
			$this->setUpFilter();

			# nastavimo filtre uporabnika
			$this->setUserFilters();
			
			# nastavimo sortiranje
			if(isset($_GET['sortField']))
				$this->sortField = $_GET['sortField'];
			if(isset($_GET['sortType']))
				$this->sortType = $_GET['sortType'];
		}
	}
	
	
	// Prikažemo stran
	public function displayUporabnost(){
		global $lang;
				
		// Prikaz nastavitev
		$this->displayUsableSettings();
		
		// Izvedemo pripravo datoteke
		$this->prepareData();
		
		// Napolnimo podatke v array
		$this->fillData();
		
		// Izrisemo tabelo
		$this->displayUporabnostTable();
		
		// Na koncu pobrisemo zacasne datoteke
		$this->deleteTemp();
	}
	
	// Prikazemo tabelo
	private function displayUporabnostTable(){
		global $site_path;
		global $lang;
		global $admin_type;
		
		echo '<div id="usable_table">';
		
		echo '<table id="tbl_usable_respondents">';
		
		
		// NASLOVNE VRSTICE
		if($this->sortType == 1){
			$sortType = 0;
			$arrow = ' <span class="faicon sort_ascending"></span>';
		}
		else{
			$sortType = 1;
			$arrow = ' <span class="faicon sort_descending"></span>';
		}
		
		if($admin_type == '0' || $admin_type == '1')
			echo '<th class="all" rowspan="2">User ID</th>';
		
		echo '<th class="recnum" rowspan="2" style="width:60px;"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=recnum&sortType='.$sortType.'">Recnum'./*$lang['recnum'].*/($this->sortField=='recnum' ? $arrow : '').'</a></th>';
		echo '<th class="all" rowspan="2">'.$lang['srv_usableResp_qcount'].'</th>';
		
		echo '<th class="data" colspan=4>'.$lang['srv_usableResp_exposed'].'</th>';
		
		echo '<th class="data" rowspan="2"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=breakoff&sortType='.$sortType.'">'.$lang['srv_usableResp_breakoff'].($this->sortField=='breakoff' ? $arrow : '').'</th>';
		
		echo '<th class="usable" colspan="2">'.$lang['srv_usableResp_usability'].'</th>';
		
		// ali odstranimo vse stolpce s podrobnimi vrednostmi (-1, -2...)
		if ($this->show_details == true) {
			foreach ($this->_missings AS $value => $text){
				$cnt_miss++;
				echo "<th rowspan=\"2\" class=\"unusable\" title=\"".$lang['srv_usableResp_'.$text]."\" >{$value}<br/>(".$lang['srv_usableResp_'.$text].")</th>";
			}
			foreach ($this->_unsets AS $value => $text){
				$cnt_undefined++;
				echo "<th rowspan=\"2\" class=\"unusable\" title=\"".$lang['srv_usableResp_'.$text]."\">{$value}<br/>(".$lang['srv_usableResp_'.$text].")</th>";
			}
		}
		
		// ali prikazemo podrobne izracune
		if ($this->show_calculations == true) {
			echo '<th class="calculation" rowspan="2">UNL</th>';
			echo '<th class="calculation" rowspan="2">UML</th>';
			echo '<th class="calculation" rowspan="2">UCL</th>';
			echo '<th class="calculation" rowspan="2">UIL</th>';
			echo '<th class="calculation" rowspan="2">UAQ</th>';			
		}
		
		echo '</tr>';
		
		echo '<tr>';
		echo '<th class="data"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=valid&sortType='.$sortType.'">'.$lang['srv_anl_valid'].($this->sortField=='valid' ? $arrow : '').'</th>';
		echo '<th class="data"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=nonsubstantive&sortType='.$sortType.'">'.$lang['srv_usableResp_nonsubstantive'].($this->sortField=='nonsubstantive' ? $arrow : '').'</th>';
		echo '<th class="data"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=nonresponse&sortType='.$sortType.'">'.$lang['srv_usableResp_nonresponse'].($this->sortField=='nonresponse' ? $arrow : '').'</th>';
		echo '<th class="data"><span class="bold">'.$lang['srv_anl_suma1'].'</span></th>';
		
		echo '<th class="usable"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=usable&sortType='.$sortType.'">%'.($this->sortField=='usable' ? $arrow : '').'</a></th>';
		echo '<th class="usable status"><a href="index.php?anketa='.$this->anketa.'&a=usable_resp&sortField=status&sortType='.$sortType.'">Status'.($this->sortField=='status' ? $arrow : '').'</a></th>';
		echo '</tr>';					
				

		// VRSTICE S PODATKI
		foreach($this->usability['data'] as $user){		
						
			// Prva vrstica z vrednostmi
			echo '<tr class="'.$user['css'].'">';

			if($admin_type == '0' || $admin_type == '1'){
				
				$sql = sisplet_query("SELECT id	FROM srv_user WHERE ank_id='".$this->anketa."' AND recnum='".$user['recnum']."'");
				$row = mysqli_fetch_array($sql);
				
				echo '<td rowspan="2" class="all">'.$row['id'].'</td>';
			}
				
			
			echo '<td rowspan="2" class="recnum">'.$user['recnum'].'</td>';
			
			// Vsi
			echo '<td rowspan="2" class="all">'.$user['all'].'</td>';
			
			// Ustrezni
			echo '<td class="data">'.$user['valid'].'</td>';
			
			// Non-substantive			
			echo '<td class="data">'.$user['nonsubstantive'].'</td>';
			
			// Non-response
			echo '<td class="data">'.$user['nonresponse'].'</td>';
			
			// Skupaj	
			echo '<td class="data sum bold">'.($user['valid']+$user['nonsubstantive']+$user['nonresponse']+$user['breakoff']).'</td>';
			
			// Breakoffs	
			echo '<td class="data breakoff">'.$user['breakoff'].'</td>';
			
			// Uporabni		
			echo '<td class="usable">'.$user['usable'].'</td>';
			echo '<td class="usable status" rowspan="2">'.$user['status'].'</td>';
			
			// ali odstranimo vse stolpce s podrobnimi vrednostmi (-1, -2...)
			if ($this->show_details == true) {
				echo '<td class="unusable">'.$user['-1'].'</td>';
				echo '<td class="unusable">'.$user['-2'].'</td>';
				echo '<td class="unusable">'.$user['-3'].'</td>';
				echo '<td class="unusable">'.$user['-4'].'</td>';
				echo '<td class="unusable">'.$user['-5'].'</td>';
				echo '<td class="unusable">'.$user['-97'].'</td>';
				echo '<td class="unusable">'.$user['-98'].'</td>';
				echo '<td class="unusable">'.$user['-99'].'</td>';
			}
			
			// ali prikazemo podrobne izracune
			if ($this->show_calculations == true) {				
				echo '<td class="calculation" rowspan="2">'.$user['UNL'].'</td>';
				echo '<td class="calculation" rowspan="2">'.$user['UML'].'</td>';
				echo '<td class="calculation" rowspan="2">'.$user['UCL'].'</td>';
				echo '<td class="calculation" rowspan="2">'.$user['UIL'].'</td>';
				echo '<td class="calculation" rowspan="2">'.$user['UAQ'].'</td>';			
			}
			
			echo '</tr>';
			
			
			// Druga vrstica s procenti
			echo '<tr class="multiVariablesHeader '.$user['css'].' '.$css_usable.'">';

			// Ustrezni
			echo '<td class="data">'.$user['validPercent'].'</td>';
				
			// Non-substantive			
			echo '<td class="data">'.$user['nonsubstantivePercent'].'</td>';
			
			// Non-response
			echo '<td class="data">'.$user['nonresponsePercent'].'</td>';
						
			// Skupaj	
			echo '<td class="data sum bold">100%</td>';
	
			// Breakoffs	
			echo '<td class="data breakoff">'.$user['breakoffPercent'].'</td>';
	
			// Uporabni		
			echo '<td class="usable">'.$user['usablePercent'].'</td>';
			
			// ali odstranimo vse stolpce s podrobnimi vrednostmi (-1, -2...)
			if ($this->show_details == true) {
				echo '<td class="unusable">'.$user['-1_percent'].'</td>';
				echo '<td class="unusable">'.$user['-2_percent'].'</td>';
				echo '<td class="unusable">'.$user['-3_percent'].'</td>';
				echo '<td class="unusable">'.$user['-4_percent'].'</td>';
				echo '<td class="unusable">'.$user['-5_percent'].'</td>';
				echo '<td class="unusable">'.$user['-97_percent'].'</td>';
				echo '<td class="unusable">'.$user['-98_percent'].'</td>';
				echo '<td class="unusable">'.$user['-99_percent'].'</td>';
			}

			echo '</tr>';
		}
				
			
		echo '</table>';
		
		if($this->usability['all'] > 0){
            echo '<div class="usable_sum">';
            
            //echo '<span class="bold">'.$lang['srv_usableResp_usability'].': </span>';
            echo '<span class="usable_legend spaceLeft spaceRight" style="background-color:#ffffff;">'.$lang['srv_usableResp_usable_unit'].' - Status 2 ('.$this->top_usable_limit.'%-100%): <span class="bold">'.$this->usability['usable'].' ('.common::formatNumber($this->usability['usable']/$this->usability['all']*100, 0, null, '%').')</span></span>';
            echo '<span class="usable_legend spaceLeft spaceRight" style="background-color:#ffffe3;">'.$lang['srv_usableResp_partusable_unit'].' - Status 1 ('.$this->bottom_usable_limit.'%-'.$this->top_usable_limit.'%): <span class="bold">'.$this->usability['partusable'].' ('.common::formatNumber($this->usability['partusable']/$this->usability['all']*100, 0, null, '%').')</span></span>';
            echo '<span class="usable_legend spaceLeft" style="background-color:#ffe8e8;">'.$lang['srv_usableResp_unusable_unit'].' - Status 0 (0%-'.$this->bottom_usable_limit.'%): <span class="bold">'.$this->usability['unusable'].' ('.common::formatNumber($this->usability['unusable']/$this->usability['all']*100, 0, null, '%').')</span></span>';
            
            echo '</div>';
        }
		
		echo '</div>';
	}	
	
	private function displayUsableSettings(){
		global $lang;
		
		// Div z nastavitvami ki se razpre
		echo '<div id="dataSettingsCheckboxes" '.($this->displayEditIconsSettings ? '' : ' style="display:none;"').'>';		
		echo '<div id="toggleDataCheckboxes2" onClick="toggleDataCheckboxes(\'usability\');"><span class="faicon close icon-orange" style="padding-bottom:2px;"></span> '.$lang['srv_data_settings_checkboxes2'].'</div>';

		
		echo '<div id="usable_respondents_settings">';
	
		echo $lang['srv_usableResp_limit'].': ';
	
		echo '<span class="spaceLeft spaceRight">'.$lang['srv_usableResp_bottom_limit'].': <input type="text" id="bottom_usable_limit" size="2" onblur="changeUsableRespSetting(this);" value="'.$this->bottom_usable_limit.'" />%</span>';
		echo '<span class="spaceLeft spaceRight">'.$lang['srv_usableResp_top_limit'].': <input type="text" id="top_usable_limit" size="2" onblur="changeUsableRespSetting(this);" value="'.$this->top_usable_limit.'" />%</span>';
	
		echo '<br />';		
		
		echo '<div style="margin-top:10px;">';
		echo $lang['srv_usableResp_show'].': ';
	
		// Prikaz neničelnih stolpcev
		/*echo '<label class="spaceLeft spaceRight">';
		echo '<input type="checkbox" id="show_with_zero" onclick="changeUsableRespSetting(this);" '.($this->show_with_zero == true ? ' checked="checked"' : '').' autocomplete="off">';
		echo $lang['srv_usableResp_showZero'];
		echo '</label>';*/
		
		// Prikaz podrobnosti
		echo '<label class="spaceLeft spaceRight">';
		echo '<input type="checkbox" id="show_details" onclick="changeUsableRespSetting(this);" '.($this->show_details == true ? ' checked="checked"' : '').' autocomplete="off">';
		echo $lang['srv_usableResp_showDetails'];
		echo '</label>';	
		
		// Prikaz podrobnih izracunov
		echo '<label class="spaceLeft">';
		echo '<input type="checkbox" id="show_calculations" onclick="changeUsableRespSetting(this);" '.($this->show_calculations == true ? ' checked="checked"' : '').' autocomplete="off">';
		echo $lang['srv_usableResp_showCalc'];
		echo '</label>';
		echo '</div>';
		
		echo '</div>';
		
		
		echo '</div>';
	}
	
	
	// Zgeneriramo pdf analizo
	private function prepareData(){
		global $site_path;
		global $lang;	
		global $admin_type;

		// Zgeneriramo zacasne csv datoteke
		$this->prepareDataCSV();
		$this->prepareQuestionCSV();
		$this->prepareItemCSV();

		// Poklicemo R skripto in zgeneriramo pdf
		$script = $site_path . SCRIPT_FOLDER . '/uporabnost.R';
		$out = exec('Rscript '.$script.' '.$this->anketa.' 2>&1', $output, $return_var);
		
		// Testiranje - izpis errorjev
		if($admin_type == 0){
			echo '<div style="display:none;">';
			echo 'Rscript '.$script;
			//echo '<br />'.$out.'<br />';
			var_dump($output);
			echo '</div>';
		}
	}	
	
	// Napolnimo podatke v array
	private function fillData(){
		global $site_path;
		global $lang;
		
		$result_folder = $site_path . RESULTS_FOLDER.'/';
		
		if (($handle = fopen($result_folder."usability_".$this->anketa.".csv", "r")) !== FALSE) {		
			
			// Loop po vrsticah
			$cnt = 0;
			while (($row = fgetcsv($handle, 1000, ';')) !== FALSE) {
		
				if($cnt == 0)
					$row = fgetcsv($handle, 1000, ';');
				
				// Preberemo se drugo vrstico, ker so v parih
				$row2 = fgetcsv($handle, 1000, ';');
		
		
				// Obarvamo vrstico glede na status (belo, rumeno, rdece)
				if($row2[7] < (int)$this->bottom_usable_limit){
					$css_usable = 'unusable';
					$status = 0;
					$this->usability['unusable']++;
				}
				elseif($row2[7] >= (int)$this->bottom_usable_limit && $row2[7] < (int)$this->top_usable_limit){
					$css_usable = 'partusable';
					$status = 1;
					$this->usability['partusable']++;
				}
				else{
					$css_usable = 'usable';
					$status = 2;
					$this->usability['usable']++;
				}
				$this->usability['all']++;
				
		
				// Nastavimo izracunane podatke za respondenta
				$this->usability['data'][$cnt]['recnum'] = $row[0];
				//$this->usability['data'][$cnt]['usr_id'] = $row['usr_id'];
				$this->usability['data'][$cnt]['css'] = $css_usable;
				$this->usability['data'][$cnt]['status'] = $status;
				
				$this->usability['data'][$cnt]['all'] = $row[1];
				
				$this->usability['data'][$cnt]['valid'] = $row[2];
				$this->usability['data'][$cnt]['nonsubstantive'] = $row[3];
				$this->usability['data'][$cnt]['nonresponse'] = $row[4];

				$this->usability['data'][$cnt]['validPercent'] = $row2[2];		
				$this->usability['data'][$cnt]['nonsubstantivePercent'] = $row2[3];
				$this->usability['data'][$cnt]['nonresponsePercent'] = $row2[4];
				
				$this->usability['data'][$cnt]['breakoff'] = $row[6];
				$this->usability['data'][$cnt]['breakoffPercent'] = $row2[6];
				
				$this->usability['data'][$cnt]['usable'] = $row[7];
				$this->usability['data'][$cnt]['usablePercent'] = $row2[7];
				
				$this->usability['data'][$cnt]['UNL'] = $row2[17];
				$this->usability['data'][$cnt]['UML'] = $row2[18];
				$this->usability['data'][$cnt]['UCL'] = $row2[19];
				$this->usability['data'][$cnt]['UIL'] = $row2[20];
				$this->usability['data'][$cnt]['UAQ'] = $row2[21];
				
				$this->usability['data'][$cnt]['-1'] = $row[9];
				$this->usability['data'][$cnt]['-1_percent'] = $row2[9];
				$this->usability['data'][$cnt]['-2'] = $row[10];
				$this->usability['data'][$cnt]['-2_percent'] = $row2[10];
				$this->usability['data'][$cnt]['-3'] = $row[11];
				$this->usability['data'][$cnt]['-3_percent'] = $row2[11];
				$this->usability['data'][$cnt]['-4'] = $row[12];
				$this->usability['data'][$cnt]['-4_percent'] = $row2[12];
				$this->usability['data'][$cnt]['-5'] = $row[13];
				$this->usability['data'][$cnt]['-5_percent'] = $row2[13];
				$this->usability['data'][$cnt]['-97'] = $row[14];
				$this->usability['data'][$cnt]['-97_percent'] = $row2[14];
				$this->usability['data'][$cnt]['-98'] = $row[15];
				$this->usability['data'][$cnt]['-98_percent'] = $row2[15];
				$this->usability['data'][$cnt]['-99'] = $row[16];
				$this->usability['data'][$cnt]['-99_percent'] = $row2[16];

				$cnt++;
			}
		}
		
		// Sortiramo podatke
		foreach ($this->usability['data'] as $key => $row) {
			$mid[$key]  = $row[$this->sortField];
		}
		if($this->sortType == 0)
			array_multisort($mid, SORT_ASC, $this->usability['data']);
		else
			array_multisort($mid, SORT_DESC, $this->usability['data']);
		
		
		# ali odstranimo stolpce kateri imajo same 0
		/*if ($this->show_with_zero == false) {
			# odstranimo missinge brez vrednosti
			foreach ($this->_missings AS $_key => $_missing) {
				if (!isset($this->cols_with_value[$_key]) || $this->cols_with_value[$_key] == false) {
					unset($this->_missings[$_key]);
				}
			}
			# odstranimo neveljavne brez vrednosti
			foreach ($this->_unsets AS $_key => $_unset) {
				if (!isset($this->cols_with_value[$_key]) || $this->cols_with_value[$_key] == false) {
					unset($this->_unsets[$_key]);
				}
			}
		}*/
	}
	
	
	// Pripravi csv s podatki
	private function prepareDataCSV(){
		global $site_path;
		global $lang;	
		global $admin_type;
		
		$temp_folder = $site_path . TEMP_FOLDER.'/';
	
		$SDF = SurveyDataFile::get_instance();
		$SDF->init($this->anketa);
		$_headFileName = $SDF->getHeaderFileName();
		$_dataFileName = $SDF->getDataFileName();
		$_fileStatus = $SDF->getStatus();
		
		if ($_headFileName != null && $_headFileName != '') {
			$_HEADERS = unserialize(file_get_contents($_headFileName));
		} 
		else {
			echo 'Error! Empty file name!';
		}
	
		// Zaenkrat dopuscamo samo status 6 in brez lurkerjev
		if($admin_type == '0')
			$status_filter = '('.STATUS_FIELD.' ~ /6|5/)&&('.LURKER_FIELD.'==0)';
		else
			$status_filter = '('.STATUS_FIELD.'==6)&&('.LURKER_FIELD.'==0)';
		
		//$start_sequence = $_HEADERS['_settings']['dataSequence'];
		$start_sequence = 2;
		$end_sequence = $_HEADERS['_settings']['metaSequence']-1;
		
		$field_delimit = ';';
			
		// Filtriramo podatke po statusu in jih zapisemo v temp folder
		if (IS_WINDOWS) {
			//$command = 'awk -F"|" "BEGIN {{OFS=\",\"} {ORS=\"\n\"}} '.$status_filter.' { print $0}" '.$_dataFileName.' >> '.$temp_folder.'/temp_data_'.$this->anketa.'.dat';
			$out = shell_exec('awk -F"|" "BEGIN {{OFS=\",\"} {ORS=\"\n\"}} '.$status_filter.'" '.$_dataFileName.' | cut -d "|" -f '.$start_sequence.'-'.$end_sequence.' >> '.$temp_folder.'/temp_data_'.$this->anketa.'.dat');
		} 
		else {
			//$command = 'awk -F"|" \'BEGIN {{OFS=","} {ORS="\n"}} '.$status_filter.' { print $0; }\' '.$_dataFileName.' >> '.$temp_folder.'/temp_data_'.$this->anketa.'.dat';
			$out = shell_exec('awk -F"|" \'BEGIN {{OFS=","} {ORS="\n"}} '.$status_filter.'\' '.$_dataFileName.' | cut -d \'|\' -f '.$start_sequence.'-'.$end_sequence.' >> '.$temp_folder.'/temp_data_'.$this->anketa.'.dat');
		}
		
		
		// Ustvarimo koncni CSV
		if ($fd = fopen($temp_folder.'/temp_data_'.$this->anketa.'.dat', "r")) {
		
			$fd2 = fopen($temp_folder.'/data_'.$this->anketa.'.csv', "w");
			
			# naredimo header row
			foreach ($_HEADERS AS $spid => $spremenljivka) {
				if (isset($spremenljivka['grids']) && count($spremenljivka['grids']) > 0) {
					foreach ($spremenljivka['grids'] AS $gid => $grid) {
						foreach ($grid['variables'] AS $vid => $variable ){
							if ($spremenljivka['tip'] !== 'sm' && !($variable['variable'] == 'uid' && $variable['naslov'] == 'User ID')){
								$output1 .= strip_tags($variable['variable']).$field_delimit;
								//$output2 .= '"'.strip_tags($variable['naslov']).'"'.$field_delimit;
							}
						}
					}
				}
			}
			
			// Pobrisemo zadnji ; ce obstaja
			$output1 = rtrim($output1, ";");
			
			// Zapisemo header row
			fwrite($fd2, $output1."\r\n");
			//fwrite($fd2, $output2."\r\n");


			while ($line = fgets($fd)) {
															
				//fwrite($fd2, '="');
				//$line = str_replace(array("\r","\n","|"), array("","",'";="'), $line);
				$line = '"' . str_replace(array("\r","\n","\"","|"), array("","","",'";"'), $line) . '"';
				
				// Spremenimo encoding v windows-1250
				$line = iconv("UTF-8","Windows-1250//TRANSLIT", $line);
				//$line = str_replace(array("č","š","ž","Č","Š","Ž"), array("\v{c}","\v{s}","\v{z}","\v{C}","\v{S}","\v{Z}"), $line);

				fwrite($fd2, $line);
				//fwrite($fd2, '"');
				fwrite($fd2, "\r\n");
			}
			
			fclose($fd2);
		}
		fclose($fd);

		
		// Na koncu pobrisemo temp datoteke
		if (file_exists($temp_folder.'/temp_data_'.$this->anketa.'.dat')) {
			unlink($temp_folder.'/temp_data_'.$this->anketa.'.dat');
		}
	}	
	
	// Pripravi csv z vprasanji
	private function prepareQuestionCSV(){
		global $site_path;
		global $lang;	
		global $admin_type;
		
		define('delimiter', ';');

		$temp_folder = $site_path . TEMP_FOLDER.'/';
	
		$fd = fopen($temp_folder.'/questions_'.$this->anketa.'.csv', "w");
		
		
		// Prva vrstica
		$output = '';
		$output .= 'ID SURVEY'.delimiter;
		$output .= 'ID QUESTION'.delimiter;
		$output .= 'ID PAGE'.delimiter;
		$output .= 'QUESTION NUMBER'.delimiter;
		
		/*$output .= 'naslov'.delimiter;
		$output .= 'info'.delimiter;*/
		$output .= 'variable'.delimiter;
		/*$output .= 'variable_custom'.delimiter;
		$output .= 'label'.delimiter;*/
		$output .= 'tip'.delimiter;
		$output .= 'vrstni_red'.delimiter;
		//$output .= 'random'.delimiter;
		$output .= 'size'.delimiter;
		/*$output .= 'undecided'.delimiter;
		$output .= 'rejected'.delimiter;
		$output .= 'inappropriate'.delimiter;
		$output .= 'stat'.delimiter;
		$output .= 'orientation'.delimiter;
		$output .= 'checkboxhide'.delimiter;
		$output .= 'reminder'.delimiter;*/
		$output .= 'visible'.delimiter;
		/*$output .= 'textfield'.delimiter;
		$output .= 'textfield_label'.delimiter;
		$output .= 'cela'.delimiter;
		$output .= 'decimalna'.delimiter;
		$output .= 'enota'.delimiter;
		$output .= 'timer'.delimiter;
		$output .= 'sistem'.delimiter;
		$output .= 'folder'.delimiter;*/
		$output .= 'params'.delimiter;
		/*$output .= 'antonucci'.delimiter;
		$output .= 'design'.delimiter;
		$output .= 'podpora'.delimiter;
		$output .= 'grids'.delimiter;
		$output .= 'grids_edit'.delimiter;
		$output .= 'grid_subtitle1'.delimiter;
		$output .= 'grid_subtitle2'.delimiter;
		$output .= 'ranking_k'.delimiter;
		$output .= 'vsota'.delimiter;
		$output .= 'vsota_limit'.delimiter;
		$output .= 'vsota_min'.delimiter;
		$output .= 'skala'.delimiter;
		$output .= 'vsota_reminder'.delimiter;
		$output .= 'vsota_limittype'.delimiter;
		$output .= 'vsota_show'.delimiter;
		$output .= 'thread'.delimiter;
		$output .= 'text_kosov'.delimiter;
		$output .= 'text_orientation'.delimiter;
		$output .= 'note'.delimiter;
		$output .= 'upload'.delimiter;
		$output .= 'dostop'.delimiter;
		$output .= 'inline_edit'.delimiter;
		$output .= 'onchange_submit'.delimiter;
		$output .= 'hidden_default'.delimiter;
		$output .= 'naslov_graf'.delimiter;
		$output .= 'edit_graf'.delimiter;
		$output .= 'wide_graf'.delimiter;
		$output .= 'coding'.delimiter;
		$output .= 'dynamic_mg'.delimiter;
		$output .= 'QUESTION IF'.delimiter;*/
		
		fwrite($fd, $output."\r\n");
		
			
		// Vrstice s podatki
		$sql = sisplet_query("SELECT s.id, s.gru_id, s.variable, s.tip, s.vrstni_red, s.size, s.visible, s.params 
								FROM srv_spremenljivka s, srv_grupa g 
								WHERE s.gru_id=g.id AND g.ank_id='".$this->anketa."' 
								ORDER BY g.vrstni_red, s.vrstni_red");
		if (!$sql) echo mysqli_error($GLOBALS['connect_db']);
		if (mysqli_num_rows($sql) > 0) {
			
			$i = 0;
			
			while ($row = mysqli_fetch_array($sql)) {
				
				$i++;
				
				$line = '';
				
				$line .= $this->anketa.delimiter;
				$line .= $row['id'].delimiter;
				$line .= $row['gru_id'].delimiter;
				$line .= $i.delimiter;
				
				/*$line .= str_replace("\n", '', str_replace(delimiter, '', $row['naslov']) ).delimiter;
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['info']) ).delimiter;*/
				$line .= $row['variable'].delimiter;
				/*$line .= $row['variable_custom'].delimiter;
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['label']) ).delimiter;*/
				$line .= $row['tip'].delimiter;
				$line .= $row['vrstni_red'].delimiter;
				//$line .= $row['random'].delimiter;
				$line .= $row['size'].delimiter;
				/*$line .= $row['undecided'].delimiter;
				$line .= $row['rejected'].delimiter;
				$line .= $row['inappropriate'].delimiter;
				$line .= $row['stat'].delimiter;
				$line .= $row['orientation'].delimiter;
				$line .= $row['checkboxhide'].delimiter;
				$line .= $row['reminder'].delimiter;*/
				$line .= $row['visible'].delimiter;
				/*$line .= $row['textfield'].delimiter;
				$line .= $row['textfield_label'].delimiter;
				$line .= $row['cela'].delimiter;
				$line .= $row['decimalna'].delimiter;
				$line .= $row['enota'].delimiter;
				$line .= $row['timer'].delimiter;
				$line .= $row['sistem'].delimiter;
				$line .= $row['folder'].delimiter;*/
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['params']) ).delimiter;
				/*$line .= $row['antonucci'].delimiter;
				$line .= $row['design'].delimiter;
				$line .= $row['podpora'].delimiter;
				$line .= $row['grids'].delimiter;
				$line .= $row['grids_edit'].delimiter;
				$line .= $row['grid_subtitle1'].delimiter;
				$line .= $row['grid_subtitle2'].delimiter;
				$line .= $row['ranking_k'].delimiter;
				$line .= $row['vsota'].delimiter;
				$line .= $row['vsota_limit'].delimiter;
				$line .= $row['vsota_min'].delimiter;
				$line .= $row['skala'].delimiter;
				$line .= $row['vsota_reminder'].delimiter;
				$line .= $row['vsota_limittype'].delimiter;
				$line .= $row['vsota_show'].delimiter;
				$line .= $row['thread'].delimiter;
				$line .= $row['text_kosov'].delimiter;
				$line .= $row['text_orientation'].delimiter;
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['note']) ).delimiter;
				$line .= $row['upload'].delimiter;
				$line .= $row['dostop'].delimiter;
				$line .= $row['inline_edit'].delimiter;
				$line .= $row['onchange_submit'].delimiter;
				$line .= $row['hidden_default'].delimiter;
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['naslov_graf']) ).delimiter;
				$line .= $row['edit_graf'].delimiter;
				$line .= $row['wide_graf'].delimiter;
				$line .= $row['coding'].delimiter;
				$line .= $row['dynamic_mg'].delimiter;
				
				$sql1 = sisplet_query("SELECT f.* FROM srv_branching b, srv_if f WHERE b.element_spr = '$row[id]' AND b.parent=f.id");
				$row1 = mysqli_fetch_array($sql1);
				$line .= $this->parentIf($id, $row1['id']).delimiter;*/
	
				fwrite($fd, $line."\r\n");
			}
		}
		
		fclose($fd);
	}
	
	// Pripravi csv z itemi
	private function prepareItemCSV(){
		global $site_path;
		global $lang;	
		global $admin_type;
		
		define('delimiter', ';');

		$temp_folder = $site_path . TEMP_FOLDER.'/';
	
		$fd = fopen($temp_folder.'/items_'.$this->anketa.'.csv', "w");
	
		// Prva vrstica
		$output = '';
		$output .= 'ID SURVEY'.delimiter;
		$output .= 'ID QUESTION'.delimiter;
		$output .= 'ID ITEM'.delimiter;
		
		/*$output .= 'naslov'.delimiter;
		$output .= 'naslov2'.delimiter;*/
		$output .= 'variable'.delimiter;
		$output .= 'variable_custom'.delimiter;
		$output .= 'vrstni_red'.delimiter;
		/*$output .= 'random'.delimiter;
		$output .= 'other'.delimiter;
		$output .= 'if_id'.delimiter;
		$output .= 'size'.delimiter;
		$output .= 'naslov_graf'.delimiter;
		
		$output .= 'grid_vrstni_red'.delimiter;
		$output .= 'grid_variable'.delimiter;
		$output .= 'grid_other'.delimiter;
		$output .= 'grid_naslov'.delimiter;*/

		fwrite($fd, $output."\r\n");
		
			
		// Vrstice s podatki
		$sql = sisplet_query("SELECT v.id, v.spr_id, v.variable, v.variable_custom, v.vrstni_red 
								FROM srv_vrednost v, srv_spremenljivka s, srv_grupa g 
								WHERE v.spr_id=s.id AND s.gru_id=g.id AND g.ank_id='".$this->anketa."' 
								ORDER BY g.vrstni_red, s.vrstni_red");
		if (!$sql) echo mysqli_error($GLOBALS['connect_db']);
		if (mysqli_num_rows($sql) > 0) {
						
			while ($row = mysqli_fetch_array($sql)) {
				
				$line = '';
				
				$line .= $this->anketa.delimiter;
				$line .= $row['spr_id'].delimiter;
				$line .= $row['id'].delimiter;

				/*$line .= str_replace("\n", '', str_replace(delimiter, '', $row['naslov']) ).delimiter;
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['naslov2']) ).delimiter;*/
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['variable']) ).delimiter;
				$line .= $row['variable_custom'].delimiter;
				$line .= $row['vrstni_red'].delimiter;
				/*$line .= $row['random'].delimiter;
				$line .= $row['other'].delimiter;
				$line .= $row['if_id'].delimiter;
				$line .= $row['size'].delimiter;
				$line .= str_replace("\n", '', str_replace(delimiter, '', $row['naslov_graf']) ).delimiter;
				
				$sql1 = sisplet_query("SELECT * FROM srv_grid WHERE spr_id = '$row[spr_id]' ORDER BY vrstni_red ASC");
				while ($row1 = mysqli_fetch_array($sql1)) {
					
					$line .= str_replace("\n", '', str_replace(delimiter, '', $row1['vrstni_red']) ).delimiter;
					$line .= str_replace("\n", '', str_replace(delimiter, '', $row1['variable']) ).delimiter;
					$line .= str_replace("\n", '', str_replace(delimiter, '', $row1['other']) ).delimiter;
					$line .= str_replace("\n", '', str_replace(delimiter, '', $row1['naslov']) ).delimiter;
				}*/
				
				fwrite($fd, $line."\r\n");
			}
		}
		
		fclose($fd);
	}
	
	
	// Pobrisemo zacasne datoteke
	private function deleteTemp(){
		global $site_path;
		
		$temp_folder = $site_path . TEMP_FOLDER.'/';
		$result_folder = $site_path . RESULTS_FOLDER.'/';
		
		// Pobrisemo zacasno CSV datoteko s podatki
		if (file_exists($temp_folder.'/data_'.$this->anketa.'.csv')) {
			unlink($temp_folder.'/data_'.$this->anketa.'.csv');
		}
		
		// Pobrisemo zacasno CSV datoteko z vprasanji
		if (file_exists($temp_folder.'/questions_'.$this->anketa.'.csv')) {
			unlink($temp_folder.'/questions_'.$this->anketa.'.csv');
		}
		
		// Pobrisemo zacasno CSV datoteko z itemi
		if (file_exists($temp_folder.'/items_'.$this->anketa.'.csv')) {
			unlink($temp_folder.'/items_'.$this->anketa.'.csv');
		}
		
		// Pobrisemo CSV datoteko z rezultati
		if (file_exists($result_folder.'/usability_'.$this->anketa.'.csv')) {
			unlink($result_folder.'/usability_'.$this->anketa.'.csv');
		}
	}


	private function parentIf($anketa, $element) {
		$sql = sisplet_query("SELECT tip FROM srv_if WHERE id = '$element'");
		$row = mysqli_fetch_array($sql);
		
		if ($row['tip'] == 0) return $element;
		
		$sql1 = sisplet_query("SELECT parent FROM srv_branching WHERE ank_id='$anketa' AND element_if = '$element'");
		$row1 = mysqli_fetch_array($sql1);
		
		return parentIf($anketa, $row1['parent']);	
	}

	
	/** Funkcija ki nastavi vse filtre
	 *
	 */
	private function setUpFilter(){
		/*if ($this->dataFileStatus == FILE_STATUS_NO_DATA
				|| $this->dataFileStatus == FILE_STATUS_NO_FILE
				|| $this->dataFileStatus == FILE_STATUS_SRV_DELETED)
		{
			return false;
		}*/

		# poiščemo kater profil uporablja uporabnik
		$_currentMissingProfile = SurveyUserSetting :: getInstance()->getSettings('default_missing_profile');
		$this->currentMissingProfile = (isset($_currentMissingProfile) ? $_currentMissingProfile : 1);

		# filtriranje po statusih
		$this->_CURRENT_STATUS_FILTER = SurveyStatusProfiles :: getStatusAsAWKString();

		# filtriranje po časih
		$_time_profile_awk = SurveyTimeProfiles :: getFilterForAWK($this->_HEADERS['unx_ins_date']['grids']['0']['variables']['0']['sequence']);

		# dodamo še ife

		SurveyConditionProfiles :: setHeader($this->_HEADERS);
		$_condition_profile_AWK = SurveyConditionProfiles:: getAwkConditionString();

		if (($_condition_profile_AWK != "" && $_condition_profile_AWK != null ) 
				|| ($_time_profile_awk != "" && $_time_profile_awk != null)) 
		{
			$this->_CURRENT_STATUS_FILTER  = '('.$this->_CURRENT_STATUS_FILTER;
			if ($_condition_profile_AWK != "" && $_condition_profile_AWK != null ) 
			{
				$this->_CURRENT_STATUS_FILTER .= ' && '.$_condition_profile_AWK;
			}
			if ($_time_profile_awk != "" && $_time_profile_awk != null) 
			{
				$this->_CURRENT_STATUS_FILTER .= ' && '.$_time_profile_awk;
			}
			$this->_CURRENT_STATUS_FILTER .= ')';
		}
		$status_filter = $this->_CURRENT_STATUS_FILTER;

		if ($this->dataFileStatus == FILE_STATUS_OK || $this->dataFileStatus == FILE_STATUS_OLD) 
		{
			if (isset($this->_HEADERS['testdata'])) 
			{
				$this->_HAS_TEST_DATA = true;
			}
		}
		
		$smv = new SurveyMissingValues($this->anketa);
		$smv -> Init();
		
		$smv_array = $smv->GetSurveyMissingValues($this->anketa);
		if (!empty($smv_array[1])){
			foreach ($smv_array[1] AS $_survey_missings)
			{
				$this->_missings[$_survey_missings['value']] = $_survey_missings['text'];
				
			}
		}
		if (!empty($smv_array[2])){
			foreach ($smv_array[2] AS $_survey_unsets)
			{
				$this->_unsets[$_survey_unsets['value']] = $_survey_unsets['text'];
			}
		}
	}

	private function setUserFilters(){
		# Nastavimo filtre variabel
		$dvp = SurveyUserSetting :: getInstance()->getSettings('default_variable_profile');
		$_currentVariableProfile = SurveyVariablesProfiles :: checkDefaultProfile($dvp);
		if ($dvp != $_currentVariableProfile) {
			SurveyUserSetting :: getInstance()->saveSettings('default_variable_profile', $_currentVariableProfile);
		}
		$this->_PROFILE_ID_VARIABLE = $_currentVariableProfile;

		# ali prikazujemo tudi stolpce z 0 vrednostmi
		if (isset($this->sessionData['usable_resp']['show_with_zero'])) {
			$this->show_with_zero = $this->sessionData['usable_resp']['show_with_zero'];
		} 
		
		# ali prikazujemo tudi stolpce z 0 vrednostmi
		if (isset($this->sessionData['usable_resp']['show_details'])) {
			$this->show_details = $this->sessionData['usable_resp']['show_details'];
		} 
		
		# ali prikazujemo tudi stolpce z izracuni
		if (isset($this->sessionData['usable_resp']['show_calculations'])) {
			$this->show_calculations = $this->sessionData['usable_resp']['show_calculations'];
		} 

		# ali prikazujemo vrstice "Drugo"
		$this->show_with_other = true;
		if (isset($this->sessionData['usable_resp']['show_with_other'])) {
			$this->show_with_other = $this->sessionData['usable_resp']['show_with_other'];
		}

		# ali prikazujemo vrstice tipa "besedilo"
		$this->show_with_text = true;
		if (isset($this->sessionData['usable_resp']['show_with_text'])) {
			$this->show_with_text = $this->sessionData['usable_resp']['show_with_text'];
		}
		
		# Spodnja in zgornja meja za usable
		if (isset($this->sessionData['usable_resp']['bottom_usable_limit'])) {
			$this->bottom_usable_limit = $this->sessionData['usable_resp']['bottom_usable_limit'];
		}
		# ali prikazujemo tudi stolpce z 0 vrednostmi
		if (isset($this->sessionData['usable_resp']['top_usable_limit'])) {
			$this->top_usable_limit = $this->sessionData['usable_resp']['top_usable_limit'];
		}
	}
	
	// Ali imamo zgenerirano datoteko ali ne
	private function hasDataFile(){
		if ($this->dataFileStatus == FILE_STATUS_NO_DATA || $this->dataFileStatus == FILE_STATUS_NO_FILE 
				|| $this->dataFileStatus == FILE_STATUS_SRV_DELETED)
			return false;
		else
			return true;
	}
	
	private function setStatusFilter($status=''){
		
		$this->_CURRENT_STATUS_FILTER = $status;
	}
	
	
	
}