<button type="button" class="btnflash15 btn btn-success btn-lg btn-block">Flash 15</button> </div> <div class="btn-group" role="group"> <button type="button" class="btnflashEffacer btn btn-success btn-lg btn-block">Effacer</button> </div> </div> <br> <?php /* CAS 2 : Saisie du pronostic du joueur */ for ($i = 1; $i <= 15; $i++) { if ($i == 8) { echo "<hr style='width:100%;color:firebrick;margin:5px 0;background-color:firebrick;height:3px;' />"; } if (getEquipe($jeu, $i, "D") != "") { $res = getProno($pronostic, $i); // 2a : Ligne Match aves les trois choix ?> <div class="btnGroupeSaisie btn-group btn-group-justified" role="group" > <div class="btn-group" role="group"> <?php echo '<button type="button" class="btnSaisie btn '; if (strpos($res, "1") !== false) { echo 'btn-primary'; } else { echo 'btn-default'; } echo '" id="btn' . $i . '1" '; echo '>' . getEquipe($jeu, $i, "D") . '</button>'; ?> </div>
function getNbPronosticJoueur($pronostic) { $j = 0; for ($i = 1; $i <= 15; $i++) { if (getProno($pronostic, $i) != "") { $j++; } } return $j; }
function CalculGains($debug, $jeu, $pronostic) { $resultat = ""; if ($debug) { echo "jeu : \n"; var_dump($jeu); echo "pronostic : \n"; var_dump($pronostic); } /* $jeu_id = $statistique->jeu_id; $saison_id = $pronostic->saison_id; if ($debug) { echo "CalculGains : Saison id :".$saison_id.", Stat jeu :".$jeu_id."\n"; } */ if ($debug) { echo "Code Jeu chez pronosoft : " . $jeu->idSite . "\n"; } //interrogation du site avec l'idSite via POST par curl $url = 'http://www.pronosoft.com/fr/lotofoot/estimateur.php?id715=' . $jeu->idSite; //$nameForm = 'estimateur_' . $idSite; $postfields = array(); //$postfields["action"] = $url; $postfields["action"] = "submit"; if ($debug) { echo "Url chez pronosoft : " . $url . "\n"; } //on remplit dynamiquement les champs nécessaire au formulaire $j = 0; for ($i = 1; $i <= 15; $i++) { $prono = getProno($pronostic, $i); $name = 'm_' . $j; if ($prono == '1') { $postfields[$name] = '1'; } elseif ($prono == 'N') { $postfields[$name] = 'N'; } elseif ($prono == '2') { $postfields[$name] = '2'; } else { $postfields[$name] = 'G'; } $j++; } //initialisation du curl $postfields["id715"] = $jeu->idSite; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0"); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //récupération du résultat html $result = curl_exec($ch); curl_close($ch); //convertion en objet html $html = str_get_html($result); if (!empty($html)) { //echo $html; $estimation = array(); $i = 0; // on récupère le tableau des extimation foreach ($html->find('div[class=box_estim]') as $listeJeux) { //création d'un tableau contenant les estimations $estim = array(); //Récupération du Titre $titre = $listeJeux->find('h2', 0)->plaintext; $rangs = array(); $rapports = array(); $j = 0; //récupération des différents rangs de gain foreach ($listeJeux->find('tr') as $rang) { $rangs[$j] = clean($rang->find('td', 0)->plaintext); $rapports[$j] = clean($rang->find('td', 1)->plaintext); $j++; } //$estim['titre']= clean($titre); $estim['rangs'] = $rangs; $estim['rapports'] = $rapports; if ($debug) { echo $titre . "\n"; echo "Rangs : \n"; var_dump($rangs); echo "rapports : \n"; var_dump($rapports); } //on remplit le tableau $estimation[$i] = $estim; $i++; } $i = 0; if (empty($estimation)) { $resultat["resultat"] = false; $resultat["commentaire"] = "Le chargement des estimations a échoué"; } else { $resultat = $estimation; } /* //on déroule le tableau, pour afficher les estimations (LF7 / LF15) $nbProno = getNbPronosticJoueur($pronostic); if ($debug) { echo "Nombre de prono. :" . $nbProno ; } foreach($estimation as $estim) { if ($nbProno == 7 && $i>0) break; $rangs=$estim['rangs']; $rapports=$estim['rapports']; //parcours des rangs $j=0; foreach($rangs as $index) { //affichage des rangs echo $rangs[$j] . '<br>'; echo $rapports[$j] . '<br>'; //echo "<br>"; $j++; } $i++; } */ } else { $resultat["resultat"] = false; $resultat["commentaire"] = "Le chargement des estimations a échoué"; } return $resultat; }