$req->execute(array($_POST[$scorea], $_POST[$scoreb], $match)); } catch (Exception $e) { $message = 'Erreur grave de connexion BDD !' . $e->getMessage(); } } else { $message = 'Le format du score est invalide !'; } } } // Si au moins une insertion s'est déroulée if ($i_return) { echo " 2 "; // on définit la position avant d'entrer le (ou les) prochain match $tab_position_avant = calculer_classement($bdd, $get_users_ranking); // calcul des points pour le joueur $i_return = calculer_points($bdd, $get_all_pronostics, $insert_prono_score, $compute_users_score); echo " lalal"; if ($i_return) { echo "voubo"; // on définit la position apres d'entrer le (ou les) prochain match $tab_position_apres = calculer_classement($bdd, $get_users_ranking); // on calcule la tendance à partir de la position avant et la position après $i_return = calculer_tendance($bdd, $insert_tendance, $tab_position_avant, $tab_position_apres); } } if (!$i_return) { $message = 'Problème lors du traitement points et position'; } } $req = $bdd->prepare($get_played_games); $req->execute(array($_SESSION['userid']));
<?php include_once 'controleur/includes/fonctions/calculs_points.php'; echo '<h3>Tu as ' . calculer_points($id_user, $bdd) . ' points !</h3>'; echo '<p>'; echo '<ul>'; echo '<li>Cadeaux / Bonus : <strong>+' . points_cadeau($id_user, $bdd) . ' points</strong><br></li>'; echo '<li>Votes : <strong>+' . points_votes($id_user, $bdd) . ' points</strong><br></li>'; echo '<li>Potins publiés : <strong>'; $points_potins = points_potins($id_user, $bdd); if ($points_potins >= 0) { echo '+'; } echo $points_potins . ' points</strong><br></li>'; echo '<li>Connexions : <strong>+' . points_connexions($id_user, $bdd) . ' points</strong><br></li>'; echo '<br>'; echo '<li>Potins découverts : <strong>-' . nb_potins_decouverts($id_user, $bdd) * 10 . ' points</strong><br></li>'; echo '<li>Potins découverts dans d\'autres groupes: <strong>-' . nb_potins_externes_decouverts($id_user, $bdd) * 20 . ' points</strong><br></li>'; echo '</ul>'; echo '</p>'; echo '<hr>'; echo '<h3>Comment gagner des points ?</h3>'; echo '<p><ul>'; echo '<li>En votant sur un potin : <strong>+1 point !</strong></li>'; echo '<li>En publiant un potin : en fonction des votes de tes amis, <strong>+10 à -5 points </strong></li>'; echo '<li>En te connectant : <strong>+1 point</strong> par jour où tu te connectes</li>'; echo '</ul></p>'; echo '<hr>'; echo '<h3>Que faire de mes points ?</h3>'; echo '<p><ul>'; echo '<li><strong>Avec 10 points</strong> : Découvrir un potin te concernant, sur <a href="' . INDEX . '?page=page_perso&onglet=potins_sur_moi"><strong>cette page</strong></a></li>';
<?php include_once 'controleur/includes/fonctions/calculs_points.php'; echo '<span class="badge points-user encart-usr-points" data-toggle="tooltip" data-placement="right" title="Dès 10 points, 1 potin !">' . calculer_points($id_user, $bdd) . ' points</span>';
/** Refaire, en ne prenant que l'id du potin comme paramètre **/ function vue_potin_v4_brouille($potin_courant, $id_user, $bdd) { $user = infos_user($id_user, $bdd); $groupe_courant = infos_groupe($potin_courant['id_Groupe'], $bdd); // Si on n'avait pas vu ce potin if (!contenu_deja_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd)) { // On l'enregistre comme vu new_contenu_vu($id_user, $potin_courant['id_Potin'], 'potin', $bdd); } $resultat = ''; $resultat .= '<div class="row-potin-v4 item corps-brouille-v4" id="potin-' . $potin_courant['id_Potin'] . '" typePotin="v4">'; // Header $resultat .= '<div class="header-potin-v4">'; if ($groupe_courant['image'] != '') { $bandeau_groupe = $groupe_courant['image']; } else { $bandeau_groupe = 'default'; } $resultat .= '<div class="hp4-bandeau"> <img src="images/groupe/' . $bandeau_groupe . '-bd.jpg"> </div>'; // Affichage des concernes $resultat .= '<div class="hp4-wrapper-profile">'; /*$nom_concernes = explode(',', $potin_courant['concernes']); $id_concernes = explode(',', $potin_courant['id_Concernes']); $nb_concernes = count($nom_concernes);*/ /*foreach ($id_concernes as $key => $concerne_courant) { $concerne_courant = infos_user($concerne_courant, $bdd);*/ if ($user['avatar'] != '') { $photo_profile = $user['avatar']; $initiales = ''; } else { $photo_profile = 'default'; $initiales = substr($user['prenom'], 0, 1) . ' ' . substr($user['nom'], 0, 1); } $resultat .= '<a href="' . INDEX . '?page=page_membre&id_concerne=' . $user['id_user'] . '&onglet=potins"> <div class="hp4-wrp"><div class="hp4-rounded-profile" style="background:url(images/profile/' . $photo_profile . '-50.jpg) no-repeat 0px 0px;" data-toggle="tooltip" data-placement="top" title="' . $user['prenom'] . ' ' . $user['nom'] . '">' . $initiales . '</div></div></a>'; //} $resultat .= '</div>'; $padding_nom = 10 + 55 + 10; // Calcul du décalage du nom du groupe $resultat .= '<div class="hp4-nom-gp">' . '<a href="' . INDEX . '?page=groupe&id_groupe=' . $potin_courant['id_Groupe'] . '" style="padding-left:' . $padding_nom . 'px">' . htmlspecialchars($potin_courant['nom_groupe']) . '</a>' . '</div>'; $resultat .= '</div>'; // Corps du potin $resultat .= '<div class="corps-potin-v4">'; $resultat .= '<div class="date-potin-v4">' . $potin_courant['nom_jour_potin'] . ' ' . $potin_courant['jour_potin'] . ' ' . $potin_courant['mois_potin'] . ' ' . $potin_courant['annee_potin']; $resultat .= '</div>'; // Le texte du potin $resultat .= '<div class="texte-potin-v4">' . 'Ce potin peut être débloqué pour 10 points.' . '</div>'; $resultat .= '</div>'; // Fin corps // Image $resultat .= '<div class="image-potin-v4">'; if ($potin_courant['Image'] != '') { $resultat .= '<img class="imagePotin" src="images/brouillage.gif" alt="Photo du potin">'; } $resultat .= '</div>'; // Fin image $resultat .= '<!-- Bouton de révélation du potin --> <form action="#" method="post" name="decouvrir_potin" class="form-horizontal "> <input type="hidden" name="decouvrir_potin" value="ok" /> <input type="hidden" name="numero_potin" value="' . $potin_courant['id_Potin'] . '" /> <button class="pull-right btn btn-link" type="submit"'; include_once 'controleur/includes/fonctions/calculs_points.php'; if (calculer_points($id_user, $bdd) < 10) { $resultat .= 'disabled="disabled"'; } $resultat .= '><span class="glyphicon glyphicon-eye-open"></span> Découvrir !</button> </form>'; // On détermine la véracité du potin switch (resultat_vote($potin_courant['id_Potin'], $bdd)) { case 'sur': $resv_css = 'sur'; $resv_text = 'C\'est sûr !'; //$resultat .= '<br>'; // On ajoute un espacement break; case 'possible': $resv_css = 'possible'; $resv_text = 'C\'est possible.'; //$resultat .= '<br>'; break; case 'surement_faux': $resv_css = 'surement_faux'; $resv_text = 'C\'est sûrement faux ...'; //$resultat .= '<br>'; break; case 'faux': $resv_css = 'faux'; $resv_text = 'C\'est faux !'; //$resultat .= '<br>'; break; case 'calomnie': $resv_css = 'calomnie'; $resv_text = 'Ce n\'est que pure calomnie !'; //$resultat .= '<br>'; break; default: $resv_css = 'none'; $resv_text = ''; break; } $resultat .= '<div class="potin-vote-wrapper-v4">'; if ($resv_text != '') { // Affichage de la véracité du potin $resultat .= '<div class="potin-resultat-vote resv-' . $resv_css . '" data-toggle="tooltip" data-placement="top" title="Cet avis est donné par un algorithme secret"> ' . $resv_text . ' </div>'; } $resultat_votes = resultat_vote($potin_courant['id_Potin'], $bdd); $nb_votes_pos = nb_votes_positif($potin_courant['id_Potin'], $bdd); $nb_votes_neut = nb_votes_ne_sait_pas($potin_courant['id_Potin'], $bdd); $nb_votes_neg = nb_votes_negatif($potin_courant['id_Potin'], $bdd); $nb_de_votants = nb_votants($potin_courant['id_Potin'], $bdd); if ($nb_de_votants != 0) { $barre_positif = $nb_votes_pos / $nb_de_votants * 100; $barre_negatif = $nb_votes_neg / $nb_de_votants * 100; $barre_neutre = $nb_votes_neut / $nb_de_votants * 100; } else { $barre_positif = 0; $barre_negatif = 0; $barre_neutre = 0; } if ($nb_de_votants != 0) { $resultat .= '<div class="vote-progressbar-wraper">'; if ($barre_positif != 0) { $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5cb85c; width: ' . $barre_positif . '%;"></span>'; } if ($barre_neutre != 0) { $resultat .= '<span class="vote-progressbar" style="border: 1px solid #5bc0de; width: ' . $barre_neutre . '%;"></span>'; } if ($barre_negatif != 0) { $resultat .= '<span class="vote-progressbar" style="border: 1px solid #d9534f; width: ' . $barre_negatif . '%;"></span>'; } $resultat .= '</div>'; } $resultat .= '</div>'; $resultat .= '</div>'; return $resultat; }
</h4> <span class="badge pg-gp-nb-pot-gp">' . $nb_potins_sur_user_ds_gp_courant . ' potins ! </span> </div> <div id="collapse-gp-' . $groupe_courant['id_groupe'] . '" class="panel-collapse collapse" role="tabpanel" aria-labelledby="acc-gp-' . $groupe_courant['id_groupe'] . '"> <div class="panel-body">'; echo '<ul>'; echo '<li><a href="' . INDEX . '?page=groupe&id_groupe=' . $groupe_courant['id_groupe'] . '">Voir la page du groupe</a></li>'; // On cherche les potins qu'on a découverts $potins_decouverts = potins_decouverts_sur_user_dans_gpe($user_concerne['id_user'], $groupe_courant['id_groupe'], $id_user); if ($potins_decouverts != 0) { $nb_potins_a_decouvrir = $nb_potins_sur_user_ds_gp_courant - sizeof($potins_decouverts); } else { $nb_potins_a_decouvrir = $nb_potins_sur_user_ds_gp_courant; } if ($nb_potins_a_decouvrir > 0) { if (calculer_points($id_user, $bdd) >= 20) { echo '<li><a class="decouvrir-potin-externe" idConcerne="' . $user_concerne['id_user'] . '" idGroupe="' . $groupe_courant['id_groupe'] . '">Découvrir un potin sur ' . $user_concerne['prenom'] . '</a> (20 points)</li>'; } else { echo '<li>A partir de 20 points, tu pourras découvrir un potin sur ' . $user_concerne['prenom'] . ' dans ' . $groupe_courant['nom'] . ' !</li>'; } } echo '</ul>'; echo '<div class="potin-externe-suivant-' . $groupe_courant['id_groupe'] . '"></div>'; if ($potins_decouverts != 0) { foreach ($potins_decouverts as $key => $potin_courant) { $potin_courant = infos_potin($potin_courant, $bdd); echo vue_affichage_potin($potin_courant, $id_user, $bdd); } } echo '</div> </div>
?> <!-- Bouton de révélation du potin --> <form action="#" method="post" name="decouvrir_potin" class="form-horizontal "> <input type="hidden" name="decouvrir_potin" value="ok" /> <input type="hidden" name="numero_potin" value="<?php echo $potin_courant['id_Potin']; ?> " /> <button class="pull-right btn btn-link" type="submit" <?php include_once 'controleur/includes/fonctions/calculs_points.php'; if (calculer_points($id_user, $bdd) < 10) { echo 'disabled="disabled"'; } ?> ><span class="glyphicon glyphicon-eye-open"></span> Découvrir !</button> </form> <?php include_once 'modele/commentaires.php'; $commentaires = rechercher_commentaires($potin_courant['id_Potin'], $bdd); ?> <a href="#">