Ejemplo n.º 1
0
            $afficheNotification_type[0] = "error";
            $afficheNotification_msg[0] = "Une erreur s'est produite lors de l'inscription ou lors de l'envoi de la proposition d'échange.";
            $afficheNotification_sticky[0] = "false";
        }
    } else {
        $afficheNotification_type[0] = "error";
        $afficheNotification_msg[0] = "Une erreur s'est produite lors de l'inscription ou lors de l'envoi de la proposition d'échange.";
        $afficheNotification_sticky[0] = "false";
    }
}
// question de ménage, on détruit les entrées ds la table trade_proposition_tmp qui n'ont pas le
// même 'session_id'...
$query = "delete from trade_proposition_tmp\n                    where\n                         id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and id_gerant1 = {$gerant}\n                         and sess_id != '{$sess_id}'";
DB::dbUpdate($query);
$query = "update accounts_detail set trading_block_vu='Y'\n                    where id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and gerant = {$gerant}";
DB::dbUpdate($query);
// Fil d'ariane
$str_fil_ariane = "Gestion Équipe / Échanges / TradeCenter";
$gravatarA = $pool->create_gravatar_array($id_pool, $id_saison);
?>

<HTML>
<HEAD>
	<?php 
$pool->affiche_header_tags($poolName, $browser, $dev);
?>

	<script type="text/javascript" src="/js/trade.js"></script>
	<script type="text/javascript" src="/plugins/msdropdown/js/jquery.dd.js"></script>
	<script type="text/javascript" src="/js/jquery.scrollfollow.js"></script>
	<script type="text/javascript" src="/js/jquery.cookie.js"></script>
Ejemplo n.º 2
0
<?php

