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
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
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
|
<?php
global $site_path;
include_once('../../function.php');
include_once('../survey/definition.php');
require_once('../exportclases/class.enka.pdf.php');
define("ALLOW_HIDE_ZERRO_REGULAR", false); // omogočimo delovanje prikazovanja/skrivanja ničelnih vnosti za navadne odgovore
define("ALLOW_HIDE_ZERRO_MISSING", true); // omogočimo delovanje prikazovanja/skrivanja ničelnih vnosti za missinge
define("NUM_DIGIT_AVERAGE", 2, true); // stevilo digitalnih mest za povprecje
define("NUM_DIGIT_DEVIATION", 2, true); // stevilo digitalnih mest za povprecje
define("M_ANALIZA_DESCRIPTOR", "descriptor", true);
define("M_ANALIZA_FREQUENCY", "frequency", true);
define("FNT_FREESERIF", "freeserif", true);
define("FNT_FREESANS", "freesans", true);
define("FNT_HELVETICA", "helvetica", true);
define("FNT_MAIN_TEXT", FNT_FREESANS, true);
define("FNT_QUESTION_TEXT", FNT_FREESANS, true);
define("FNT_HEADER_TEXT", FNT_FREESANS, true);
define("FNT_MAIN_SIZE", 10, true);
define("FNT_QUESTION_SIZE", 9, true);
define("FNT_HEADER_SIZE", 10, true);
define("RADIO_BTN_SIZE", 3, true);
define("CHCK_BTN_SIZE", 3, true);
define("LINE_BREAK", 6, true);
define ('PDF_MARGIN_HEADER', 8);
define ('PDF_MARGIN_FOOTER', 12);
define ('PDF_MARGIN_TOP', 18);
define ('PDF_MARGIN_BOTTOM', 18);
define ('PDF_MARGIN_LEFT', 15);
define ('PDF_MARGIN_RIGHT', 15);
/** Class za generacijo pdf-a
*
* @desc: po novem je potrebno form elemente generirati ro�no kot slike
*
*/
class PdfIzvozEditsAnalysis {
var $anketa;// = array(); // trenutna anketa
var $pi=array('canCreate'=>false); // za shrambo parametrov in sporocil
var $pdf;
var $currentStyle;
var $db_table = '';
public static $ss = null; //SurveyStatistic class
public static $sas = null; // $sas = new SurveyAdminSettings();class
/**
* @desc konstruktor
*/
function __construct ($anketa = null, $ssData)
{
global $site_path;
global $global_user_id;
//error_log(json_encode($_GET));
// preverimo ali imamo stevilko ankete
if ( is_numeric($anketa) )
{
$this->anketa['id'] = $anketa;
$this->anketa['podstran'] = $podstran;
// create new PDF document
$this->pdf = new enka_TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
}
else
{
$this->pi['msg'] = "Anketa ni izbrana!";
$this->pi['canCreate'] = false;
return false;
}
$this->sas = new SurveyAdminSettings(0,$this->anketa['id']);
//ustvarimo SurveyStatistic objekt in mu napolnimo variable
$this->ss = new SurveyStatistic();
$this->ss->Init($this->anketa['id'],true);
/*
$this->ss->realUsersByStatus_base = $ssData[0];
$this->ss->type = $ssData[1];
$this->ss->period = $ssData[2];
*/
/* intervali se več ne pošiljajo preko get, ker se polovijo iz porfila
if($ssData[1] != 'undefined')
$this->ss->startDate = $ssData[1];
if($ssData[2] != 'undefined')
$this->ss->endDate = $ssData[2];
$this->ss->type = $ssData[3];
$this->ss->period = $ssData[4];
//$this->ss->isDefaultFilters = false;
*/
if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init())
{
$this->anketa['uid'] = $global_user_id;
SurveyUserSetting::getInstance()->Init($this->anketa['id'], $this->anketa['uid']);
}
else
return false;
// ce smo prisli do tu je vse ok
$this->pi['canCreate'] = true;
return true;
}
// SETTERS && GETTERS
function checkCreate()
{
return $this->pi['canCreate'];
}
function getFile($fileName)
{
//Close and output PDF document
ob_end_clean();
$this->pdf->Output($fileName, 'I');
}
function init()
{
global $lang;
// array used to define the language and charset of the pdf file to be generated
$language_meta = Array();
$language_meta['a_meta_charset'] = 'UTF-8';
$language_meta['a_meta_dir'] = 'ltr';
$language_meta['a_meta_language'] = 'sl';
$language_meta['w_page'] = $lang['page'];
//set some language-dependent strings
$this->pdf->setLanguageArray($language_meta);
//set margins
$this->pdf->setPrintHeaderFirstPage(true);
$this->pdf->setPrintFooterFirstPage(true);
$this->pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$this->pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$this->pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set header and footer fonts
$this->pdf->setHeaderFont(Array(FNT_HEADER_TEXT, "I", FNT_HEADER_SIZE));
$this->pdf->setFooterFont(Array(FNT_HEADER_TEXT, 'I', FNT_HEADER_SIZE));
// set document information
$this->pdf->SetAuthor('An Order Form');
$this->pdf->SetTitle('An Order');
$this->pdf->SetSubject('An Order');
// set default header data
$this->pdf->SetHeaderData(null, null, "www.1ka.si", $this->encodeText(SurveyInfo::getInstance()->getSurveyAkronim()));
//set auto page breaks
$this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$this->pdf->SetFont(FNT_MAIN_TEXT, '', FNT_MAIN_SIZE);
//set image scale factor
$this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
return true;
}
function encodeText($text)
{ // popravimo sumnike ce je potrebno
$text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8');
$text = str_replace(array("š","š","č"),array("š","š","č"),$text);
return strip_tags($text);
}
function createPdf()
{
global $site_path;
global $lang;
$this->pdf->AddPage();
$this->pdf->setFont('','B','11');
$this->display();
}
public function display() {
global $lang;
$this->pdf->setDrawColor(200, 200, 200);
$this->pdf->setFillColor(150, 220, 150);
$sea=new SurveyEditsAnalysis($this->anketa['id']);
//se ponovi v funkciji ajax_drawContinuEditsTable
if ($_GET['seansa'] > 0)
$seansa = $_GET['seansa'];
else
$seansa = '30';
if (isset ($_GET['time']))
$time = $_GET['time'];
else
$time = '1 month';
if (isset ($_GET['status']))
$status = $_GET['status'];
else
$status = 0;
if (isset ($_GET['from']))
$from = $_GET['from'];
else
$from = '';
if (isset ($_GET['to']))
$to = $_GET['to'];
else
$to = '';
//create iterval - SQL where statement
$interval = $sea->createInterval($time, $from, $to);
//get object of all edits data
$data = $sea->getData($status, $interval);
}
/** Funkcija prikaze osnovnih informacij
*
*/
function DisplayInfoView() {
global $lang;
global $site_url;
$X = 10;
$Y = 25;
$height = 80;
$this->pdf->setXY($X, $Y);
//izrisemo okvir
$this->pdf->setFont('','B','8');
$this->pdf->SetTextColor(180, 0, 0);
$this->pdf->MultiCell(90, $height, $this->encodeText($lang['srv_statistic_info_title']), 1, 'L', 0, 0, 0 ,0, true);
$this->pdf->setXY($X, $Y+8);
$this->pdf->setFont('','','6');
$this->pdf->SetTextColor(0, 0, 0);
//ime ankete
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_name'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(70, 3, $this->encodeText(SurveyInfo::getSurveyTitle()), 0, 1, 'L', 0);
$this->pdf->setX($X);
//katere napredne možnosti so vklopljene
$row = SurveyInfo::getSurveyRow();
$enabled_advanced = null;
$prefix = '';
if ($row['uporabnost'] == 1) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_4'];
$prefix = ', ';
}
if ($row['user_from_cms'] == 1) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_5'];
$prefix = ', ';
}
if ($row['quiz'] == 1) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_6'];
$prefix = ', ';
}
if ($row['phone'] == 1) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_7'];
$prefix = ', ';
}
if ($row['social_network'] == 1) {
$enabled_advanced .= $prefix . $lang['srv_vrsta_survey_type_8'];
$prefix = ', ';
}
//tip ankete
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_type'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_vrsta_survey_type_'.SurveyInfo::getSurveyType()] . ($enabled_advanced != null ? ' ('.$enabled_advanced.')' : '' )), 0, 1, 'L', 0);
$this->pdf->setX($X);
//vprašanj, variabel
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_questions'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(15, 3, $this->encodeText(SurveyInfo::getSurveyQuestionCount()), 0, 0, 'L', 0);
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_variables'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(15, 3, $this->encodeText(SurveyInfo::getSurveyVariableCount()), 0, 1, 'L', 0);
$this->pdf->setX($X);
//uporabnikov, odgovorov
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_analiza_stUporabnikov'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(15, 3, $this->encodeText(SurveyInfo::getSurveyAnswersCount()), 0, 0, 'L', 0);
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_answers_valid'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(15, 3, $this->encodeText(SurveyInfo::getSurveyApropriateAnswersCount()), 0, 1, 'L', 0);
$this->pdf->setX($X);
//jezik ankete
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_language'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(70, 3, $this->encodeText(SurveyInfo::getRespondentLanguage()), 0, 1, 'L', 0);
$this->pdf->setX($X);
//avtor
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_creator'].':'), 0, 0, 'L', 0);
$text = '';
$text .= SurveyInfo::getSurveyInsertName();
if (SurveyInfo::getSurveyInsertDate() && SurveyInfo::getSurveyInsertDate() != "00.00.0000")
$text .= SurveyInfo::getDateTimeSeperator() . $this->ss->dateFormat(SurveyInfo::getSurveyInsertDate(),DATE_FORMAT_SHORT);
if (SurveyInfo::getSurveyInsertTime() && SurveyInfo::getSurveyInsertTime() != "00:00:00")
$text .= SurveyInfo::getDateTimeSeperator() . $this->ss->dateFormat(SurveyInfo::getSurveyInsertTime(),TIME_FORMAT_SHORT);
$this->pdf->Cell(70, 3, $this->encodeText($text), 0, 1, 'L', 0);
$this->pdf->setX($X);
//spreminjal
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_modify'].':'), 0, 0, 'L', 0);
$text = '';
$text .= SurveyInfo::getSurveyEditName();
if (SurveyInfo::getSurveyEditDate() && SurveyInfo::getSurveyEditDate() != "00.00.0000")
$text .= SurveyInfo::getDateTimeSeperator() . $this->ss->dateFormat(SurveyInfo::getSurveyEditDate(),DATE_FORMAT_SHORT);
if (SurveyInfo::getSurveyEditTime() && SurveyInfo::getSurveyEditTime() != "00:00:00")
$text .= SurveyInfo::getDateTimeSeperator() . $this->ss->dateFormat(SurveyInfo::getSurveyEditTime(),TIME_FORMAT_SHORT);
$this->pdf->Cell(70, 3, $this->encodeText($text), 0, 1, 'L', 0);
$this->pdf->setX($X);
//dostop, Kdo razen avtorja ima dostop
$dostop = SurveyInfo::getSurveyAccessUsers();
if ($dostop) {
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_access'].':'), 0, 0, 'L', 0);
$prefix='';
foreach ( $dostop as $user) {
$prefix .= $user['name'].'; ';
}
$prefix = substr($prefix, 0, -2);
$this->pdf->Cell(70, 3, $this->encodeText($prefix), 0, 1, 'L', 0);
$this->pdf->setX($X);
}
//aktivnost
$activity = SurveyInfo:: getSurveyActivity();
$_last_active = end($activity);
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_displaydata_status'].':'), 0, 0, 'L', 0);
if (SurveyInfo::getSurveyColumn('active') == 1) {
$this->pdf->SetTextColor(0,150,0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_anketa_active2']), 0, 1, 'L', 0);
} else {
# preverimo ali je bila anketa že aktivirana
if (!isset($_last_active['starts'])) {
# anketa še sploh ni bila aktivirana
$this->pdf->SetTextColor(255,120,0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_survey_non_active_notActivated']), 0, 1, 'L', 0);
} else {
# anketa je že bila aktivirna ampak je sedaj neaktivna
$this->pdf->SetTextColor(255,120,0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_survey_non_active']), 0, 1, 'L', 0);
}
}
$this->pdf->SetTextColor(0);
$this->pdf->setX($X);
//trajanje: datumi aktivnosti
if ( count($activity) > 0 ) {
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_activity'].':'), 0, 0, 'L', 0);
$prefix = '';
foreach ($activity as $active) {
$_starts = explode('-',$active['starts']);
$_expire = explode('-',$active['expire']);
$prefix .= $_starts[2].'.'.$_starts[1].'.'.$_starts[0].'-'.$_expire[2].'.'.$_expire[1].'.'.$_expire[0];
$prefix .= '; ';
}
$this->pdf->Cell(70, 3, $this->encodeText($prefix), 0, 1, 'L', 0);
$this->pdf->setX($X);
}
# predviceni cas trajanja enkete
$skupni_cas = $this->sas->testiranje_cas(1);
$skupni_predvideni_cas = $this->sas->testiranje_predvidenicas(1);
$d = new Dostop();
//predviceni cas trajanja enkete
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_duration'].':'), 0, 0, 'L', 0);
$text = '';
$text .= ($skupni_cas != '') ? $skupni_cas.', ' : '';
$text .= $lang['srv_predvideno'].': '.$skupni_predvideni_cas;
$this->pdf->Cell(70, 3, $this->encodeText($text), 0, 1, 'L', 0);
$this->pdf->setX($X);
//VNOSI - pvi / zadnji vnos
$prvi_vnos_date = SurveyInfo::getSurveyFirstEntryDate();
$prvi_vnos_time = SurveyInfo::getSurveyFirstEntryTime();
$zadnji_vnos_date = SurveyInfo::getSurveyLastEntryDate();
$zadnji_vnos_time = SurveyInfo::getSurveyLastEntryTime();
if ($prvi_vnos_date != null) {
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_first_entry'].':'), 0, 0, 'L', 0);
$text = '';
$text .= $this->ss->dateFormat($prvi_vnos_date,DATE_FORMAT_SHORT);
$text .= $prvi_vnos_time != null ? (SurveyInfo::$dateTimeSeperator .$this->ss->dateFormat($prvi_vnos_time,TIME_FORMAT_SHORT)) : '';
$this->pdf->Cell(15, 3, $this->encodeText($text), 0, 0, 'L', 0);
}
if ($zadnji_vnos_date != null) {
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_info_last_entry'].':'), 0, 0, 'L', 0);
$text = '';
$text .= $this->ss->dateFormat($zadnji_vnos_date,DATE_FORMAT_SHORT);
$text .= $zadnji_vnos_time != null ? (SurveyInfo::$dateTimeSeperator .$this->ss->dateFormat($zadnji_vnos_time,TIME_FORMAT_SHORT)) : '';
$this->pdf->Cell(15, 3, $this->encodeText($text), 0, 0, 'L', 0);
}
$this->pdf->Cell(0, 0, '', 0, 1, 'L', 0);
$this->pdf->setX($X);
// Komentarji
$SD = new SurveyDiagnostics($this->anketa['id']);
$comments = $SD->testComments();
list($commentsAll,$commentsUnresolved,$commentsQuestionAll,$commentsQuestionUnresolved,$commentsUser,$commentsUserFinished) = $comments;
$commentsUserUnresolved = $commentsUser - $commentsUserFinished;
if (( (int)$commentsAll
+(int)$commentsUnresolved
+(int)$commentsQuestionAll
+(int)$commentsQuestionUnresolved
+(int)$commentsUser
+(int)$commentsUserFinished
) > 0 ) {
$this->pdf->Cell(20, 3, $this->encodeText($lang['srv_diagnostic_4_element_0'].':'), 0, 0, 'L', 0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_diagnostic_4_element_1'].': '.(int)$commentsAll.' / '.(int)$commentsUnresolved), 0, 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->Cell(20, 3, $this->encodeText(''), 0, 0, 'L', 0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_diagnostic_4_element_6'].': '.(int)$commentsQuestionAll.' / '.(int)$commentsQuestionUnresolved), 0, 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->Cell(20, 3, $this->encodeText(''), 0, 0, 'L', 0);
$this->pdf->Cell(70, 3, $this->encodeText($lang['srv_diagnostic_4_element_7'].': '.(int)$commentsUser.' / '.(int)$commentsUserUnresolved), 0, 1, 'L', 0);
$this->pdf->setX($X);
}
}
/** Funkcija prikaže statuse
*
*/
function DisplayStatusView() {
global $lang;
$X = 105;
$Y = 25;
$height = 80;
$this->pdf->setXY($X, $Y);
//izrisemo okvir
$this->pdf->setFont('','B','8');
$this->pdf->SetTextColor(180, 0, 0);
$this->pdf->MultiCell(90, $height, $this->encodeText($lang['srv_statistic_status_title']), 1, 'L', 0, 0, 0 ,0, true);
$this->pdf->setXY($X, $Y+8);
$this->pdf->setFont('','','6');
$this->pdf->SetTextColor(0, 0, 0);
$cntValid = 0; // da vemo ali izpisemo skupne
$cntNonValid = 0; // da vemo ali izpisemo skupne
foreach ($this->ss->appropriateStatus as $status) {
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['valid'][$status] == 0)) {// da ne delamo po neporebnem
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->userByStatus['valid'][$status]), 0, 1, 'L', 0);
$cntValid++;
$this->pdf->setX($X);
}
}
// vsota vlejavnih
if ($cntValid > 0 || !$this->ss->hideNullValues_status) {
$this->pdf->setFont('','B','6');
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_valid']), 'T', 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['valid']), 'T', 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
}
// izpišemo še neveljavne
foreach ($this->ss->unAppropriateStatus as $status) {
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['nonvalid'][$status] == 0)) {// da ne delamo po neporebnem
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->userByStatus['nonvalid'][$status]), 0, 1, 'L', 0);
$cntNonValid++;
$this->pdf->setX($X);
}
}
// se status null (neznan status)
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['nonvalid'][-1] == 0)) {// da ne delamo po neporebnem
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_null']), 0, 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText(isset($this->ss->userByStatus['nonvalid'][-1]) ? $this->ss->userByStatus['nonvalid'][-1] : '0'), 0, 1, 'L', 0);
$cntNonValid++;
$this->pdf->setX($X);
}
// vsota nevlejavnih
if ($cntNonValid > 0 || !$this->ss->hideNullValues_status) {
$this->pdf->setFont('','B','6');
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_nonvalid']), 'T', 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['nonvalid']), 'T', 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
}
$this->pdf->setFont('','B','6');
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum']), 'T', 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['valid']+$this->ss->cntUserByStatus['nonvalid']), 'T', 1, 'L', 0);
$this->pdf->setFont('','','6');
$this->pdf->setX($X);
# preštejemo še neposlana vabila
$str = "SELECT count(*) FROM srv_invitations_recipients WHERE ank_id='".$this->anketa['id']."' AND sent='0' AND deleted='0'";
$qry = sisplet_query($str);
list($cntUnsent) = mysqli_fetch_row($qry);
$this->ss->userByStatus['invitation'][0] = (int)$cntUnsent;
# še email vabila
foreach ($this->ss->invitationStatus as $status)
{
if (!($this->ss->hideNullValues_status && $this->ss->userByStatus['invitation'][$status] == 0))
{// da ne delamo po neporebnem
//echo '<span class="dashboard_status_span">' . $lang['srv_userstatus_'.$status] . ' ('.$status.') :</span>' . $this->ss->userByStatus['invitation'][$status].'<br/>';
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_userstatus_'.$status] . ' ('.$status.') :'), 0, 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->userByStatus['invitation'][$status]), 0, 1, 'L', 0);
$cntInvitation++;
$this->pdf->setX($X);
}
}
// vsota emaili
if ($cntInvitation > 0 || !$this->ss->hideNullValues_status) {
//echo '<div class="anl_dash_bt full strong"><span class="dashboard_status_span">'.$lang['srv_statistic_redirection_sum_invitation'].'</span>'.($this->cntUserByStatus['invitation']).'<br/></div><br/>';
$this->pdf->setFont('','B','6');
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_invitation']), 'T', 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($this->ss->cntUserByStatus['invitation']), 'T', 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
}
// testni podatki
if ((int)$this->ss->testDataCount > 0) {
$this->pdf->setFont('','B','6');
$this->pdf->Cell(90, 6, '', 'B', 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_test']), 'T', 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText((int)$this->ss->testDataCount), 'T', 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
}
// Skupaj enot
SurveySetting::getInstance()->setSID($this->anketa);
$view_count = SurveySetting::getInstance()->getSurveyMiscSetting('view_count'); if ($view_count == "") $view_count = 0;
if ($view_count > 0 || !$this->ss->hideNullValues_status){
$this->pdf->setFont('','B','6');
$this->pdf->Cell(45, 0, $this->encodeText($lang['srv_statistic_redirection_sum_view']), 'T', 0, 'L', 0);
$this->pdf->Cell(45, 0, $this->encodeText($view_count), 'T', 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
}
}
/** Funkcija prikaže statuse odgovorov
*
*/
function DisplayAnswerStateView() {
global $lang;
$X = 200;
$Y = 25;
$height = 80;
$this->pdf->setXY($X, $Y);
//izrisemo okvir
$this->pdf->setFont('','B','8');
$this->pdf->SetTextColor(180, 0, 0);
$this->pdf->MultiCell(90, $height, $this->encodeText($lang['srv_statistic_answer_state_title']), 1, 'L', 0, 0, 0 ,0, true);
$this->pdf->setXY($X, $Y+8);
$this->pdf->setFont('','B','6');
$this->pdf->SetTextColor(0, 0, 0);
$order = array('3ll','4ll','5ll',5,6);
$this->pdf->Cell(40, 0, $this->encodeText($lang['srv_statistic_answer_state_status']), 'B', 0, 'L', 0);
$this->pdf->Cell(25, 0, $this->encodeText($lang['srv_statistic_answer_state_frequency']), 'BLR', 0, 'C', 0);
$this->pdf->Cell(25, 0, $this->encodeText($lang['srv_statistic_answer_state_percent']), 'B', 1, 'C', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
foreach ($order as $key) {
$this->pdf->Cell(40, 0, $this->encodeText($lang['srv_userstatus_'.$key]), 0, 0, 'L', 0);
#frekvenca
$this->pdf->Cell(25, 0, $this->encodeText($this->ss->realUsersByStatus[$key]['cnt'] > 0 ? $this->ss->realUsersByStatus[$key]['cnt'] : '0'), 'LR', 0, 'C', 0);
#procenti
$this->pdf->Cell(25, 0, $this->encodeText( ((float)$this->ss->realUsersByStatus[$key]['percent'] > 1.0) ? '--' : $this->formatNumber($this->ss->realUsersByStatus[$key]['percent']*100,NUM_DIGIT_PERCENT,'%') ), 0, 1, 'C', 0);
$this->pdf->setX($X);
}
}
/** Funkcija za prikaz referalov
*
*/
function DisplayReferalsView() {
global $lang;
global $admin_type;
$height = 80;
$X = 10;
$Y = $height+30;
$this->pdf->setXY($X, $Y);
//izrisemo okvir
$this->pdf->setFont('','B','8');
$this->pdf->SetTextColor(180, 0, 0);
$this->pdf->MultiCell(90, $height, $this->encodeText($lang['srv_statistic_redirection_title']), 1, 'L', 0, 0, 0 ,0, true);
$this->pdf->setXY($X, $Y+8);
$this->pdf->setFont('','B','6');
$this->pdf->SetTextColor(0, 0, 0);
// izrisemo graf
if ( ( $this->ss->cntValidRedirections + $this->ss->cntNonValidRedirections ) > 0) {
$maxValue = $this->ss->maxRedirection * GRAPH_REDUCE;
$value_sum = 0;
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_site']), 0, 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($lang['srv_statistic_redirection_click']), 0, 1, 'R', 0);
$this->pdf->setX($X);
$this->pdf->Cell(90, 3, $this->encodeText(''), 'T', 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
if (count($this->ss->userRedirections["valid"])) {
$lineCount = 0;
foreach ($this->ss->userRedirections["valid"] as $key => $value) {
// zaenkrat je max stevilo vrstic 13 - drugace prebije na drugo stran
if($lineCount == 13){
$this->pdf->Cell(90, 0, ' ...', 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
break;
}
$this->pdf->Cell(20, 0, $this->encodeText($key), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
$value_sum += $value;
$lineCount++;
}
}
// dodamo še direktni link
if ($this->ss->userRedirections["direct"] > 0) {
$value = $this->ss->userRedirections["direct"];
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_direct']), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
$value_sum += $value;
}
// dodamo še email klik
if ($this->ss->userRedirections["email"] > 0) {
$value = $this->ss->userRedirections["email"];
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_email']), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
$value_sum += $value;
}
// dodamo sumo
$this->pdf->setFont('','B','6');
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_sum_clicked']), 'T', 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($value_sum), 'T', 1, 'L', 0);
$this->pdf->setFont('','','6');
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
// dodamo se neveljavne
$value_sum_nonvalid = 0;
for ($key = 2; $key >= 0; $key--) {
$value = $this->ss->userRedirections["$key"];
if ($value > 0) {
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_'.$key]), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
$value_sum_nonvalid += $value;
}
}
// dodamo sumo
if ($value_sum_nonvalid > 0 ) {
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_sum_nonvalid']), 0, 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($value_sum_nonvalid), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
}
if (!($value_sum_nonvalid == 0 || $value_sum == 0 )) {
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_sum']), 0, 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($value_sum+$value_sum_nonvalid), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 3);
$this->pdf->setX($X);
}
}
else {
$this->pdf->Cell(90, 0, $this->encodeText($lang['srv_statistic_show_no_referals']), 0, 1, 'L', 0);
$this->pdf->setX($X);
}
$this->pdf->setFont('','B','6');
$this->pdf->Cell(90, 0, $this->encodeText($lang['srv_count_ip_list'].': '.count($this->ss->ip_list)), 0, 1, 'L', 0);
$this->pdf->setX($X);
$this->pdf->setFont('','','6');
if ($admin_type==0 && count($this->ss->ip_list) > 0) {
$this->pdf->Cell(90, 0, $this->encodeText($lang['srv_detail_ip_list']), 0, 1, 'L', 0);
$this->pdf->setX($X);
foreach($this->ss->ip_list AS $key => $val) {
$this->pdf->Cell(20, 0, $this->encodeText($val), 0, 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($key), 0, 1, 'L', 0);
$this->pdf->setX($X);
}
}
}
/** Funkcija prikaze statistike
*
*/
function DisplayDateView() {
global $lang;
$height = 80;
$X = 105;
$Y = $height+30;
$this->pdf->setXY($X, $Y);
//izrisemo okvir
$this->pdf->setFont('','B','8');
$this->pdf->SetTextColor(180, 0, 0);
$this->pdf->MultiCell(90, $height, $this->encodeText($lang['srv_statistic_timeline_title']), 1, 'L', 0, 0, 0 ,0, true);
$this->pdf->setXY($X, $Y+8);
$this->pdf->setFont('','','6');
$this->pdf->SetTextColor(0, 0, 0);
$this->ss->maxValue *= GRAPH_REDUCE;
$cnt=0;
if ($this->ss->arrayRange) {
$lineCount = 0;
foreach ($this->ss->arrayRange as $key => $value) {
// zaenkrat je max stevilo vrstic 19 - drugace prebije na drugo stran
if($lineCount == 19){
$this->pdf->Cell(90, 0, ' ...', 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
break;
}
$label = $this->ss->formatStatsString($key, $this->ss->period);
$this->pdf->Cell(20, 0, $this->encodeText($label), 0, 0, 'L', 0);
$width = ($this->ss->maxValue && $value) ? (round($value / $this->ss->maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
$cnt+=$value;
$lineCount++;
}
// dodamo sumo
$this->pdf->setFont('','B','6');
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_redirection_sum'].':'), 'T', 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($cnt), 'T', 1, 'L', 0);
$this->pdf->setFont('','','6');
}
else {
$this->pdf->Cell(90, 0, $this->encodeText($lang['srv_no_data']), 0, 1, 'L', 0);
}
}
/** Funkcija za prikaz klikov po straneh
*
*/
function DisplayPagesStateView() {
global $lang;
$height = 80;
$X = 200;
$Y = $height+30;
$this->pdf->setXY($X, $Y);
//izrisemo okvir
$this->pdf->setFont('','B','8');
$this->pdf->SetTextColor(180, 0, 0);
$this->pdf->MultiCell(90, $height, $this->encodeText($lang['srv_statistic_pages_state_title']), 1, 'L', 0, 0, 0 ,0, true);
$this->pdf->setXY($X, $Y+8);
$this->pdf->setFont('','','6');
$this->pdf->SetTextColor(0, 0, 0);
//ali lovimo samo strani ki niso bile preskočene
$grupa_jump = "AND ug.preskocena = 0 ";
$sql = "SELECT g.id, g.naslov, COUNT(ug.usr_id) cnt FROM srv_grupa g".
" LEFT JOIN (SELECT * FROM srv_user_grupa".$this->ss->db_table." ug WHERE".
" ug.time_edit BETWEEN '".$this->ss->startDate."' AND '".$this->ss->endDate."' + INTERVAL 1 DAY ".$grupa_jump.") as ug ON g.id = ug.gru_id".
" WHERE g.ank_id = '".$this->ss->getSurveyId()."' GROUP BY g.id ORDER BY g.vrstni_red";
$qry = sisplet_query($sql);
$pages=array();
$maxValue = 0;
while ($row = mysqli_fetch_assoc($qry)) {
$pages[$row['id']] = array('naslov'=>$row['naslov'],'cnt'=>$row['cnt']);
$maxValue = max($maxValue, $row['cnt']);
}
$maxValue = max($maxValue, $this->ss->realUsersByStatus['3ll']['cnt']);
$maxValue = $maxValue * GRAPH_REDUCE;
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_statistic_answer_state_status']), 0, 0, 'L', 0);
$this->pdf->Cell(70, 0, $this->encodeText($lang['srv_statistic_redirection_click']), 0, 1, 'R', 0);
$this->pdf->setX($X);
$this->pdf->Cell(90, 3, $this->encodeText(''), 'T', 1, 'L', 0);
$this->pdf->setX($X);
# status 3 - "Klik na anketo"
$value = $this->ss->realUsersByStatus['3ll']['cnt'];
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_3']), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
# status 4 - "Klik na prvo stran"
$value = $this->ss->realUsersByStatus['4ll']['cnt'];
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_4']), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
# status 5 - "Začel izpolnjevati",
$value = $this->ss->realUsersByStatus[5]['cnt'];
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_5']), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
#strani
$this->pdf->Cell(90, 3, $this->encodeText(''), 'T', 1, 'L', 0);
$this->pdf->setX($X);
$lineCount = 0;
foreach ($pages as $key => $page) {
// zaenkrat je max vrstic 9 - drugace prebije na drugo stran
if($lineCount == 9){
$this->pdf->Cell(90, 0, ' ...', 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
break;
}
$value = $page['cnt'];
$this->pdf->Cell(20, 0, $this->encodeText($page['naslov']), 0, 0, 'L', 0);
$width = ($maxValue && $value) ? (round($value / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
$lineCount++;
}
#strani
$this->pdf->Cell(90, 3, $this->encodeText(''), 'T', 1, 'L', 0);
$this->pdf->setX($X);
# status 6 - "Koncal",
$value6 = $this->ss->realUsersByStatus[6]['cnt'];
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_6']), 0, 0, 'L', 0);
$width = ($maxValue && $value6) ? (round($value6 / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($value6), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
#če imamo lurkerje 6l dodamo skupaj konačal anketo (to je 6 + 6l) in nato še koliko jih je samo s statusom 6 (končal anketo)
# status 6l - "Koncal - lurker", izpišemo samo če obstajajo 6l
$lurkerjev = $this->ss->realUsersByStatus['6ll']['cnt'] - $value6;
if ($lurkerjev > 0) {
$valueall = $this->ss->realUsersByStatus['6ll']['cnt'] ;
# končal s tem da je lurker (6l)
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_6l']), 0, 0, 'L', 0);
$width = ($maxValue && $lurkerjev) ? (round($lurkerjev / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($lurkerjev), 0, 1, 'L', 0);
$this->pdf->setY($this->pdf->getY() + 1);
$this->pdf->setX($X);
#črta
$this->pdf->Cell(90, 3, $this->encodeText(''), 'T', 1, 'L', 0);
$this->pdf->setX($X);
# končal ne glede na to ali je lurker
$this->pdf->Cell(20, 0, $this->encodeText($lang['srv_userstatus_all']), 0, 0, 'L', 0);
$width = ($maxValue && $valueall) ? (round($valueall / $maxValue * 60, 0)) : 0.1;
$width = ($width == 0) ? 0.1 : $width;
$this->pdf->Cell($width, 0, $this->encodeText(''), 1, 0, 'L', 1);
$this->pdf->Cell(10, 0, $this->encodeText($valueall), 0, 1, 'L', 0);
}
}
/*Skrajsa tekst in doda '...' na koncu*/
function snippet($text,$length=64,$tail="...")
{
$text = trim($text);
$txtl = strlen($text);
if($txtl > $length)
{
for($i=1;$text[$length-$i]!=" ";$i++)
{
if($i == $length)
{
return substr($text,0,$length) . $tail;
}
}
$text = substr($text,0,$length-$i+1) . $tail;
}
return $text;
}
function drawLine()
{
$cy = $this->pdf->getY();
$this->pdf->Line(15, $cy , 195, $cy , $this->currentStyle);
}
function setUserId($usrId) {$this->anketa['uid'] = $usrId;}
function getUserId() {return ($this->anketa['uid'])?$this->anketa['uid']:false;}
function formatNumber($value,$digit=0,$sufix="")
{
if ( $value <> 0 && $value != null )
$result = round($value,$digit);
else
$result = "0";
$result = number_format($result, $digit, ',', '.').$sufix;
return $result;
}
}
?>
|