forked from SimonT-STHS/STHS-DynamicWebsite-Production
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCareerStatTeamsStatByYear.php
132 lines (117 loc) · 8.38 KB
/
CareerStatTeamsStatByYear.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
<?php include "Header.php";
If ($lang == "fr"){include 'LanguageFR-Stat.php';}else{include 'LanguageEN-Stat.php';}
$Title = (string)"";
$Search = (boolean)False;
$CareerLeaderSubPrintOut = (int)1;
If (file_exists($DatabaseFile) == false){
Goto CareerStatTeamsStatByYear;
}else{try{
$ACSQuery = (boolean)FALSE;/* The SQL Query must be Ascending Order and not Descending */
$Playoff = (string)"False";
$TypeText = (string)"Pro";$TitleType = $DynamicTitleLang['Pro'];
$LeagueName = (string)"";
$OrderByField = (string)"Points";
$OrderByFieldText = (string)"Points";
$OrderByInput = (string)"";
$Team = (integer)0;
$Year = (integer)0;
if(isset($_GET['ACS'])){$ACSQuery= TRUE;}
if(isset($_GET['Farm'])){$TypeText = "Farm";$TitleType = $DynamicTitleLang['Farm'];}
if(isset($_GET['Playoff'])){$Playoff="True";}
if(isset($_GET['Order'])){$OrderByInput = filter_var($_GET['Order'], FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW || FILTER_FLAG_STRIP_HIGH || FILTER_FLAG_NO_ENCODE_QUOTES || FILTER_FLAG_STRIP_BACKTICK);}
if(isset($_GET['Year'])){$Year = filter_var($_GET['Year'], FILTER_SANITIZE_NUMBER_INT);}
include "SearchPossibleOrderField.php";
foreach ($TeamStatPossibleOrderField as $Value) {
If (strtoupper($Value[0]) == strtoupper($OrderByInput)){
$OrderByField = $Value[0];
$OrderByFieldText = $Value[1];
Break;
}
}
$db = new SQLite3($DatabaseFile);
$Query = "Select Name, PlayOffStarted, PointSystemW from LeagueGeneral";
$LeagueGeneral = $db->querySingle($Query,true);
$LeagueName = $LeagueGeneral['Name'];
$Query = "SELECT 0 As TeamThemeID, 0 as Number, Team" . $TypeText . "StatCareer.Name as Name, Team" . $TypeText . "StatCareer.Year as Year, Team" . $TypeText . "StatCareer.Name as OrderName, Team" . $TypeText . "StatCareer.GP AS GP, Team" . $TypeText . "StatCareer.W AS W, Team" . $TypeText . "StatCareer.L AS L, Team" . $TypeText . "StatCareer.T AS T, Team" . $TypeText . "StatCareer.OTW AS OTW, Team" . $TypeText . "StatCareer.OTL AS OTL, Team" . $TypeText . "StatCareer.SOW AS SOW, Team" . $TypeText . "StatCareer.SOL AS SOL, Team" . $TypeText . "StatCareer.Points AS Points, Team" . $TypeText . "StatCareer.GF AS GF, Team" . $TypeText . "StatCareer.GA AS GA, Team" . $TypeText . "StatCareer.HomeGP AS HomeGP, Team" . $TypeText . "StatCareer.HomeW AS HomeW, Team" . $TypeText . "StatCareer.HomeL AS HomeL, Team" . $TypeText . "StatCareer.HomeT AS HomeT, Team" . $TypeText . "StatCareer.HomeOTW AS HomeOTW, Team" . $TypeText . "StatCareer.HomeOTL AS HomeOTL, Team" . $TypeText . "StatCareer.HomeSOW AS HomeSOW, Team" . $TypeText . "StatCareer.HomeSOL AS HomeSOL, Team" . $TypeText . "StatCareer.HomeGF AS HomeGF, Team" . $TypeText . "StatCareer.HomeGA AS HomeGA, Team" . $TypeText . "StatCareer.PPAttemp AS PPAttemp, Team" . $TypeText . "StatCareer.PPGoal AS PPGoal, Team" . $TypeText . "StatCareer.PKAttemp AS PKAttemp, Team" . $TypeText . "StatCareer.PKGoalGA AS PKGoalGA, Team" . $TypeText . "StatCareer.PKGoalGF AS PKGoalGF, Team" . $TypeText . "StatCareer.ShotsFor AS ShotsFor, Team" . $TypeText . "StatCareer.ShotsAga AS ShotsAga, Team" . $TypeText . "StatCareer.ShotsBlock AS ShotsBlock, Team" . $TypeText . "StatCareer.ShotsPerPeriod1 AS ShotsPerPeriod1, Team" . $TypeText . "StatCareer.ShotsPerPeriod2 AS ShotsPerPeriod2, Team" . $TypeText . "StatCareer.ShotsPerPeriod3 AS ShotsPerPeriod3, Team" . $TypeText . "StatCareer.ShotsPerPeriod4 AS ShotsPerPeriod4, Team" . $TypeText . "StatCareer.GoalsPerPeriod1 AS GoalsPerPeriod1, Team" . $TypeText . "StatCareer.GoalsPerPeriod2 AS GoalsPerPeriod2, Team" . $TypeText . "StatCareer.GoalsPerPeriod3 AS GoalsPerPeriod3, Team" . $TypeText . "StatCareer.GoalsPerPeriod4 AS GoalsPerPeriod4, Team" . $TypeText . "StatCareer.PuckTimeInZoneDF AS PuckTimeInZoneDF, Team" . $TypeText . "StatCareer.PuckTimeInZoneOF AS PuckTimeInZoneOF, Team" . $TypeText . "StatCareer.PuckTimeInZoneNT AS PuckTimeInZoneNT, Team" . $TypeText . "StatCareer.PuckTimeControlinZoneDF AS PuckTimeControlinZoneDF, Team" . $TypeText . "StatCareer.PuckTimeControlinZoneOF AS PuckTimeControlinZoneOF, Team" . $TypeText . "StatCareer.PuckTimeControlinZoneNT AS PuckTimeControlinZoneNT, Team" . $TypeText . "StatCareer.Shutouts AS Shutouts, Team" . $TypeText . "StatCareer.TotalGoal AS TotalGoal, Team" . $TypeText . "StatCareer.TotalAssist AS TotalAssist, Team" . $TypeText . "StatCareer.TotalPoint AS TotalPoint, Team" . $TypeText . "StatCareer.Pim AS Pim, Team" . $TypeText . "StatCareer.Hits AS Hits, Team" . $TypeText . "StatCareer.FaceOffWonDefensifZone AS FaceOffWonDefensifZone, Team" . $TypeText . "StatCareer.FaceOffTotalDefensifZone AS FaceOffTotalDefensifZone, Team" . $TypeText . "StatCareer.FaceOffWonOffensifZone AS FaceOffWonOffensifZone, Team" . $TypeText . "StatCareer.FaceOffTotalOffensifZone AS FaceOffTotalOffensifZone, Team" . $TypeText . "StatCareer.FaceOffWonNeutralZone AS FaceOffWonNeutralZone, Team" . $TypeText . "StatCareer.FaceOffTotalNeutralZone AS FaceOffTotalNeutralZone, Team" . $TypeText . "StatCareer.EmptyNetGoal AS EmptyNetGoal FROM Team" . $TypeText . "StatCareer WHERE Playoff = '" . $Playoff . "'";
If($Year > 0){$Query = $Query ." AND YEAR = '" . $Year . "'";}
$Query = $Query . " ORDER BY ". $OrderByField;
If ($Playoff=="True"){$Title = $SearchLang['Playoff'] . " ";}
$Title = $Title . $DynamicTitleLang['CareerStatByYear'];
If ($Year > 0){$Title = $Title . $Year . " - ";}
$Title = $Title . $DynamicTitleLang['TeamStat'] . " " . $TitleType;
/* Order by */
If ($ACSQuery == TRUE){
$Query = $Query . " ASC";
$Title = $Title . $DynamicTitleLang['InAscendingOrderBy'] . $OrderByFieldText;
}else{
$Query = $Query . " DESC";
$Title = $Title . $DynamicTitleLang['InDecendingOrderBy'] . $OrderByFieldText;
}
echo "<title>" . $LeagueName . " - " . $Title . "</title>";
If (file_exists($CareerStatDatabaseFile) == true){ /* CareerStat */
$CareerStatdb = new SQLite3($CareerStatDatabaseFile);
$TeamStatSub = $CareerStatdb->query($Query);
include "SearchCareerSub.php";
}
} catch (Exception $e) {
CareerStatTeamsStatByYear:
$LeagueName = $DatabaseNotFound;
$TeamStat = Null;
echo "<title>" . $DatabaseNotFound . "</title>";
$Title = $DatabaseNotFound;
$Team = 0;
}}
?>
</head><body>
<?php include "Menu.php";?>
<script>
$(function() {
$.tablesorter.addWidget({ id: "numbering",format: function(table) {var c = table.config;$("tr:visible", table.tBodies[0]).each(function(i) {$(this).find('td').eq(0).text(i + 1);});}});
$(".STHSPHPTeamsStat_Table").tablesorter({
widgets: ['numbering','columnSelector', 'stickyHeaders', 'filter', 'output'],
widgetOptions : {
columnSelector_container : $('#tablesorter_ColumnSelector'),
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',
output_delivery: 'd',
output_saveFileName: 'STHSTeamStat.CSV'
}
});
$('.download').click(function(){
var $table = $('.STHSPHPTeamsStat_Table'),
wo = $table[0].config.widgetOptions;
$table.trigger('outputTable');
return false;
});
});
</script>
<div style="width:99%;margin:auto;">
<?php echo "<h1>" . $Title . "</h1>";?>
<div id="ReQueryDiv" style="display:none;">
<?php if($LeagueName != $DatabaseNotFound){include "SearchCareerStatTeamsStatByYear.php";}?>
</div>
<div class="tablesorter_ColumnSelectorWrapper">
<button class="tablesorter_Output" id="ReQuery"><?php echo $SearchLang['ChangeSearch'];?></button>
<input id="tablesorter_colSelect1" type="checkbox" class="hidden">
<label class="tablesorter_ColumnSelectorButton" for="tablesorter_colSelect1"><?php echo $TableSorterLang['ShoworHideColumn'];?></label>
<button class="tablesorter_Output download" type="button">Output</button>
<div id="tablesorter_ColumnSelector" class="tablesorter_ColumnSelector"></div>
<?php include "FilterTip.php";?>
</div>
</div>
<table class="tablesorter STHSPHPTeamsStat_Table"><thead><tr>
<?php include "TeamsStatSub.php";?>
</tbody></table>
</div>
<?php
include "Footer.php";
?>