require_once '../class.db.php';
isset($_REQUEST['id_pool']) ? $id_pool = $_REQUEST['id_pool'] : ($id_pool = "");
isset($_REQUEST['id_saison']) ? $id_saison = $_REQUEST['id_saison'] : ($id_saison = "");
isset($_REQUEST['poolName']) ? $poolName = $_REQUEST['poolName'] : ($poolName = "");
isset($_REQUEST['gerant']) ? $gerant = $_REQUEST['gerant'] : ($gerant = "");
isset($_REQUEST['periode']) ? $periode = $_REQUEST['periode'] : ($periode = "");
isset($_REQUEST['func']) ? $func = $_REQUEST['func'] : ($func = "");
isset($_REQUEST['id_player']) ? $id_player = $_REQUEST['id_player'] : ($id_player = "");
isset($_REQUEST['injured']) ? $injured = $_REQUEST['injured'] : ($injured = "");
isset($_REQUEST['force_injury']) ? $force_injury = $_REQUEST['force_injury'] : ($force_injury = "");
isset($_REQUEST['force_injury_raison']) ? $force_injury_raison = $_REQUEST['force_injury_raison'] : ($force_injury_raison = "");
echo "func: {$func}";
DB::dbConnect(strtolower($poolName));
switch ($func) {
    case "chgPlayerInjuryStatus":
        $q = "update joueurs_nhl set injured='{$injured}',force_injury='{$force_injury}',force_injury_raison=\"{$force_injury_raison}\"\n                    where\n                         id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and periode >= {$periode}\n                         and id_player = {$id_player}";
        //echo $q;
        DB::dbUpdate($q);
        $q = "update joueurs_nhl_1st_day set injured='{$injured}',force_injury='{$force_injury}',force_injury_raison=\"{$force_injury_raison}\"\n                    where\n                         id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and periode >= {$periode}\n                         and id_player = {$id_player}";
        DB::dbUpdate($q);
        break;
}
Ejemplo n.º 3
0
 function admin_approuve_delete_trade($id_pool, $id_saison, $periode, $id_trade, $approuve_delete, $id_gerant, $poolName)
 {
     if ($this->isTodayFisrtDayOfAPeriod($id_pool, $id_saison)) {
         $table = "joueurs_pool_1st_day";
     } else {
         $table = "joueurs_pool";
     }
     if ($approuve_delete == "supprimer") {
         $subject = "{$poolName} - Transaction annulée...";
         $body = "La transaction avec {$nickname_gerant2} qui était sous approbation a été annulée par le commissaire.";
         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_trade, $periode, "admin_cancel_trade", $subject, $body);
         $query = "delete from trade\n                         where id_pool = {$id_pool}\n                               and saison_id = {$id_saison}\n                               and id = {$id_trade}";
         mysql_query($query, $this->handle);
         if (mysql_affected_rows() > 0) {
             $this->dbLog($id_pool, $id_gerant, "admin", $query);
         }
     } else {
         // envoi d'un email à tous les participants du pool avant de faire le switch des joueurs/picks pour avoir
         // la bonne information dans le email...
         $this->envoi_email_acceptProposition($id_pool, $id_saison, $id_trade, $periode, "admin_approuve_trade");
         $query = "select * from trade\n                         where id_pool = {$id_pool}\n                               and saison_id = {$id_saison}\n                               and id = {$id_trade}";
         $resultID = mysql_query($query, $this->handle);
         $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
         mysql_free_result($resultID);
         $id_gerant1 = $data["id_gerant1"];
         $id_gerant2 = $data["id_gerant2"];
         $liste_joueurs_gerant1 = $data["liste_joueurs_gerant1"];
         $liste_joueurs_gerant2 = $data["liste_joueurs_gerant2"];
         $liste_picks_gerant1 = $data['liste_picks_gerant1'];
         $liste_picks_gerant2 = $data['liste_picks_gerant2'];
         $periode_activation = $data["periode_activation"];
         $trade_approuve = $data["approuve"];
         $gerant1A = $this->getGerantProfil($id_pool, $id_gerant1, $id_saison);
         $gerant2A = $this->getGerantProfil($id_pool, $id_gerant2, $id_saison);
         // il ne faut pas faire le trade 2 fois... ça arrive quand F5 est appuyé
         // immmédiatement après avoir approuvé un échange
         if ($trade_approuve == "Y") {
             return;
         }
         // on met le champ 'approuve' à Y de la table trade
         $query = "update trade set approuve='Y'\n                         where id_pool = {$id_pool}\n                               and saison_id = {$id_saison}\n                               and id = {$id_trade}";
         mysql_query($query, $this->handle);
         if (mysql_affected_rows() > 0) {
             $this->dbLog($id_pool, $id_gerant, "admin_approuve_delete_trade", $query);
         }
         // On détruit toutes les autres propositions d'échange des 2 gérants qui contiennent
         // un des joueurs/picks impliqués dans l'échange...
         //$liste_joueurs_gerant1A = explode(":",$liste_joueurs_gerant1);
         $propositions1A = $this->getTradePropositions($id_pool, $id_gerant1, $id_saison);
         foreach ($propositions1A as $proposition) {
             $propositionA = explode(";", $proposition);
             $id_prop = $propositionA[0];
             $id_gerant1_prop = $propositionA[1];
             $liste_joueurs_gerant1_prop = $propositionA[2];
             $id_gerant2_prop = $propositionA[3];
             $liste_joueurs_gerant2_prop = $propositionA[4];
             $liste_picks_gerant1_prop = $propositionA[13];
             $liste_picks_gerant2_prop = $propositionA[14];
             if ($id_prop == $id_proposition) {
                 continue;
             }
             if ($id_gerant1_prop == $id_gerant1) {
                 $liste_joueurs_gerant1_propA = explode(":", $liste_joueurs_gerant1_prop);
                 foreach ($liste_joueurs_gerant1_propA as $id_player) {
                     if ($id_player == "") {
                         continue;
                     }
                     if (array_search($id_player, $liste_joueurs_gerant1A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
                 $liste_picks_gerant1_propA = explode(":", $liste_picks_gerant1_prop);
                 foreach ($liste_picks_gerant1_propA as $id_pick) {
                     if ($id_pick == "") {
                         continue;
                     }
                     if (array_search($id_pick, $liste_picks_gerant1A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
             } else {
                 $liste_joueurs_gerant2_propA = explode(":", $liste_joueurs_gerant2_prop);
                 foreach ($liste_joueurs_gerant2_propA as $id_player) {
                     if ($id_player == "") {
                         continue;
                     }
                     if (array_search($id_player, $liste_joueurs_gerant1A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
                 $liste_picks_gerant2_propA = explode(":", $liste_picks_gerant2_prop);
                 foreach ($liste_picks_gerant2_propA as $id_pick) {
                     if ($id_pick == "") {
                         continue;
                     }
                     if (array_search($id_pick, $liste_picks_gerant1A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
             }
         }
         //$liste_joueurs_gerant2A = explode(":",$liste_joueurs_gerant2);
         $propositions2A = $this->getTradePropositions($id_pool, $id_gerant2, $id_saison);
         foreach ($propositions2A as $proposition) {
             $propositionA = explode(";", $proposition);
             $id_prop = $propositionA[0];
             $id_gerant1_prop = $propositionA[1];
             $liste_joueurs_gerant1_prop = $propositionA[2];
             $id_gerant2_prop = $propositionA[3];
             $liste_joueurs_gerant2_prop = $propositionA[4];
             $liste_picks_gerant1_prop = $propositionA[13];
             $liste_picks_gerant2_prop = $propositionA[14];
             if ($id_prop == $id_proposition) {
                 continue;
             }
             if ($id_gerant1_prop == $id_gerant2) {
                 $liste_joueurs_gerant1_propA = explode(":", $liste_joueurs_gerant1_prop);
                 foreach ($liste_joueurs_gerant1_propA as $id_player) {
                     if ($id_player == "") {
                         continue;
                     }
                     if (array_search($id_player, $liste_joueurs_gerant2A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
                 $liste_picks_gerant1_propA = explode(":", $liste_picks_gerant1_prop);
                 foreach ($liste_picks_gerant1_propA as $id_pick) {
                     if ($id_pick == "") {
                         continue;
                     }
                     if (array_search($id_pick, $liste_picks_gerant2A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
             } else {
                 $liste_joueurs_gerant2_propA = explode(":", $liste_joueurs_gerant2_prop);
                 foreach ($liste_joueurs_gerant2_propA as $id_player) {
                     if ($id_player == "") {
                         continue;
                     }
                     if (array_search($id_player, $liste_joueurs_gerant2A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
                 $liste_picks_gerant2_propA = explode(":", $liste_picks_gerant2_prop);
                 foreach ($liste_picks_gerant2_propA as $id_pick) {
                     if ($id_pick == "") {
                         continue;
                     }
                     if (array_search($id_pick, $liste_picks_gerant2A) !== FALSE) {
                         // envoi d'un email aux 2 gérants de l'échange
                         $this->envoi_email_cancelProposition($id_pool, $id_saison, $id_prop, $periode);
                         $query = "update trade_proposition set gerant1_accepte='N',gerant2_accepte='N'\n                                             WHERE id_pool = {$id_pool} AND id = {$id_prop} AND saison_id = {$id_saison}";
                         $resultID = mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                         break;
                     }
                 }
             }
         }
         $liste_joueurs_gerant1A = explode(":", $liste_joueurs_gerant1);
         $liste_joueurs_gerant2A = explode(":", $liste_joueurs_gerant2);
         $liste_picks_gerant1A = explode(":", $liste_picks_gerant1);
         $liste_picks_gerant2A = explode(":", $liste_picks_gerant2);
         // écriture de l'échange dans la table des news
         $news = "<b><i><u>BREAKING NEWS!!</u></i></b><br> <b>" . $gerant1A["nickname"] . "</b> échange";
         foreach ($liste_joueurs_gerant1A as $id_player) {
             if ($id_player == "") {
                 continue;
             }
             $playerInfoA = $this->getPlayerInfoForBallotage($id_player, $id_saison, $id_pool);
             $first_name = $playerInfoA["first_name"];
             $last_name = $playerInfoA["last_name"];
             $abbr = $playerInfoA["abbr"];
             $points = $playerInfoA["points"];
             $pos = $playerInfoA["pos"];
             if ($pos == "TM") {
                 $news .= " {$last_name} (l'équipe) ({$points} pts),";
             } else {
                 $news .= " {$first_name} {$last_name} - {$abbr} ({$points} pts),";
             }
         }
         foreach ($liste_picks_gerant1A as $id_pick) {
             if ($id_pick == "") {
                 continue;
             }
             $q = "select a.pick_no,a.owner_ori,b.real_name_abrege\n                          from trade_draftPicks_gerant a, accounts b\n                          where\n                              a.id = {$id_pick}\n                              and a.owner_ori = b.id";
             $data = DB::dbSelect($q);
             $data = $data[0];
             $pick_no = $data['pick_no'];
             $pick_owner_ori = $data['owner_ori'];
             $pick_owner_ori_name = $data['real_name_abrege'];
             switch ($pick_no) {
                 case 1:
                     $news .= " choix de 1ère ronde";
                     break;
                 case 2:
                     $news .= " choix de 2e ronde";
                     break;
                 case 3:
                     $news .= " choix de 3e ronde";
                     break;
                 case 4:
                     $news .= " choix de 4e ronde";
                     break;
                 case 5:
                     $news .= " choix de 5e ronde";
                     break;
                 case 6:
                     $news .= " choix de 6e ronde";
                     break;
                 case 7:
                     $news .= " choix de 7e ronde";
                     break;
             }
             if ($pick_owner_ori != $id_gerant1) {
                 $news .= " (choix de {$pick_owner_ori_name}),";
             } else {
                 $news .= ",";
             }
         }
         $news = substr($news, 0, strlen($news) - 1);
         $news .= " à <b>" . $gerant2A["nickname"] . "</b> en retour de";
         foreach ($liste_joueurs_gerant2A as $id_player) {
             if ($id_player == "") {
                 continue;
             }
             $playerInfoA = $this->getPlayerInfoForBallotage($id_player, $id_saison, $id_pool);
             $first_name = $playerInfoA["first_name"];
             $last_name = $playerInfoA["last_name"];
             $abbr = $playerInfoA["abbr"];
             $points = $playerInfoA["points"];
             $pos = $playerInfoA["pos"];
             if ($pos == "TM") {
                 $news .= " {$last_name} (l'équipe) ({$points} pts),";
             } else {
                 $news .= " {$first_name} {$last_name} - {$abbr} ({$points} pts),";
             }
         }
         foreach ($liste_picks_gerant2A as $id_pick) {
             if ($id_pick == "") {
                 continue;
             }
             $q = "select a.pick_no,a.owner_ori,b.real_name_abrege\n                          from trade_draftPicks_gerant a, accounts b\n                          where\n                              a.id = {$id_pick}\n                              and a.owner_ori = b.id";
             $data = DB::dbSelect($q);
             $data = $data[0];
             $pick_no = $data['pick_no'];
             $pick_owner_ori = $data['owner_ori'];
             $pick_owner_ori_name = $data['real_name_abrege'];
             switch ($pick_no) {
                 case 1:
                     $news .= " choix de 1ère ronde";
                     break;
                 case 2:
                     $news .= " choix de 2e ronde";
                     break;
                 case 3:
                     $news .= " choix de 3e ronde";
                     break;
                 case 4:
                     $news .= " choix de 4e ronde";
                     break;
                 case 5:
                     $news .= " choix de 5e ronde";
                     break;
                 case 6:
                     $news .= " choix de 6e ronde";
                     break;
                 case 7:
                     $news .= " choix de 7e ronde";
                     break;
             }
             if ($pick_owner_ori != $id_gerant2) {
                 $news .= " (choix de {$pick_owner_ori_name}),";
             } else {
                 $news .= ",";
             }
         }
         $news = substr($news, 0, strlen($news) - 1);
         $_mydate = new Datetime(null, $this->timeZone);
         $_mydate->modify("+2 days");
         $date_fin = $_mydate->format('Y-m-d');
         $query = "INSERT INTO newsbar (id_pool,date_debut,date_fin,priority,text,saison_id)\n                    VALUES ({$id_pool},'{$this->today}',\"{$date_fin}\",20,\"{$news}\",{$id_saison})";
         $resultID = mysql_query($query, $this->handle);
         // si les joueurs échangés faisaient partis de la liste 'trading block', on l'enlève...
         foreach ($liste_joueurs_gerant1A as $id_player) {
             if ($id_player == "") {
                 continue;
             }
             $query = "update {$table} set trading_block='N'\n                              where id_pool = {$id_pool}\n                              and saison_id = {$id_saison}\n                              and gerant = {$id_gerant1}\n                              and id_player = {$id_player}\n                              and periode > {$periode}";
             mysql_query($query, $this->handle);
             if (mysql_affected_rows() > 0) {
                 $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
             }
         }
         foreach ($liste_joueurs_gerant2A as $id_player) {
             if ($id_player == "") {
                 continue;
             }
             $query = "update {$table} set trading_block='N'\n                              where id_pool = {$id_pool}\n                              and saison_id = {$id_saison}\n                              and gerant = {$id_gerant2}\n                              and id_player = {$id_player}\n                              and periode > {$periode}";
             mysql_query($query, $this->handle);
             if (mysql_affected_rows() > 0) {
                 $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
             }
         }
         // SWICH DES JOUEURS
         $query = "select trade_howto_switch_players,date_debut_saison from configPool\n                         where id_pool = {$id_pool}\n                              and saison_id = {$id_saison}";
         $resultID = mysql_query($query, $this->handle);
         $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
         mysql_free_result($resultID);
         $trade_howto_switch_players = $data["trade_howto_switch_players"];
         $date_debut_saison = $data["date_debut_saison"];
         if ($trade_howto_switch_players == "rang") {
             // création des listes pour faire le swith après...
             foreach ($liste_joueurs_gerant1A as $id_player) {
                 if ($id_player == "") {
                     continue;
                 }
                 if ($OR == "") {
                     $OR = "id_player = {$id_player}";
                 } else {
                     $OR .= " OR id_player = {$id_player}";
                 }
             }
             $query = "SELECT id_player,rank FROM {$table}\n                              WHERE id_pool = {$id_pool}\n                              AND gerant = {$id_gerant1}\n                              AND periode = {$periode}\n                              AND saison_id = {$id_saison}\n                              AND ({$OR})\n                              ORDER BY rank ASC;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $liste_triee_joueurs_gerant1A[] = $id_player;
             }
             mysql_free_result($resultID);
             foreach ($liste_joueurs_gerant2A as $id_player) {
                 if ($id_player == "") {
                     continue;
                 }
                 if ($OR == "") {
                     $OR = "id_player = {$id_player}";
                 } else {
                     $OR .= " OR id_player = {$id_player}";
                 }
             }
             $query = "SELECT id_player,rank FROM {$table}\n                              WHERE id_pool = {$id_pool}\n                              AND gerant = {$id_gerant2}\n                              AND periode = {$periode}\n                              AND saison_id = {$id_saison}\n                              AND ({$OR})\n                              ORDER BY rank ASC;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $liste_triee_joueurs_gerant2A[] = $id_player;
             }
             mysql_free_result($resultID);
             //$nbre_per = $this->getNombrePeriodes($id_pool,$id_saison);
             $nbre_joueurs = count($liste_joueurs_gerant1A) - 1;
             for ($i = 0; $i < $nbre_joueurs; $i++) {
                 // est-ce que le joueur est sur la liste IR?
                 $query = "SELECT rank,IR FROM {$table}\n\t\t               \t\tWHERE id_pool = {$id_pool}\n\t\t               \t\t     AND saison_id = {$id_saison}\n\t\t               \t\t     AND gerant = {$id_gerant1}\n\t\t               \t\t\tAND periode = {$periode_activation}\n\t\t               \t\t\tAND id_player = {$liste_triee_joueurs_gerant1A[$i]}";
                 $resultID = mysql_query($query, $this->handle);
                 $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                 mysql_free_result($resultID);
                 $infoJoueur1['rank'] = $data["rank"];
                 $infoJoueur1['IR'] = $data["IR"];
                 // est-ce que le joueur est sur la liste IR?
                 $query = "SELECT rank,IR FROM {$table}\n\t\t               \t\tWHERE id_pool = {$id_pool}\n\t\t               \t\t     AND saison_id = {$id_saison}\n\t\t               \t\t     AND gerant = {$id_gerant2}\n\t\t               \t\t\tAND periode = {$periode_activation}\n\t\t               \t\t\tAND id_player = {$liste_triee_joueurs_gerant2A[$i]}";
                 $resultID = mysql_query($query, $this->handle);
                 $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                 mysql_free_result($resultID);
                 $infoJoueur2['rank'] = $data["rank"];
                 $infoJoueur2['IR'] = $data["IR"];
                 // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                 $query = "SELECT IR FROM {$table}\n\t\t               \t\tWHERE id_pool = {$id_pool}\n\t\t               \t\t     AND saison_id = {$id_saison}\n\t\t               \t\t     AND gerant = {$id_gerant1}\n\t\t               \t\t\tAND periode = {$periode_activation}\n\t\t               \t\t\tAND rank = {$infoJoueur1['rank']}\n\t\t               \t\t\tAND IR = 'Y'";
                 $resultID = mysql_query($query, $this->handle);
                 $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                 mysql_free_result($resultID);
                 $infoJoueur1['remplacant_IR'] = $data["IR"];
                 // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                 $query = "SELECT IR FROM {$table}\n\t\t               \t\tWHERE id_pool = {$id_pool}\n\t\t               \t\t     AND saison_id = {$id_saison}\n\t\t               \t\t     AND gerant = {$id_gerant2}\n\t\t               \t\t\tAND periode = {$periode_activation}\n\t\t               \t\t\tAND rank = {$infoJoueur2['rank']}\n\t\t               \t\t\tAND IR = 'Y'";
                 $resultID = mysql_query($query, $this->handle);
                 $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                 mysql_free_result($resultID);
                 $infoJoueur2['remplacant_IR'] = $data["IR"];
                 $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_gerant1A[$i]}\n\t\t               \t\tWHERE id_pool = {$id_pool}\n\t\t               \t\tAND periode >= {$periode_activation}\n\t\t               \t\tAND gerant = {$id_gerant2}\n\t\t               \t\tAND rank = {$infoJoueur2['rank']}\n\t\t               \t\tAND saison_id = {$id_saison}\n\t\t               \t\tAND IR = '{$infoJoueur2['IR']}'";
                 mysql_query($query, $this->handle);
                 if (mysql_affected_rows() > 0) {
                     $this->dbLog($id_pool, $id_gerant, "admin_approuve_delete_trade", $query);
                 }
                 $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_gerant2A[$i]}\n\t\t               \t\tWHERE id_pool = {$id_pool}\n\t\t               \t\tAND periode >= {$periode_activation}\n\t\t               \t\tAND gerant = {$id_gerant1}\n\t\t               \t\tAND rank = {$infoJoueur1['rank']}\n\t\t               \t\tAND saison_id = {$id_saison}\n\t\t               \t\tAND IR = '{$infoJoueur1['IR']}'";
                 mysql_query($query, $this->handle);
                 if (mysql_affected_rows() > 0) {
                     $this->dbLog($id_pool, $id_gerant, "admin_approuve_delete_trade", $query);
                 }
                 // si le joueur est sur la liste IR, il faut modifier l'entrée dans la table
                 // liste_IR avec le joueur qui prend sa place
                 if ($infoJoueur1['IR'] == "Y") {
                     $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_gerant2A[$i]}\n                                        where id_pool = {$id_pool}\n                                        and id_gerant = {$id_gerant1}\n                                        and id_player_IR = {$liste_triee_joueurs_gerant1A[$i]}\n                                        and date_fin = '2099-12-31'\n                                        and rank_player_IR = {$infoJoueur1['rank']}";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "admin_approuve_delete_trade", $query);
                     }
                 }
                 if ($infoJoueur2['IR'] == "Y") {
                     $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_gerant1A[$i]}\n                                        where id_pool = {$id_pool}\n                                        and id_gerant = {$id_gerant2}\n                                        and id_player_IR = {$liste_triee_joueurs_gerant2A[$i]}\n                                        and date_fin = '2099-12-31'\n                                        and rank_player_IR = {$infoJoueur2['rank']}";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "admin_approuve_delete_trade", $query);
                     }
                 }
                 // si le joueur est en remplacement d'un joueur blessé (liste IR), il faut modifier l'entrée dans la table
                 // liste_IR
                 if ($infoJoueur1['remplacant_IR'] == "Y") {
                     $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_gerant2A[$i]}\n                                        where id_pool = {$id_pool}\n                                        and id_gerant = {$id_gerant1}\n                                        and id_player_remplacement = {$liste_triee_joueurs_gerant1A[$i]}\n                                        and date_fin = '2099-12-31'\n                                        and rank_player_IR = {$infoJoueur1['rank']}";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                 }
                 if ($infoJoueur2['remplacant_IR'] == "Y") {
                     $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_gerant1A[$i]}\n                                        where id_pool = {$id_pool}\n                                        and id_gerant = {$id_gerant2}\n                                        and id_player_remplacement = {$liste_triee_joueurs_gerant2A[$i]}\n                                        and date_fin = '2099-12-31'\n                                        and rank_player_IR = {$infoJoueur2['rank']}";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                 }
             }
         } else {
             // création des listes pour faire le swith après...
             $liste_joueurs_gerant1_select = "";
             foreach ($liste_joueurs_gerant1A as $id_player) {
                 if ($id_player == "") {
                     continue;
                 }
                 if ($liste_joueurs_gerant1_select == "") {
                     $liste_joueurs_gerant1_select = $id_player;
                 } else {
                     $liste_joueurs_gerant1_select .= ",{$id_player}";
                 }
             }
             $liste_joueurs_gerant2_select = "";
             foreach ($liste_joueurs_gerant2A as $id_player) {
                 if ($id_player == "") {
                     continue;
                 }
                 if ($liste_joueurs_gerant2_select == "") {
                     $liste_joueurs_gerant2_select = $id_player;
                 } else {
                     $liste_joueurs_gerant2_select .= ",{$id_player}";
                 }
             }
             /**********
              *** BUG ***
              *** Quand un joueur n'a pas joué de la saison et qu'il est échangé, il n'y a aucune entrée ds la table
              *** joueurs_pts pour ce joueur, ce qui fait que son id n'apparaitra pas dans les listes des switchs
              *** des joueurs. Pour régler ce problème, je vais faire une entrée bidon pour chaque joueur échangé
              *** dans la table joueurs_pts avec la date 2099-12-31 et 0 pts. Ainsi, la logique du tri demeure intacte
              *** puisque tous les joueurs ont +0 pour les pts et +1 pour les pj...
              ***********/
             foreach ($liste_joueurs_gerant1A as $this_id_player) {
                 $query = "replace into joueurs_pts (saison_id,id_player,date,points)\n                                         values ({$id_saison},{$this_id_player},'2099-12-31',0)";
                 mysql_query($query, $this->handle);
                 if (mysql_affected_rows() > 0) {
                     $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                 }
             }
             foreach ($liste_joueurs_gerant2A as $this_id_player) {
                 $query = "replace into joueurs_pts (saison_id,id_player,date,points)\n                                         values ({$id_saison},{$this_id_player},'2099-12-31',0)";
                 mysql_query($query, $this->handle);
                 if (mysql_affected_rows() > 0) {
                     $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                 }
             }
             /*****************
              *** GRAND CLUB ***
              *****************/
             // Gérant 1
             // il faut le faire par position (TM, G, D et F)...
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant1_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant1}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant1_select})\n                                   and c.pos = 'TM'\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_TM_gerant1A[] = $id_player;
                 $joueurs_rank_gerant1A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant1_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant1}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant1_select})\n                                   and c.pos = 'G'\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_G_gerant1A[] = $id_player;
                 $joueurs_rank_gerant1A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant1_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant1}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant1_select})\n                                   and c.pos = 'D'\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_D_gerant1A[] = $id_player;
                 $joueurs_rank_gerant1A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant1_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant1}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant1_select})\n                                   and c.pos not in ('G','D','TM')\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_A_gerant1A[] = $id_player;
                 $joueurs_rank_gerant1A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             // Gérant 2
             // il faut le faire par position (TM, G, D et F)...
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant2_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant2}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant2_select})\n                                   and c.pos = 'TM'\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_TM_gerant2A[] = $id_player;
                 $joueurs_rank_gerant2A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant2_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant2}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant2_select})\n                                   and c.pos = 'G'\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_G_gerant2A[] = $id_player;
                 $joueurs_rank_gerant2A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant2_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant2}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant2_select})\n                                   and c.pos = 'D'\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_D_gerant2A[] = $id_player;
                 $joueurs_rank_gerant2A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant2_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant2}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'Y'\n                                   AND a.id_player in ({$liste_joueurs_gerant2_select})\n                                   and c.pos not in ('G','D','TM')\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_A_gerant2A[] = $id_player;
                 $joueurs_rank_gerant2A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             // SWITCH DES JOUEURS, PAR POSITION...
             // équipes
             $nbre_items = count($liste_triee_joueurs_TM_gerant1A);
             if ($nbre_items > 0) {
                 for ($i = 0; $i < $nbre_items; $i++) {
                     $infoJoueur1['rank'] = $joueurs_rank_gerant1A[$liste_triee_joueurs_TM_gerant1A[$i]];
                     $infoJoueur2['rank'] = $joueurs_rank_gerant2A[$liste_triee_joueurs_TM_gerant2A[$i]];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_TM_gerant1A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['IR'] = $data["IR"];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_TM_gerant2A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['remplacant_IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['remplacant_IR'] = $data["IR"];
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_TM_gerant1A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant2}\n\t\t                    \t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur2['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_TM_gerant2A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant1}\n\t\t                    \t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur1['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     // si le joueur est sur la liste IR, il faut modifier l'entrée dans la table
                     // liste_IR avec le joueur qui prend sa place
                     if ($infoJoueur1['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_TM_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_IR = {$liste_triee_joueurs_TM_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_TM_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_IR = {$liste_triee_joueurs_TM_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     // si le joueur est en remplacement d'un joueur blessé (liste IR), il faut modifier l'entrée dans la table
                     // liste_IR
                     if ($infoJoueur1['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_TM_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_remplacement = {$liste_triee_joueurs_TM_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_TM_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_remplacement = {$liste_triee_joueurs_TM_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                 }
             }
             // gardiens
             $nbre_items = count($liste_triee_joueurs_G_gerant1A);
             if ($nbre_items > 0) {
                 for ($i = 0; $i < $nbre_items; $i++) {
                     $infoJoueur1['rank'] = $joueurs_rank_gerant1A[$liste_triee_joueurs_G_gerant1A[$i]];
                     $infoJoueur2['rank'] = $joueurs_rank_gerant2A[$liste_triee_joueurs_G_gerant2A[$i]];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_G_gerant1A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['IR'] = $data["IR"];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_G_gerant2A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['remplacant_IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['remplacant_IR'] = $data["IR"];
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_G_gerant1A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant2}\n\t\t                    \t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur2['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_G_gerant2A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant1}\n\t\t                    \t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur1['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     // si le joueur est sur la liste IR, il faut modifier l'entrée dans la table
                     // liste_IR avec le joueur qui prend sa place
                     if ($infoJoueur1['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_G_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_IR = {$liste_triee_joueurs_G_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_G_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_IR = {$liste_triee_joueurs_G_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     // si le joueur est en remplacement d'un joueur blessé (liste IR), il faut modifier l'entrée dans la table
                     // liste_IR
                     if ($infoJoueur1['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_G_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_remplacement = {$liste_triee_joueurs_G_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_G_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_remplacement = {$liste_triee_joueurs_G_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                 }
             }
             // défenseurs
             $nbre_items = count($liste_triee_joueurs_D_gerant1A);
             if ($nbre_items > 0) {
                 for ($i = 0; $i < $nbre_items; $i++) {
                     $infoJoueur1['rank'] = $joueurs_rank_gerant1A[$liste_triee_joueurs_D_gerant1A[$i]];
                     $infoJoueur2['rank'] = $joueurs_rank_gerant2A[$liste_triee_joueurs_D_gerant2A[$i]];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_D_gerant1A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['IR'] = $data["IR"];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_D_gerant2A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['remplacant_IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['remplacant_IR'] = $data["IR"];
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_D_gerant1A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant2}\n\t\t                    \t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur2['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_D_gerant2A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant1}\n\t\t                    \t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur1['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     // si le joueur est sur la liste IR, il faut modifier l'entrée dans la table
                     // liste_IR avec le joueur qui prend sa place
                     if ($infoJoueur1['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_D_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_IR = {$liste_triee_joueurs_D_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_D_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_IR = {$liste_triee_joueurs_D_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     // si le joueur est en remplacement d'un joueur blessé (liste IR), il faut modifier l'entrée dans la table
                     // liste_IR
                     if ($infoJoueur1['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_D_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_remplacement = {$liste_triee_joueurs_D_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_D_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_remplacement = {$liste_triee_joueurs_D_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                 }
             }
             // avants
             $nbre_items = count($liste_triee_joueurs_A_gerant1A);
             if ($nbre_items > 0) {
                 for ($i = 0; $i < $nbre_items; $i++) {
                     $infoJoueur1['rank'] = $joueurs_rank_gerant1A[$liste_triee_joueurs_A_gerant1A[$i]];
                     $infoJoueur2['rank'] = $joueurs_rank_gerant2A[$liste_triee_joueurs_A_gerant2A[$i]];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_A_gerant1A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['IR'] = $data["IR"];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_A_gerant2A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['remplacant_IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['remplacant_IR'] = $data["IR"];
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_A_gerant1A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant2}\n\t\t                    \t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur2['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_A_gerant2A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant1}\n\t\t                    \t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur1['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     // si le joueur est sur la liste IR, il faut modifier l'entrée dans la table
                     // liste_IR avec le joueur qui prend sa place
                     if ($infoJoueur1['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_A_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_IR = {$liste_triee_joueurs_A_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_A_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_IR = {$liste_triee_joueurs_A_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     // si le joueur est en remplacement d'un joueur blessé (liste IR), il faut modifier l'entrée dans la table
                     // liste_IR
                     if ($infoJoueur1['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_A_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_remplacement = {$liste_triee_joueurs_A_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_A_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_remplacement = {$liste_triee_joueurs_A_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                 }
             }
             /*****************
              *** CLUB ÉCOLE ***
              *****************/
             // Le club école est différent, car n'importe quel joueur peut être échangé
             // pour un autre: pas besoin d'être de la même position...
             unset($joueurs_rank_gerant1A, $joueurs_rank_gerant2A);
             unset($liste_triee_joueurs_TM_gerant1A, $liste_triee_joueurs_TM_gerant2A);
             unset($liste_triee_joueurs_G_gerant1A, $liste_triee_joueurs_G_gerant2A);
             unset($liste_triee_joueurs_D_gerant1A, $liste_triee_joueurs_D_gerant2A);
             unset($liste_triee_joueurs_A_gerant1A, $liste_triee_joueurs_A_gerant2A);
             // Gérant 1
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant1_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant1}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'N'\n                                   AND a.id_player in ({$liste_joueurs_gerant1_select})\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_gerant1A[] = $id_player;
                 $joueurs_rank_gerant1A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             // Gérant 2
             // il faut le faire par position (TM, G, D et F)...
             $query = "SELECT a.id_player,a.rank,b.pts,b.pj\n                              FROM {$table} a,\n                                   (select id_player,sum(points) pts,count(*) pj\n                                    from joueurs_pts\n                                    where saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant2_select})\n                                        and date >= '{$date_debut_saison}'\n                                    group by id_player\n                                   ) b,\n                                   nhl_players c\n                              WHERE a.id_player = b.id_player\n                                   and a.id_player = c.id\n                                   and a.id_pool = {$id_pool}\n                                   AND a.gerant = {$id_gerant2}\n                                   AND a.periode = {$periode}\n                                   AND a.saison_id = {$id_saison}\n                                   and a.grand_club = 'N'\n                                   AND a.id_player in ({$liste_joueurs_gerant2_select})\n                                   and c.date_expiration = '2099-12-31'\n                              ORDER BY b.pts desc,b.pj asc;";
             $resultID = mysql_query($query, $this->handle);
             while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
                 $id_player = $data["id_player"];
                 $rank = $data["rank"];
                 $liste_triee_joueurs_gerant2A[] = $id_player;
                 $joueurs_rank_gerant2A[$id_player] = $rank;
             }
             mysql_free_result($resultID);
             // SWITCH DES JOUEURS, PAR POSITION...
             $nbre_items = count($liste_triee_joueurs_gerant1A);
             if ($nbre_items > 0) {
                 for ($i = 0; $i < $nbre_items; $i++) {
                     $infoJoueur1['rank'] = $joueurs_rank_gerant1A[$liste_triee_joueurs_gerant1A[$i]];
                     $infoJoueur2['rank'] = $joueurs_rank_gerant2A[$liste_triee_joueurs_gerant2A[$i]];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_gerant1A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['IR'] = $data["IR"];
                     // est-ce que le joueur est sur la liste IR?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND id_player = {$liste_triee_joueurs_gerant2A[$i]}";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant1}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur1['remplacant_IR'] = $data["IR"];
                     // est-ce que le joueur est en remplacement d'un joueur blessé (liste IR)?
                     $query = "SELECT IR FROM {$table}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\t     AND saison_id = {$id_saison}\n\t\t                    \t\t     AND gerant = {$id_gerant2}\n\t\t                    \t\t\tAND periode = {$periode_activation}\n\t\t                    \t\t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\t\tAND IR = 'Y'";
                     $resultID = mysql_query($query, $this->handle);
                     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
                     mysql_free_result($resultID);
                     $infoJoueur2['remplacant_IR'] = $data["IR"];
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_gerant1A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant2}\n\t\t                    \t\tAND rank = {$infoJoueur2['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur2['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     $query = "UPDATE {$table} SET id_player={$liste_triee_joueurs_gerant2A[$i]}\n\t\t                    \t\tWHERE id_pool = {$id_pool}\n\t\t                    \t\tAND periode >= {$periode_activation}\n\t\t                    \t\tAND gerant = {$id_gerant1}\n\t\t                    \t\tAND rank = {$infoJoueur1['rank']}\n\t\t                    \t\tAND saison_id = {$id_saison}\n\t\t                    \t\tAND IR = '{$infoJoueur1['IR']}'";
                     mysql_query($query, $this->handle);
                     if (mysql_affected_rows() > 0) {
                         $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                     }
                     // si le joueur est sur la liste IR, il faut modifier l'entrée dans la table
                     // liste_IR avec le joueur qui prend sa place
                     if ($infoJoueur1['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_IR = {$liste_triee_joueurs_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['IR'] == "Y") {
                         $query = "update liste_IR set id_player_IR={$liste_triee_joueurs_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_IR = {$liste_triee_joueurs_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     // si le joueur est en remplacement d'un joueur blessé (liste IR), il faut modifier l'entrée dans la table
                     // liste_IR
                     if ($infoJoueur1['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_gerant2A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant1}\n                                             and id_player_remplacement = {$liste_triee_joueurs_gerant1A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur1['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                     if ($infoJoueur2['remplacant_IR'] == "Y") {
                         $query = "update liste_IR set id_player_remplacement={$liste_triee_joueurs_gerant1A[$i]}\n                                             where id_pool = {$id_pool}\n                                             and id_gerant = {$id_gerant2}\n                                             and id_player_remplacement = {$liste_triee_joueurs_gerant2A[$i]}\n                                             and date_fin = '2099-12-31'\n                                             and rank_player_IR = {$infoJoueur2['rank']}";
                         mysql_query($query, $this->handle);
                         if (mysql_affected_rows() > 0) {
                             $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
                         }
                     }
                 }
             }
             // Il faut enlever les entrées dans la table joueurs_pts qui ont comme date 2099-12-31...
             $query = "delete from joueurs_pts where date = '2099-12-31'\n                                        and saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant1_select})";
             mysql_query($query, $this->handle);
             if (mysql_affected_rows() > 0) {
                 $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
             }
             $query = "delete from joueurs_pts where date = '2099-12-31'\n                                        and saison_id = {$id_saison}\n                                        and id_player in ({$liste_joueurs_gerant2_select})";
             mysql_query($query, $this->handle);
             if (mysql_affected_rows() > 0) {
                 $this->dbLog($id_pool, $id_gerant, "tradePropositionAccept", $query);
             }
         }
         // SWITCH DES PCIKS
         foreach ($liste_picks_gerant1A as $id_pick) {
             $q = "update trade_draftPicks_gerant set owner={$id_gerant2}\n                          where id = {$id_pick}";
             DB::dbUpdate($q);
         }
         foreach ($liste_picks_gerant2A as $id_pick) {
             $q = "update trade_draftPicks_gerant set owner={$id_gerant1}\n                          where id = {$id_pick}";
             DB::dbUpdate($q);
         }
     }
 }
Ejemplo n.º 4
0
## ------------------------------------------------------------------------------- ##
## Modification:                                                                   ##
##                                                                                 ##
## ------------------------------------------------------------------------------- ##
#####################################################################################
require_once '/data/disk1/www/interPool/src/class.db.php';
// parsing des paramètres
$options = getopt("s:h");
if (isset($options['h'])) {
    echo "Usage: " . $argv[0] . " -s saison_id \n\n";
    exit;
}
$id_saison = "";
if (isset($options['s'])) {
    $id_saison = $options['s'];
}
if ($id_saison == "") {
    echo "Usage: " . $argv[0] . " -s saison_id \n\n";
    exit;
}
DB::dbConnect();
$query = "select id_player,pts from VMAT_teams_pts where saison_id = {$id_saison}";
$data = DB::dbSelect($query);
foreach ($data as $item) {
    $id_player = $item['id_player'];
    $salary = $item['pts'] * 100000;
    //$salary = ($item['pts'] * 82 / 48 * 100000);
    $query2 = "update nhl_players set salary={$salary}\n              where id = {$id_player}\n                  and date_expiration = '2099-12-31'";
    DB::dbUpdate($query2);
}
DB::dbClose();
Ejemplo n.º 5
0
 function insertTradeProposition2($id_pool, $id_saison, $id_gerant, $id_gerant_adv, $periode, $commentaire, $old_id_proposition, $duree_prop, $sess_id)
 {
     $liste_joueurs_gerant1 = "";
     $liste_joueurs_gerant2 = "";
     $liste_picks_gerant1 = "";
     $liste_picks_gerant2 = "";
     // on va chercher les joueurs de la proposition des 2 gérants
     $query = "select id_player,id_pick\n                              from trade_proposition_tmp\n                              where\n                                   id_pool = {$id_pool}\n                                   and saison_id = {$id_saison}\n                                   and id_gerant1 = {$id_gerant}\n                                   and id_gerant2 = {$id_gerant_adv}\n                                   and gerant_owner = {$id_gerant}\n                                   and sess_id = '{$sess_id}'";
     $joueurs_gerant1A = DB::dbSelect($query);
     foreach ($joueurs_gerant1A as $value) {
         $id_player = $value['id_player'];
         $id_pick = $value['id_pick'];
         if ($id_player != 0) {
             $liste_joueurs_gerant1 .= "{$id_player}:";
         }
         if ($id_pick != 0) {
             $liste_picks_gerant1 .= "{$id_pick}:";
         }
     }
     $query = "select id_player,id_pick\n                              from trade_proposition_tmp\n                              where\n                                   id_pool = {$id_pool}\n                                   and saison_id = {$id_saison}\n                                   and id_gerant1 = {$id_gerant}\n                                   and id_gerant2 = {$id_gerant_adv}\n                                   and gerant_owner = {$id_gerant_adv}\n                                   and sess_id = '{$sess_id}'";
     $joueurs_gerant2A = DB::dbSelect($query);
     foreach ($joueurs_gerant2A as $value) {
         $id_player = $value['id_player'];
         $id_pick = $value['id_pick'];
         if ($id_player != 0) {
             $liste_joueurs_gerant2 .= "{$id_player}:";
         }
         if ($id_pick != 0) {
             $liste_picks_gerant2 .= "{$id_pick}:";
         }
     }
     $time = $this->todayDate->format('H:i:s');
     // nickname du gérant
     $nickname = $this->getGerantNickname($id_pool, $id_gerant, $id_saison);
     $commentaire = "[{$nickname}:] {$commentaire}";
     if ($old_id_proposition == "") {
         $query = "INSERT INTO trade_proposition (id_pool,id_gerant1,liste_joueurs_gerant1,\n     \t                    id_gerant2,liste_joueurs_gerant2,date,time,saison_id,gerant1_accepte,\n     \t                    periode,comment,duree,liste_picks_gerant1,liste_picks_gerant2)\n     \t               VALUES ({$id_pool},{$id_gerant},\"{$liste_joueurs_gerant1}\",{$id_gerant_adv},\n     \t                    \"{$liste_joueurs_gerant2}\",'{$this->today}',\"{$time}\",{$id_saison},'Y',\n     \t                    {$periode},\"{$commentaire}\",{$duree_prop},'{$liste_picks_gerant1}','{$liste_picks_gerant2}')";
     } else {
         // on va chercher les précécents commentaires s'il y a lieu
         $query = "select comment from trade_proposition\n\t                    where id = {$old_id_proposition}";
         $resultID = mysql_query($query, $this->handle);
         $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
         mysql_free_result($resultID);
         $old_comment = $data['comment'];
         if ($old_comment == "") {
             $new_comment = $commentaire;
         } else {
             $new_comment = "{$commentaire} \n--------------------\n{$old_comment}";
         }
         $query = "INSERT INTO trade_proposition (id_pool,id_gerant1,liste_joueurs_gerant1,\n     \t                    id_gerant2,liste_joueurs_gerant2,date,time,saison_id,gerant1_accepte,\n     \t                    periode,comment,prev_id_prop,duree,liste_picks_gerant1,liste_picks_gerant2)\n     \t               VALUES ({$id_pool},{$id_gerant},\"{$liste_joueurs_gerant1}\",{$id_gerant_adv},\n     \t                    \"{$liste_joueurs_gerant2}\",'{$this->today}',\"{$time}\",{$id_saison},'Y',\n     \t                    {$periode},\"{$new_comment}\",{$old_id_proposition},{$duree_prop},'{$liste_picks_gerant1}','{$liste_picks_gerant2}')";
     }
     $last_id = DB::dbInsertAndGetLastInsertID($query);
     // update des accounts_detail pour mettre le champ tradu_vu à 'N'
     $query = "update accounts_detail set trade_vu='N'\n\t               where id_pool = {$id_pool}\n\t               and saison_id = {$id_saison}\n\t               and gerant = {$id_gerant_adv}";
     mysql_query($query, $this->handle);
     // on supprimes les records de la table trade_proposition_tmp
     $query = "delete from trade_proposition_tmp\n                              where\n                                   id_pool = {$id_pool}\n                                   and saison_id = {$id_saison}\n                                   and id_gerant1 = {$id_gerant}\n                                   and id_gerant2 = {$id_gerant_adv}\n                                   and sess_id = '{$sess_id}'";
     DB::dbUpdate($query);
     unset($old_comment, $new_comment, $old_id_proposition, $nickname, $liste_joueurs_gerant1, $liste_joueurs_gerant2, $valueA, $id_player, $time, $query, $pool, $sess);
     return "{$last_id}";
 }
Ejemplo n.º 6
0
<?php

require "DB.php";
switch ($_REQUEST['req']) {
    case "ggd":
        if (empty($DB)) {
            $DB = new DB();
        }
        $uid = $DB->escape($_REQUEST['uid']);
        //            error_log('AJAX - ggd: '.var_export($_REQUEST,true));
        $tmx = time();
        $drt = $DB->simpleQuery('users', 'fb_id', 'fb_id = ' . $uid);
        if ($drt) {
            $DB->dbUpdate('users', array('last' => $tmx), 'fb_id = ' . $uid);
        } else {
            $DB->dbWrite('users', array('fb_id' => $uid, 'first' => $tmx, 'last' => $tmx));
        }
        $ctd = $DB->fullQuery("SELECT COUNT(*) AS ct FROM puzzles p LEFT JOIN used u ON p.puzzle_id = u.puzzle_id AND u.user_id = {$uid} AND u.dsbl = 0 AND p.dsbl = 0 WHERE u.user_id IS NULL");
        $rn = rand(0, $ctd[0]['ct'] - 1);
        $gdd = $DB->fullQuery("SELECT p.puzzle_id,puzzle_data FROM puzzles p LEFT JOIN used u ON p.puzzle_id = u.puzzle_id AND u.user_id = {$uid} AND u.dsbl = 0 AND p.dsbl = 0 WHERE u.user_id IS NULL LIMIT {$rn},1");
        echo $gdd[0]['puzzle_id'] . '|' . $gdd[0]['puzzle_data'];
        break;
    case "ghs":
        if (empty($DB)) {
            $DB = new DB();
        }
        $uids = $DB->escape($_REQUEST['uids']);
        if (substr($uids, 0, 1) == ',') {
            $uids = substr($uids, 1);
        }
        $hsr = $DB->simpleQuery('scores', 'uid,MIN(score) as hsc', 'uid IN (' . $uids . ')', 'GROUP BY uid ORDER BY uid,score');
                     }
                 }
             }
             foreach ($awayA as $index => $away_team_id) {
                 $home_team_id = $homeA[$index];
                 $time = $timeA[$index];
                 $ontv = $ontvA[$index];
                 $gc_link = $gc_linkA[$index];
                 // si la ligne existe dans la table, on update les champs game_result et on_tv seulement
                 $q = "select * from schedule_nhl\n                              where date = '" . $this_date->format("Y-m-d") . "'\n                                   and home = {$home_team_id}\n                                   and visitor = {$away_team_id}";
                 $data = DB::dbSelect($q);
                 if (count($data) > 0) {
                     $q = "UPDATE schedule_nhl set time='{$time}',ontv='{$ontv}',url_boxscore='{$gc_link}'\n                                         WHERE date = '" . $this_date->format("Y-m-d") . "' AND home = {$home_team_id}\n                                         AND visitor = {$away_team_id}";
                     $q2 = "UPDATE schedule_playoffs set time='{$time}',ontv='{$ontv}',url_boxscore='{$gc_link}'\n                                         WHERE date = '" . $this_date->format("Y-m-d") . "' AND home = {$home_team_id}\n                                         AND visitor = {$away_team_id}";
                     DB::dbUpdate($q);
                     DB::dbUpdate($q2);
                     //echo "$q\n";
                     //echo "$q2\n";
                 } else {
                     $q = "insert into schedule_nhl (date,home,visitor,time,ontv,url_boxscore)\n                                       values ('" . $this_date->format("Y-m-d") . "',{$home_team_id},{$away_team_id},'{$time}','{$ontv}','{$gc_link}')";
                     $q2 = "insert into schedule_playoffs (date,home,visitor,time,ontv,url_boxscore,ronde)\n                                       values ('" . $this_date->format("Y-m-d") . "',{$home_team_id},{$away_team_id},'{$time}','{$ontv}','{$gc_link}',{$ronde})";
                     DB::dbInsert($q);
                     DB::dbInsert($q2);
                     //echo "$q\n";
                     //echo "$q2\n";
                 }
             }
             //exit;
         }
     }
 }