Esempio n. 1
0
if (utilisateurEstConnecteEtAdmin() && isset($_GET['action']) && $_GET['action'] == 'deconnexion') {
    session_destroy();
    header("location:" . RACINE_SITE . "connexion.php");
    exit;
}
$cinqarticlesMieuxNotes = executeRequete("SELECT id_article FROM avis GROUP BY id_article ORDER BY AVG(note) DESC LIMIT 5");
echo "<h1>Statistiques</h1>";
echo '<div id="articleStats">';
echo '<h4>Top 5 des articles les mieux notées</h4>';
while ($resultat1 = $cinqarticlesMieuxNotes->fetch_assoc()) {
    $recupInfosArticle = executeRequete("SELECT titre, photo, s.id_article, categorie, ROUND(AVG(note)*2)/2 AS moyenne FROM article s, avis a WHERE s.id_article = a.id_article AND a.id_article='" . $resultat1['id_article'] . " '  GROUP BY id_article");
    while ($infos = $recupInfosArticle->fetch_assoc()) {
        echo "<div class='article_div'>";
        echo "<p class='titreStats'>{$infos['titre']}</p>";
        echo "<div class='imageArticle'>" . "<img src='{$infos['photo']}' height='130' alt='{$infos['titre']}' data-tooltip='Article n° {$infos['id_article']}'>" . "</div>";
        echo imageNotation($infos['moyenne']);
        echo "</div>";
    }
}
echo '</div><br>';
// $donnees = executeRequete("SELECT ar.id_article, note, categorie, titre, prix, photo, id_promo FROM article ar LEFT JOIN avis av ON ar.id_article = av.id_article  GROUP BY ar.id_article ORDER BY ar.id_article DESC LIMIT " . (($cPage-1)*$perPage) . ",$perPage");
$cinqarticlesPlusAchetes = executeRequete("SELECT id_commande, d.id_article, a .id_article, titre, photo, a.prix FROM details_commande d LEFT JOIN article a ON d.id_article = a.id_article GROUP BY d.id_article ORDER BY COUNT(*) DESC LIMIT 5");
echo '<div id="articleStats">';
echo '<h4>Top 5 des articles les plus achetés</h4>';
while ($resultat2 = $cinqarticlesPlusAchetes->fetch_assoc()) {
    echo "<div class='article_div'>";
    echo "<p class='titreStats'>{$resultat2['titre']}</p>";
    echo "<div class='imageArticle'>" . "<img src='{$resultat2['photo']}' height='120' alt='{$resultat2['titre']}' data-tooltip='Article n° {$resultat2['id_article']}''>" . "</div>";
    echo "<p class='prixStats'>{$resultat2['prix']} €</p>";
    echo "</div>";
}
Esempio n. 2
0
if ($_GET['categorie'] != 'all') {
    $donnees2 = executeRequete("SELECT ar.id_article, note, categorie, titre, prix, photo, id_promo FROM article ar LEFT JOIN avis av ON ar.id_article = av.id_article  WHERE categorie = '{$_GET['categorie']}' GROUP BY ar.id_article ");
    // $recupCategories = executeRequete("SELECT categorie FROM article GROUP BY categorie ");
    // $recupMarques = executeRequete("SELECT marque FROM article GROUP BY marque ");
    // Affichage de tous les articles de la catégorie:
    // Header dynamique en fonction de la catégorie:
    echo "<div id='header_categorie'><img src=' " . RACINE_SITE . "photo/{$_GET['categorie']}.jpg' alt='{$_GET['categorie']}' title='Bandeau catégorie {$_GET['categorie']}' /></div>";
    echo '<a href="categories.php?categorie=all"> < Retour aux catégories </a>';
    while ($article = $donnees2->fetch_assoc()) {
        $recup_promo = informationSurUnePromotion($article['id_article']);
        $promotion = $recup_promo->fetch_assoc();
        $calcul_note = executeRequete("SELECT ROUND(AVG(note)*2)/2 AS moyenne FROM avis WHERE id_article = {$article['id_article']}");
        $note_final = $calcul_note->fetch_assoc();
        echo '<div class="articleCat">';
        echo '<div class="note">';
        imageNotation($note_final['moyenne']);
        echo '</div>';
        if ($article['id_promo'] == 1) {
            echo '<div class="fond_prixCat">';
            echo "<p>{$article['prix']} €</p>";
            echo '</div>';
        } else {
            echo '<div class="fond_prixPromoCat">';
            echo "<p><span class='old_price'>{$article['prix']}€ </span> " . prixAvecPromo($article['id_article']) . "€</p>";
            echo '</div>';
        }
        echo "<a href='fiche_article.php?id_article={$article['id_article']}&categorie={$article['categorie']}'><img src='{$article['photo']}' alt='{$article['titre']}' class='img_article'></a>";
        echo "<h3>{$article['titre']}</h3>";
        if (utilisateurEstConnecte()) {
            echo "<form method='post' action='panier.php'>";
            echo "<input type='hidden' name='id_article' value='{$article['id_article']}'>";
Esempio n. 3
0
echo '<span>' . $nbLinesPromotion . '</span>';
echo '</div>';
echo '<a href="' . RACINE_SITE . 'admin/gestion_promos.php?action=affichage" class="dashboard_title">Promotions</a>';
echo '</div>';
echo '<div class="div_dashboard statistiques_info">';
echo '<a href="' . RACINE_SITE . 'admin/statistiques.php" class="dashboard_title">Statistiques</a>';
echo '</div>';
echo '</div>';
echo '<div id="derniers_avis">';
echo "<div id='avisTitle'><h4>Derniers avis</h4></div>";
echo "<div id='contentThreeComments'>";
while ($threeLastComments = $commentaire->fetch_assoc()) {
    echo '<div class="comment">';
    echo "<div class='infos_comment'>";
    echo "<p class='pseudo_comm'>" . $threeLastComments['pseudo'] . "</p>";
    imageNotation($threeLastComments['note']);
    echo "<p class='date_comm'>" . dateLongue($threeLastComments['date'], 'no') . "</p>";
    echo '</div>';
    echo "<div class='affichage_comment'>";
    echo "<p class='subject_comm'>" . $threeLastComments['sujet'] . "</p>";
    echo "<p class='comm_comm'>" . $threeLastComments['commentaire'] . "</p>";
    echo "<a href='" . RACINE_SITE . "admin/gestion_avis.php?action=0#" . $threeLastComments['id_avis'] . "' class='link_comm'> >> Voir</a>";
    echo "</div>";
    echo '</div>';
}
echo '</div>';
echo '</div>';
echo '<div id="infos_droite">';
echo '<div id="chiffre_affaire">';
echo "<table>";
echo "<tr>";