Ejemplo n.º 1
0
     } else {
         echo $show($match->equipe1, '', '', $seed1, '');
     }
 }
 echo "</td>";
 echo show_score1($match->score1, $match->score2, $match->frags1, $match->frags2, $match->type, $match->status, $match->statusequipe, $match->modematchscore);
 if ($avatar_ok && $op != 'admin') {
     echo "<td class=text align=center width=20></td>";
 } else {
     echo "<td class=text align=center width=20>{$strVS}</td>";
 }
 echo show_score2($match->score1, $match->score2, $match->frags1, $match->frags2, $match->type, $match->status, $match->statusequipe, $match->modematchscore);
 echo "<td class=text align=center width=120>";
 if ($op == 'admin') {
     echo "<select name=equipe2><option value=0>";
     if ($match->equipe2 && status_participe($match->equipe2, $match->tournois) != 'P') {
         echo "<option value={$match->equipe2} SELECTED>! " . $nom_participant($match->equipe2) . " !";
     }
     foreach ($participants_list as $eid => $enom) {
         if ($eid == $match->equipe2) {
             echo "<option value={$eid} SELECTED>{$enom}";
         } else {
             echo "<option value={$eid}>{$enom}";
         }
     }
     echo "</select>";
 } else {
     $seed2 = seed($match->equipe2, $match->tournois);
     if ($match->statusequipe == 'F2') {
         echo $show($match->equipe2, '', 'F', $seed2, 'right');
     } elseif ($match->statusequipe == 'D2') {
Ejemplo n.º 2
0
function calcul_finales($id)
{
    global $db, $dbprefix, $s_tournois, $modeelimination_tournois, $nb_finales_winner_tournois, $nb_finales_looser_tournois;
    /*** verification securite ***/
    //verif_admin_tournois($s_joueur,$s_tournois);
    /*** creation du match suivant ***/
    $type_match = type_match($id);
    if (match_fini($id) && $type_match != 'P') {
        $n_finale = no_finale($id);
        $no = no_match($id);
        $equipe_g = equipe_gagnante($id);
        $equipe_p = equipe_perdante($id);
        $forfait_perdant = 0;
        /** pour ne pas envoyer le perdant disqualifi&eacute;/forfait winner dans le looser **/
        if (status_participe($equipe_p, $s_tournois) != 'P') {
            $forfait_perdant = 1;
        }
        /*echo "final: 1/$n_finale $type_match<BR>";
        		echo "n°: $no<BR>";
        		echo "equipe gagnante: $equipe_g<BR>";
        		echo "equipe perdante: $equipe_p<BR><BR>";
         		*/
        // si le match n'est pas nul
        if (!($equipe_g == 0 && $equipe_p == 0)) {
            // si le match est dans le winner
            if ($type_match == 'W') {
                // pour les matchs gagnants du winner
                if (!($modeelimination_tournois == 'S' && $n_finale == 1) && !($modeelimination_tournois == 'D' && $n_finale == 0)) {
                    $next_finale = floor($n_finale / 2);
                    $next_no = round($no / 2);
                    if ($no % 2 == 1) {
                        $next_pos = 1;
                    } else {
                        $next_pos = 2;
                    }
                    /*
                    echo "equipe gagnante: $equipe_g<BR>";
                    echo "next final: 1/$next_finale W <BR>";
                    echo "next n°: $next_no<BR>";
                    echo "next pos°: $next_pos<BR>";
                    */
                    $next_id = id_match_finale('W', $next_finale, $next_no, $s_tournois, 'admin');
                    //echo "next id: $next_id<BR><BR>";
                    $db->update("{$dbprefix}matchs");
                    $db->set("equipe{$next_pos} = {$equipe_g}");
                    $db->where("id = {$next_id}");
                    $db->exec();
                }
                // pour les perdants des matchs du winner du 1er tour
                if ($modeelimination_tournois == 'D' && $n_finale == $nb_finales_looser_tournois) {
                    $next_finale = $n_finale / 2;
                    $next_no = $n_finale / 2 + 1 - round($no / 2);
                    if ($no % 2 == 0) {
                        $next_pos = 1;
                    } else {
                        $next_pos = 2;
                    }
                    /*echo "equipe perdante: $equipe_p<BR><BR>";
                    		echo "next final: 1/$next_finale L<BR>";
                    		echo "next n°: $next_no<BR>";
                    		echo "next pos°: $next_pos<BR>";
                    		*/
                    $next_id = id_match_finale('L', $next_finale, $next_no, $s_tournois, 'admin');
                    //echo "next id: $next_id<BR><BR>";
                    $db->update("{$dbprefix}matchs");
                    $db->set("equipe{$next_pos} = {$equipe_p}");
                    if ($forfait_perdant) {
                        $db->set("statusequipe = 'F{$next_pos}'");
                    }
                    $db->where("id = {$next_id}");
                    $db->exec();
                } elseif ($modeelimination_tournois == 'D' && $n_finale < $nb_finales_looser_tournois && $n_finale != 0) {
                    $next_finale = $n_finale;
                    $next_no = $no + $n_finale;
                    $next_pos = 1;
                    /*echo "equipe perdante: $equipe_p<BR><BR>";
                    		echo "next final: 1/$next_finale L<BR>";
                    		echo "next n°: $next_no<BR>";
                    		echo "next pos°: $next_pos<BR>";
                    		*/
                    $next_id = id_match_finale('L', $next_finale, $next_no, $s_tournois, 'admin');
                    //echo "next id: $next_id<BR><BR>";
                    $db->update("{$dbprefix}matchs");
                    $db->set("equipe{$next_pos} = {$equipe_p}");
                    if ($forfait_perdant) {
                        $db->set("statusequipe = 'F{$next_pos}'");
                    }
                    $db->where("id = {$next_id}");
                    $db->exec();
                }
            } else {
                // pour les matchs gagnants du looser autre que la finale (la L 1.2)
                if ($n_finale != 1 || $no != 2) {
                    // si c le 1er tour
                    if ($no <= $n_finale) {
                        $next_finale = $n_finale;
                        $next_no = $no + $n_finale;
                        $next_pos = 2;
                        /*echo "equipe gagnante: $equipe_g<BR>";
                        		echo "next final: 1/$next_finale L <BR>";
                        		echo "next n°: $next_no<BR>";
                        		echo "next pos°: $next_pos<BR>";
                        		*/
                        $next_id = id_match_finale('L', $next_finale, $next_no, $s_tournois, 'admin');
                        //echo "next id: $next_id<BR><BR>";
                        $db->update("{$dbprefix}matchs");
                        $db->set("equipe{$next_pos} = {$equipe_g}");
                        $db->where("id = {$next_id}");
                        $db->exec();
                    } else {
                        $next_finale = floor($n_finale / 2);
                        $next_no = round(($no - $n_finale) / 2);
                        if ($no % 2 == 1) {
                            $next_pos = 1;
                        } else {
                            $next_pos = 2;
                        }
                        /*echo "equipe gagnante: $equipe_g<BR>";
                        		echo "next final: 1/$next_finale L <BR>";
                        		echo "next n°: $next_no<BR>";
                        		echo "next pos°: $next_pos<BR>";
                        		*/
                        $next_id = id_match_finale('L', $next_finale, $next_no, $s_tournois, 'admin');
                        //echo "next id: $next_id<BR><BR>";
                        $db->update("{$dbprefix}matchs");
                        $db->set("equipe{$next_pos} = {$equipe_g}");
                        $db->where("id = {$next_id}");
                        $db->exec();
                    }
                } elseif ($n_finale == 1 && $no == 2) {
                    $next_finale = 0;
                    $next_no = 1;
                    $next_pos = 2;
                    /*echo "equipe gagnante: $equipe_g<BR>";
                    		echo "next final: GRAND FINAL W <BR>";
                    		echo "next n°: $next_no<BR>";
                    		*/
                    $next_id = id_match_finale('W', $next_finale, $next_no, $s_tournois, 'admin');
                    //echo "next id: $next_id<BR><BR>";
                    $db->update("{$dbprefix}matchs");
                    $db->set("equipe{$next_pos} = {$equipe_g}");
                    $db->where("id = {$next_id}");
                    $db->exec();
                }
            }
        }
    }
}