-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDynamicCoachTest.php
More file actions
159 lines (146 loc) · 8.62 KB
/
DynamicCoachTest.php
File metadata and controls
159 lines (146 loc) · 8.62 KB
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
<?php include "Header.php";
If ($lang == "fr"){include 'LanguageFR-League.php';}else{include 'LanguageEN-League.php';}
$CoachesQueryOK = (boolean)False;
$HistoryOutput = (boolean)False;
$ExtraH1 = (string)"";
$CoachLifeTime = Null;
If (file_exists($DatabaseFile) == false){
Goto STHSErrorCoach;
}else{try{
$db = new SQLite3($DatabaseFile);
$Query = "Select FarmEnable from LeagueSimulation";
$LeagueSimulationMenu = $db->querySingle($Query,true);
$Query = "Select StandardStandingOutput From LeagueOutputOption";
$LeagueOutputOption = $db->querySingle($Query,true);
$Query = "Select Name, OutputName, PointSystemSO from LeagueGeneral";
$LeagueGeneral = $db->querySingle($Query,true);
$LeagueName = $LeagueGeneral['Name'];
$Title = $LeagueName . " - " . $CoachesLang['CoachesTitle'];
$CoachLifeTimeValue = $db->querySingle("SELECT Count(name) AS CountName FROM CoachInfo WHERE LifeTimeGP > 0",true);
If ($CoachLifeTimeValue['CountName'] > 0){
If ($LeagueOutputOption['StandardStandingOutput'] == "True"){
$Query = "SELECT CoachInfo.* FROM CoachInfo WHERE LifeTimeGP > 0 ORDER BY CoachInfo.LifeTimeGP DESC, (CoachInfo.LifeTimeW + CoachInfo.LifeTimeOTW + CoachInfo.LifeTimeSOW) DESC";
}else{
$Query = "SELECT CoachInfo.* FROM CoachInfo WHERE LifeTimeGP > 0 ORDER BY CoachInfo.LifeTimeGP DESC, CoachInfo.LifeTimeW DESC";
}
$CoachLifeTime = $db->query($Query);
}
$CoachesQueryOK = True;
} catch (Exception $e) {
STHSErrorCoach:
$LeagueName = $DatabaseNotFound;
$Coach = Null;
echo "<style>Div{display:none}</style>";
$Title = $DatabaseNotFound;
$LeagueSimulationMenu = Null;
$HistoryOutput = False;
}}
echo "<title>" . $Title . "</title>";
?>
<style>
#tablesorter_colSelectPro:checked + label {background: #5797d7; border-color: #555;}
#tablesorter_colSelectPro:checked ~ #tablesorter_ColumnSelectorPro {display: block;}
#tablesorter_colSelectFarm:checked + label {background: #5797d7; border-color: #555;}
#tablesorter_colSelectFarm:checked ~ #tablesorter_ColumnSelectorFarm {display: block;}
#tablesorter_colSelectAvailable:checked + label {background: #5797d7; border-color: #555;}
#tablesorter_colSelectAvailable:checked ~ #tablesorter_ColumnSelectorAvailable {display: block;}
<?php if (isset($LeagueSimulationMenu)){If ($LeagueSimulationMenu['FarmEnable'] == "False"){echo "#FarmTable{display:none;}\n#FarmH1{display:none;}";}}?>
</style>
</head><body>
<?php include "Menu.php";?>
<script>
$(function() {
$(".STHSPHPProCoaches_Table").tablesorter({
showProcessing: true,
widgets: ['columnSelector', 'stickyHeaders', 'filter'],
widgetOptions : {
columnSelector_container : $('#tablesorter_ColumnSelectorPro'),
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
columnSelector_name : 'title',
columnSelector_mediaquery: true,
columnSelector_mediaqueryName: 'Automatic',
columnSelector_mediaqueryState: true,
columnSelector_mediaqueryHidden: true,
columnSelector_breakpoints : [ '20em', '40em', '60em', '80em', '90em', '95em' ],
filter_columnFilters: true,
filter_placeholder: { search : '<?php echo $TableSorterLang['Search'];?>' },
filter_searchDelay : 500,
filter_reset: '.tablesorter_Reset'
}
});
});
function myFunction() {
document.getElementById("demo").innerHTML = "YOU CLICKED ME!";
$('.STHSPHPProCoaches_Table tbody').empty();
$('.STHSPHPProCoaches_Table > tbody:last-child' ).append('<tr><td>ASimon Tremblay</td><td><img src="./images/1.png" alt="" class="STHSPHPCoachesTeamImage"/>Simon Tremblay</td> <td>60</td> <td>60</td><td>60</td><td>60</td><td>60</td><td>60</td><td>60</td><td>CAN</td> <td>49</td><td>5</td><td></td><td>100,000$</td></tr>');
$('.STHSPHPProCoaches_Table > tbody:last-child' ).append('<tr><td>bSimon Tremblay</td><td><img src="./images/1.png" alt="" class="STHSPHPCoachesTeamImage"/>Simon Tremblay</td> <td>60</td> <td>60</td><td>60</td><td>60</td><td>60</td><td>60</td><td>60</td><td>CAN</td> <td>49</td><td>5</td><td></td><td>100,000$</td></tr>');
$('.STHSPHPProCoaches_Table').trigger("update");
$('.STHSPHPProCoaches_Table').trigger("sorton", [ [[0,"s"]] ]);
}
</script>
<div style="width:95%;margin:auto;">
<?php echo "<h1>" . $CoachesLang['CoachesTitle'] . $ExtraH1 . "</h1>";
If($HistoryOutput == True){
echo "<div id=\"ReQueryDiv\" style=\"display:none;\">";include "SearchHistorySub.php";include "SearchHistoryCoaches.php";echo "</div>";
echo "<button class=\"tablesorter_Output\" style=\"margin-left:15px\" id=\"ReQuery\">" . $SearchLang['ChangeSearch'] . "</button>";
}?>
<p id="demo" onclick="myFunction()">Click me.</p>
<br>
<div class="tablesorter_ColumnSelectorWrapper">
<input id="tablesorter_colSelectPro" type="checkbox" class="hidden">
<label class="tablesorter_ColumnSelectorButton" for="tablesorter_colSelectPro"><?php echo $TableSorterLang['ShoworHideColumn'];?></label>
<div id="tablesorter_ColumnSelectorPro" class="tablesorter_ColumnSelector"></div>
<?php include "FilterTip.php";?>
</div>
<h1><?php echo $CoachesLang['ProCoaches'] . $ExtraH1;?></h1>
<table class="STHSPHPProCoaches_Table tablesorter"><thead><tr>
<th data-priority="critical" title="Coaches Name" class="STHSW200"><?php echo $CoachesLang['CoachesName'];?></th>
<th data-priority="1" title="Team Name" class="STHSW200"><?php echo $CoachesLang['TeamName'];?></th>
<th data-priority="2" title="Physical Style" class="STHSW25">PH</th>
<th data-priority="2" title="Defense Style" class="STHSW25">DF</th>
<th data-priority="2" title="Offense Style" class="STHSW25">OF</th>
<th data-priority="2" title="Player Discipline" class="STHSW25">PD</th>
<th data-priority="2" title="Experience" class="STHSW25">EX</th>
<th data-priority="2" title="Leadership" class="STHSW25">LD</th>
<th data-priority="3" title="Potential" class="STHSW25">PO</th>
<th data-priority="6" title="Country" class="STHSW35">CNT</th>
<th data-priority="5" title="Age" class="STHSW35"><?php echo $CoachesLang['Age'];?></th>
<th data-priority="4" title="Contract" class="STHSW25"><?php echo $CoachesLang['Contract'];?></th>
<th data-priority="6" title="Contract Signature Date" class="STHSW55"><?php echo $CoachesLang['ContractSignatureDate'];?></th>
<th data-priority="4" title="Salary" class="STHSW100"><?php echo $CoachesLang['Salary'];?></th>
</tr></thead>
<tbody>
<?php
If($CoachesQueryOK == True){If ($HistoryOutput == False){
$Query = "SELECT CoachInfo.*, TeamProInfo.Name as TeamProName, TeamFarmInfo.Name As TeamFarmName, TeamProInfo.CoachID as ProCoachTeamID, TeamFarmInfo.CoachID as FarmCoachTeamID, TeamProInfo.TeamThemeID As TeamThemeID FROM (CoachInfo LEFT JOIN TeamFarmInfo ON CoachInfo.Team = TeamFarmInfo.Number) LEFT JOIN TeamProInfo ON CoachInfo.Team = TeamProInfo.Number WHERE TEAM <> 0 ORDER BY CoachInfo.Name";
If (file_exists($DatabaseFile) ==True){$Coach = $db->query($Query);}
}else{
$Query = "SELECT CoachInfo.*, TeamProInfoHistory.Name as TeamProName, TeamFarmInfoHistory.Name As TeamFarmName, TeamProInfoHistory.CoachID as ProCoachTeamID, TeamFarmInfoHistory.CoachID as FarmCoachTeamID, 0 AS TeamThemeID FROM (CoachInfo LEFT JOIN TeamFarmInfoHistory ON CoachInfo.Team = TeamFarmInfoHistory.Number) LEFT JOIN TeamProInfoHistory ON CoachInfo.Team = TeamProInfoHistory.Number WHERE TEAM <> 0 AND CoachInfo.Year = " . $Year . " AND CoachInfo.Playoff = '" . $PlayoffString. "' AND TeamProInfoHistory.Year = " . $Year . " AND TeamProInfoHistory.Playoff = '" . $PlayoffString. "' AND TeamFarmInfoHistory.Year = " . $Year . " AND TeamFarmInfoHistory.Playoff = '" . $PlayoffString. "' ORDER BY CoachInfo.Name";
If (file_exists($CareerStatDatabaseFile) ==True){$Coach = $db->query($Query);}
}
if (empty($Coach) == false){while ($row = $Coach ->fetchArray()) {
If ($row['Number'] == $row['ProCoachTeamID']){
echo "<tr><td>" . $row['Name'] . "</td><td>";
If ($row['TeamThemeID'] > 0){echo "<img src=\"" . $ImagesCDNPath . "/images/" . $row['TeamThemeID'] .".png\" alt=\"\" class=\"STHSPHPCoachesTeamImage\">";}
echo $row['TeamProName'] . "</td>";
echo "<td>" . $row['PH'] . "</td>";
echo "<td>" . $row['DF'] . "</td>";
echo "<td>" . $row['OF'] . "</td>";
echo "<td>" . $row['PD'] . "</td>";
echo "<td>" . $row['EX'] . "</td>";
echo "<td>" . $row['LD'] . "</td>";
echo "<td>" . $row['PO'] . "</td>";
echo "<td>" . $row['Country'] . "</td>";
echo "<td>" . $row['Age'] . "</td>";
echo "<td>" . $row['Contract'] . "</td>";
echo "<td>" . $row['ContractSignatureDate'] . "</td>";
echo "<td>" . number_format($row['Salary'],0) . "$</td>";
echo "</tr>\n"; /* The \n is for a new line in the HTML Code */
}
}}}
?>
</tbody></table>
<br>
<br>
</div>
<?php include "Footer.php";?>