Пример #1
0
  function GetBottomLine($isSixserver) {
    require('variables.php');
    require('variablesdb.php');
    
    $players = "";
    $type = "";
    if ($isSixserver) {
      $sql = "SELECT season FROM six_stats";
      $row = mysql_fetch_array(mysql_query($sql));
      $sixSeason = $row[0];
      $oldseason = $sixSeason-1;
      $type = "Sixserver";
      $sql = "SELECT wp.name as player_name FROM six_history sh ".
        "LEFT JOIN weblm_players wp ON sh.playerId=wp.player_id ".
        "where sh.season=". $oldseason ." AND sh.position=1";
        
    } else {
      $oldseason = $season-1;
      $type = "Ladder";
      $sql = "SELECT player_name from $historytable where season=". $oldseason ." AND position=1";
    }
    $result = mysql_query($sql);
    
    while ($row = mysql_fetch_array($result)) {
      $name = $row['player_name'];
      $sql = "select approved from $playerstable where name = '$name'";
      $playerresult = mysql_query($sql);
      $playerrow = mysql_fetch_array($playerresult);
      $approved = $playerrow["approved"];
      $nameClass = colorNameClass($name, $approved);
    }
    
    $players .= "$type Season $oldseason: <span $nameClass><a style='text-decoration: none;' href='$directory/profile.php?name=$name' title='view profile'>$name</a></span>";
    
    // team ladder - player
    $sql = "SELECT playerId from $teamladdertable where type='player' ORDER BY timestamp DESC LIMIT 0, 1";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
      $playerIdSaved = $row["playerId"];
      $playerName = getPlayerNameForId($playerIdSaved);
    }
    $players .= " - Team Standings leader: ".getPlayerLinkId($playerName, $playerIdSaved);
              
    // team ladder - team
    $sql = "SELECT playerId, playerId2 from $teamladdertable where type='team' ORDER BY timestamp DESC LIMIT 0, 1";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
      $playerIdSaved = $row["playerId"];
      $playerName = getPlayerNameForId($playerIdSaved);
      $playerId2Saved = $row["playerId2"];
      $player2Name = getPlayerNameForId($playerId2Saved);
    }
              
    $players .= " - Best Team: ".getPlayerLinkId($playerName, $playerIdSaved);
    $players .= '<span class="grey-small">&ndash;</span>';
    $players .= getPlayerLinkId($player2Name, $playerId2Saved);
    
     if ($oldseason > 0) {
      $title_left = '<span style="font-size:10px;color:#000000">'.
      "<a style='text-decoration:none;font-weight:bold' href='champions.php'>Champions</a>&nbsp;-&nbsp;".
      "<span style='font-size:10px;font-weight:normal;text-decoration: none;'>". $players.
      "</span></span>";
    }
    return $title_left;
}
Пример #2
0
function GetAwards($player_id, $name) {
  require('variables.php');
  require('variablesdb.php');

  $awards = "";
  
// ladder awards
  $ladderAwards = "";
  $awards_sql = "SELECT position, season from $historytable ".
    "WHERE player_id = '$player_id' order by season";
  $awards_result = mysql_query($awards_sql);
  $seasonPosArray = array();
  
  while($awards_row = mysql_fetch_array($awards_result)) {
    $position = $awards_row['position'];
    $db_season = $awards_row['season'];
    if ($position < 7 && $position > 0) {
      $seasonPosArray = addSeasonAndPos($seasonPosArray, $db_season, $position);
    }	
  }
  foreach ($seasonPosArray as $position => $seasonArray) {
    $ladderAwards .= getImgForPosAndSeasonArray($position, $seasonArray, "bottom");
  }
  if (!empty($ladderAwards)) {
    $awards .= "<p>".$ladderAwards."</p>";
  }
  
  // sixserver awards
  $sixAwards = "";
  $awards_sql = "SELECT position, season from six_history ".
    "WHERE playerId = '$player_id' ORDER BY season";
  $awards_result = mysql_query($awards_sql);
  $sixSeasonPosArray = array();
  
  while($awards_row = mysql_fetch_array($awards_result)) {
    $position = $awards_row['position'];
    $db_season = $awards_row['season'];
    if ($position < 7 && $position > 0) {
      $sixSeasonPosArray = addSeasonAndPos($sixSeasonPosArray, $db_season, $position);
    }	
  }
  foreach ($sixSeasonPosArray as $position => $seasonArray) {
    $sixAwards .= getSixImgForPosAndSeasonArray($position, $seasonArray, "bottom");
  }
  if (!empty($sixAwards)) {
    $awards .= "<p>".$sixAwards."</p>";
  }
  
  
  // tournament awards
  $tournamentAwards = "";
  $cup_sql = "SELECT profileImage, cupName from $tournamenttable ".
    "WHERE firstPlace = '$name'";
  $cup_result = mysql_query($cup_sql);
  while($cup_row = mysql_fetch_array($cup_result)) {
    $profileImage = $cup_row['profileImage'];
    $cupName = $cup_row['cupName'];
    $img = '<img style="vertical-align:bottom;padding:0 0 0 2px;margin:0 0 0 2px;" src="'.
      $directory.'/Cup/'.$profileImage.'" />';
    $tournamentAwards .= '<span style="cursor:help;" title="Winner of '.$cupName.'">'.$img.'</span>';
  }
 
    // mini tournament wins
  $mini_sql = "SELECT count(*) AS cou FROM $minitournamenttable where PLAYER_ID = '$player_id'";
  $mini_result = mysql_query($mini_sql);
  $mini_row = mysql_fetch_array($mini_result);
  
  $miniTournamentWins = $mini_row['cou'];
   
  if ($miniTournamentWins > 0) {
    $profileImage = $gfx_mini_tournament_prefix.$miniTournamentWins.".gif";
    $titleText = $miniTournamentWins." mini tournament win";
    if ($miniTournamentWins > 1) {
      $titleText .= "s";
    }
    $img = '<img style="vertical-align:bottom; padding:0 0 0 2px;margin:0 0 0 2px; margin-bottom:-2px;padding-bottom:-2px;" src="'.
      $directory.'/gfx/awards/'.$profileImage.'" />';
    $tournamentAwards .= '<span style="cursor:help;" title="'.$titleText.'">'.$img.'</span>';
  }
  
  // team ladder - player
   $sql = "SELECT playerId from $teamladdertable where type='player' ORDER BY timestamp DESC LIMIT 0, 1";
   $result = mysql_query($sql);
   while ($row = mysql_fetch_array($result)) {
    $playerIdSaved = $row["playerId"];
    if ($playerIdSaved == $player_id) {
      $tournamentAwards .= '<span style="cursor:help;" title="Team Standings - Best player"><img style="vertical-align:bottom;padding:0 0 0 2px;margin:0 0 0 2px;" src="'.$directory.'/gfx/teamLadderPlayer.gif" /></span>';
    }
   }

   // team ladder - team
   $sql = "SELECT playerId, playerId2 from $teamladdertable where type='team' ORDER BY timestamp DESC LIMIT 0, 1";
   $result = mysql_query($sql);
   while ($row = mysql_fetch_array($result)) {
    $playerIdSaved = $row["playerId"];
    $playerId2Saved = $row["playerId2"];
    if ($playerIdSaved == $player_id || $playerId2Saved == $player_id) {
      if ($playerIdSaved == $player_id) {
        $teammateId = $playerId2Saved; 
      } else {
        $teammateId = $playerIdSaved;
      }
      $teammate = getPlayerNameForId($teammateId);
      $tournamentAwards .= '<span style="cursor:help;" title="Team Standings - Best team with '.$teammate.'"><img style="vertical-align:bottom;padding:0 0 0 2px;margin:0 0 0 2px;" src="'.$directory.'/gfx/teamLadderTeam.gif" /></span>';
    }
   }
  
  // special awards
  $special_sql = "SELECT profileImage, titleText from $awardstable where playerId = '$player_id'";
  $special_result = mysql_query($special_sql);
  $specialHtml = "";
  while($special_row = mysql_fetch_array($special_result)) {
    $profileImage = $special_row['profileImage'];
    $titleText = $special_row['titleText'];
    $img = '<img style="vertical-align:bottom;padding:0 0 0 2px;margin:0 0 0 2px;" src="'.
      $directory.'/gfx/awards/'.$profileImage.'" />';
    $specialHtml .= '<span style="cursor:help;" title="'.$titleText.'">'.$img.'</span>';
  }
  $tournamentAwards .= $specialHtml;
  
  // donators
  $donate_sql = "SELECT id from $donationstable where name = '$name'";
  $donate_result = mysql_query($donate_sql);
  if (mysql_num_rows($donate_result)) {
    $img = '<img style="vertical-align:bottom;padding:0 0 0 2px;margin:0 0 0 2px;" src="'.
      $directory.'/gfx/awards/donator.gif" />';
    $tournamentAwards .= '<span style="cursor:help;" title="'.$name.' donated to '.$leaguename.', thank you!">'.$img.'</span>';
  }
  
  if (!empty($tournamentAwards)) {
    $awards .= "<p>".$tournamentAwards."</p>";
  }
  
  return $awards;
}