"; start_menu_bar("#8b0000"); display_menu_item("Games", "iphone_games.php", 7, $topnum, 2, "#008b00"); display_menu_item("Units", "iphone_pieces.php", 7, 5, 2, "#008b00"); display_menu_item("Leaders", "iphone_leaders.php", 7, $topnum, 2, "#008b00"); display_menu_item("League", "iphone_league.php", 7, 7, 2, "#008b00"); display_menu_item("Home", "index.php", 7, $topnum, 2, "#008b00"); end_menu_bar(); print ""; print"
"; if($league_id=="") { $league_id=1; } league_details($dbh, $user_id, $league_id); print "
"; mysql_close($dbh); print " "; #-------------------- function league_details($dbh, $user_id, $league_id) { $name = get_sql_item($dbh, "select name from L_LEAGUE where row_id = '$league_id'"); print "
$name
"; $status = get_sql_item($dbh, "select status from L_LEAGUE where row_id = '$league_id'"); if($status=="Forming") { print "Season 2 Starting soon!
"; show_users_in_league($dbh, 1, $user_id); } else { if($status=="Playoffs") display_playoff_brackets($dbh, $league_id); display_ileague_standings($dbh, $league_id); print "
"; display_analysis_report($dbh, $league_id); $current_week = get_sql_item($dbh, "select current_week from L_LEAGUE where row_id = '$league_id'"); print "Current Week: $current_week (Show Entire Schedule)"; display_league_schedule($dbh, $league_id, $current_week); } } #------------------------ function display_ileague_standings($dbh, $league_id) { $season_id = get_sql_item($dbh, "select current_season from L_LEAGUE where row_id = '$league_id'"); $name = get_sql_item($dbh, "select name from L_LEAGUE where row_id = '$league_id'"); $status = get_sql_item($dbh, "select status from L_LEAGUE where row_id = '$league_id'"); print "
Allies Conference
"; display_division_standings($dbh, $season_id, 1); print ""; display_division_standings($dbh, $season_id, 2); print "
Axis Conference
"; display_division_standings($dbh, $season_id, 3); print ""; display_division_standings($dbh, $season_id, 4); print "
"; print "x - First Place Clintched
y - Playoff Spot Clintched
z - Eliminated from Playoffs
"; } function display_analysis_report($dbh, $league_id) { $current_week = get_sql_item($dbh, "select current_week from L_LEAGUE where row_id = '$league_id'"); $current_season = get_sql_item($dbh, "select current_season from L_LEAGUE where row_id = '$league_id'"); print "
Week $current_week Report

"; switch($current_week) { case 1: print "New season just starting! Week one kicks off with 2 big 8-player diplomacy games."; break; case 2: print "Week 2 games are under way with 2v2 inner-conference locked games."; break; case 3: print "Week 3 games consist of 1v1 games with each person playing someone from their own conference."; break; case 4: print "Week 4 games are now being played with a series of 2v2 diplomacy games."; break; case 5: print "Week 5 is another round of 1v1 conference games."; break; case 6: print "Week 6 marks our first shot at inter-conference play with 2 big 4v4 division verses division matchups under way."; break; case 7: print "Week 7 continues the inter-conference play with a series of 2v2 locked games."; break; case 8: print "Week 8 is another round of 2v2 inter-conference games, this time with diplomacy game type."; break; case 9: print "Week 9 is the odd-ball week where most of the teams will be playing in odd-man out 5-player diplomacy games. These are very interested games."; break; case 10: print "Only 3 more weeks left! Week 10 games in 1v1 division rivalry games."; break; case 11: print "Week 11 is another round of 1v1 division rivaly games."; break; case 12: print "Final week of the season ends with one final round of 1v1 division rivalry games."; break; } #--- team analysis--- $sql = "select * from L_SEASON_TEAM where season_id = '$current_season'"; $result = mysql_query($sql, $dbh); print mysql_error(); $count = 0; $win_streak=0; $lose_streak=0; $undefeated=0; $no_wins=0; while($row = mysql_fetch_array($result)) { $row_id = $row[row_id]; $team_id = $row[team_id]; $wins = $row[wins]; $losses = $row[losses]; $streak = $row[streak]; $last10 = $row[last10]; if($streak>$win_streak) $win_streak=$streak; if($streak<0 and $streak<$lose_streak) $lose_streak=$streak; if($wins==0) $no_wins++; if($losses==0 and $wins>0) $undefeated++; } #<-- while #-------------------- print "

"; #----------winners------------- $s_team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and streak = '$win_streak' order by wins desc"); $streakName = get_sql_item($dbh, "select name from L_TEAM where row_id = '$s_team_id'"); $team_id=0; if($undefeated>1 and $undefeated<6) { $team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and losses = 0 order by wins desc"); $wins = get_sql_item($dbh, "select wins from L_SEASON_TEAM where season_id = '$current_season' and team_id = '$team_id'"); $name = get_sql_item($dbh, "select name from L_TEAM where row_id = '$team_id'"); print "There are still $undefeated undefeated teams left in the league led by $name who has won his first $wins games and is sitting in first place in his division."; } if($undefeated==1) { $team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and losses = 0 order by wins desc"); $wins = get_sql_item($dbh, "select wins from L_SEASON_TEAM where season_id = '$current_season' and team_id = '$team_id'"); $name = get_sql_item($dbh, "select name from L_TEAM where row_id = '$team_id'"); print "There is only 1 undefeated team left in the league, $name who has won his first $wins games and is sitting on top in his division."; } if($team_id>0) $s_team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and streak = '$win_streak' and team_id <> $team_id order by wins desc"); $streakName = get_sql_item($dbh, "select name from L_TEAM where row_id = '$s_team_id'"); if($streakName != "") print " $streakName is also having a good run lately winning $win_streak games in a row."; print "

"; #----------losers------------- $s_team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and streak = '$lose_streak' order by losses desc"); if($no_wins>1 and $no_wins<6) { $team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and wins = 0 order by losses desc"); $losses = get_sql_item($dbh, "select losses from L_SEASON_TEAM where season_id = '$current_season' and team_id = '$team_id'"); $name = get_sql_item($dbh, "select name from L_TEAM where row_id = '$team_id'"); $s_team_id = get_sql_item($dbh, "select team_id from L_SEASON_TEAM where season_id = '$current_season' and streak = '$lose_streak' and team_id <> '$team_id' order by losses desc"); print "There are still $no_wins teams in the league looking for their first win, including $name who is off to a slow start, losing his first $losses games and sitting in last place but looking to move up."; } $streakName = get_sql_item($dbh, "select name from L_TEAM where row_id = '$s_team_id'"); $lose_streak *= -1; if($streakName != "") print " $streakName is also having a rough time lately losing his last $lose_streak games in a row."; print "

"; } ?>