Example #1
0
 if ($type == "B") {
     if ($jeu->jeu_bloque == "1") {
         $json["resultat"] = false;
         $json["commentaire"] = "Jeu déjà bloqué";
     } else {
         if ($debug) {
             echo "Déblocage du jeu\n";
         }
         // Recherche la liste des joueurs
         $joueurs = new Joueur($db);
         $stmtJoueurs = $joueurs->litJoueurs();
         $listeJoueurs = $stmtJoueurs->fetchAll(PDO::FETCH_ASSOC);
         // Pronostics des joueurs
         $pronostic = new Pronostic($db);
         $pronostic->jeu_id = $jeu->jeu_id;
         $stmtPronostics = $pronostic->litPronostics();
         $listePronostics = $stmtPronostics->fetchAll(PDO::FETCH_ASSOC);
         $nbJoueurs = 0;
         for ($j = 0; $j < sizeof($listeJoueurs); $j++) {
             $joueur_id = $listeJoueurs[$j]["joueur_id"];
             if ($listePronostics) {
                 $prono = getPronoJoueur($listePronostics, $joueur_id);
             }
             if ($debug && isset($prono)) {
                 echo "Joueur {$joueur_id} a le prono " . getPronostic($prono, 1) . " pour le premier match<br>\n";
             }
             // Pas de pronostic ou alors pronostic vide (car effacé)
             if (!isset($prono) || isset($prono) && getPronostic($prono, 1) == "") {
                 $nbJoueurs++;
             }
         }