/
dashboard.php
2090 lines (2047 loc) · 92.8 KB
/
dashboard.php
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
<?php
################################################################################
# @Name : dashboard.php
# @Description : Display tickets list
# @Call : /index.php
# @Parameters :
# @Author : Flox
# @Create : 17/07/2009
# @Update : 06/12/2017
# @Version : 3.1.30 p2
################################################################################
//initialize variables
if(!isset($asc)) $asc = '';
if(!isset($img)) $img= '';
if(!isset($from)) $from='';
if(!isset($filter)) $filter='';
if(!isset($col)) $col='';
if(!isset($view)) $view='';
if(!isset($nkeyword)) $nkeyword='';
if(!isset($rowlastname)) $rowlastname='';
if(!isset($resultcriticality['color'])) $resultcriticality['color']= '';
if(!isset($displayusername)) $displayusername= '';
if(!isset($displaytechname)) $displaytechname= '';
if(!isset($u_group)) $u_group= '';
if(!isset($t_group)) $t_group= '';
if(!isset($techread)) $techread= '';
if(!isset($techread)) $techread= '';
if(!isset($start_page)) $start_page= '';
if(!isset($cursor)) $cursor= '';
if(!isset($date_start)) $date_start= '';
if(!isset($date_end)) $date_end= '';
if(!isset($_GET['ticket'])) $_GET['ticket']= '';
if(!isset($_GET['technician'])) $_GET['technician']= '';
if(!isset($_GET['u_group'])) $_GET['u_group']= '';
if(!isset($_GET['t_group'])) $_GET['t_group']= '';
if(!isset($_GET['category'])) $_GET['category']= '';
if(!isset($_GET['subcat'])) $_GET['subcat']= '';
if(!isset($_GET['asset'])) $_GET['asset']= '';
if(!isset($_GET['place'])) $_GET['place']= '';
if(!isset($_GET['service'])) $_GET['service']= '';
if(!isset($_GET['sender_service'])) $_GET['sender_service']= '';
if(!isset($_GET['agency'])) $_GET['agency']= '';
if(!isset($_GET['cursor'])) $_GET['cursor']= '';
if(!isset($_GET['searchengine'])) $_GET['searchengine'] = '';
if(!isset($_GET['company'])) $_GET['company'] = '';
if(!isset($_GET['user'])) $_GET['user'] = '';
if(!isset($_GET['date_create'])) $_GET['date_create'] = '';
if(!isset($_GET['date_res'])) $_GET['date_res'] = '';
if(!isset($_GET['date_hope'])) $_GET['date_hope'] = '';
if(!isset($_GET['date_start'])) $_GET['date_start'] = '';
if(!isset($_GET['date_end'])) $_GET['date_end'] = '';
if(!isset($_GET['date_range'])) $_GET['date_range'] = '';
if(!isset($_GET['view'])) $_GET['view'] = '';
if(!isset($_GET['state'])) $_GET['state'] = '';
if(!isset($_GET['priority'])) $_GET['priority'] = '';
if(!isset($_GET['title'])) $_GET['title'] = '';
if(!isset($_GET['criticality'])) $_GET['criticality'] = '';
if(!isset($_GET['type'])) $_GET['type'] = '';
if(!isset($_GET['place'])) $_GET['place'] = '';
if(!isset($_GET['way'])) $_GET['way'] = '';
if(!isset($_GET['order'])) $_GET['order'] = '';
if(!isset($_GET['techread'])) $_GET['techread'] = '';
if(!isset($_GET['companyview'])) $_GET['companyview'] = '';
if(!isset($_GET['techgroup'])) $_GET['techgroup'] = '';
//get value is for filter case
if(!isset($_POST['date'])) $_POST['date']= '';
if(!isset($_POST['selectrow'])) $_POST['selectrow']= '';
if(!isset($_POST['ticket'])) $_POST['ticket']=$_GET['ticket'];
if(!isset($_POST['technician'])) $_POST['technician']=$_GET['technician'];
if(!isset($_POST['title'])) $_POST['title']=$_GET['title'];
if(!isset($_POST['ticket'])) $_POST['ticket']= '';
if(!isset($_POST['userid'])) $_POST['userid']= '';
if(!isset($_POST['company'])) $_POST['company']= $_GET['company'];
if(!isset($_POST['user'])) $_POST['user']= $_GET['user'];
if(!isset($_POST['category'])) $_POST['category']=$_GET['category'];
if(!isset($_POST['subcat'])) $_POST['subcat']=$_GET['subcat'];
if(!isset($_POST['asset'])) $_POST['asset']=$_GET['asset'];
if(!isset($_POST['place'])) $_POST['place']=$_GET['place'];
if(!isset($_POST['service'])) $_POST['service']=$_GET['service'];
if(!isset($_POST['sender_service'])) $_POST['sender_service']=$_GET['sender_service'];
if(!isset($_POST['agency'])) $_POST['agency']=$_GET['agency'];
if(!isset($_POST['date_create'])) $_POST['date_create']=$_GET['date_create'];
if(!isset($_POST['date_hope'])) $_POST['date_hope']=$_GET['date_hope'];
if(!isset($_POST['date_res'])) $_POST['date_res']=$_GET['date_res'];
if(!isset($_POST['date_start'])) $_POST['date_start']=$_GET['date_start'];
if(!isset($_POST['date_end'])) $_POST['date_end']=$_GET['date_end'];
if(!isset($_POST['state'])) $_POST['state']=$_GET['state'];
if(!isset($_POST['priority'])) $_POST['priority']=$_GET['priority'];
if(!isset($_POST['criticality'])) $_POST['criticality']=$_GET['criticality'];
if(!isset($_POST['type'])) $_POST['type']=$_GET['type'];
if(!isset($_POST['u_group'])) $_POST['u_group']=$_GET['u_group'];
if(!isset($_POST['t_group'])) $_POST['t_group']=$_GET['t_group'];
//default values
if ($techread=='') $techread='%';
if ($state=='')$state='%';
if($_GET['way']=='') $_GET['way']='DESC';
if($_GET['category']=='') $_GET['category']= '%';
if($_GET['t_group']=='') $_GET['t_group']= '%';
if($_GET['u_group']=='') $_GET['u_group']= '%';
if($_GET['subcat']=='') $_GET['subcat']= '%';
if($_GET['asset']=='') $_GET['asset']= '%';
if($_GET['place']=='') $_GET['place']= '%';
if($_GET['cursor']=='') $_GET['cursor']='0';
if($_GET['techread']=='') $_GET['techread']='%';
if($_GET['type']=='') {$_GET['type']='%'; }
if($_POST['criticality']=='') $_POST['criticality']= '%';
if($_POST['priority']=='') $_POST['priority']='%';
if($_POST['state']=='') {$_POST['state']='%'; }
if($_POST['type']=='') {$_POST['type']='%'; }
//avoid page 2 bug when technician switch
if (($_POST['technician']!=$_GET['technician']) && ($_GET['cursor']!=0)) {$_GET['cursor']=0;}
//default values check user profil parameters
//if admin user
if($_SESSION['profile_id']==0 || $_SESSION['profile_id']==4)
{
if($_POST['technician']=='') $_POST['technician']= $_GET['userid'];
if($_POST['user']=='') $_POST['user']= '%';
} else {
if($_POST['user']=='') $_POST['user']= $_GET['userid'];
if($_POST['technician']=='') $_POST['technician']= '%';
}
if($_POST['date_create']=='') $_POST['date_create']= '%';
if($_POST['date_res']=='') $_POST['date_res']= '%';
if($_POST['sender_service']=='') $_POST['sender_service']= '%';
if($_POST['title']=='') $_POST['title']= '%';
if($_POST['ticket']=='') $_POST['ticket']= '%';
if($_POST['userid']=='') $_POST['userid']= '%';
if($_POST['category']=='') $_POST['category']= '%';
if($_POST['subcat']=='') $_POST['subcat']= '%';
if($_POST['asset']=='') $_POST['asset']= '%';
if($_POST['place']=='') $_POST['place']= '%';
if($_POST['service']=='') $_POST['service']= '%';
if($_POST['agency']=='') $_POST['agency']= '%';
if($_POST['company']=='') $_POST['company']= '%';
//technician and technician group separate
if(substr($_POST['technician'], 0, 1) =='G')
{
$t_group = explode("_", $_POST['technician']);
$t_group=$t_group[1];
$_GET['t_group']=$t_group;
$_POST['technician']='%';
}
//user and user group separate
if(substr($_POST['user'], 0, 1) =='G')
{
$u_group = explode("_", $_POST['user']);
$u_group=$u_group[1];
$_GET['u_group']=$u_group;
$_POST['user']='%';
}
//special case to filter technician group is send
if (($rright['side_your_tech_group']!=0) && ($_GET['techgroup']!=0))
{
$_POST['technician']="%";
}
//select order
if (($filter=='on' || $_GET['order']=='')){
if($ruser['dashboard_ticket_order'])
{
$_GET['order']=$ruser['dashboard_ticket_order'];
$_GET['way']='ASC';
} else {
//modify order to resolution date for state 3 and 4
if(preg_match("#tstates.number, tincidents.date_hope#i", "'.$rparameters[order].'") && (($_GET['state']==3) || ($_GET['state']==4)))
{
$_GET['order']='tincidents.date_res';
$_GET['way']='DESC';
} else {
$_GET['order']=$rparameters['order'];
}
}
$_GET['order']=str_replace(' ','', $_GET['order']);
}
elseif ($_GET['order']=='')
{$_GET['order']='priority';}
$db_order=strip_tags($db->quote($_GET['order']));
$db_order=str_replace("'","",$db_order);
if($_GET['way']=='ASC' || $_GET['way']=='DESC') {$db_way=$_GET['way'];} else {$db_way='DESC';}
$db_state=strip_tags($db->quote($_GET['state']));
$db_viewid=strip_tags($db->quote($_GET['viewid']));
$db_techgroup=strip_tags($db->quote($_GET['techgroup']));
$db_u_group=strip_tags($db->quote($_GET['u_group']));
$db_t_group=strip_tags($db->quote($_GET['t_group']));
$db_techread=strip_tags($db->quote($_GET['techread']));
$db_keywords=strip_tags($db->quote($_GET['keywords']));
if(is_numeric($_GET['cursor'])) {$db_cursor=$_GET['cursor'];} else {$db_cursor=0;}
//meta state generation
if($_GET['state']=='meta')
{
$state="AND (tincidents.state LIKE 1 OR tincidents.state LIKE 2 OR tincidents.state LIKE 6)";
//change order in this case
if ($_GET['order']=='tstates.number, tincidents.priority, tincidents.criticality, tincidents.date_create') {$_GET['order']='tincidents.priority, tincidents.criticality, tincidents.date_create';}
if ($_GET['order']=='tstates.number, tincidents.priority, tincidents.criticality, tincidents.date_hope') {$_GET['order']='tincidents.priority, tincidents.criticality, tincidents.date_hope';}
if ($_GET['order']=='tstates.number, tincidents.date_hope, tincidents.priority, tincidents.criticality') {$_GET['order']='tincidents.date_hope, tincidents.priority, tincidents.criticality';}
if ($_GET['order']=='tstates.number, tincidents.date_hope, tincidents.criticality, tincidents.priority') {$_GET['order']='tincidents.date_hope, tincidents.criticality, tincidents.priority';}
if ($_GET['order']=='tstates.number, tincidents.criticality, tincidents.date_hope, tincidents.priority') {$_GET['order']='tincidents.criticality, tincidents.date_hope, tincidents.priority';}
} else {
$state='AND tincidents.state LIKE \''.$_POST['state'].'\'';
}
$url_post_parameters="userid=$_GET[userid]&state=$_POST[state]&viewid=$_GET[viewid]&ticket=$_POST[ticket]&technician=$_POST[technician]&user=$_POST[user]&sender_service=$_POST[sender_service]&category=$_POST[category]&subcat=$_POST[subcat]&asset=$_POST[asset]&title=$_POST[title]&date_create=$_POST[date_create]&priority=$_POST[priority]&criticality=$_POST[criticality]&place=$_POST[place]&service=$_POST[service]&agency=$_POST[agency]&companyview=$_GET[companyview]&type=$_POST[type]&company=$_POST[company]&keywords=$keywords&view=$_GET[view]&date_start=$_POST[date_start]&date_end=$_POST[date_end]";
//special case redirect to all ticket if date create is filtered on activity view
if(!isset($today)) {$today=date('Y-m-d');}
if($_GET['view']=='activity' && $_POST['date_create']!=$today && $_POST['date_create']!='current' && $_POST['date_create']!='%')
{
echo "<SCRIPT LANGUAGE='JavaScript'>
<!--
function redirect()
{
window.location='./index.php?page=dashboard&userid=%&state=%&ticket=%&technician=%&user=%&category=%&subcat=%&title=%&date_create=$_POST[date_create]&priority=%&criticality=%&company=%'
}
setTimeout('redirect()',0);
-->
</SCRIPT>";
}
if($_GET['view']=='activity' && $_POST['date_res']!=$today && $_POST['date_res']!='current' && $_POST['date_res']!='%')
{
echo "<SCRIPT LANGUAGE='JavaScript'>
<!--
function redirect()
{
window.location='./index.php?page=dashboard&userid=%&state=%&ticket=%&technician=%&user=%&category=%&subcat=%&title=%&date_res=$_POST[date_res]&priority=%&criticality=%&company=%'
}
setTimeout('redirect()',0);
-->
</SCRIPT>";
}
//load in url parameter of filter, for using back button of browser on ticket page
if(
($_POST['ticket']!='%' && $_GET['ticket']=='%') ||
($_POST['technician']!='%' && $_GET['technician']=='%') ||
($_POST['user']!='%' && $_GET['user']=='%') ||
($_POST['sender_service']!='%' && $_GET['sender_service']=='%') ||
($_POST['category']!='%' && $_GET['category']=='%') ||
($_POST['subcat']!='%' && $_GET['subcat']=='%') ||
($_POST['asset']!='%' && $_GET['asset']=='%') ||
($_POST['title']!='%' && $_GET['title']=='%') ||
($_POST['priority']!='%' && $_GET['priority']=='%') ||
($_POST['criticality']!='%' && $_GET['criticality']=='%') ||
($_POST['place']!='%' && $_GET['place']=='%') ||
($_POST['service']!='%' && $_GET['service']=='%') ||
($_POST['agency']!='%' && $_GET['agency']=='%') ||
($_POST['type']!='%' && $_GET['type']=='%') ||
($_POST['company']!='%' && $_GET['company']=='%') ||
($_POST['keywords']!='' && $_GET['keywords']=='') ||
($_GET['date_range']==1)
)
{
$reload=1;
//redirect
echo "<SCRIPT LANGUAGE='JavaScript'>
<!--
function redirect()
{
window.location='./index.php?page=dashboard&$url_post_parameters'
}
setTimeout('redirect()',0);
-->
</SCRIPT>";
echo '<i class="icon-spinner icon-spin"></i> '.T_('Chargement...');
exit;
} else {$reload=0;}
///// SQL QUERY
//Date conversion for filter line
if ($_POST['date_create']!='%')
{
$date_create=$_POST['date_create'];
$find='/';
$find= strpos($date_create, $find);
if ($find!=false)
{
$date_create=explode("/",$date_create);
$_POST['date_create']="$date_create[2]-$date_create[1]-$date_create[0]";
}
}
if ($_POST['date_hope']!='%')
{
$date_hope=$_POST['date_hope'];
$find='/';
$find= strpos($date_hope, $find);
if ($find!=false)
{
$date_hope=explode("/",$date_hope);
$_POST['date_hope']="$date_hope[2]-$date_hope[1]-$date_hope[0]";
}
}
if ($_POST['date_res']!='%')
{
$date_res=$_POST['date_res'];
$find='/';
$find= strpos($date_res, $find);
if ($find!=false)
{
$date_res=explode("/",$date_res);
$_POST['date_res']="$date_res[2]-$date_res[1]-$date_res[0]";
}
}
if ($keywords && $reload==0)
{
include "./core/searchengine_ticket.php";
} else {
//escape special char and secure string before database insert
$db_sender_service=strip_tags($db->quote($_POST['sender_service']));
$db_category=strip_tags($db->quote($_POST['category']));
$db_subcat=strip_tags($db->quote($_POST['subcat']));
$db_asset=strip_tags($db->quote($_POST['asset']));
$db_userid=strip_tags($db->quote($_POST['userid']));
$db_user=strip_tags($db->quote($_POST['user']));
$db_ticket=strip_tags($db->quote($_POST['ticket']));
$db_priority=strip_tags($db->quote($_POST['priority']));
$db_criticality=strip_tags($db->quote($_POST['criticality']));
$db_type=strip_tags($db->quote($_POST['type']));
$db_technician=strip_tags($db->quote($_POST['technician']));
$db_title=strip_tags($db->quote($_POST['title']));
$db_title=str_replace("'","",$db_title);
$db_u_group=strip_tags($db->quote($_GET['u_group']));
$db_t_group=strip_tags($db->quote($_GET['t_group']));
$db_techread=strip_tags($db->quote($_GET['techread']));
//build SQL query
$select= "DISTINCT tincidents.*";
$from="tincidents";
$join='LEFT JOIN tstates ON tincidents.state=tstates.id ';
$where="
tincidents.disable='0'
AND tincidents.sender_service LIKE $db_sender_service
AND tincidents.u_group LIKE $db_u_group
AND tincidents.t_group LIKE $db_t_group
AND tincidents.techread LIKE $db_techread
AND tincidents.category LIKE $db_category
AND tincidents.subcat LIKE $db_subcat
AND tincidents.asset_id LIKE $db_asset
AND tincidents.id LIKE $db_ticket
AND tincidents.user LIKE $db_userid
AND tincidents.date_hope LIKE '$_POST[date_hope]%'
AND tincidents.priority LIKE $db_priority
AND tincidents.criticality LIKE $db_criticality
AND tincidents.type LIKE $db_type
AND tincidents.title LIKE '%$db_title%'
$state
";
//special case to display ticket where technician is user associated to the ticket, and service limit is enabled
if($_SESSION['profile_id']==0 && $rparameters['user_limit_service']==1 && $_GET['userid']!='%')
{
$where.="AND (tincidents.technician LIKE $db_technician OR tincidents.user LIKE $db_technician) ";
} else {
$where.="AND tincidents.user LIKE $db_user AND tincidents.technician LIKE $db_technician ";
}
//special case to filter query when company view is selected
if ($rparameters['user_company_view']==1 && $rright['side_company']!=0)
{
$join.='LEFT JOIN tusers ON tincidents.user=tusers.id ';
$where.="AND tusers.company='$ruser[company]' ";
}
//special case to filter query when user company right is enable
if ($rright['dashboard_col_company']!=0)
{
$db_company=strip_tags($db->quote($_POST['company']));
if(!preg_match('#LEFT JOIN tusers#',$join)) {$join.='LEFT JOIN tusers ON tincidents.user=tusers.id ';}
$join.='LEFT JOIN tcompany ON tusers.company=tcompany.id';
$where.="AND tcompany.id LIKE $db_company ";
}
//special case where user have service and agency
if(($rparameters['user_agency']==1 && ($_GET['userid']=='%' || $_GET['userid']=='0'))&&($rparameters['user_limit_service']==1 && ($_GET['userid']=='%' || $_GET['userid']=='0'))&& $cnt_agency!=0 && $cnt_service!=0)
{
$where.= "$where_agency $where_service $parenthese2" ;
} else {
//special case query when agency parameter is enable to display agency ticket and user tickets
if($rparameters['user_agency']==1 && ($_GET['userid']=='%' || $_GET['userid']=='0')){$where.=$where_agency;} else {$where.=$where_agency_your;}
//special case query when service parameter is enable to display service ticket and user tickets
if($rparameters['user_limit_service']==1 && ($_GET['userid']=='%' || $_GET['userid']=='0')){$where.=$where_service;} else {$where.=$where_service_your;}
}
//special case to filter query when place view is selected
if($rparameters['ticket_places']==1){
$db_place=strip_tags($db->quote($_POST['place']));
$where.="AND tincidents.place LIKE $db_place ";
}
//special case to filter query when service parameter is enable
if($rright['dashboard_col_service']!=0){
$db_service=strip_tags($db->quote($_POST['service']));
$where.="AND tincidents.u_service LIKE $db_service ";
}
//special case to filter query when agency parameter is enable
if($rright['dashboard_col_agency']!=0){
$db_agency=strip_tags($db->quote($_POST['agency']));
$where.="AND tincidents.u_agency LIKE $db_agency ";
}
//special case to filter query for activities tickets
if ($_GET['view']=='activity')
{
//case of range period selected else today tickets
if($_POST['date_start'] && $_POST['date_end'])
{
if(preg_match('#/#', $_POST['date_start'])) //convert date only if slash detected
{
//convert date format
$_POST['date_start']=DateTime::createFromFormat('d/m/Y', $_POST['date_start']);
$_POST['date_start']=$_POST['date_start']->format('Y-m-d');
$_POST['date_end']=DateTime::createFromFormat('d/m/Y', $_POST['date_end']);
$_POST['date_end']=$_POST['date_end']->format('Y-m-d');
}
//$join.='LEFT JOIN tthreads ON tincidents.id=tthreads.ticket';
//$where.="AND ((tincidents.date_create BETWEEN '$_POST[date_start] 00:00:00' AND '$_POST[date_end] 23:59:59') OR ((tincidents.date_res BETWEEN '$_POST[date_start] 00:00:00' AND '$_POST[date_end] 23:59:59') AND tincidents.date_res!='0000-00-00 00:00:00') OR (tthreads.date BETWEEN '$_POST[date_start] 00:00:00' AND '$_POST[date_end] 23:59:59' AND tthreads.type=0))";
$from="tincidents,tthreads,tstates";
$join='';
$where.="AND tincidents.id=tthreads.ticket AND tincidents.state=tstates.id ";
$where.="AND ((tincidents.date_create BETWEEN '$_POST[date_start] 00:00:00' AND '$_POST[date_end] 23:59:59') OR ((tincidents.date_res BETWEEN '$_POST[date_start] 00:00:00' AND '$_POST[date_end] 23:59:59') AND tincidents.date_res!='0000-00-00 00:00:00') OR (tthreads.date BETWEEN '$_POST[date_start] 00:00:00' AND '$_POST[date_end] 23:59:59' AND tthreads.type=0))";
} else {
//$join.='LEFT JOIN tthreads ON tincidents.id=tthreads.ticket';
//$where.="AND (tincidents.date_create LIKE '$_POST[date_create]%' OR tincidents.date_res LIKE '$_POST[date_create]%' OR (tthreads.date LIKE '$_POST[date_create]%' AND tthreads.type=0))";
$from="tincidents,tthreads,tstates";
$join='';
$where.="AND tincidents.id=tthreads.ticket AND tincidents.state=tstates.id ";
$where.="AND (tincidents.date_create LIKE '$_POST[date_create]%' OR tincidents.date_res LIKE '$_POST[date_create]%' OR (tthreads.date LIKE '$_POST[date_create]%' AND tthreads.type=0))";
}
//case company col
if ($rright['dashboard_col_company']!=0)
{
$from.=",tcompany,tusers";
$where.="AND tincidents.user=tusers.id AND tusers.company=tcompany.id ";
$where.="AND tcompany.id LIKE '$_POST[company]' ";
}
} else {
$where.="AND tincidents.date_create LIKE '$_POST[date_create]%' AND tincidents.date_res LIKE '$_POST[date_res]%'";
}
//special case to filter technician group is send
if (($rright['side_your_tech_group']!=0) && ($_GET['techgroup']!=0))
{
$where.="AND tincidents.t_group='$_GET[techgroup]' ";
}
}
if ($rparameters['debug']==1)
{
$where_debug=str_replace("AND", "AND <br />",$where);
$where_debug=str_replace("OR", "OR <br />",$where_debug);
$join_debug =str_replace("LEFT", "<br />LEFT",$join);
echo "
<b><u>DEBUG MODE:</u></b><br />
<b>SELECT</b> $select<br />
<b>FROM</b> $from
$join_debug<br />
<b>WHERE</b> <br />
$where_debug<br />
<b>ORDER BY</b> $db_order $db_way<br />
<b>LIMIT</b> $db_cursor,$rparameters[maxline]<br />
<b>VAR:</b>
POST_keywords=$_POST[keywords] GET_keywords=$db_keywords |
POST_state=$_POST[state] GET_state=$_GET[state] state=$state |
POST_date_create=$_POST[date_create] GET_date_create=$_GET[date_create] |
cnt_service=$cnt_service |
GET_view=$_GET[view] |
POST_date_start=$_POST[date_start] |
POST_date_end=$_POST[date_end]
";
if($user_services) {echo ' user_services=';foreach($user_services as $value) {echo $value.' ';}}
echo '| cnt_agency='.$cnt_agency;
if($user_agencies) {echo ' user_agencies=';foreach($user_agencies as $value) {echo $value.' ';}}
}
if($reload==0) //avoid double query for reload parameters in url optimization for large database
{
$masterquery = $db->query("
SELECT SQL_CALC_FOUND_ROWS $select
FROM $from
$join
WHERE $where
ORDER BY $db_order $db_way
LIMIT $db_cursor,
$rparameters[maxline]
");
} else {$masterquery='';}
$query=$db->query("SELECT FOUND_ROWS();");
$resultcount=$query->fetch();
$query->closeCursor();
//check box selection SQL updates
if($_POST['selectrow'] && $_POST['selectrow']!='selectall')
{
while ($row=$masterquery->fetch())
{
//initialize variables
if(!isset($_POST['checkbox'.$row["id"]])) $_POST['checkbox'.$row["id"]] = '';
if ($_POST['checkbox'.$row['id']]!='')
{
//change state
if($_POST['selectrow']=="delete")
{
$db->exec("UPDATE tincidents SET disable='1' WHERE id LIKE '$row[id]'");
echo '<div class="alert alert-block alert-success"><i class="icon-remove"></i> '.T_('Ticket').' '.$row['id'].' '.T_('supprimé').'.</div>';
} else {
$db->exec("UPDATE tincidents SET state='$_POST[selectrow]' WHERE id LIKE '$row[id]'");
echo '<div class="alert alert-block alert-success"><i class="icon-ok green"></i> '.T_('Ticket').' '.$row['id'].' '.T_('modifié').'.</div>';
//case solved state insert current date in resolution date
if ($_POST['selectrow']==3)
{
$currentdate=date("Y-m-d H:i:s");
$db->exec("UPDATE tincidents SET date_res='$currentdate' WHERE id LIKE '$row[id]'");
}
}
}
}
$masterquery->closeCursor();
//redirect
echo "<SCRIPT LANGUAGE='JavaScript'>
<!--
function redirect()
{
window.location='./index.php?page=dashboard&state=$_GET[state]&userid=$_GET[userid]'
}
setTimeout('redirect()',$rparameters[time_display_msg]);
-->
</SCRIPT>";
}
?>
<div class="page-header position-relative">
<h1>
<?php
if ($keywords)
{
$disp_keyword=str_replace("'","",$db_keywords);
echo '<i class="icon-search"></i> '.T_('Recherche de tickets').': '.$disp_keyword.' ';
}
elseif ($_GET['view']=='activity')
{
//convert and create date format to display
if($_POST['date_start'] && $_POST['date_end']) // case post date
{
//convert date to display
$date_start_db=DateTime::createFromFormat('Y-m-d', $_POST['date_start']);
$date_end_db=DateTime::createFromFormat('Y-m-d', $_POST['date_end']);
$date_start=$date_start_db->format('d/m/Y');
$date_end=$date_end_db->format('d/m/Y');
$date_start_db=$date_start_db->format('Y-m-d');
$date_end_db=$date_end_db->format('Y-m-d');
} else { //default date is today date
$date_start_db=DateTime::createFromFormat('Y-m-d', date('Y-m-d'));
$date_end_db=DateTime::createFromFormat('Y-m-d', date('Y-m-d'));
$date_start=$date_start_db->format('d/m/Y');
$date_end=$date_end_db->format('d/m/Y');
$date_start_db=$date_start_db->format('Y-m-d');
$date_end_db=$date_end_db->format('Y-m-d');
}
//count open ticket for selected period
$query="
SELECT DISTINCT(id) FROM `tincidents`
WHERE
tincidents.date_create BETWEEN '$date_start_db 00:00:00' AND '$date_end_db 23:59:59'
AND tincidents.id LIKE $db_ticket
AND tincidents.technician LIKE '$_POST[technician]'
AND tincidents.user LIKE '$_POST[user]'
AND tincidents.category LIKE '$_POST[category]'
AND tincidents.subcat LIKE '$_POST[subcat]'
AND tincidents.title LIKE '%$db_title%'
AND tincidents.date_create LIKE '$_POST[date_create]%'
AND tincidents.date_hope LIKE '$_POST[date_hope]%'
AND tincidents.date_res LIKE '$_POST[date_res]%'
AND tincidents.state LIKE '$_POST[state]'
AND tincidents.criticality LIKE '$_POST[criticality]'
AND tincidents.priority LIKE '$_POST[priority]'
AND disable='0'
$where_agency $where_service $parenthese2";
$query = $db->query($query);
$cnt_activity_open=$query->rowCount();
$query->closecursor();
//count advanced ticket for selected period (technician add text resolution and ticket not disable)
$query="
SELECT DISTINCT(tthreads.id) FROM `tthreads`,`tincidents`
WHERE
tincidents.id=tthreads.ticket
AND tincidents.technician=tthreads.author
AND tincidents.state!=3
AND tincidents.id LIKE $db_ticket
AND tincidents.technician LIKE '$_POST[technician]'
AND tincidents.user LIKE '$_POST[user]'
AND tincidents.category LIKE '$_POST[category]'
AND tincidents.subcat LIKE '$_POST[subcat]'
AND tincidents.title LIKE '%$db_title%'
AND tincidents.date_create LIKE '$_POST[date_create]%'
AND tincidents.date_hope LIKE '$_POST[date_hope]%'
AND tincidents.date_res LIKE '$_POST[date_res]%'
AND tincidents.state LIKE '$_POST[state]'
AND tincidents.criticality LIKE '$_POST[criticality]'
AND tincidents.priority LIKE '$_POST[priority]'
AND tincidents.disable=0
AND tthreads.type='0'
AND tthreads.date BETWEEN '$date_start_db 00:00:00' AND '$date_end_db 23:59:59'
$where_agency $where_service $parenthese2
";
$query = $db->query($query);
$cnt_activity_advanced=$query->rowCount();
$query->closecursor();
//count close tickets for selected period
$query="
SELECT DISTINCT(id) FROM `tincidents`
WHERE
tincidents.state='3'
AND tincidents.id LIKE $db_ticket
AND tincidents.technician LIKE '$_POST[technician]'
AND tincidents.user LIKE '$_POST[user]'
AND tincidents.category LIKE '$_POST[category]'
AND tincidents.subcat LIKE '$_POST[subcat]'
AND tincidents.title LIKE '%$db_title%'
AND tincidents.date_create LIKE '$_POST[date_create]%'
AND tincidents.date_hope LIKE '$_POST[date_hope]%'
AND tincidents.date_res LIKE '$_POST[date_res]%'
AND tincidents.state LIKE '$_POST[state]'
AND tincidents.criticality LIKE '$_POST[criticality]'
AND tincidents.priority LIKE '$_POST[priority]'
AND date_res BETWEEN '$date_start_db 00:00:00' AND '$date_end_db 23:59:59'
AND disable='0'
$where_agency $where_service $parenthese2";
$query = $db->query($query);
$cnt_activity_close=$query->rowCount();
$query->closecursor();
//display title with date selection form
echo '
<span title="'.T_("Liste des tickets modifiés: ouverts ou fermés ou sur lesquels un élément de résolution à été ajouté sur la période sélectionnée").'">
<i class="icon-calendar"></i>
'.T_('Tickets modifiés du').'
</span>
<form style="display: inline-block;" class="form-horizontal" name="period" id="period" method="post" action="./index.php?page=dashboard&userid='.$_GET['userid'].'&state=%&view=activity&date_range=1" onsubmit="loadVal();" >
<input type="text" size="10" name="date_start" id="date_start" value="'.$date_start.'" onchange="submit();" >
'.T_('au').'
<input type="text" size="10" name="date_end" id="date_end" value="'.$date_end.'" onchange="submit();" >
</form>
';
}
else
{
//find state name for display in title
$query=$db->query("SELECT description FROM tstates WHERE id=$db_state");
$rstate=$query->fetch();
$query->closeCursor();
if (!$rstate && !$_GET['viewid'] && !$_GET['techgroup']) $rstate['description']=T_('tickets non lus'); //case not read
if ($_GET['state']=='meta') $rstate['description']=T_('tickets à traiter'); //case not read
//special case for service only add name of services at the end of the title
if($rright['dashboard_service_only']!=0 && $rparameters['user_limit_service']==1 && $cnt_service!=0 )
{
$service_title='';
$cnt=0;
//get services of current user
$query=$db->query("SELECT service_id FROM tusers_services WHERE user_id='$_SESSION[user_id]'");
while ($row=$query->fetch())
{
$cnt++;
//get service name to display in title
$query2=$db->query("SELECT name FROM tservices WHERE id='$row[service_id]'");
$row2=$query2->fetch();
$query2->closeCursor();
if ($cnt==1){$service_title.=' '.$row2['name'];} else {$service_title.=' '.T_("et").' '.$row2['name'];}
}
$service_title=' '.T_("du service").' '.$service_title;
} else {$service_title='';}
//special case for agency only add name of agencies at the end of the title
if($rright['dashboard_agency_only']!=0 && $cnt_agency!=0 && $rparameters['user_agency'])
{
$agency_title='';
$cnt=0;
//get agencies of current user
$query=$db->query("SELECT agency_id FROM tusers_agencies WHERE user_id='$_SESSION[user_id]'");
while ($row=$query->fetch())
{
$cnt++;
//get agency name to display in title
$query2=$db->query("SELECT name FROM tagencies WHERE id='$row[agency_id]'");
$row2=$query2->fetch();
$query2->closeCursor();
if ($cnt==1){$agency_title.=' '.$row2['name'];} else {$agency_title.=' '.T_("et").' '.$row2['name'];}
}
$agency_title=' '.T_("de l'agence").' '.$agency_title;
} else {$agency_title='';}
//find view name to display in title
if ($_GET['viewid'])
{
$qview = $db->query("SELECT name FROM tviews WHERE id=$db_viewid");
$rview=$qview->fetch();
$rstate['description']=T_('tickets de la vue').' '.$rview['name'].'';
echo '<i class="icon-ticket"></i> '.T_('Tickets de la vue').' '.$rview['name'].'';
}
elseif($_GET['userid']=='%' && $_GET['companyview']=='')
{
if ($_GET['state']=='%') {echo '<i class="icon-ticket"></i> '.T_('Tous les tickets').$service_title.$agency_title;} else {echo '<i class="icon-ticket"></i> '.T_('Tous les').' '.T_($rstate['description']).$service_title.$agency_title;}
}
elseif ($_GET['userid']=='%' && $_GET['companyview']!='')
{
if ($_GET['state']=='%') {echo '<i class="icon-ticket"></i> '.T_('Tous les tickets de ma société');} else {echo '<i class="icon-ticket"></i> '.T_($rstate['description']).' '.T_('de ma société');}
}
elseif ($_GET['userid']!='0' && !$_GET['techgroup'])
{
if ($_GET['state']=='%') {echo '<i class="icon-ticket"></i> '.T_('Tous vos tickets').'';} else {echo '<i class="icon-ticket"></i> '.T_('Vos').' '.T_($rstate['description']).'';}
}
elseif ($_GET['techgroup'])
{
//get name of current group
$query = $db->query("SELECT name FROM tgroups WHERE id=$db_techgroup");
$group_name=$query->fetch();
$query->closeCursor();
echo '<i class="icon-ticket"></i> '.T_('Vos tickets du groupe').' '.$group_name['name'];
}
if($_GET['state']=='%' && $_GET['userid']==0 && $_GET['userid']!='%') echo '<i class="icon-ticket"></i> '.T_('Tous les tickets non attribués').''; //case not read
}
?>
<small>
<i class="icon-double-angle-right"></i>
<?php if($mobile==0) {echo T_('Nombre').':';} ?> <?php echo $resultcount[0]; ?></i>
</small>
<?php
//display counter section activity page
if ($_GET['view']=='activity')
{
echo ' | <small>
<span title="'.T_('Nombre de tickets pour lesquels la date de création est dans la période sélectionnée').'">'.T_('Ouverts').'</span>: '.$cnt_activity_open.'
<span title="'.T_("Nombre de tickets pour lesquels un élément de résolution textuel à été ajouté par le technicien en charge dans la période sélectionnée et qui ne sont pas dans l'état résolu").'">'.T_('Avancés').'</span>: '.$cnt_activity_advanced.'
<span title="'.T_("Nombre de tickets pour lesquels la date de résolution est dans la période sélectionnée et qui sont dans l'état résolu").'">'.T_('Fermés').':</span> '.$cnt_activity_close.'</small>';
}
?>
</h1>
</div>
<?php
//display message if search result is null
if($resultcount[0]==0 && $keywords!="") echo '<div class="alert alert-danger"><i class="icon-remove"></i> Aucun ticket trouvé pour la recherche: <strong>'.$db_keywords.'</strong></div>';
?>
<div class="row">
<div class="col-xs-12">
<div class="table-responsive">
<table id="sample-table-1" class="table table-striped table-bordered table-hover">
<?php
if($_GET['way']=='ASC') $arrow_way='DESC'; else $arrow_way='ASC';
//*********************** FIRST LIGN ***********************
echo '
<thead>
<tr>
<th '; if ($_GET['order']=='id') echo 'class="active"'; echo '>
<center>
<a title="'.T_('Numéro du ticket').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=id&way='.$arrow_way.'">
<i class="icon-tag"></i><br />
'.T_('Numéro');
//Display way arrows
if ($_GET['order']=='id'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo "
</a>
</center>
</th>
";
//display tech column, do not display tech column if technician is connected
if ($_SESSION['profile_id']!=0 || $_SESSION['profile_id']!=4 || $_GET['userid']=='%')
{
echo '
<th '; if ($_GET['order']=='technician') echo 'class="active"'; echo '>
<center>
<a title="'.T_('Technicien en charge du ticket').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=technician&way='.$arrow_way.'">
<i class="icon-user"></i><br />
'.T_('Technicien');
//Display arrows
if ($_GET['order']=='technician'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo'
</a>
</center>
</th>
';
}
//display user company column
if($rright['dashboard_col_company']!=0)
{
echo '
<th '; if ($_GET['order']=='company') echo 'class="active"'; echo '>
<center>
<a title="'.T_('Société du demandeur').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=company&way='.$arrow_way.'">
<i class="icon-building"></i><br />
'.T_('Société');
//Display arrows
if ($_GET['order']=='company'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo'
</a>
</center>
</th>
';
}
//display user column
if (($_SESSION['profile_id']==0 || $_SESSION['profile_id']==3 || $_SESSION['profile_id']==4) || ($rright['side_all']!=0 && ($_GET['userid']=='%'|| $keywords!='')) || ($rparameters['user_company_view']!=0 && $_GET['userid']=='%' && ($rright['side_company']!=0|| $keywords!='')))
{
echo '
<th '; if ($_GET['order']=='user') echo 'class="active"'; echo '>
<center>
<a title="'.T_('Demandeur associé au ticket').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=user&way='.$arrow_way.'">
<i class="icon-male"></i><br />
'.T_('Demandeur');
//Display arrows
if ($_GET['order']=='user'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo"
</a>
</center>
</th>
";
}
//display user service column
if ($rright['dashboard_col_user_service']!=0)
{
echo '
<th '; if ($_GET['order']=='sender_service') {echo 'class="active"';} echo '>
<center>
<a title="'.T_('Service du demandeur').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=sender_service&way='.$arrow_way.'">
<i class="icon-group"></i><br />
'.T_('Service du demandeur');
//Display arrows
if ($_GET['order']=='sender_service'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo"
</a>
</center>
</th>
";
}
//display ticket type column
if ($rright['dashboard_col_type']!=0)
{
echo '
<th '; if ($_GET['order']=='type') {echo 'class="active"';} echo '>
<center>
<a title="'.T_('Type de ticket').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=type&way='.$arrow_way.'">
<i class="icon-flag"></i><br />
'.T_('Type');
//Display arrows
if ($_GET['order']=='type'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo"
</a>
</center>
</th>
";
}
//display ticket category column
if ($rright['dashboard_col_category']!=0)
{
echo '
<th '; if ($_GET['order']=='category') {echo 'class="active"';} echo ' >
<center>
<a title="'.T_('Catégorie').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=category&way='.$arrow_way.'">
<i class="icon-sign-blank"></i><br />
'.T_('Catégorie');
//Display arrows
if ($_GET['order']=='category'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo '
</a>
</center>
</th>
';
}
//display ticket subcat column
if ($rright['dashboard_col_subcat']!=0)
{
echo'
<th '; if ($_GET['order']=='subcat') {echo 'class="active"';} echo ' >
<center>
<a title="'.T_('Sous-catégorie').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=subcat&way='.$arrow_way.'">
<i class="icon-sitemap"></i><br />
'.T_('Sous-catégorie');
//Display arrows
if ($_GET['order']=='subcat'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo '
</a>
</center>
</th>
';
}
//display ticket asset column
if ($rright['dashboard_col_asset']!=0)
{
echo'
<th '; if ($_GET['order']=='asset_id') {echo 'class="active"';} echo ' >
<center>
<a title="'.T_('Équipement').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=asset_id&way='.$arrow_way.'">
<i class="icon-desktop"></i><br />
'.T_('Équipement');
//Display arrows
if ($_GET['order']=='asset_id'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo '
</a>
</center>
</th>
';
}
?>
<?php if($rparameters['ticket_places']==1){ ?>
<th <?php if ($_GET['order']=='place') echo 'class="active"'; ?> >
<center>
<a title="<?php echo T_('Emplacement du ticket'); ?>" href="<?php echo './index.php?page=dashboard&'.$url_post_parameters; ?>&order=place&way=<?php echo $arrow_way; ?>">
<i class="icon-globe"></i><br />
<?php
echo T_('Lieu');
//Display arrows
if ($_GET['order']=='place'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
?>
</a>
</center>
</th>
<?php } ?>
<?php
if ($rright['dashboard_col_service']!=0)
{
echo'
<th '; if ($_GET['order']=='service') {echo 'class="active"';} echo ' >
<center>
<a title="'.T_('Service').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=u_service&way='.$arrow_way.'">
<i class="icon-group"></i><br />
'.T_('Service');
//Display arrows
if ($_GET['order']=='u_service'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo '
</a>
</center>
</th>
';
}
if ($rright['dashboard_col_agency']!=0)
{
echo'
<th '; if ($_GET['order']=='u_agency') {echo 'class="active"';} echo ' >
<center>
<a title="'.T_('Agence').'" href="./index.php?page=dashboard&'.$url_post_parameters.'&order=u_agency&way='.$arrow_way.'">
<i class="icon-globe"></i><br />
'.T_('Agence');
//Display arrows
if ($_GET['order']=='u_agency'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}
if ($_GET['way']=='DESC') {echo ' <i class="icon-sort-down"></i>';}
}
echo '
</a>
</center>
</th>
';
}
?>
<th <?php if ($_GET['order']=='title') echo 'class="active"'; ?> >
<center>
<a title="<?php echo T_('Titre du ticket'); ?>" href="<?php echo './index.php?page=dashboard&'.$url_post_parameters; ?>&order=title&way=<?php echo $arrow_way; ?>">
<i class="icon-file-text-alt"></i><br />
<?php
echo T_('Titre');
//Display arrows
if ($_GET['order']=='title'){
if ($_GET['way']=='ASC') {echo ' <i class="icon-sort-up"></i>';}