/* Set Matches information */ $sql = 'SELECT m.id_match,m.nom_match,m.heure,m.id_parent,m.id_enfant1, m.id_enfant2, m.nbr_manche, m.teamParMatch as mtpm, t.teamParMatch as ttpm FROM matchs as m, tournoi as t WHERE m.id_tournoi=:idt AND t.id_tournoi=:idt AND m.id_groupe IS NULL AND m.looser_bracket=:looser ORDER BY m.id_parent'; $query = new Query($database, $sql); $query->bind('idt', $id_tournoi, PDO::PARAM_INT); $query->bind('looser', $looser, PDO::PARAM_INT); $finale = 0; $petite_finale = 0; if ($query->execute()) { foreach ($query->getResult() as $match) { $nbrmatch++; $matches[$match['id_match']]['id'] = $match['id_match']; $matches[$match['id_match']]['heure'] = get_jour_de_la_semaine($match['heure']) . ' ' . get_heure($match['heure']); $matches[$match['id_match']]['nom'] = $match['nom_match']; $matches[$match['id_match']]['id_parent'] = $match['id_parent']; $matches[$match['id_match']]['id_enfant1'] = $match['id_enfant1']; $matches[$match['id_match']]['id_enfant2'] = $match['id_enfant2']; $matches[$match['id_match']]['nbr_manche'] = $match['nbr_manche']; $matches[$match['id_match']]['mtpm'] = $match['mtpm']; $matches[$match['id_match']]['ttpm'] = $match['ttpm']; if (is_null($match['id_parent'])) { if (is_null($match['id_enfant1']) and is_null($match['id_enfant2'])) { $petite_finale = $match['id_match']; } else { $finale = $match['id_match']; } } /* For every Match proceeded, get the Joueurs corresponding */
if (isset($scores[$team['id']][$team2['id']])) { $couleur = 'loose_'; $valeur = $scores[$team['id']][$team2['id']]['score'] . '-' . $scores[$team2['id']][$team['id']]['score']; if ($scores[$team['id']][$team2['id']]['score'] > $scores[$team2['id']][$team['id']]['score']) { $totaux[$team['id']] += 3; $couleur = 'win_'; } if ($scores[$team['id']][$team2['id']]['score'] == $scores[$team2['id']][$team['id']]['score']) { $totaux[$team['id']] += 1; $couleur = 'same_'; } $isPickActive = false; } if ($valeur == '') { if (isset($heures[$team['id']][$team2['id']])) { $valeur = get_jour_de_la_semaine($heures[$team['id']][$team2['id']]) . ' ' . get_heure($heures[$team['id']][$team2['id']]); // recuperer le dateTime du match $dateTime_DebutMatch = $heures[$team['id']][$team2['id']]; // chequer en fct du temps si on peut afficher le link (1h avant que match commence) $isPickActive = false; //checkIsPickActive($dateTime_DebutMatch); } } // recuperer l'id du match if (isset($scores[$team2['id']][$team['id']]['id_match'])) { $id_match = $scores[$team2['id']][$team['id']]['id_match']; } else { $id_match = 0; } $resultTeam[] = array("id_match" => $database->getIdMatchEquipe($groupe['id_groupe'], $team['id'], $team2['id']), "couleur" => $couleur, "valeur" => $valeur, "isPickActive" => $isPickActive); } else {
if ($glob_debug) { echo 'ERREUR - SQL EQUIPES'; } exit; } } //------------ KILL THEM BEFORE THEY LAY EGGS!!!!!!!!!!!! ------------ foreach ($groupes as $keyGroupe => $groupe) { //-----------------TOURNOI TYPE UT TRACKMANIA----------------- $sql = 'SELECT id_match,nbr_manche, heure FROM matchs WHERE id_groupe=:idg LIMIT 0,1'; $query = new Query($database, $sql); $query->bind(':idg', $groupe['id_groupe'], PDO::PARAM_INT); if ($query->execute()) { if ($nbr_manches = $query->getResult()[0]) { $groupes[$keyGroupe]['id_match'] = $nbr_manches['id_match']; $groupes[$keyGroupe]['heure'] = get_jour_de_la_semaine($nbr_manches['heure']) . ' ' . get_heure($nbr_manches['heure']); $groupes[$keyGroupe]['nbr_manches'] = $nbr_manches['nbr_manche']; } else { $groupes[$keyGroupe]['nbr_manches'] = $tournoi['nombreManche']; } $nbr_manches = $groupes[$keyGroupe]['nbr_manches']; } else { global $glob_debug; if ($glob_debug) { echo 'ERREUR - SQL MANCHES'; } exit; } $sql = 'SELECT j.pseudo, mj.id_joueur, SUM(mj.score) as total FROM joueurs as j, manches_joueurs as mj, matchs as m WHERE m.id_groupe=:idg AND mj.id_match=m.id_match and j.id_joueur=mj.id_joueur
} $clr2 = '2'; if ($score2 > $score1) { $clr2 = 'win'; } $fleche = '->'; if ($c == 0) { $fleche = ''; } if ($score1 == '') { //$score1=1; // for jbracket $score1 = substr(get_jour_de_la_semaine($matches[$tablo[$c][$m]]['heure']), 0, 3); } if ($score2 == '') { //$score2=3; // for jbracket $score2 = get_heure($matches[$tablo[$c][$m]]['heure']); } $matches[$tablo[$c][$m]]['nom1'] = $nom1; $matches[$tablo[$c][$m]]['nom2'] = $nom2; $matches[$tablo[$c][$m]]['clr1'] = $clr1; $matches[$tablo[$c][$m]]['clr2'] = $clr2; $matches[$tablo[$c][$m]]['score1'] = $score1; $matches[$tablo[$c][$m]]['score2'] = $score2; $matches[$tablo[$c][$m]]['fleche'] = $fleche; } } } // for bracket js ------------------------------------------------------- /* $teams = array(); $scores = array();
foreach ($teams as $team2) { if (!($team['id'] == $team2['id'])) { $couleur = 'same_'; if (is_numeric($scores[$team['id']][$team2['id']]['score'])) { $couleur = 'loose_'; $matchs[$team['id']][$team2['id']]['score'] = $scores[$team['id']][$team2['id']]['score']; if ($scores[$team['id']][$team2['id']]['score'] > $scores[$team2['id']][$team['id']]['score']) { $totaux[$team['id']] += 3; $couleur = 'win_'; } if ($scores[$team['id']][$team2['id']]['score'] == $scores[$team2['id']][$team['id']]['score']) { $totaux[$team['id']] += 1; $couleur = 'same_'; } $matchs[$team['id']][$team2['id']]['couleur'] = $couleur; } $matchs[$team['id']][$team2['id']]['heure'] = get_jour_de_la_semaine($matchs[$team['id']][$team2['id']]['heure']) . ' ' . get_heure($matchs[$team['id']][$team2['id']]['heure']); } } $groupes[$keyGroupe]['teams'][$keyTeam]['total'] = $totaux[$team['id']]; } } // send to the template $smarty->assign('con', $connected); $smarty->assign('participants', $participants); $smarty->assign('tournoi', $tournoi); $smarty->assign('groupes', $groupes); $smarty->assign('matchs', $matchs); $smarty->assign('totaux', $totaux); $smarty->assign('couleur', $couleur); $smarty->display(DOCUMENT_ROOT . '/view/templates/admin/scoresPools-old.tpl');
public function getNextMatches($connected) { if (!$connected) { return ''; } $sql = file_get_contents(DOCUMENT_ROOT . '/src/sql/selectMatches.sql'); $query = new Query($this, $sql); $query->bind(':idj', $_SESSION['id_joueur'], PDO::PARAM_INT); if ($query->execute()) { $next_matches = $query->getResult(); $nm = array(); foreach ($next_matches as $next_match) { $nm[] = array("jour" => get_jour_de_la_semaine($next_match['heure']), "heure" => get_heure($next_match['heure']), "nom" => $next_match['nomTournoi']); } return $nm; } else { global $glob_debug; if ($glob_debug) { echo 'ERREUR SQL NEXT MATCHES'; } exit; } }
$query = new Query($database, $sql); $max = 0; if (isset($_POST['max'])) { $max = $_POST['max']; } $query->bind('max', $max, PDO::PARAM_INT); if (isset($_POST['start'])) { $query->bind('start', $_POST['start'], PDO::PARAM_INT); } echo ' {"messages": {"message":[ '; if ($query->execute()) { $first = true; foreach ($query->getResult() as $msg) { $pseudo = htmlspecialchars($msg['pseudo']); $message = htmlspecialchars($msg['message']); //$quand=get_date($msg['quand']).' à '.get_heure($msg['quand']); $quand = get_heure($msg['quand']); if (!$first) { echo ','; } echo '{"id": "' . $msg['id_chat'] . '","user": "******", "text": "' . $message . '", "time": "' . $quand . '" }'; $first = false; } } else { echo 'ERREUR NEWS SQL'; } echo ' ] } }';
$score[$j] = ''; $id_score[$j] = '0'; foreach ($joueurs as $joueur) { $nom[$j] .= '<option value="' . $joueur['id'] . '"'; if (isset($matches[$tablo[$c][$m]][$j]['id'])) { if ($matches[$tablo[$c][$m]][$j]['id'] == $joueur['id']) { $nom[$j] .= 'selected'; $id_score[$j] = $joueur['id']; } $score[$j] = $matches[$tablo[$c][$m]][$j]['score']; } $nom[$j] .= ' >' . $joueur['nom'] . '</option>'; } $clr[$j] = ''; $fleche = '->'; $heure = get_jour_de_la_semaine($matches[$tablo[$c][$m]]['heure']) . ' ' . get_heure($matches[$tablo[$c][$m]]['heure']); if ($j == 1) { if ($c == 0) { if ($m == 1) { echo '<tr class="tr_arbre_vide"><td class="td_finale_vide" colspan="' . ($matches[$tablo[$c][$m]]['nbr_manche'] + 4) . '">FINALE<br><a href="#" onclick="popup_heure(' . $tablo[$c][$m] . ')">' . $heure . '</a></td></tr>'; } if ($m == 2) { echo '<tr class="tr_arbre_vide"><td class="td_finale_vide" colspan="' . ($matches[$tablo[$c][$m]]['nbr_manche'] + 4) . '">Petite Finale<br><a href="#" onclick="popup_heure(' . $tablo[$c][$m] . ')">' . $heure . '</a></td></tr>'; } $fleche = ''; } else { echo '<tr class="tr_arbre_vide"><td class="td_finale_vide" colspan="' . ($matches[$tablo[$c][$m]]['nbr_manche'] + 4) . '"><a href="#" onclick="popup_heure(' . $tablo[$c][$m] . ')">' . $heure . '</a></td></tr>'; } echo '<tr class="tr_arbre_vide"> <td class="td_arbre_gauche"></td> <th class="th_arbre_joueur">Joueur <input type="checkbox"
exit; } else { $nbr_lb3 = $query->getResult()[0]; $nbr_lb3 = $nbr_lb3['nbr']; } foreach ($groupes as $itGroupe => $groupe) { //-----------------TOURNOI TYPE UT TRACKMANIA----------------- // Get time and number of rounds for each group $sql = 'SELECT heure, nbr_manche FROM matchs WHERE id_groupe=:idg LIMIT 0,1'; $query = new Query($database, $sql); $query->bind(':idg', $groupe['id_groupe'], PDO::PARAM_INT); $heure = ''; if ($query->execute()) { if ($nbr_manches = $query->getResult()[0]) { $groupes[$itGroupe]['jour'] = get_jour_de_la_semaine($nbr_manches['heure']); $groupes[$itGroupe]['heure'] = get_heure($nbr_manches['heure']); $tournoi['nombreManche'] = $nbr_manches['nbr_manche']; } } else { global $glob_debug; if ($glob_debug) { echo 'ERREUR - SQL MANCHES'; } exit; } $sql = 'SELECT j.pseudo, j.id_joueur, SUM(mj.score) as total FROM joueurs_groupes as jg RIGHT JOIN joueurs as j ON jg.id_joueur = j.id_joueur LEFT JOIN manches_joueurs as mj ON j.id_joueur=mj.id_joueur WHERE jg.id_groupe=:idg GROUP BY j.id_joueur