-
Notifications
You must be signed in to change notification settings - Fork 0
/
games_v3.php
1159 lines (1060 loc) · 35.6 KB
/
games_v3.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
define('DIR', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR);
define('DB_CLS', DIR . 'admin/class/db.cls.php');
define('COMMON', DIR . 'bhlcommon.php');
require DB_CLS;
require COMMON;
$db = new DB_Connect(MYSQL_INTRANET, 1);
if (!$db) die("Can't connect to database.");
$m = 'ppg';
$mm = 'Points';
$ppg1 = $r = $rpg1 = $apg1 = $ppg2 = $rpg2 = $apg2 = array();
extract($_REQUEST);
### NEW VARS ###
$rimage[0] = "1st.png";
$rimage[1] = "2nd.png";
$rimage[2] = "3rd.png";
### NEW VARS ###
$sql_ppg1 = "select ave.player_id, ave.player_name, ave.team_name, ave.score, round((ave.score / ave.games_played), 2) as pg,ave.team_id from (
select b.id as player_id, upper(concat(substr(b.player_fname,1,1), '. ', b.player_lname)) as player_name,
c.team_name, c.id as team_id,
sum(if(a.player_id=b.id, ((game_points_1*1) + (game_points_2*2) + (game_points_3*3)), 0)) as score,
sum(if(a.player_id=b.id, 1, 0)) as games_played
from bhleague.players_stats a, bhleague.players b, bhleague.teams c
where weekday(a.game_date) IN('1','5','6') and
(select case (weekday(a.game_date))
when '1' then b.team_id
when '5' then b.team_id2
when '6' then b.team_id3
end) = '$team1' and c.id = '$team1' and a.game_date ='$gamedate'
group by b.id
order by score desc) as ave
order by pg desc limit 3";
if ($rs = $db->query($sql_ppg1)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$ppg1[] = $row;
}
}
$rs->close();
}
$sql_rpg1 = "select ave.player_id, ave.player_name, ave.team_name, ave.score, round((ave.score / ave.games_played), 2) as pg,ave.team_id from (
select b.id as player_id, upper(concat(substr(b.player_fname,1,1), '. ', b.player_lname)) as player_name,
c.team_name, c.id as team_id,
sum(if(a.player_id=b.id, game_rebounds, 0)) as score,
sum(if(a.player_id=b.id, 1, 0)) as games_played
from bhleague.players_stats a, bhleague.players b, bhleague.teams c
where weekday(a.game_date) IN('1','5','6') and
(select case (weekday(a.game_date))
when '1' then b.team_id
when '5' then b.team_id2
when '6' then b.team_id3
end) = '$team1' and c.id = '$team1' and a.game_date ='$gamedate'
group by b.id
order by score desc) as ave
order by pg desc limit 3";
if ($rs = $db->query($sql_rpg1)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$rpg1[] = $row;
}
}
$rs->close();
}
$sql_apg1 = "select ave.player_id, ave.player_name, ave.team_name, ave.score, round((ave.score / ave.games_played), 2) as pg,ave.team_id from (
select b.id as player_id, upper(concat(substr(b.player_fname,1,1), '. ', b.player_lname)) as player_name,
c.team_name, c.id as team_id,
sum(if(a.player_id=b.id, game_assists, 0)) as score,
sum(if(a.player_id=b.id, 1, 0)) as games_played
from bhleague.players_stats a, bhleague.players b, bhleague.teams c
where weekday(a.game_date) IN('1','5','6') and
(select case (weekday(a.game_date))
when '1' then b.team_id
when '5' then b.team_id2
when '6' then b.team_id3
end) = '$team1' and c.id = '$team1' and a.game_date ='$gamedate'
group by b.id
order by score desc) as ave
order by pg desc limit 3";
if ($rs = $db->query($sql_apg1)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$apg1[] = $row;
}
}
$rs->close();
}
$sql_ppg2 = "select ave.player_id, ave.player_name, ave.team_name, ave.score, round((ave.score / ave.games_played), 2) as pg,ave.team_id from (
select b.id as player_id, upper(concat(substr(b.player_fname,1,1), '. ', b.player_lname)) as player_name,
c.team_name, c.id as team_id,
sum(if(a.player_id=b.id, ((game_points_1*1) + (game_points_2*2) + (game_points_3*3)), 0)) as score,
sum(if(a.player_id=b.id, 1, 0)) as games_played
from bhleague.players_stats a, bhleague.players b, bhleague.teams c
where weekday(a.game_date) IN('1','5','6') and
(select case (weekday(a.game_date))
when '1' then b.team_id
when '5' then b.team_id2
when '6' then b.team_id3
end) = '$team2' and c.id = '$team2' and a.game_date ='$gamedate'
group by b.id
order by score desc) as ave
order by pg desc limit 3";
if ($rs = $db->query($sql_ppg2)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$ppg2[] = $row;
}
}
$rs->close();
}
$sql_rpg2 = "select ave.player_id, ave.player_name, ave.team_name, ave.score, round((ave.score / ave.games_played), 2) as pg,ave.team_id from (
select b.id as player_id, upper(concat(substr(b.player_fname,1,1), '. ', b.player_lname)) as player_name,
c.team_name,c.id as team_id,
sum(if(a.player_id=b.id, game_rebounds, 0)) as score,
sum(if(a.player_id=b.id, 1, 0)) as games_played
from bhleague.players_stats a, bhleague.players b, bhleague.teams c
where weekday(a.game_date) IN('1','5','6') and
(select case (weekday(a.game_date))
when '1' then b.team_id
when '5' then b.team_id2
when '6' then b.team_id3
end) = '$team2' and c.id = '$team2' and a.game_date ='$gamedate'
group by b.id
order by score desc) as ave
order by pg desc limit 3";
if ($rs = $db->query($sql_rpg2)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$rpg2[] = $row;
}
}
$rs->close();
}
$sql_apg2 = "select ave.player_id, ave.player_name, ave.team_name, ave.score, round((ave.score / ave.games_played), 2) as pg,ave.team_id from (
select b.id as player_id, upper(concat(substr(b.player_fname,1,1), '. ', b.player_lname)) as player_name,
c.team_name,c.id as team_id,
sum(if(a.player_id=b.id, game_assists, 0)) as score,
sum(if(a.player_id=b.id, 1, 0)) as games_played
from bhleague.players_stats a, bhleague.players b, bhleague.teams c
where weekday(a.game_date) IN('1','5','6') and
(select case (weekday(a.game_date))
when '1' then b.team_id
when '5' then b.team_id2
when '6' then b.team_id3
end) = '$team2' and c.id = '$team2' and a.game_date ='$gamedate'
group by b.id
order by score desc) as ave
order by pg desc limit 3";
if ($rs = $db->query($sql_apg2)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$apg2[] = $row;
}
}
$rs->close();
}
$sql = "select rank.team, round(rank.pts_for - rank.pts_against, 0) as pts_diff from (
select b.team_name as team,
sum(if(a.game_winner=b.id,1,0)) as wins,
sum(if(a.game_loser=b.id,1,0)) as losses,
(sum(if(a.game_winner=b.id,a.winner_score,0)) + sum(if(a.game_loser=b.id,a.loser_score,0))) as pts_for,
(sum(if(a.game_winner=b.id,a.loser_score,0)) + sum(if(a.game_loser=b.id,a.winner_score,0))) as pts_against
from bhleague.games_stats a, bhleague.teams b
where weekday(a.game_date) = '{$gameday}'
group by b.id having pts_for <> 0
order by wins desc, losses asc) as rank
order by pts_diff desc limit 8;";
if ($rs = $db->query($sql)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
while ($row = $rs->fetch_assoc()) {
$r[] = $row;
}
}
$rs->close();
}
$sql = "select date_format(game_date, '%M %e') as game_date, dayname(game_date) as game_dayname from bhleague.`schedule` where game_date >= now() group by game_date limit 1;";
if ($rs = $db->query($sql)) {
$rs_cnt = $rs->num_rows;
if ($rs_cnt > 0) {
$s = $rs->fetch_assoc();
}
$rs->close();
}
$db->close();
$db = NULL;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>BHLeague</title>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400italic,400,700,700italic|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css_v3/reset.css" type="text/css" media="screen" title="style" charset="utf-8" />
<link rel="stylesheet" href="css_v3/style.css" type="text/css" media="screen" title="style" charset="utf-8" />
<!--[if IE 6]>
<link rel="stylesheet" href="css/ie6.css" type="text/css" media="screen" title="style" charset="utf-8" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" href="css/ie7.css" type="text/css" media="screen" title="style" charset="utf-8" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" href="css/ie8.css" type="text/css" media="screen" title="style" charset="utf-8" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" charset="utf-8" src="js_v3/jq.js"></script>
<script type="text/javascript" charset="utf-8" src="js_v3/placeholder.js"></script>
<script type="text/javascript" charset="utf-8" src="js_v3/main.js"></script>
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<!-- ExtJS library: all widgets -->
<script type="text/javascript" src="extjs/ext-all.js"></script>
<!--<script type="text/javascript" src="league_leaders_v3.js"></script>-->
<script type="text/javascript" src="bhlcommon_v3.js"></script>
<style>
.container {
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
margin-top: 0;
position: relative;
width: 1120px;
}
</style>
</head>
<body>
<style>
.x-grid3-row td {
font-family: 'Montserrat',sans-serif;
font-size: 12px;
}
.x-grid3-hd-inner {
font-family: 'Montserrat',sans-serif;
font-size: 12px;
}
</style>
<script language="javascript">
Ext.Element.prototype.setClass = function(cls,add_class){
add_class ? this.addClass(cls) : this.removeClass(cls)
}
function togglebox_leaders(box) {
var bp_el = Ext.get('box_point');
var br_el = Ext.get('box_rebound');
var ba_el = Ext.get('box_assist');
//var bp_el2 = Ext.get('box_point2');
// var br_el2 = Ext.get('box_rebound2');
// var ba_el2 = Ext.get('box_assist2');
switch (box) {
default:
case 1:
Ext.get('a_box_point').addClass('on');
Ext.get('a_box_rebound').removeClass('on');
Ext.get('a_box_assist').removeClass('on');
//Ext.get('a_box_point2').addClass('on');
// Ext.get('a_box_rebound2').removeClass('on');
// Ext.get('a_box_assist2').removeClass('on');
bp_el.show();
br_el.setVisibilityMode(Ext.Element.DISPLAY);
br_el.hide();
ba_el.setVisibilityMode(Ext.Element.DISPLAY);
ba_el.hide();
//bp_el2.show();
// br_el2.setVisibilityMode(Ext.Element.DISPLAY);
// br_el2.hide();
// ba_el2.setVisibilityMode(Ext.Element.DISPLAY);
// ba_el2.hide();
break;
case 2:
Ext.get('a_box_point').removeClass('on');
Ext.get('a_box_rebound').addClass('on');
Ext.get('a_box_assist').removeClass('on');
//Ext.get('a_box_point2').removeClass('on');
// Ext.get('a_box_rebound2').addClass('on');
// Ext.get('a_box_assist2').removeClass('on');
bp_el.setVisibilityMode(Ext.Element.DISPLAY);
bp_el.hide();
br_el.show();
ba_el.setVisibilityMode(Ext.Element.DISPLAY);
ba_el.hide();
//bp_el2.setVisibilityMode(Ext.Element.DISPLAY);
// bp_el2.hide();
// br_el2.show();
// ba_el2.setVisibilityMode(Ext.Element.DISPLAY);
// ba_el2.hide();
break;
case 3:
Ext.get('a_box_point').removeClass('on');
Ext.get('a_box_rebound').removeClass('on');
Ext.get('a_box_assist').addClass('on');
//Ext.get('a_box_point2').removeClass('on');
// Ext.get('a_box_rebound2').removeClass('on');
// Ext.get('a_box_assist2').addClass('on');
bp_el.setVisibilityMode(Ext.Element.DISPLAY);
bp_el.hide();
br_el.setVisibilityMode(Ext.Element.DISPLAY);
br_el.hide();
ba_el.show();
//bp_el2.setVisibilityMode(Ext.Element.DISPLAY);
// bp_el2.hide();
// br_el2.setVisibilityMode(Ext.Element.DISPLAY);
// br_el2.hide();
// ba_el2.show();
break;
}
}
</script>
<script>
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* http://www.sencha.com/license
*/
function change(val) {
if (val > 0) {
return '<span style="color:green;">' + val + '</span>';
} else if (val < 0) {
return '<span style="color:red;">' + val + '</span>';
}
return val;
}
/**
* Custom function used for column renderer
* @param {Object} val
*/
function pctChange(val) {
if (val > 0) {
return '<span style="color:green;">' + val + '%</span>';
} else if (val < 0) {
return '<span style="color:red;">' + val + '%</span>';
}
return val;
}
function getGame_Player_Profile(team1,team2,gamedate,uri)
{
var reader = new Ext.data.ArrayReader({}, [
{name: 'player_id',type: 'int'},
{name: 'player'},
//{name: 'height'},
// {name: 'weight',},
{name: 'position'},
{name: 'ppg', type: 'float'},
{name: 'rpg', type: 'float'},
{name: 'apg', type: 'float'},
//{name: 'games', type: 'float'}
]);
// get the data
var proxy = new Ext.data.HttpProxy({
//where to retrieve data
url: uri , //url to data object (server side script)
method: 'GET'
});
// create the data store.
var store1 = new Ext.data.Store({
reader: reader,
proxy: proxy
});
// create the Grid
var grid1 = new Ext.grid.GridPanel({
store: store1,
//title:'Player Stats',
viewConfig:{
emptyText:'No records to display'
},
columns: [
{
id :'player',
header : 'Player',
width : 160,
sortable : false,
renderer : Ext.bhlcommondata.format_underline,
dataIndex: 'player'
},
//{
// header : 'Height',
// width : 100,
// sortable : false,
// renderer : change,
// dataIndex: 'height',
// align : 'left'
// },
// {
// header : 'Weight',
// width : 100,
// sortable : false,
// renderer : change,
// dataIndex: 'weight',
// align : 'center'
// },
{
header : 'Position',
width : 100,
sortable : false,
renderer : change,
dataIndex: 'position',
align : 'center'
},
{
header : 'Points',
width : 100,
sortable : false,
renderer : change,
dataIndex: 'ppg',
align : 'center'
},
{
header : 'Rebounds',
width : 100,
sortable : false,
renderer : change,
dataIndex: 'rpg',
align : 'center'
},
{
header : 'Assists',
width : 100,
sortable : false,
renderer : change,
dataIndex: 'apg',
align : 'center'
}//,
// {
// header : 'Games Played',
// width : 100,
// sortable : false,
// renderer : change,
// dataIndex: 'games',
// align : 'center'
// }
],
stripeRows: true,
autoExpandColumn: 'player',
listeners: {
cellclick: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); // Get the Record
//var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
var data = record.get('player_id');
//console.log('fieldName: '+fieldName+', data: '+data);
window.location.href='player_v3.php?player='+data;
}
},
autoHeight: true,
border: false,
layout: 'fit',
// config options for stateful behavior
stateful: true,
stateId: 'grid'
});
store1.load();
grid1.render('grid-team-rosters');
grid1.getSelectionModel().selectFirstRow();
}
function getGame_Profile(team1,team2,gamedate,uri)
{
var ds_model = Ext.data.Record.create([
{name: 'team1x', type:'int'},
{name: 'team2x', type:'int'},
{name: 'game_date'},
{name: 'game_time'},
{name: 'team1',},
{name: 'team2'},
{name: 'score'}
]);
// get the data
store = new Ext.data.Store({
url: uri ,
reader: new Ext.data.JsonReader({
root:'rows',
totalProperty: 'results',
id:'id'
}, ds_model)
});
// create the Grid
var grid = new Ext.grid.GridPanel({
store: store,
width:900,
//title:'Game Stats',
viewConfig:{
emptyText:'No records to display'
},
columns: [
{
id :'game_date',
header : 'Game Date',
width : 140,
sortable : false,
align : 'center',
dataIndex: 'game_date'
},
{
header : 'Time',
width : 160,
sortable : false,
dataIndex: 'game_time',
align : 'center'
},
{
header : 'Team 1',
width : 160,
sortable : false,
dataIndex: 'team1',
renderer : Ext.bhlcommondata.format_underline,
align : 'center'
},
{
header : 'Team 2',
width : 160,
sortable : false,
dataIndex: 'team2',
renderer : Ext.bhlcommondata.format_underline,
align : 'center'
},
{
header : 'Score',
width : 140,
sortable : false,
renderer : change,
dataIndex: 'score',
align : 'center'
}
],
stripeRows: true,
autoExpandColumn: 'game_date',
listeners: {
cellclick: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); // Get the Record
//alert(columnIndex);
//var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
if(columnIndex==2)
{
//alert(columnIndex);
var data = record.get('team1x');
window.location.href='teams_v3.php?team_id='+data;
//alert(window.location.hash);
}
else if(columnIndex==3)
{
//alert(columnIndex);
var data = record.get('team2x');
window.location.href='teams_v3.php?team_id='+data;
//alert(window.location.hash);
}
//window.location.href='teams_v3.php?team_id='+data2;
}
},
autoHeight: true,
border: false,
layout: 'fit',
// config options for stateful behavior
stateful: true,
stateId: 'grid'
});
store.load();
grid.render('grid-team-stats');
grid.getSelectionModel().selectFirstRow();
}
function getGame_Revious_Match(team1,team2,gamedate,uri)
{
var ds_model = Ext.data.Record.create([
{name: 'game_date'},
{name: 'game_time'},
{name: 'team1',},
{name: 'team2'},
{name: 'score'}
]);
// get the data
storex = new Ext.data.Store({
url: uri ,
reader: new Ext.data.JsonReader({
root:'rows',
totalProperty: 'results',
id:'id'
}, ds_model)
});
// create the Grid
var gridx = new Ext.grid.GridPanel({
store: storex,
width:900,
//title:'Game Stats',
viewConfig:{
emptyText:'No records to display'
},
columns: [
{
id :'game_date',
header : 'Game Date',
width : 140,
sortable : false,
align : 'center',
dataIndex: 'game_date'
},
{
header : 'Time',
width : 160,
sortable : false,
dataIndex: 'game_time',
align : 'center'
},
{
header : 'Team 1',
width : 160,
sortable : false,
dataIndex: 'team1',
renderer : Ext.bhlcommondata.format_underline,
align : 'center'
},
{
header : 'Team 2',
width : 160,
sortable : false,
dataIndex: 'team2',
renderer : Ext.bhlcommondata.format_underline,
align : 'center'
},
{
header : 'Score',
width : 140,
sortable : false,
renderer : change,
dataIndex: 'score',
align : 'center'
}
],
stripeRows: true,
autoExpandColumn: 'game_date',
listeners: {
cellclick: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); // Get the Record
//alert(columnIndex);
//var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
if(columnIndex==2)
{
//alert(columnIndex);
var data = record.get('team1x');
window.location.href='teams_v3.php?team_id='+data;
//alert(window.location.hash);
}
else if(columnIndex==3)
{
//alert(columnIndex);
var data = record.get('team2x');
window.location.href='teams_v3.php?team_id='+data;
//alert(window.location.hash);
}
//window.location.href='teams_v3.php?team_id='+data2;
}
},
autoHeight: true,
border: false,
layout: 'fit',
// config options for stateful behavior
stateful: true,
stateId: 'grid'
});
storex.load();
gridx.render('grid-prev-games');
gridx.getSelectionModel().selectFirstRow();
}
function getGames(idx,tm1,tm2)
{
urx ='games_callback.php?action=get_game_stats&gamedate=' + idx + '&team1=' +tm1 + '&team2=' +tm2;
//alert(idx);
getGame_Profile(tm1,tm2,idx,urx )
idz = idx
//titlez = resp.responseText + ' Player Stats';
urz ='games_callback.php?action=get_game_player_roster&gamedate=' + idx + '&team1=' +tm1 + '&team2=' +tm2;
getGame_Player_Profile(tm1,tm2,idx,urz)
urq ='games_callback.php?action=get_previous_matchup&gamedate=' + idx + '&team1=' +tm1 + '&team2=' +tm2;
getGame_Revious_Match(tm1,tm2,idx,urq)
}
function isValidDate(value)
{
var dateWrapper = new Date(value);
return isNaN(dateWrapper.getDate());
}
function getLast_GameDate()
{
Ext.Ajax.request({
params: {action: 'get_Date'},
url: 'games_callback.php',
success: function (resp,form,action) {
//Ext.getCmp('season').setValue('1');
getGames('2012-04-24 00:00:00',13,8)
//team_id.setValue(team_id.getStore().getAt(resp.responseText).get(cb.valueField));
},
failure: function (form,action) {
switch (action.failureType) {
case Ext.form.Action.CLIENT_INVALID:
Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
break;
case Ext.form.Action.CONNECT_FAILURE:
Ext.Msg.alert('Failure', 'Ajax communication failed');
break;
case Ext.form.Action.SERVER_INVALID:
Ext.Msg.alert('Failure', action.result.msg);
break;
default:
Ext.Msg.alert('Failure',action.result.msg);
}
}
});
}
Ext.onReady(function(){
Ext.QuickTips.init();
//alert(document.getElementById('hid_team_id').value);
// NOTE: This is an example showing simple state management. During development,
// it is generally best to disable state management as dynamically-generated ids
// can change across page loads, leading to unpredictable results. The developer
// should ensure that stable state ids are set for stateful components in real apps.
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
/**
* Custom function used for column renderer
* @param {Object} val
*/
// `game_date`,`game_time`,team1,team2,team1_score,team2_score
//setgame_params();
var tmz = document.getElementById('hid_game_date').value;
if(isValidDate(tmz)==false)
{
//alert("ZZZZ");
var gamedate = document.getElementById('hid_game_date').value;
//alert(gamedate);
var txm1 = document.getElementById('hid_team1').value;
var txm2 = document.getElementById('hid_team2').value;
getGames(gamedate,txm1,txm2);
//var teamx = getGames(tmx)
}
else
{
var gamedate ='<?php echo $gamedate;?>';
var txm1 =<?php echo $team1;?>;
var txm2 =<?php echo $team2;?>;
getGames(gamedate,txm1,txm2)
}
//alert("XXXX");
// alert(tmx);
//var titlex = "Team Profile: " + teamx;
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
});
</script>
<div class="fixed">
<div id="header">
<div class="container">
<h1 class="logo"><a href="#"><img src="images_v3/logo.png" /></a></h1>
<div class="wrap">
<div class="menu">
<div class="menu-link">
<a href="index.php">HOME</a>
<a href="standings_v3.html">STANDINGS</a>
<a href="schedule_v3.html">SCHEDULES</a>
<a href="league_leaders_v3.html">LEAGUE LEADERS</a>
<a href="rosters_v3.php">ROSTERS</a>
<a href="photos_v3.php">PHOTOS</a>
<a href="about_v3.php">ABOUT</a>
<a href="signup_v3.php" class="signup"> <span> SIGNUP </span></a>
</div>
</div>
</div>
</div>
<div class="subheader">
<div class="container">
<div class="input-search">
<div class="input-text">
<div id="league_sel" data-value="">
<a href="#" class="btn-sel"><span><input type="text" id="local-gamedays" size="20"/></span></a>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<input type="hidden" id="hid_game_date" name="hid_game_date" value="" /><input type="hidden" id="hid_team1" name="hid_team1" value="" /><input type="hidden" id="hid_team2" name="hid_team2" value="" />
<div id="content">
<div class="container">
<div class="col ">
<h2 class="title">Game Leaders</h2>
<div class="sub"><a id="a_box_point" href="#" class="on" onclick="togglebox_leaders(1);">Points</a> <a id="a_box_rebound" href="#" onclick="togglebox_leaders(2);">Rebound</a> <a id="a_box_assist" href="#" onclick="togglebox_leaders(3);">Assist</a></div>
<div class="padding_clear"></div>
<div class="people">
<ul id="box_point">
<?php
foreach ($ppg1 as $idx => $k) {
$image = $rimage[$idx];
$team_name = $k['team_name'];
$player_name = $k['player_name'];
$pg = @number_format($k['pg'], 1);
$li_class = ($idx == 0)?'class="first"':'';
?>
<li class="first">
<a href="#">
<div class="space"></div>
<h5><a href="teams_v3.php?team_id=<?php echo $k['team_id']; ?>" style="text-decoration:none; color:#D3D2D2;"><?php echo strtoupper($team_name); ?></a></h5>
<div class="img">
<div class="img-person">
<img src="images_v3/<?php echo $image; ?>" class="rank" />
<img src="images_v3/no-pic.png" />
</div>
</div>
<div class="name">
<a href="player_v3.php?player=<?php echo $k['player_id']; ?>" style="text-decoration:none; color:#FFFFFF"><?php echo $player_name; ?></a>
</div>
<div class="point">
<div class="p_point">
<div class="big">
<?php echo $pg; ?>
</div>
<div class="small">
PPG
</div>
<div class="clear"></div>
</div>
</div>
</a>
</li>
<?php
}
?>
<?php
foreach ($ppg2 as $idx2 => $k2) {
$image2 = $rimage[$idx2];
$team_name2 = $k2['team_name'];
$player_name2 = $k2['player_name'];
$pg2 = @number_format($k2['pg'], 1);
?>
<li>
<a href="#">
<div class="space"></div>
<h5><a href="teams_v3.php?team_id=<?php echo $k2['team_id']; ?>" style="text-decoration:none; color:#D3D2D2"><?php echo strtoupper($team_name2); ?></a></h5>
<div class="img">
<div class="img-person">
<img src="images_v3/<?php echo $image2; ?>" class="rank" />
<img src="images_v3/no-pic.png" />
</div>
</div>
<div class="name">
<a href="player_v3.php?player=<?php echo $k2['player_id']; ?>" style="text-decoration:none; color:#FFFFFF"><?php echo $player_name2; ?></a>
</div>
<div class="point">
<div class="p_point">
<div class="big">
<?php echo $pg2; ?>
</div>
<div class="small">
PPG
</div>
<div class="clear"></div>
</div>
</div>
</a>
</li>
<?php
}
?>
</ul>
<ul id="box_rebound" style="display:none;">
<?php
foreach ($rpg1 as $idx => $k) {
$image = $rimage[$idx];
$team_name = $k['team_name'];
$player_name = $k['player_name'];
$pg = @number_format($k['pg'], 1);
$li_class = ($idx == 0)?'class="first"':'';
?>
<li class="first">
<a href="#">
<div class="space"></div>
<h5><a href="teams_v3.php?team_id=<?php echo $k['team_id']; ?>" style="text-decoration:none; color:#D3D2D2;"><?php echo strtoupper($team_name); ?></a></h5>
<div class="img">
<div class="img-person">
<img src="images_v3/<?php echo $image; ?>" class="rank" />
<img src="images_v3/no-pic.png" />
</div>
</div>
<div class="name">
<a href="player_v3.php?player=<?php echo $k['player_id']; ?>" style="text-decoration:none; color:#FFFFFF"><?php echo $player_name; ?></a>
</div>
<div class="point">
<div class="p_point">
<div class="big">
<?php echo $pg; ?>
</div>
<div class="small">
RPG
</div>
<div class="clear"></div>
</div>
</div>
</a>
</li>
<?php
}
?>
<?php
foreach ($rpg2 as $idx2 => $k2) {
$image2 = $rimage[$idx2];
$team_name2 = $k2['team_name'];
$player_name2 = $k2['player_name'];
$pg2 = @number_format($k2['pg'], 1);
?>
<li>