-
Notifications
You must be signed in to change notification settings - Fork 0
/
draft_picks.php
355 lines (314 loc) · 13.7 KB
/
draft_picks.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
<?php include('Connections/settings.php'); ?>
<?php include("includes/sessionInfo.php") ?>
<?php include("includes/functions.php") ?>
<?php include("includes/langfile.php") ?>
<?php include("includes/langs.php") ?>
<?php
switch ($lang){
case 'en':
$l_Year = "Year";
$l_draftpicks = "Draft Picks";
$l_Round = "Round";
$l_UpcomingDraftPicks = "Upcoming Draft Picks";
$l_PastDraftPicks = "Past Draft Picks";
break;
case 'fr':
$l_Year = "Année";
$l_draftpicks = "Choix au repêchage";
$l_Round = "Rond";
$l_UpcomingDraftPicks = "Choix au repêchage prochaine";
$l_PastDraftPicks = "Choix au repêchage précédent";
break;
}
// Class draft picks
class draft_pick
{
var $iYearIdx;
var $iRound;
var $strPickOwner;
var $strTeam;
}
$tmpYear = $_SESSION['current_DraftYear'];
$query_GetDraftPicks = sprintf("SELECT draftpicks.*, proteam.Abbre, proteam.LogoTiny FROM draftpicks, proteam WHERE draftpicks.TeamName=proteam.Number AND draftpicks.OwnBy=%s AND draftpicks.Year >= %s ORDER BY draftpicks.Year, draftpicks.Round", $_SESSION['current_Team_ID'], $tmpYear);
$GetDraftPicks = mysql_query($query_GetDraftPicks, $connection) or die(mysql_error());
$row_GetDraftPicks = mysql_fetch_assoc($GetDraftPicks);
$totalRows_GetDraftPicks = mysql_num_rows($GetDraftPicks);
$query_GetSeasons = sprintf("SELECT draftpicks.* FROM draftpicks WHERE draftpicks.Year >= %s group by draftpicks.Year Order By draftpicks.Year",$tmpYear);
$GetSeasons = mysql_query($query_GetSeasons, $connection) or die(mysql_error());
$row_GetSeasons = mysql_fetch_assoc($GetSeasons);
$totalRows_GetSeasons = mysql_num_rows($GetSeasons);
$query_GetOldDraftPicks = sprintf("SELECT draftpicks.*, proteam.Abbre, proteam.LogoTiny FROM draftpicks, proteam WHERE draftpicks.TeamName=proteam.Number AND draftpicks.OwnBy=%s AND draftpicks.Year < %s ORDER BY draftpicks.Year desc, draftpicks.Round asc", $_SESSION['current_Team_ID'], $tmpYear);
$GetOldDraftPicks = mysql_query($query_GetOldDraftPicks, $connection) or die(mysql_error());
$row_GetOldDraftPicks = mysql_fetch_assoc($GetOldDraftPicks);
$totalRows_GetOldDraftPicks = mysql_num_rows($GetOldDraftPicks);
$query_GetOldSeasons = sprintf("SELECT Year FROM draftpicks WHERE Year < %s group by Year Order By Year desc",$tmpYear);
$GetOldSeasons = mysql_query($query_GetOldSeasons, $connection) or die(mysql_error());
$row_GetOldSeasons = mysql_fetch_assoc($GetOldSeasons);
$totalRows_GetOldSeasons = mysql_num_rows($GetOldSeasons);
// Draft picks!
$iRounds = 8;
$iYear = $row_GetSeasons[ 'Year' ];
$iOldRounds = 8;
$iOldYear = $row_GetOldSeasons[ 'Year' ];
// Initialize the structures that will be used to store the draft picks
$a_Picks = array();
for( $i = $iYear; $i < $iYear + $totalRows_GetSeasons; $i++ )
{
$a_Picks[ $i ] = array();
for( $j = 0; $j < $iRounds; $j++ )
{
$a_Picks[$i][$j] = array();
}
}
$a_OldPicks = array();
for( $i = $iOldYear; $i < $iOldYear + $totalRows_GetOldSeasons; $i++ )
{
$a_OldPicks[ $i ] = array();
for( $j = 0; $j < $iOldRounds; $j++ )
{
$a_OldPicks[$i][$j] = array();
}
}
// Select the picks and sort them in a way that will make them easier to display
do {
$pick = new draft_pick;
$pick->iYearIdx = $row_GetDraftPicks['Year'];
$pick->iRound = $row_GetDraftPicks['Round'];
$pick->strPickOwner = $row_GetDraftPicks['OwnBy'];
$pick->strTeam = $row_GetDraftPicks['Abbre'];
$a_Picks[$row_GetDraftPicks['Year']][$row_GetDraftPicks['Round']][] = (object)$pick;
} while ($row_GetDraftPicks = mysql_fetch_assoc($GetDraftPicks));
$query_GetRounds = sprintf("SELECT * FROM draft WHERE Year <= %s ORDER BY Year desc",$tmpYear);
$GetRounds = mysql_query($query_GetRounds, $connection) or die(mysql_error());
$row_GetRounds = mysql_fetch_assoc($GetRounds);
$totalRows_GetRounds = mysql_num_rows($GetRounds);
// Select the picks and sort them in a way that will make them easier to display
do {
$Oldpick = new draft_pick;
$Oldpick->iYearIdx = $row_GetOldDraftPicks['Year'];
$Oldpick->iRound = $row_GetOldDraftPicks['Round'];
$Oldpick->strPickOwner = $row_GetOldDraftPicks['OwnBy'];
$Oldpick->strTeam = $row_GetOldDraftPicks['Abbre'];
$a_OldPicks[$row_GetOldDraftPicks['Year']][$row_GetOldDraftPicks['Round']][] = (object)$Oldpick;
} while ($row_GetOldDraftPicks = mysql_fetch_assoc($GetOldDraftPicks));
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><?php echo $l_nav_draft;?> - <?php echo $_SESSION['SiteName'] ; ?></title>
<link rel="shortcut icon" type="image/png" href="<?php echo $_SESSION['DomainName']; ?>/image/<?php echo $_SESSION['FavIcon'];?>" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/reset.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/html5.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/menu.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/jquery.accessible-news-slider.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/jquery-ui-1.8.custom.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/header.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/tipsy.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/ui.tabs.css">
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jcarousellite_1.0.1c4.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/formly.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.pop.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.tipsy.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/ui.core.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/reflection.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery-ui-1.8.custom.min.js"></script>
<?php if(isset($_SESSION['username'])){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/chat.css" />
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/chat.js"></script>
<?php } ?>
<!--[if lte IE 9]>
<script src="<?php echo $_SESSION['DomainName']; ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<script type="text/javascript">
$(function(){
$("table").tablesorter();
$('#cssdropdown li.headlink').hover(
function() { $('ul', this).css('display', 'block'); },
function() { $('ul', this).css('display', 'none'); });
});;
</script>
<style media="all" type="text/css">
#container {background-image:url(<?php echo $_SESSION['DomainName']; ?>/image/headers/<?php echo $_SESSION['current_HeaderImage']; ?>); background-color:#<?php echo $_SESSION['current_PrimaryColor'];?>;}
a {color:#<?php echo $_SESSION['current_PrimaryColor']; ?>;}
table.tablesorter thead tr th { background-color: #<?php echo $_SESSION['current_SecondaryColor']; ?>; color:#<?php echo $_SESSION['current_TextColor']; ?>;}
table.tablesorterRates thead tr th { background-color: #<?php echo $_SESSION['current_SecondaryColor']; ?>; color:#<?php echo $_SESSION['current_TextColor']; ?>;}
table.tablesorter thead tr th a{ color:#<?php echo $_SESSION['current_TextColor']; ?>;}
table.tablesorterRates thead tr th a{ color:#<?php echo $_SESSION['current_TextColor']; ?>;}
footer { background-color:#<?php echo $_SESSION['current_PrimaryColor']; ?>;}
#FatFooter { background-color:#<?php echo $_SESSION['current_SecondaryColor']; ?>; color:#<?php echo $_SESSION['current_TextColor']; ?>;}
<?php if ($_SESSION['current_SecondaryColor'] == $_SESSION['current_PrimaryColor']){ echo "#FatFooter a { color:#".$_SESSION['current_TextColor']."; } "; } ?>
h3 {color:#<?php echo $_SESSION['current_PrimaryColor']; ?>;}
#cssdropdown, #cssdropdown ul {background-color:#<?php echo $_SESSION['current_PrimaryColor']; ?>;}
nav {background-color:#<?php echo $_SESSION['current_PrimaryColor']; ?>;}
.fieldsetleft {float:left; width:450px; border: 1px solid #eeeeee; padding: 10px; min-height:500px; }
.fieldsetright {float:right; width:450px; border: 1px solid #eeeeee; padding: 10px; min-height:500px;}
</style>
</head>
<body>
<div align="center">
<div id="wrapper">
<?php include("includes/header.php"); ?>
<?php include("includes/nav.php"); ?>
<article>
<!-- RIGHT HAND SIDE BAR GOES HERE -->
<!--<aside></aside>-->
<!-- MAIN PAGE CONTENT GOES HERE -->
<section>
<h1><?php echo $l_nav_draft;?></h1>
<br clear="all" />
<div class="fieldsetleft">
<?php
do{
echo "<h3>".$row_GetRounds['DraftName']."</h3>";
echo '<table class="tablesorterRates">';
echo '<thead>';
echo '<tr>';
echo '<th width=30>'.$l_Round.'</th>';
echo '<th width=30>'.$l_overall.'</th>';
echo '<th>'.$l_nav_players.'</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
if($totalRows_GetRounds > 0){
$query_GetPlayers = sprintf("SELECT * FROM draftpicks WHERE Year=%s AND OwnBy=%s ORDER BY Round asc, Overall asc", $row_GetRounds['Year'], $_SESSION['current_Team_ID']);
$GetPlayers = mysql_query($query_GetPlayers, $connection) or die(mysql_error());
$row_GetPlayers = mysql_fetch_assoc($GetPlayers);
$totalRows_GetPlayers = mysql_num_rows($GetPlayers);
do{
$query_GetPlayer = sprintf("SELECT 'Player' as Type, Number FROM players WHERE Name='%s' UNION ALL SELECT 'Goalie' as Type, Number FROM goalies WHERE Name='%s' UNION ALL SELECT 'Prospect' as Type, Name as Number FROM prospects WHERE Name='%s' ", $row_GetPlayers["Name"],$row_GetPlayers["Name"],$row_GetPlayers["Name"]);
$GetPlayer = mysql_query($query_GetPlayer, $connection) or die(mysql_error());
$row_GetPlayer = mysql_fetch_assoc($GetPlayer);
$totalRows_GetPlayer = mysql_num_rows($GetPlayer);
echo '<tr>';
echo '<td align=center>'.$row_GetPlayers["Round"].'</td>';
echo '<td align=center>'.$row_GetPlayers["Overall"].'</td>';
echo '<td align=center>';
if($row_GetPlayer['Type']=='Player'){
echo '<a href="player.php?player='.$row_GetPlayer["Number"].'">'.$row_GetPlayers["Name"].'</a>';
} else if($row_GetPlayer['Type']=='Goalie'){
echo '<a href="goalie.php?player='.$row_GetPlayer["Number"].'">'.$row_GetPlayers["Name"].'</a>';
} else if($row_GetPlayer['Type']=='Prospect'){
echo '<a href="prospect.php?player='.$row_GetPlayer["Number"].'">'.$row_GetPlayers["Name"].'</a>';
} else {
echo $row_GetPlayers["Name"];
}
echo '</td>';
echo '</tr>';
} while ($row_GetPlayers = mysql_fetch_assoc($GetPlayers));
}
echo '</tbody>';
echo '</table><br clear="all" />';
} while ($row_GetRounds = mysql_fetch_assoc($GetRounds));
?>
</div>
<div class="fieldsetright">
<h3><?php echo $l_UpcomingDraftPicks;?></h3>
<table class="tablesorterRates">
<thead>
<tr>
<th><?php echo $l_Year;?></th>
<th><?php echo $l_nav_draft;?></th>
</tr>
</thead>
<tbody>
<?php
$tmpRowCount=0;
$tmpRowColor="FFFFFF";
$iCounter = 0;
// Now, display the picks for each year
for( $i = $iYear; $i < $iYear + $totalRows_GetSeasons; $i++ )
{
$iCounter = $iCounter + 1;
if ($tmpRowCount==1){
$tmpRowColor="E9ECF3";
$tmpRowCount=0;
}
else {
$tmpRowColor="FFFFFF";
$tmpRowCount=1;
}
echo( '<tr>');
echo( "<td align='center' valign='middle' style='padding-top:10px;; width:80px;'>" . (($_SESSION['current_Season']) + $iCounter) . "</td>" );
echo( "<td valign='middle' style='padding-top:10px;'>" );
for( $j = 1; $j <= $iRounds; $j++ )
{
if(isset($a_Picks[$i][$j])){
if( count( $a_Picks[$i][$j] ) == 0 ) {
echo( " " );
}
for( $k = 0; $k < count( $a_Picks[$i][$j] ); $k++ )
{
$pick = (object) $a_Picks[$i][$j][$k];
echo $pick->strTeam.' '.$pick->iRound;
echo ", ";
}
}
}
echo( "</td>" );
echo( "</tr>" );
}
?>
</tbody>
</table>
<h3><?php echo $l_PastDraftPicks;?></h3>
<table class="tablesorterRates">
<thead>
<tr>
<th><?php echo $l_Year;?></th>
<th><?php echo $l_nav_draft;?></th>
</tr>
</thead>
<tbody>
<?php
$tmpRowCount=0;
$tmpRowColor="FFFFFF";
// Now, display the picks for each year
for( $i = $iOldYear; $i > $iOldYear - $totalRows_GetOldSeasons-1; $i--)
{
if ($tmpRowCount==1){
$tmpRowColor="E9ECF3";
$tmpRowCount=0;
}
else {
$tmpRowColor="FFFFFF";
$tmpRowCount=1;
}
echo( '<tr>');
echo( "<td align='center' valign='middle' style='padding-top:10px; width:80px;'>" . (($_SESSION['current_Season']-2) - ($totalRows_GetOldSeasons - $i)) . "</td>" );
echo( "<td valign='middle' style='padding-top:10px;'>" );
for( $j = 1; $j <= $iOldRounds; $j++ )
{
if( count( $a_OldPicks[$i][$j] ) == 0 ) {
echo( " " );
}
for( $k = 0; $k < count( $a_OldPicks[$i][$j] ); $k++ )
{
$Oldpick = (object) $a_OldPicks[$i][$j][$k];
echo $Oldpick->strTeam.' '.$Oldpick->iRound;
echo ", ";
}
}
echo( "</td>" );
echo( "</tr>" );
}
?>
</tbody>
</table>
</div>
<br clear="all" />
</section>
</article>
<?php include("includes/footer.php"); ?>
<?php include("includes/statusBar.php"); ?>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($GetInfo);
mysql_free_result($GetSeasons);
mysql_free_result($GetDraftPicks);
?>