<?php
/*======================================================================*\
|| #################################################################### ||
|| # EoT-Clan BF3 Leaderboard                                         # ||
|| # ---------------------------------------------------------------- # ||
|| # Dieses Copyright darf nicht entfernet werden                     # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # -----------------BF3 Leaderboard is a free Software--------------# ||
|| #                   http://eot-clan.net                            # ||
|| #################################################################### ||
\*======================================================================*/
require_once ('../inc/config.php');
require_once ('../language/'.$row['language'].'.php');

$_GET = security::escape($_GET);
$_POST = security::escape($_POST);
$EoT = new eGamersofTomorrow;


     $aSsql = array("m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11","m12","m13","m14","m15","m16","m17","m18","m19","m20","m21","m22","m23","m24","m25","m26","m27","m28","m29","m30","m31","m32","m33","m34","m35","m36","m37","m38","m39","m40","m41","m42","m43","m44","m45","m46","m47","m48","m49","m50");


          foreach ($aSsql as $MedalsSUM){
          	$rCount = 'SUM(`'.$MedalsSUM.'_count`) AS `'.$MedalsSUM.'_count`';      
            $arCount[] = $rCount;
          }
           $arCount = implode(", " , $arCount);

       $sSql = "SELECT ".$arCount." FROM ".DBPrefix."medals";       
          $result= mysql_query($sSql)or die(mysql_error()) ;

     while ($row = mysql_fetch_assoc($result)) {	
          foreach ($aSsql as $medals){
             $sMedals = $medals.'_count';
             $aCount[$medals] = $row[$sMedals];
          }
     }
     arsort($aCount);
   ?>
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">
     <title>BF3 LB / <?php echo LANG_CLANSTATS_MEDALS_TITLE; ?></title>
     <?php echo $styleSettings; ?>
      <div class="body_bfLB" style="width:<?php echo $style['IndexDivWidth']; ?>px;">   
	           <?php echo $Banner; ?>
        <ul id="statstabs" class="shadetabs" style="margin-top:10px;margin-bottom:-10px;">
        <li><a href="../index.php">Leaderboard</a></li>
        <li><a href="class.php"><?php echo LANG_CLANSTATS_TAB_KITS; ?></a></li>
        <li><a href="skill.php"><?php echo LANG_CLANSTATS_TAB_SKILL; ?></a></li>
        <li><a href="teamplay.php" >Teamplay</a></li>
        <li><a href="vehicles.php"><?php echo LANG_CLANSTATS_TAB_VEHICLES; ?></a></li>
        <li><a href="weaponstats.php"><?php echo LANG_CLANSTATS_TAB_WEAPONS; ?></a></li>
        <li><a href="ribbonsstats.php">Ribbons</a></li>
        <li><a href="medalsstats.php" class="selected">Medals</a></li>
        <li><a href="events.php">Events</a></li>
        <li><a href="serverHistory.php">S.History</a></li>
      </ul>
				<table class="default" style="width:<?php echo $style['IndexTableWidth']; ?>px;">
        <td class="head" colspan="13" cellspacing="0"><?php echo LANG_CLANSTATS_MEDALS_TITLE; ?></td>
        <tr>
    <?php
    
    $i = 0;
 foreach ($aCount as $key => $count){
 	$i++;
    	$Medalsconstante = 'LANG_MEDALS_TEXT_'.$key.'';
   if ($count <= 1){
  	$countI = '';
  }else{
  	$countI = '<div style="position:absolute;margin-left:42px;margin-top:-18px;background-color:#000;width:55px;opacity:0.80;filter: alpha(opacity=80);-moz-opacity: 0.8;">'.$count.'x</div>';
  }
  
   if ($count == 0){
   	$img = '<img src="'.$domain.'/img/medals/transparent/'.$key.'.png" width="'.$imgW.'px" />';
  }else{
  	$img = '<img src="'.$domain.'/img/medals/'.$key.'.png" width="'.$imgW.'px" />';
  }
  
    	 
      $tooltip = '<img src="'.$domain.'/img/medals/'.$key.'.png" /><br />'.constant($Medalsconstante);
    ?>
    	<td class="result"><a href="Medaldetails.php?medal=<?php echo $key; ?>" class="tooltip">
    		  	<?php echo $img; ?>
    		   <span style="margin-top:25px;margin-left:-85px;z-index:1000;"><?php echo $tooltip; ?></span>
    		  </a>
    		<?php echo $countI; ?>
    	</td>
    <?php
     if ($i % 8 == 0) echo'<tr />';    
 }  
 
 ?>
  <td class="result" colspan="7">&ensp;</td>
 </table>
  <?php
   include_once '../inc/footer.php';
              echo '</div>';
