forked from SimonT-STHS/STHS-DynamicWebsite-Production
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EntryDraft.php
79 lines (68 loc) · 3.47 KB
/
EntryDraft.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
<?php include "Header.php";
If ($lang == "fr"){include 'LanguageFR-League.php';}else{include 'LanguageEN-League.php';}
$Title = (string)"";
If (file_exists($DatabaseFile) == false){
Goto STHSErrorEntryDraft;
}else{try{
$LeagueName = (string)"";
$db = new SQLite3($DatabaseFile);
$Query = "Select Name, NumbersOfTeam from LeagueGeneral";
$LeagueGeneral = $db->querySingle($Query,true);
$LeagueName = $LeagueGeneral['Name'];
$Query = "SELECT EntryDraft.*, TeamProInfoCurrent.Name AS CurrentTeamName, TeamProInfoCurrent.TeamThemeID As CurrentTeamThemeID, TeamProInfoOriginal.Name As OriginalTeamName, TeamProInfoOriginal.TeamThemeID As OriginalTeamThemeID FROM (EntryDraft LEFT JOIN TeamProInfo AS TeamProInfoCurrent ON EntryDraft.CurrentTeam = TeamProInfoCurrent.Number) LEFT JOIN TeamProInfo AS TeamProInfoOriginal ON EntryDraft.OriginalTeam = TeamProInfoOriginal.Number";
$EntryDraft = $db->query($Query);
$Query = "SELECT EntryDraftProspectAvailable.* FROM EntryDraftProspectAvailable ORDER BY ProspectName";
$EntryDraftProspectAvailable = $db->query($Query);
echo "<title>" . $LeagueName . " - " . $EntryDraftLang['EntryDraft'] . "</title>";
} catch (Exception $e) {
STHSErrorEntryDraft:
$LeagueName = $DatabaseNotFound;
$EntryDraft = Null;
$EntryDraftProspectAvailable = Null;
echo "<title>" . $DatabaseNotFound ."</title>";
echo "<style>.STHSEntryDraft_MainDiv{display:none}</style>";
}}?>
</head><body>
<?php include "Menu.php";?>
<div class="STHSEntryDraft_MainDiv" style="width:99%;margin:auto;">
<?php echo "<h1>" . $EntryDraftLang['EntryDraft']. "</h1>"; ?>
<table class="STHSEntryDraft_MainTable">
<thead><tr>
<th class="STHSEntryDraft_Rank"><?php echo $EntryDraftLang['Rank'];?></th>
<th class="STHSEntryDraft_Team"><?php echo $EntryDraftLang['Team'];?></th>
<th class="STHSEntryDraft_Pick"><?php echo $EntryDraftLang['Pick'];?></th>
</tr></thead><tbody>
<?php
$LoopCount =0;
$Round =0;
if (empty($EntryDraft) == false){while ($row = $EntryDraft ->fetchArray()) {
If ($LoopCount % $LeagueGeneral['NumbersOfTeam'] == 0){
$Round +=1;
echo "<tr><td colspan=\"3\" class=\"STHSCenter\"><b> " . $EntryDraftLang['Round'] . " #" . $Round . "</b></td></tr>";
}
$LoopCount +=1;
If ($row['OriginalTeam'] == $row['CurrentTeam']){
echo "<tr><td>" . $row['PickNumber'] . "</td><td>";
If ($row['CurrentTeamThemeID'] > 0){echo "<img src=\"" . $ImagesCDNPath . "/images/" . $row['CurrentTeamThemeID'] .".png\" alt=\"\" class=\"STHSPHPEntryDraftTeamImage\" />";}
echo $row['CurrentTeamName'] . "</td><td>" . $row['ProspectPick'];
}else{
echo "<tr><td>" . $row['PickNumber'] . "</td><td>";
If ($row['CurrentTeamThemeID'] > 0){echo "<img src=\"" . $ImagesCDNPath . "/images/" . $row['CurrentTeamThemeID'] .".png\" alt=\"\" class=\"STHSPHPEntryDraftTeamImage\" />";}
echo $row['CurrentTeamName'];
echo " <img src=\"" . $ImagesCDNPath . "/images/switch.png\">(";
If ($row['OriginalTeamThemeID'] > 0){echo "<img src=\"" . $ImagesCDNPath . "/images/" . $row['OriginalTeamThemeID'] .".png\" alt=\"\" class=\"STHSPHPEntryDraftTeamImage\" />";}
echo $row['OriginalTeamName'] . ")</td><td>" . $row['ProspectPick'];
}
echo "</td></tr>";
}}
?>
</tbody></table>
<br>
<h1 class="STHSEntryDraft_AvailableProspect"><?php echo $EntryDraftLang['AvailablesProspect'];?></h1>
<?php
if (empty($EntryDraftProspectAvailable) == false){while ($row = $EntryDraftProspectAvailable ->fetchArray()) {
echo $row['ProspectName'] . "<br>\n";
}}
?>
</div>
<?php include "Footer.php";?>