
<h2>Classement</h2>
<?php
if ( sizeof((array)v('TabLadders')) == 0 ){
	?>Aucune &eacute;quipe inscrite<?php
} else {
        $liste_equipes = v('liste_equipes');
        $defi = '<a href="'.href('',array('controleur'=>'ladder','action'=>'voir','params'=>Routage::params()),false,true).'#tabs-defier" class="lien-defi" title="Defier cette equipe" rel="[[_REL_]]" onclick="return defier([[_REL_]])">défier</a>';

	?><table id="classement-ladder" class="table-css table table-striped" align="center">
	<thead>
		<tr>
			<th rowspan="2">N°</th>
			<th rowspan="2">Equipe</th>
			<th class="pts" rowspan="2">Points</th>
			<th class="matchs" colspan="5">Matchs</th>
			<th class="med" rowspan="2">Défier</th>
		</tr>
		<tr>
			<th class="matchs"><abbr title="Joués">J</abbr></th>
			<th class="matchs"><abbr title="Gagnés">G</abbr></th>
			<th class="matchs"><abbr title="Perdus">P</abbr></th>
			<th class="matchs"><abbr title="Nuls">N</abbr></th>
			<th class="matchs"><abbr title="Goal Average">GA</abbr></th>
		</tr>
	</thead>
    <?php
    $der_points = null;
           $der_classement = 1;
           $der_aff_classement = '-';
           $der_ga = null;
	$cpt = 0;
	foreach ((array)v('TabLadders') as $Ladder){
        $der_aff_classement = $der_classement;
                if ($der_points === null) {
                    $der_classement = 1;
                } else {
                    if ($der_points != $Ladder['LAD_PTS']) {
                        $der_classement++;
                        $der_aff_classement = $der_classement;
                    } else {
                        if ($der_ga != $Ladder['LAD_GA']) {
                            $der_classement++;
                            $der_aff_classement = $der_classement;
                        } else {
                            $der_aff_classement = '-';
                        }
                    }
                }
                $der_points = $Ladder['LAD_PTS'];
                $der_ga = $Ladder['LAD_GA'];

		$defier = $Ladder['EQI_ETAT']!=9&&$Ladder['LAD_ETAT']==1;
		?>
		<tr class="eq-<?php echo $Ladder['EQI_CLE'].' '; echo $cpt++%2==0?'pair':'impair'; ?>">
			<td><?php echo $der_aff_classement; ?></td>
			<td class="EQI_NOM"><?php echo ' '.zk_equipe($Ladder); ?></td>
			<td class="matchs"><?php echo $Ladder['LAD_PTS']; ?></td>
			<td class="matchs"><?php echo $Ladder['LAD_NB_MAT']; ?></td>
			<td class="matchs"><?php echo $Ladder['LAD_NB_VICT']; ?></td>
			<td class="matchs"><?php echo $Ladder['LAD_NB_DEF']; ?></td>
			<td class="matchs"><?php echo $Ladder['LAD_NB_NUL']; ?></td>
			<td class="matchs"><?php echo $Ladder['LAD_GA']; ?></td>
			<td class="med">
			<?php echo $defier?str_replace("[[_REL_]]",$Ladder['EQI_CLE'],$defi):''; echo $Ladder['LAD_ETAT']==0?'<strike>défier</strike>':''; ?></td>
		</tr>
		<?php
	}
	?></table>
	
	<script type="text/javascript">
<!--
	if ( monEquipe() > 0 ){
		$("tr.eq-"+monEquipe()).addClass('monEquipe');
	}
//-->
</script>
	
	<?php
}