-
Notifications
You must be signed in to change notification settings - Fork 1
/
fantasyleague.php
789 lines (751 loc) · 36.5 KB
/
fantasyleague.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
<?php
$params = explode("/", htmlspecialchars($_GET[id]));
include("includes/advert_bigscreenside.php");
// pred zaciatkom ligy vyprazdnit tabulku fl_prices, fl_prices_g a fl_selects
$league = 144;
$uid = $_SESSION['logged'];
$m = mysql_query("SELECT * FROM 2004leagues WHERE id='$league'");
$n = mysql_fetch_array($m);
if(!$uid)
{
$leaguecolor = $n[color];
$active_league = $league;
$title = 'Fantasy '.$n[longname];
$content .= "<i class='float-left h1 h1-fluid ll-".LeagueFont($n[longname])." text-gray-600 mr-1'></i>
<h1 class='h3 h3-fluid mb-1'>".LANG_FANTASY_TITLE."</h1>
<h2 class='h6 h6-fluid text-".$leaguecolor." text-uppercase font-weight-bold mb-3'>".$n[longname]."</h2>
<div style='max-width: 1000px;'>";
$content .= '<div class="alert alert-danger" role="alert">
'.sprintf(LANG_FANTASY_NOTLOGGED, $n[longname]).'
</div>
</div>';
}
else
{
function Generate_Roster($userid)
{
Global $league, $uid, $leaguecolor;
if($userid==$uid) $hl = LANG_FANTASY_MYROSTER;
else
{
$q = mysql_query("SELECT uname FROM e_xoops_users WHERE uid='$userid'");
$f = mysql_fetch_array($q);
$hl = LANG_FANTASY_ROSTEROF.' '.$f[uname];
}
$y = mysql_query("SELECT *, t2.price as aktual FROM fl_selects JOIN el_players t1 ON t1.id=fl_selects.pid JOIN fl_prices t2 ON t2.playerid=fl_selects.pid WHERE uid='$userid' && league='$league'");
$roster .= '
<div class="card shadow animated--grow-in">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.$hl.'
</h6>
</div>
<div class="card-body">
<h5 class="card-title text-danger h5-fluid">'.LANG_FANTASY_FORWARDS.'</h5>
<div class="row">';
$y = mysql_query("SELECT *, t2.price as aktual FROM fl_selects JOIN el_players t1 ON t1.id=fl_selects.pid JOIN fl_prices t2 ON t2.playerid=fl_selects.pid WHERE fl_selects.pos='F' && uid='$userid' && league='$league'");
$i=0;
while($u = mysql_fetch_array($y))
{
$players[$i] = array($u[teamshort], $u[name], $u[pos], $u[g], $u[a], $u[aktual], $u[delta], $u[pid]);
$i++;
}
$i=0;
while($i < 5)
{
if(!$players[$i][1])
{
if($userid==$uid) $butt = '<button class="btn btn-'.$leaguecolor.' btn-circle playerbutton show-dialog" id="buy-'.$i.'-0-F" data-toggle="tooltip" data-placement="bottom" title="'.LANG_FANTASY_BUYFORWARD.'"><i class="fas fa-user-plus"></i></button>';
else $butt = '';
$body = '<div class="col align-self-center text-center">'.$butt.'</div>';
$volne=1;
}
else
{
if($userid==$uid) $butt = '<br><button class="btn btn-outline-'.$leaguecolor.' mt-2 playerbutton show-dialog" id="sell-'.$players[$i][7].'-0" data-toggle="tooltip" data-placement="bottom" title="'.LANG_FANTASY_SELLFORWARD.'"><i class="fas fa-money-bill-alt"></i> '.LANG_FANTASY_SELL.'</button>';
else $butt = '';
if($players[$i][6]>0) $delta = '<p class="text-center text-success small">(<i class="fas fa-caret-up"></i>'.money_format('%.0n', $players[$i][6]).')</p>';
elseif($players[$i][6]<0) $delta = '<p class="text-center text-danger small">(<i class="fas fa-caret-down"></i>'.money_format('%.0n', $players[$i][6]).')</p>';
else $delta = '<p class="small"></p>';
$body = '<div class="col text-center">
<p class="text-center font-weight-bold p-fluid">'.money_format('%.0n', $players[$i][5]).'</p>
'.$delta.'
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/includes/player_photo.php?name='.$players[$i][1].'" class="lazy rounded-circle img-thumbnail" style="width:100px; max-width:100px;">
<p class="p-fluid"><span class="font-weight-bold"><img class="flag-el '.$players[$i][0].'-small" src="/images/blank.png" alt="'.$players[$i][0].'">'.$players[$i][1].'</span><br>
'.LANG_PLAYERSTATS_F.'<br>
<span class="badge badge-pill badge-'.$leaguecolor.'">'.$players[$i][3].'+'.$players[$i][4].'</span>
'.$butt.'</p>
</div>';
$value = $value+$players[$i][5];
$bol=1;
}
$roster .= $body;
$i++;
}
$roster .= '
</div>
<h5 class="card-title text-danger h5-fluid">'.LANG_FANTASY_DEFENSE.'</h5>
<div class="row">';
$y = mysql_query("SELECT *, t2.price as aktual FROM fl_selects JOIN el_players t1 ON t1.id=fl_selects.pid JOIN fl_prices t2 ON t2.playerid=fl_selects.pid WHERE fl_selects.pos='D' && uid='$userid' && league='$league'");
$i=5;
while($u = mysql_fetch_array($y))
{
$players[$i] = array($u[teamshort], $u[name], $u[pos], $u[g], $u[a], $u[aktual], $u[delta], $u[pid]);
$i++;
}
$i=5;
while($i < 8)
{
if(!$players[$i][1])
{
if($userid==$uid) $butt = '<button class="btn btn-'.$leaguecolor.' btn-circle playerbutton show-dialog" id="buy-'.$i.'-0-D" data-toggle="tooltip" data-placement="bottom" title="'.LANG_FANTASY_BUYDEFENSE.'"><i class="fas fa-user-plus"></i></button>';
else $butt = '';
$body = '<div class="col align-self-center text-center">'.$butt.'</div>';
$volne=1;
}
else
{
if($userid==$uid) $butt = '<br><button class="btn btn-outline-'.$leaguecolor.' mt-2 playerbutton show-dialog" id="sell-'.$players[$i][7].'-0" data-toggle="tooltip" data-placement="bottom" title="'.LANG_FANTASY_SELLDEFENSE.'"><i class="fas fa-money-bill-alt"></i> '.LANG_FANTASY_SELL.'</button>';
else $butt = '';
if($players[$i][6]>0) $delta = '<p class="text-center text-success small">(<i class="fas fa-caret-up"></i>'.money_format('%.0n', $players[$i][6]).')</p>';
elseif($players[$i][6]<0) $delta = '<p class="text-center text-danger small">(<i class="fas fa-caret-down"></i>'.money_format('%.0n', $players[$i][6]).')</p>';
else $delta = '<p class="small"></p>';
$body = '<div class="col text-center">
<p class="text-center font-weight-bold p-fluid">'.money_format('%.0n', $players[$i][5]).'</p>
'.$delta.'
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/includes/player_photo.php?name='.$players[$i][1].'" class="lazy rounded-circle img-thumbnail" style="width:100px; max-width:100px;">
<p class="p-fluid"><span class="font-weight-bold"><img class="flag-el '.$players[$i][0].'-small" src="/images/blank.png" alt="'.$players[$i][0].'">'.$players[$i][1].'</span><br>
'.LANG_PLAYERSTATS_D.'<br>
<span class="badge badge-pill badge-'.$leaguecolor.'">'.$players[$i][3].'+'.$players[$i][4].'</span>
'.$butt.'</p>
</div>';
$value = $value+$players[$i][5];
$bol=1;
}
$roster .= $body;
$i++;
}
$roster .= '
</div>
<h5 class="card-title text-danger h5-fluid">'.LANG_FANTASY_GOALIE.'</h5>
<div class="row">';
$y = mysql_query("SELECT *, t2.price as aktual FROM fl_selects JOIN el_goalies t1 ON t1.id=fl_selects.pid JOIN fl_prices_g t2 ON t2.playerid=fl_selects.pid WHERE fl_selects.pos='GK' && uid='$userid' && league='$league'");
$i=8;
while($u = mysql_fetch_array($y))
{
$players[$i] = array($u[teamshort], $u[name], $u[pos], $u[w], $u[s], $u[aktual], $u[delta], $u[pid]);
$i++;
}
$i=8;
if(!$players[$i][1])
{
if($userid==$uid) $butt = '<button class="btn btn-'.$leaguecolor.' btn-circle playerbutton show-dialog" id="buy-'.$i.'-1-GK" data-toggle="tooltip" data-placement="bottom" title="'.LANG_FANTASY_BUYGOALIE.'"><i class="fas fa-user-plus"></i></button>';
else $butt = '';
$body = '<div class="col align-self-center text-center">'.$butt.'</div>';
$volne=1;
}
else
{
if($userid==$uid) $butt = '<br><button class="btn btn-outline-'.$leaguecolor.' mt-2 playerbutton show-dialog" id="sell-'.$players[$i][7].'-1" data-toggle="tooltip" data-placement="bottom" title="'.LANG_FANTASY_SELLGOALIE.'"><i class="fas fa-money-bill-alt"></i> '.LANG_FANTASY_SELL.'</button>';
else $butt = '';
if($players[$i][6]>0) $delta = '<p class="text-center text-success small">(<i class="fas fa-caret-up"></i>'.money_format('%.0n', $players[$i][6]).')</p>';
elseif($players[$i][6]<0) $delta = '<p class="text-center text-danger small">(<i class="fas fa-caret-down"></i>'.money_format('%.0n', $players[$i][6]).')</p>';
else $delta = '<p class="small"></p>';
$body = '<div class="col text-center">
<p class="text-center font-weight-bold p-fluid">'.money_format('%.0n', $players[$i][5]).'</p>
'.$delta.'
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/includes/player_photo.php?name='.$players[$i][1].'" class="lazy rounded-circle img-thumbnail" style="width:100px; max-width:100px;">
<p class="p-fluid"><span class="font-weight-bold"><img class="flag-el '.$players[$i][0].'-small" src="/images/blank.png" alt="'.$players[$i][0].'">'.$players[$i][1].'</span><br>
'.LANG_PLAYERSTATS_GK.'<br>
<span class="badge badge-pill badge-'.$leaguecolor.'">'.$players[$i][3].' '.LANG_MATCHES_WINS1.'</span><br>
<span class="badge badge-pill badge-'.$leaguecolor.'">'.$players[$i][4].' '.LANG_FANTASY_SO.'</span>
'.$butt.'</p>
</div>';
$value = $value+$players[$i][5];
$bol=1;
}
$roster .= $body;
$roster .= '
</div>
</div>
<div class="card-footer">
<p class="text-center">'.LANG_FANTASY_ROSTERVALUE.': <strong>'.money_format('%.0n', $value).'</strong></p>';
if($userid==$uid) $roster .= '
<p class="text-center">
<button class="btn btn-sm btn-'.$leaguecolor.' btn-icon-split show-dialog" id="sellteam"'.(!$bol ? ' disabled':'').'>
<span class="icon">
<i class="fas fa-money-bill-alt"></i>
</span>
<span class="text">'.LANG_FANTASY_SELLROSTER.'</span>
</button>
<button class="btn btn-sm btn-'.$leaguecolor.' btn-icon-split show-dialog" id="automat"'.($volne ? '':' disabled').'>
<span class="icon">
<i class="fas fa-robot"></i>
</span>
<span class="text">'.LANG_FANTASY_AUTOFILL.'</span>
</button>
</p>';
$roster .= '
</div>
</div>';
return $roster;
}
$content .= '
<div class="modal fade" id="dialog" tabindex="-1" role="dialog" aria-labelledby="dialogTitle" aria-hidden="true">
</div>';
// hlavna stranka
if($params[0]=="main")
{
$locale = explode(";",setlocale(LC_ALL, '0'));
$locale = explode("=",$locale[0]);
$locale = $locale[1];
$q = mysql_query("SELECT * FROM fl_wallet WHERE uid='$uid' && league='$league'");
$leaguecolor = $n[color];
$active_league = $league;
$title = 'Fantasy '.$n[longname];
if(mysql_num_rows($q)>0)
{
$f = mysql_fetch_array($q);
$content .= "<i class='float-left h1 h1-fluid ll-".LeagueFont($n[longname])." text-gray-600 mr-1'></i>
<h1 class='h3 h3-fluid mb-1'>".LANG_FANTASY_TITLE."</h1>
<h2 class='h6 h6-fluid text-".$leaguecolor." text-uppercase font-weight-bold mb-3'>".$n[longname]."</h2>
<div class='row'>
<div class='col-12' style='max-width: 1000px;'>";
$content .= '<nav aria-label="Fantasy navigation">
<ul class="pagination pagination-sm">
<li class="page-item">
<a class="page-link text-gray-800" href="/fantasy/select" aria-label="'.LANG_FANTASY_MYROSTER.'">
<span aria-hidden="true"><i class="fas fa-users"></i> '.LANG_FANTASY_MYROSTER.'</span>
</a>
</li>
<li class="page-item">
<a class="page-link text-gray-800 show-prices" href="#" aria-label="'.LANG_FANTASY_PRICELIST.'" id="pricelist">
<span aria-hidden="true"><i class="fas fa-money-bill-alt"></i> '.LANG_FANTASY_PRICELIST.'</span>
</a>
</li>
</ul>
</nav>
<div class="row">
<div class="col-md-6 col-xl-4 mb-4">
<div class="card shadow animated--grow-in h-100">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.LANG_FANTASY_BEST.'
<span class="swipe d-none float-right text-gray-800"><i class="fas fa-hand-point-up"></i> <i class="fas fa-exchange-alt align-text-top text-xs"></i></span>
</h6>
</div>
<div class="card-body px-1">
<table class="table-hover table-light table-striped table-responsive-sm w-100 p-fluid" id="ranking">
<thead>
<tr>
<th class="text-center">#</th>
<th>'.LANG_FANTASY_MANAGER.'</th>
<th>'.LANG_TEAMSTATS_POINTS.'</th>
<th>'.LANG_FANTASY_VALUE.'</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4" class="dataTables_empty">'.LANG_STATS_LOADING.'</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-6 col-xl-4 mb-4">
<div class="card shadow animated--grow-in h-100">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.LANG_FANTASY_BIGGESTJUMP.'
<span class="swipe d-none float-right text-gray-800"><i class="fas fa-hand-point-up"></i> <i class="fas fa-exchange-alt align-text-top text-xs"></i></span>
</h6>
</div>
<div class="card-body px-1">
<table class="table-hover table-light table-striped table-responsive w-100 p-fluid">
<thead>
<tr>
<th>'.LANG_PLAYERDB_PLAYER.'</th>
<th class="text-center">'.LANG_FANTASY_PRICE.'</th>
<th>'.LANG_FANTASY_CHANGE.'</th>
</tr>
</thead>
<tbody>';
$w = mysql_query("SELECT id, price, delta, teamshort, name, pos FROM fl_prices JOIN el_players t1 ON t1.id=fl_prices.playerid WHERE league='$league' UNION SELECT id, price, delta, teamshort, name, 'GK' as pos FROM fl_prices_g JOIN el_goalies t1 ON t1.id=fl_prices_g.playerid WHERE league='$league' ORDER BY delta DESC LIMIT 10");
while($e = mysql_fetch_array($w))
{
if($e[delta]>0) $delta = '<span class="text-success"><i class="fas fa-caret-up"></i>'.$e[delta].'</span>';
elseif($e[delta]<0) $delta = '<span class="text-danger"><i class="fas fa-caret-down"></i>'.$e[delta].'</span>';
else $delta = '-';
$content .= '<tr>
<td class="text-nowrap" style="width:50%;"><img class="flag-el '.$e[teamshort].'-small" src="/images/blank.png" alt="'.$e[teamshort].'"> '.$e[name].' <span class="text-muted text-xs">('.$e[pos].')</span></td>
<td class="text-center" style="width:25%;">'.$e[price].'</td>
<td class="text-nowrap" style="width:25%;">'.$delta.'</td>
</tr>';
}
$content .= '
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-6 col-xl-4 mb-4">
<div class="card shadow animated--grow-in h-100">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.LANG_FANTASY_BIGGESTFALLS.'
<span class="swipe d-none float-right text-gray-800"><i class="fas fa-hand-point-up"></i> <i class="fas fa-exchange-alt align-text-top text-xs"></i></span>
</h6>
</div>
<div class="card-body px-1">
<table class="table-hover table-light table-striped table-responsive w-100 p-fluid">
<thead>
<tr>
<th>'.LANG_PLAYERDB_PLAYER.'</th>
<th class="text-center">'.LANG_FANTASY_PRICE.'</th>
<th>'.LANG_FANTASY_CHANGE.'</th>
</tr>
</thead>
<tbody>';
$w = mysql_query("SELECT id, price, delta, teamshort, name, pos FROM fl_prices JOIN el_players t1 ON t1.id=fl_prices.playerid WHERE league='$league' UNION SELECT id, price, delta, teamshort, name, 'GK' as pos FROM fl_prices_g JOIN el_goalies t1 ON t1.id=fl_prices_g.playerid WHERE league='$league' ORDER BY delta ASC LIMIT 10");
while($e = mysql_fetch_array($w))
{
if($e[delta]>0) $delta = '<span class="text-success"><i class="fas fa-caret-up"></i>'.$e[delta].'</span>';
elseif($e[delta]<0) $delta = '<span class="text-danger"><i class="fas fa-caret-down"></i>'.$e[delta].'</span>';
else $delta = '-';
$content .= '<tr>
<td class="text-nowrap" style="width:50%;"><img class="flag-el '.$e[teamshort].'-small" src="/images/blank.png" alt="'.$e[teamshort].'"> '.$e[name].' <span class="text-muted text-xs">('.$e[pos].')</span></td>
<td class="text-center" style="width:25%;">'.$e[price].'</td>
<td class="text-nowrap" style="width:25%;">'.$delta.'</td>
</tr>';
}
$content .= '
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="card mb-4 shadow animated--grow-in">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.LANG_FANTASY_LATESTTRANSACTIONS.'
<span class="swipe d-none float-right text-gray-800"><i class="fas fa-hand-point-up"></i> <i class="fas fa-exchange-alt align-text-top text-xs"></i></span>
</h6>
</div>
<div class="card-body">
<table class="table-hover table-light table-striped table-responsive-sm w-100 p-fluid">
<thead>
<tr>
<th>'.LANG_REPORT_TIME.'</th>
<th>'.LANG_FANTASY_TRANSACTION.'</th>
</tr>
</thead>
<tbody>';
$w = mysql_query("SELECT t1.*, t2.uname, t3.name as pname, t3.teamshort as pshort, t4.name as gname, t4.teamshort as gshort FROM `fl_transactions` t1 JOIN e_xoops_users t2 ON t2.uid=t1.uid LEFT JOIN el_players t3 ON t3.id=t1.pid LEFT JOIN el_goalies t4 ON t4.id=t1.pid ORDER BY tstamp DESC LIMIT 20");
while($e = mysql_fetch_array($w))
{
if($e[pos]=="GK")
{
$meno = $e[gname];
$tshort = '<img class="flag-el '.$e[gshort].'-small" src="/images/blank.png" alt="'.$e[gshort].'">';
$koho = LANG_FANTASY_AGOALIE;
}
elseif($e[pos]=="T")
{
$koho = LANG_FANTASY_WHOLETEAM;
$tshort = "";
$meno = "";
}
else
{
if($e[pos]=="F") $koho = LANG_FANTASY_AFORWARD;
if($e[pos]=="D") $koho = LANG_FANTASY_ADEFENSE;
$meno = $e[pname];
$tshort = '<img class="flag-el '.$e[pshort].'-small" src="/images/blank.png" alt="'.$e[pshort].'">';
}
if($e[type]==1)
{
if($e[price]>0) $delta = LANG_FANTASY_WITHAPROFIT.' <span class="text-success">+'.money_format('%.0n', $e[price]).'</span>';
elseif($e[price]<0) $delta = LANG_FANTASY_WITHLOSSOF.' <span class="text-danger">'.money_format('%.0n', $e[price]).'</span>';
else $delta = LANG_FANTASY_WITHOUTPROFIT;
$hl = LANG_FANTASY_SOLD;
}
else
{
$hl = LANG_FANTASY_BOUGHT;
$delta = LANG_FANTASY_FORPRICE." ".money_format('%.0n', $e[price]);
}
$content .= '<tr>
<td class="text-nowrap align-top" style="width:15%;">'.time_elapsed_string($e[tstamp]).'</td>
<td style="width:85%;">'.LANG_FANTASY_MANAGER.' <b>'.$e[uname].'</b> '.$hl.' '.$koho.' '.$tshort.' <b>'.$meno.'</b> '.$delta.'</td>
</tr>';
}
$content .= '
</tbody>
</table>
</div>
</div>
<div class="card my-4 shadow animated--grow-in">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.LANG_BETS_FORWHAT.'
</h6>
</div>
<div class="card-body">
<p>'.sprintf(LANG_BETS_BUYMEABEERTEXT, "Fantasy KHL", LANG_BETS_BUYMEABEER, "e74a3b").'</p>
<p>'.LANG_BETS_FORWHATTEXT.'</p>
<div class="card-columns">
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/batoh.jpg" class="lazy card-img-top" alt="Cestovný batoh">
<div class="card-body">
<h5 class="card-title">Cestovný batoh</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/ciapka.jpg" class="lazy card-img-top" alt="zimná čiapka">
<div class="card-body">
<h5 class="card-title">zimná čiapka</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/usbled.jpg" class="lazy card-img-top" alt="USB LED lampa">
<div class="card-body">
<h5 class="card-title">USB LED lampa</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/odznaky.jpg" class="lazy card-img-top" alt="Odznaky s hokejovým logom">
<div class="card-body">
<h5 class="card-title">Odznaky s hokejovým logom</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/pero.jpg" class="lazy card-img-top" alt="Pero">
<div class="card-body">
<h5 class="card-title">Pero</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/nalepky.jpg" class="lazy card-img-top" alt="Živicové nálepky">
<div class="card-body">
<h5 class="card-title">Živicové nálepky</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/drziak.jpg" class="lazy card-img-top" alt="Držiak na puk">
<div class="card-body">
<h5 class="card-title">Držiak na puk</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/placka.jpg" class="lazy card-img-top" alt="Závesná placka Ľubomír Višňovský">
<div class="card-body">
<h5 class="card-title">Závesná placka Ľubomír Višňovský</h5>
</div>
</div>
<div class="card">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/ceny/zastavka.jpg" class="lazy card-img-top" alt="2x zástavka Slovensko na auto">
<div class="card-body">
<h5 class="card-title">2x zástavka Slovensko na auto</h5>
</div>
</div>
</div>
</div>
</div>';
$script_end = '<script type="text/javascript">
$(document).ready(function() {
$("#ranking").dataTable( {
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
if ( aData[4] == "0" )
{
$("td", nRow).css("background-color", "rgba(255, 0, 0, 0.08)");
}
return nRow;
},
"bProcessing": true,
"bServerSide": true,
"bFilter": false,
"bLengthChange": false,
"bInfo": false,
"bPaginate": false,
"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 0 ] }, { "bVisible": false, "aTargets": [ 4 ] }],
"oLanguage": { "sUrl": "/includes/lang/datatables_'.$locale.'.txt" },
"aaSorting": [[2, "desc"], [3, "desc"]],
"bAutoWidth": false,
"aoColumns": [{ "sWidth": "5%", className: "text-center" }, { "sWidth": "60%" }, { "sWidth": "20%", className: "text-nowrap" }, { "sWidth": "20%", className: "text-nowrap"}],
"sPaginationType": "numbers",
"bJQueryUI": false,
"sAjaxSource": "/includes/fantasyranking.php?lid='.$league.'"
}
);
} );
</script>';
}
else
{
$content .= "<i class='float-left h1 h1-fluid ll-".LeagueFont($n[longname])." text-gray-600 mr-1'></i>
<h1 class='h3 h3-fluid mb-1'>".LANG_FANTASY_TITLE."</h1>
<h2 class='h6 h6-fluid text-".$leaguecolor." text-uppercase font-weight-bold mb-3'>".$n[longname]."</h2>
<div class='row'>
<div class='col-12' style='max-width: 1000px;'>";
$content .= '
<div class="row">
<div class="col-lg-7">
<div class="card mb-4 shadow animated--grow-in">
<img src="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="/images/khlfantasy.jpg" class="lazy card-img-top" alt="Fantasy '.$n[longname].'">
<div class="card-body">
<h5 class="card-title">Fantasy '.$n[longname].' - pravidlá</h5>
<ol type="1">
<li>Zúčastniť sa môžu iba <a href="/register">registrovaní</a> užívatelia stránky hockey-LIVE.sk (po prihlásení sa, kliknite na Fantasy '.$n[longname].' v ľavom menu '.$n[longname].').</li>
<li>Každý manažér (užívateľ) má na začiatku na konte k dispozícii 180 000 EUR.</li>
<li>Každý manažér si kúpi 5 útočníkov, 3 obrancov a 1 brankára z dostupných hráčov ligy.</li>
<li>Manažér za hráčov nezačne zbierať body, až kým jeho tím nebude kompletný (8 hráčov a 1 brankár).</li>
<li>Trhová cena hráčov sa mení podľa ich reálnej výkonnosti.</li>
<li>Hráča alebo brankára je možné kedykoľvek predať za aktuálnu trhovú cenu.</li>
<li>Nie je možné nakupovať z tímov, ktorých zápasy sa práve hrajú, alebo ešte neboli spracované systémom.</li>
<li>Bodovanie:<br>Gól, asistencia = <b>1 bod</b>,<br>výhra brankára = <b>2 body</b>,<br>čisté konto brankára = <b>2 body</b>.</li>
</ol>
<a href="#" class="btn btn-'.$leaguecolor.' signin">OK, poďme na to!</a>
</div>
</div>
</div>
</div>';
$script_end .= "<script>
$(function() {
$(document).on('click', '.signin', function() {
$.ajax({
url: '/includes/dialog.php?action=signin&lid=$league',
success: function(data){
location.href = '/fantasy/main';
}
});
});
});
</script>";
}
$content .= '
</div> <!-- end col -->
<div class="col-auto flex-grow-1 flex-shrink-1 d-none d-xl-block">
'.$advert.'
</div> <!-- end col -->
</div> <!-- end row -->';
}
// zostava ineho manazera
if($params[0]=="roster")
{
$lid = $params[2];
$userid = $params[1];
$leaguecolor = $n[color];
$active_league = $league;
$title = 'Fantasy '.$n[longname].' - zostava manažéra';
$content .= "<i class='float-left h1 h1-fluid ll-".LeagueFont($n[longname])." text-gray-600 mr-1'></i>
<h1 class='h3 h3-fluid mb-1'>".LANG_FANTASY_TITLE."</h1>
<h2 class='h6 h6-fluid text-".$leaguecolor." text-uppercase font-weight-bold mb-3'>".$n[longname]."</h2>
<div class='row'>
<div class='col-12' style='max-width: 1000px;'>";
$content .= '<nav aria-label="Fantasy navigation">
<ul class="pagination pagination-sm">
<li class="page-item">
<a class="page-link text-gray-800" href="/fantasy/main" aria-label="'.LANG_BETS_RANK.'">
<span aria-hidden="true"><i class="fas fa-list-ol"></i> '.LANG_BETS_RANK.'</span>
</a>
</li>
<li class="page-item">
<a class="page-link text-gray-800 show-prices" href="#" aria-label="'.LANG_FANTASY_PRICELIST.'" id="pricelist">
<span aria-hidden="true"><i class="fas fa-money-bill-alt"></i> '.LANG_FANTASY_PRICELIST.'</span>
</a>
</li>
<li class="page-item">
<a class="page-link text-gray-800" href="/fantasy/select" aria-label="'.LANG_FANTASY_MYROSTER.'">
<span aria-hidden="true"><i class="fas fa-users"></i> '.LANG_FANTASY_MYROSTER.'</span>
</a>
</li>
</ul>
</nav>';
$q = mysql_query("SELECT * FROM fl_wallet WHERE uid='$userid' && league='$lid'");
if(mysql_num_rows($q)>0)
{
$content .= Generate_Roster($userid);
}
else
{
$content .= '<div class="message" style="text-align:center;">Tento užívateľ nehrá Fantasy ligu.</div>';
}
$content .= '
</div> <!-- end col -->
<div class="col-auto flex-grow-1 flex-shrink-1 d-none d-xl-block">
'.$advert.'
</div> <!-- end col -->
</div> <!-- end row -->';
}
// moja zostava
if($params[0]=="select")
{
$leaguecolor = $n[color];
$active_league = $league;
$title = 'Fantasy '.$n[longname].' - moja zostava';
$content .= '<div id="toasts" class="fixed-top" style="top: 80px; right: 23px; left: initial; z-index:1051;"></div>';
$content .= "<i class='float-left h1 h1-fluid ll-".LeagueFont($n[longname])." text-gray-600 mr-1'></i>
<h1 class='h3 h3-fluid mb-1'>".LANG_FANTASY_TITLE."</h1>
<h2 class='h6 h6-fluid text-".$leaguecolor." text-uppercase font-weight-bold mb-3'>".$n[longname]."</h2>
<div class='row mb-4'>
<div class='col-12' style='max-width: 1000px;'>";
$content .= '<nav aria-label="Fantasy navigation">
<ul class="pagination pagination-sm">
<li class="page-item">
<a class="page-link text-gray-800" href="/fantasy/main" aria-label="'.LANG_BETS_RANK.'">
<span aria-hidden="true"><i class="fas fa-list-ol"></i> '.LANG_BETS_RANK.'</span>
</a>
</li>
<li class="page-item">
<a class="page-link text-gray-800 show-prices" href="#" aria-label="'.LANG_FANTASY_PRICELIST.'" id="pricelist">
<span aria-hidden="true"><i class="fas fa-money-bill-alt"></i> '.LANG_FANTASY_PRICELIST.'</span>
</a>
</li>
</ul>
</nav>';
$w = mysql_query("SELECT * FROM fl_wallet WHERE uid='$uid' && league='$league'");
$e = mysql_fetch_array($w);
$content .='
<div class="row justify-content-center">
<div class="col-sm-8 col-md-5">
<div class="card shadow animated--grow-in mb-4 text-center">
<div class="card-header">
<h6 class="m-0 font-weight-bold text-'.$leaguecolor.'">
'.LANG_FANTASY_BALANCE.'
</h6>
</div>
<div class="card-body">
<p class="h4 h4-fluid">'.money_format('%.0n', $e[balance]).'</p>
<p class="h6 h6-fluid">'.$e[points].' '.LANG_TEAMSTATS_PTS.'</p>
</div>
<div class="card-footer text-light '.($e[active]==0 ? 'bg-danger':'bg-success').'">
'.($e[active]==0 ? LANG_FANTASY_NOTACTIVE:LANG_FANTASY_ACTIVE).'
</div>
</div>
</div>
</div>
'.Generate_Roster($uid).'
</div> <!-- end col -->
<div class="col-auto flex-grow-1 flex-shrink-1 d-none d-xl-block">
'.$advert.'
</div> <!-- end col -->
</div> <!-- end row -->';
$script_end .= "
<script>
$(function() {
$(document).on('click', '.show-dialog', function() {
var action = $(this).attr('id').split('-');
var lid = $league;
var butt = $(this);
$.ajax({
url: '/includes/dialog.php?action='+action[0]+'&pid='+action[1]+'&g='+action[2]+'&lid='+lid+'&pos='+action[3],
success: function(data){
butt.tooltip('hide');
$('#dialog').html(data);
$('#dialog').modal('show');
}
});
});
$(document).on('change', '#team', function() {
if(this.value!='0') {
var orez = this.value.split('-');
var pos = orez[0];
var team = orez[1];
var lid = $league;
$.ajax({
url: '/includes/dialog.php?action=buy&lid='+lid+'&team='+team+'&pos='+pos,
success: function(data){
$('.modal-body').html(data);
$('.buy').prop('disabled', false);
}
});
}
});
$(document).on('click', '.buy', function() {
var lid = $league;
var orez = $('#player').val().split('-');
var player = orez[0];
var pos = orez[1];
$.ajax({
url: '/includes/dialog.php?action=buy&lid='+lid+'&player='+player+'&pos='+pos,
success: function(data){
if(data=='notenough')
{
var today = new Date();
var smallText = today.toLocaleDateString('sk-SK');
Notification('money-bill-alt text-danger', '".LANG_FANTASY_TITLE."', smallText, '".LANG_FANTASY_NOTENOUGHMONEY."', 5000);
}
else
{
$('#dialog').modal('hide');
location.href = '/fantasy/select';
}
}
});
});
$(document).on('click', '.sell', function() {
var lid = $league;
var orez = $('#pid').val().split('-');
var pid = orez[0];
var g = orez[1];
$.ajax({
url: '/includes/dialog.php?action=sell&lid='+lid+'&playerid='+pid+'&g='+g,
success: function(data){
$('#dialog').modal('hide');
location.href = '/fantasy/select';
}
});
});
$(document).on('click', '.sellteam', function() {
var lid = $league;
$.ajax({
url: '/includes/dialog.php?action=sellteam&ok='+lid,
success: function(data){
$('#dialog').modal('hide');
location.href = '/fantasy/select';
}
});
});
$(document).on('click', '.automat', function() {
var lid = $league;
$.ajax({
url: '/includes/dialog.php?action=automat&ok='+lid,
success: function(data){
$('#dialog').modal('hide');
location.href = '/fantasy/select';
}
});
});
});
</script>";
}
$script_end .= '
<script>
$(document).on("click", ".show-prices", function() {
var lid = '.$league.';
$.ajax({
url: "/includes/dialog.php?action=pricelist&lid="+lid,
success: function(data){
$("#dialog").html(data);
$("#dialog").modal(\'show\');
}
});
});
$(document).on("change", "#pricesteam", function() {
if(this.value!="0") {
var orez = this.value.split("-");
var team = orez[1];
var lid = '.$league.';
$.ajax({
url: "/includes/dialog.php?action=pricelist&lid="+lid+"&team="+team,
success: function(data){
$(".modal-body").html(data);
}
});
}
});
</script>';
}
?>