[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/ -> statistiques_visites.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  include  ("inc.php");
  20  
  21  include  ("inc_statistiques.php");
  22  
  23  require_once ("PEAR.php");
  24  require_once (dirname(__FILE__). "/include/bd/inc_article_factory.php");
  25  require_once (dirname(__FILE__). "/include/bd/inc_visite_factory.php");
  26  
  27  if ($id_article = intval($id_article)) {
  28      $articleMetier = &recuperer_instance_article();
  29      $articleMetier->loadLightWeight($id_article);
  30      $articleStatus = $articleMetier->getStatut();
  31      if ($articleStatus == 'publie') {
  32          $titre = typo($articleMetier->getTitre());
  33          $total_absolu = $articleMetier->getVisites();
  34          $val_popularite = round($articleMetier->getPopularite());
  35      }
  36  }
  37  else {
  38      $visiteMetier = &recuperer_instance_visite();
  39      $total_absolu = $visiteMetier->howManyVisite();
  40      if (PEAR::isError($total_absolu)) {
  41          die ($total_absolu->getMessage());
  42      }
  43  }
  44  
  45  if ($titre)
  46      $pourarticle = " " . _T('info_pour'). " &laquo; $titre &raquo;";
  47  
  48  if ($origine) {
  49      debut_page(_T('titre_page_statistiques_referers'), "suivi", "statistiques");
  50      echo "<br><br>";
  51      gros_titre (_T('titre_liens_entrants'));
  52      $activer_statistiques_ref = lire_meta("activer_statistiques_ref");
  53  
  54      if ($activer_statistiques_ref != "non")
  55          barre_onglets("statistiques", "referers");
  56  
  57      debut_gauche();
  58      debut_boite_info();
  59      echo "<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2>";
  60      echo "<P align=left>" . _T('info_gauche_statistiques_referers'). "</P></FONT>";
  61      fin_boite_info();
  62  
  63      debut_droite();
  64  }
  65  else {
  66      debut_page(_T('titre_page_statistiques_visites'). $pourarticle, "suivi", "statistiques");
  67      echo "<br><br>";
  68      gros_titre (_T('titre_evolution_visite'). "<html>" . aide("confstat"). "</html>");
  69      $activer_statistiques_ref = lire_meta("activer_statistiques_ref");
  70  
  71      if ($activer_statistiques_ref != "non")
  72          barre_onglets("statistiques", "evolution");
  73  
  74      if ($titre)
  75          gros_titre ($titre);
  76  
  77      debut_gauche();
  78  
  79      echo "<p>";
  80  
  81      echo "<div class='iconeoff' style='padding: 5px;'>";
  82      echo "<font face='Verdana,Arial,Sans,sans-serif' size=2>";
  83      echo typo(_T('info_afficher_visites'));
  84      echo "<ul>\n";
  85  
  86      if ($id_article > 0) {
  87          echo "<li><b><a href='statistiques_visites.php'>" . _T('info_tout_site'). "</a></b>";
  88      }
  89      else {
  90          echo "<li><b>" . _T('titre_page_articles_tous'). "</b>";
  91      }
  92  
  93      echo "</ul>\n";
  94      echo "</font>";
  95  
  96      echo "</div>\n";
  97  
  98      // Par popularite
  99      $articleMetier = &recuperer_instance_article();
 100      $articles_recents = &$articleMetier->getRecentArticleIds();
 101      $articles_recents = join($articles_recents, ",");
 102  
 103      // Par popularite
 104      $articles = &$articleMetier->getPublishedAndPopular();
 105      $nombre_articles = sizeof($articles);
 106  
 107      if ($nombre_articles > 0) {
 108          echo "<p>";
 109          echo "<div class='iconeoff' style='padding: 5px;'>";
 110          echo "<font face='Verdana,Arial,Sans,sans-serif' size=2>";
 111          echo typo(_T('info_visites_plus_populaires'));
 112          echo "<ol style='padding-left:25 px;'>";
 113          echo "<font size=1 color='#666666'>";
 114          while (list(, $currentArticle) = each($articles)) {
 115              $titre = typo($currentArticle->getTitre());
 116              $l_article = $currentArticle->getArticleId();
 117              $visites = $currentArticle->getVisites();
 118              $popularite = round($currentArticle->getPopularite());
 119              $liste++;
 120              $classement[$l_article] = $liste;
 121              if ($liste <= 30) {
 122                  $articles_vus[] = $l_article;
 123                  if ($l_article == $id_article) {
 124                      echo "\n<li value='$liste'><b>$titre</b>";
 125                  }
 126                  else {
 127                      echo "\n<li value='$liste'>" .
 128                           "<a href='statistiques_visites.php?id_article=$l_article' " .
 129                           "title='" . _T('info_popularite', array('popularite' => $popularite, 'visites' => $visites)). "'>$titre</a>";
 130                  }
 131              }
 132          }
 133          $articles_vus = join($articles_vus, ",");
 134  
 135          // Par popularite
 136          $articles = $articleMetier->getRecentPublishedAndPopularButNotSeen($articles_recents, $articles_vus);
 137  
 138          if (PEAR::isError($articles)) {
 139              die ($articles->getMessage());
 140          }
 141  
 142          $nombre_articles = sizeof($articles);
 143          if ($nombre_articles > 0) {
 144              echo "<br><br>[...]<br><br>";
 145              while (list(, $currentArticle) = each($articles)) {
 146                  $titre = typo($currentArticle->getTitre());
 147                  $l_article = $currentArticle->getArticleId();
 148                  $visites = $currentArticle->getVisites();
 149                  $popularite = round($currentArticle->getPopularite());
 150                  $numero = $classement[$l_article];
 151                  if ($l_article == $id_article) {
 152                      echo "\n<li value='$numero'><b>$titre</b></li>";
 153                  }
 154                  else {
 155                      echo "\n<li value='$numero'>" .
 156                           "<a href='statistiques_visites.php?id_article=$l_article' " .
 157                           "title='" . _T('info_popularite_3', array('popularite' => $popularite, 'visites' => $visites)). "'>$titre</a>" .
 158                           "</li>\n";
 159                  }
 160              }
 161          }
 162  
 163          echo "</ol>\n";
 164  
 165          echo "<b>" . _T('info_comment_lire_tableau'). "</b><br>" . _T('texte_comment_lire_tableau');
 166  
 167          echo "</font>";
 168          echo "</font>";
 169          echo "</div>\n";
 170      }
 171  
 172      // Par visites depuis le debut
 173      $articleMetier = &recuperer_instance_article();
 174      $articles = $articleMetier->getPublishedAndPopularFromBeginning();
 175      $nombre_articles = sizeof($articles);
 176  
 177      if ($nombre_articles > 0) {
 178          creer_colonne_droite();
 179  
 180          echo "<p></p><div class='iconeoff' style='padding: 5px;'>";
 181          echo "<font face='Verdana,Arial,Helvetica,sans-serif' size=2>";
 182          echo typo(_T('info_affichier_visites_articles_plus_visites'));
 183          echo "<ol style='padding-left:25 px;'>";
 184          echo "<font size=1 color='#666666'>";
 185  
 186          while (list(, $currentArticle) = each($articles)) {
 187              $titre = typo($currentArticle->getTitre());
 188              $l_article = $currentArticle->getArticleId();
 189              $visites = $currentArticle->getVisites();
 190              $popularite = round($currentArticle->getPopularite());
 191              $numero = $classement[$l_article];
 192              if ($l_article == $id_article) {
 193                  echo "\n<li value='$numero'><b>$titre</b></li>\n";
 194              }
 195              else {
 196                  echo "\n<li value='$numero'>" .
 197                       "<a href='statistiques_visites.php?id_article=$l_article' " .
 198                       "title='" . _T('info_popularite_4', array('popularite' => $popularite, 'visites' => $visites)). "'>$titre</a>" .
 199                       "</li>\n";
 200              }
 201          }
 202          echo "</ol>";
 203          echo "</font>";
 204  
 205          echo "</font>";
 206          echo "</div>";
 207      }
 208  
 209      //
 210      // Afficher les boutons de creation d'article et de breve
 211      //
 212      $authorization = &recuperer_instance_authorization('afficherStatistiques', $GLOBALS['connect_id_auteur']);
 213  
 214      if ($authorization->isAuthorizedAction()) {
 215          if ($id_article > 0) {
 216              debut_raccourcis();
 217              icone_horizontale(_T('icone_retour_article'), "articles.php?id_article=$id_article", "article-24.gif",
 218                                "rien.gif");
 219              fin_raccourcis();
 220          }
 221      }
 222      debut_droite();
 223  }
 224  
 225  $authorization = &recuperer_instance_authorization('afficherStatistiques', $GLOBALS['connect_id_auteur']);
 226  
 227  if (!$authorization->isAuthorizedAction()) {
 228      echo _T('avis_non_acces_page');
 229      fin_page();
 230      exit;
 231  }
 232  
 233  if (!$origine) {
 234      //----------Modification Clever Age elebescond----------
 235      $visiteMetier = &recuperer_instance_visite();
 236  
 237      if ($id_article) {
 238          $allVisites = $visiteMetier->getAllForArticleIdAndDate($id_article);
 239          $table_ref = $GLOBALS['table_prefix']. "_referers_articles";
 240          $where = "id_article=$id_article";
 241      }
 242      else {
 243          $allVisites = $visiteMetier->getAllForDate();
 244          $table_ref = $GLOBALS['table_prefix']. "_referers";
 245          $where = "1";
 246      }
 247  
 248      if (PEAR::isError($allVisites)) {
 249          die ($allVisites->getMessage());
 250      }
 251  
 252      if (sizeOf($allVisites) > 0) {
 253          while (list(, $maVisite) = each($allVisites)) {
 254              $date = $maVisite['date_unix'];
 255              $visites = $maVisite['visites'];
 256  
 257              $log[$date] = $visites;
 258  
 259              if ($i == 0)
 260                  $date_debut = $date;
 261              $i++;
 262          }
 263      }
 264  
 265      // Visites du jour
 266      $visiteMetier = &recuperer_instance_visite();
 267  
 268      if ($id_article) {
 269          $visites_today = $visiteMetier->howManyDistinctVisiteForAnArticle($id_article);
 270      }
 271      else {
 272          $visites_today = $visiteMetier->howManyDistinctVisiteForAnArticle();
 273      }
 274  
 275      if (PEAR::isError($visites_today)) {
 276          die ($visites_today->getMessage());
 277      }
 278  
 279      if (count($log) > 0) {
 280          $max = max(max($log), $visites_today);
 281          $date_today = time();
 282          $nb_jours = floor(($date_today - $date_debut) / (3600 * 24));
 283  
 284          $maxgraph = substr(ceil(substr($max, 0, 2) / 10). "000000000000", 0, strlen($max));
 285  
 286          if ($maxgraph < 10)
 287              $maxgraph = 10;
 288  
 289          if (1.1 * $maxgraph < $max)
 290              $maxgraph .= "0";
 291  
 292          if (0.8 * $maxgraph > $max)
 293              $maxgraph = 0.8 * $maxgraph;
 294  
 295          $rapport = 200 / $maxgraph;
 296  
 297          if (count($log) < 420)
 298              $largeur = floor(450 / ($nb_jours + 1));
 299  
 300          if ($largeur < 1)
 301              $largeur = 1;
 302  
 303          if ($largeur > 50)
 304              $largeur = 50;
 305  
 306          debut_cadre_relief ("statistiques-24.gif");
 307          echo "<table cellpadding=0 cellspacing=0 border=0><tr><td background='img_pack/fond-stats.gif'>";
 308          echo "<table cellpadding=0 cellspacing=0 border=0><tr>";
 309          echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=200></td>";
 310  
 311          // Presentation graphique
 312          while (list($key, $value) = each($log)) {
 313              $n++;
 314  
 315              if ($decal == 30)
 316                  $decal = 0;
 317  
 318              $decal++;
 319              $tab_moyenne[$decal] = $value;
 320  
 321              // Inserer des jours vides si pas d'entrees    
 322              if ($jour_prec > 0) {
 323                  $ecart = floor(($key - $jour_prec) / (3600 * 24) - 1);
 324                  for ($i = 0; $i < $ecart; $i++) {
 325                      if ($decal == 30)
 326                          $decal = 0;
 327  
 328                      $decal++;
 329                      $tab_moyenne[$decal] = $value;
 330  
 331                      reset ($tab_moyenne);
 332                      $moyenne = 0;
 333  
 334                      while (list(, $val_tab) = each($tab_moyenne))
 335                          $moyenne += $val_tab;
 336  
 337                      $moyenne = $moyenne / count($tab_moyenne);
 338  
 339                      $hauteur_moyenne = round(($moyenne) * $rapport) - 1;
 340                      echo "<td valign='bottom' width=$largeur>";
 341                      $difference = ($hauteur_moyenne) -1;
 342  
 343                      if ($difference > 0) {
 344                          echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
 345                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne>";
 346                      }
 347  
 348                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
 349                      echo "</td>";
 350                      $n++;
 351                  }
 352              }
 353  
 354              $total_loc = $total_loc + $value;
 355              reset ($tab_moyenne);
 356  
 357              $moyenne = 0;
 358  
 359              while (list(, $val_tab) = each($tab_moyenne))
 360                  $moyenne += $val_tab;
 361  
 362              $moyenne = $moyenne / count($tab_moyenne);
 363  
 364              $hauteur_moyenne = round($moyenne * $rapport) - 1;
 365              $hauteur = round($value * $rapport) - 1;
 366              echo "<td valign='bottom' width=$largeur>";
 367  
 368              if ($hauteur > 0) {
 369                  if ($hauteur_moyenne > $hauteur) {
 370                      $difference = ($hauteur_moyenne - $hauteur) - 1;
 371                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
 372                      echo "<img src='img_pack/rien.gif' width=$largeur height=$difference>";
 373                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 374                      if (date("w", $key) == "0") // Dimanche en couleur foncee
 375                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
 376                      else
 377                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
 378                  }
 379                  else if ($hauteur_moyenne < $hauteur) {
 380                      $difference = ($hauteur - $hauteur_moyenne) - 1;
 381                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 382  
 383                      if (date("w", $key) == "0") // Dimanche en couleur foncee
 384                          $couleur = $couleur_foncee;
 385                      else
 386                          $couleur = $couleur_claire;
 387  
 388                      echo "<img src='img_pack/rien.gif' width=$largeur height=$difference style='background-color:$couleur;'>";
 389                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
 390                      echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne style='background-color:$couleur;'>";
 391                  }
 392                  else {
 393                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 394                      if (date("w", $key) == "0") // Dimanche en couleur foncee
 395                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
 396                      else
 397                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
 398                  }
 399              }
 400  
 401              echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
 402              echo "</td>\n";
 403  
 404              $jour_prec = $key;
 405              $val_prec = $value;
 406          }
 407  
 408          // Dernier jour
 409          $hauteur = round($visites_today * $rapport) - 1;
 410          $total_absolu = $total_absolu + $visites_today;
 411          echo "<td valign='bottom' width=$largeur>";
 412  
 413          if ($hauteur > 0) {
 414              echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 415              echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:#eeeeee;'>";
 416          }
 417  
 418          echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
 419          echo "</td>";
 420  
 421          echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=1></td>";
 422          echo "</tr></table>";
 423          echo "</td>";
 424          echo "<td background='img_pack/fond-stats.gif' valign='bottom'><img src='img_pack/rien.gif' style='background-color:black;' width=3 height=1></td>";
 425          echo "<td><img src='img_pack/rien.gif' width=5 height=1></td>";
 426          echo "<td valign='top'><font face='Verdana,Arial,Sans,sans-serif' size=2>";
 427          echo "<table cellpadding=0 cellspacing=0 border=0>";
 428          echo "<tr><td height=15 valign='top'>";
 429          echo "<font face='arial,helvetica,sans-serif' size=1><b>" . round($maxgraph). "</b></font>";
 430          echo "</td></tr>";
 431          echo "<tr><td height=25 valign='middle'>";
 432          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(7 * ($maxgraph / 8)). "</font>";
 433          echo "</td></tr>";
 434          echo "<tr><td height=25 valign='middle'>";
 435          echo "<font face='arial,helvetica,sans-serif' size=1>" . round(3 * ($maxgraph / 4)). "</font>";
 436          echo "</td></tr>";
 437          echo "<tr><td height=25 valign='middle'>";
 438          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(5 * ($maxgraph / 8)). "</font>";
 439          echo "</td></tr>";
 440          echo "<tr><td height=25 valign='middle'>";
 441          echo "<font face='arial,helvetica,sans-serif' size=1><b>" . round($maxgraph / 2). "</b></font>";
 442          echo "</td></tr>";
 443          echo "<tr><td height=25 valign='middle'>";
 444          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(3 * ($maxgraph / 8)). "</font>";
 445          echo "</td></tr>";
 446          echo "<tr><td height=25 valign='middle'>";
 447          echo "<font face='arial,helvetica,sans-serif' size=1>" . round($maxgraph / 4). "</font>";
 448          echo "</td></tr>";
 449          echo "<tr><td height=25 valign='middle'>";
 450          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(1 * ($maxgraph / 8)). "</font>";
 451          echo "</td></tr>";
 452          echo "<tr><td height=10 valign='bottom'>";
 453          echo "<font face='arial,helvetica,sans-serif' size=1><b>0</b></font>";
 454          echo "</td>";
 455  
 456          echo "</table>";
 457          echo "</font></td>";
 458          echo "</td></tr></table>";
 459  
 460          echo "<font face='arial,helvetica,sans-serif' size=1>" . _T('texte_statistiques_visites'). "</font>";
 461          echo "<p><table cellpadding=0 cellspacing=0 border=0 width='100%'><tr width='100%'>";
 462          echo "<td valign='top' width='33%'><font face='Verdana,Arial,Sans,sans-serif'>";
 463          echo _T('info_maximum'). " " . $max;
 464          echo "<br>" . _T('info_moyenne'). " " . round($moyenne);
 465          echo "</td>";
 466          echo "<td valign='top' width='33%'><font face='Verdana,Arial,Sans,sans-serif'>";
 467          echo _T('info_aujourdhui'). ' ' . $visites_today;
 468  
 469          if ($val_prec > 0)
 470              echo "<br>" . _T('info_hier'). $val_prec;
 471  
 472          if ($id_article)
 473              echo "<br>" . _T('info_popularite_5'). $val_popularite;
 474  
 475          echo "</td>";
 476          echo "<td valign='top' width='33%'><font face='Verdana,Arial,Sans,sans-serif'>";
 477          echo "<b>" . _T('info_total'). " " . $total_absolu . "</b>";
 478  
 479          if ($id_article) {
 480              if ($classement[$id_article] > 0) {
 481                  if ($classement[$id_article] == 1)
 482                      $ch = _T('info_classement_1', array('liste' => $liste));
 483                  else
 484                      $ch = _T('info_classement_2', array('liste' => $liste));
 485                  echo "<br>" . $classement[$id_article]. $ch;
 486              }
 487          }
 488          else {
 489              echo "<font size=1>";
 490              echo "<br>" . _T('info_popularite_2'). " ";
 491              echo ceil(lire_meta('popularite_total'));
 492              echo "</font>";
 493          }
 494          echo "</td></tr></table>";
 495      }
 496  
 497      if (count($log) > 80) {
 498          echo "<p>";
 499          echo "<font face='verdana,arial,helvetica,sans-serif' size='2'><b>" . _T(
 500                                                                                    'info_visites_par_mois'). "</b></font>";
 501  
 502          echo "<div align='left'>";
 503          ///////// Affichage par mois
 504          //----------Modification Clever Age elebescond----------
 505          $visiteMetier = &recuperer_instance_visite();
 506  
 507          if ($id_article) {
 508              $allVisites = $visiteMetier->getAllforArticleIdPerMonth($id_article);
 509          }
 510          else {
 511              $allVisites = $visiteMetier->getAllPerMonth();
 512          }
 513  
 514          if (PEAR::isError($allVisites)) {
 515              die ($allVisites->getMessage());
 516          }
 517  
 518          while (list(, $maVisite) = each($allVisites)) {
 519              $date = $maVisite['date_unix'];
 520              $visites = $maVisite['total_visites'];
 521              $i++;
 522              $entrees["$date"] = $visites;
 523          }
 524  
 525          if (count($entrees) > 0) {
 526              $max = max($entrees);
 527              $maxgraph = substr(ceil(substr($max, 0, 2) / 10). "000000000000", 0, strlen($max));
 528  
 529              if ($maxgraph < 10)
 530                  $maxgraph = 10;
 531  
 532              if (1.1 * $maxgraph < $max)
 533                  $maxgraph .= "0";
 534  
 535              if (0.8 * $maxgraph > $max)
 536                  $maxgraph = 0.8 * $maxgraph;
 537  
 538              $rapport = 200 / $maxgraph;
 539  
 540              $largeur = floor(420 / (count($entrees)));
 541  
 542              if ($largeur < 1)
 543                  $largeur = 1;
 544              if ($largeur > 50)
 545                  $largeur = 50;
 546          }
 547  
 548          echo "<table cellpadding=0 cellspacing=0 border=0><tr><td background='img_pack/fond-stats.gif'>";
 549          echo "<table cellpadding=0 cellspacing=0 border=0><tr>";
 550          echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=200></td>";
 551  
 552          // Presentation graphique
 553          $n = 0;
 554          $decal = 0;
 555          $tab_moyenne = "";
 556  
 557          while (list($key, $value) = each($entrees)) {
 558              $n++;
 559  
 560              if ($decal == 30)
 561                  $decal = 0;
 562  
 563              $decal++;
 564              $tab_moyenne[$decal] = $value;
 565  
 566              $total_loc = $total_loc + $value;
 567              reset ($tab_moyenne);
 568  
 569              $moyenne = 0;
 570  
 571              while (list(, $val_tab) = each($tab_moyenne))
 572                  $moyenne += $val_tab;
 573  
 574              $moyenne = $moyenne / count($tab_moyenne);
 575  
 576              $hauteur_moyenne = round($moyenne * $rapport) - 1;
 577              $hauteur = round($value * $rapport) - 1;
 578              echo "<td valign='bottom' width=$largeur>";
 579  
 580              if ($hauteur > 0) {
 581                  if ($hauteur_moyenne > $hauteur) {
 582                      $difference = ($hauteur_moyenne - $hauteur) - 1;
 583                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
 584                      echo "<img src='img_pack/rien.gif' width=$largeur height=$difference>";
 585                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 586                      if (ereg("-01", $key)) { // janvier en couleur foncee
 587                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
 588                      }
 589                      else {
 590                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
 591                      }
 592                  }
 593                  else if ($hauteur_moyenne < $hauteur) {
 594                      $difference = ($hauteur - $hauteur_moyenne) - 1;
 595                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 596  
 597                      if (ereg("-01", $key)) { // janvier en couleur foncee
 598                          $couleur = $couleur_foncee;
 599                      }
 600                      else {
 601                          $couleur = $couleur_claire;
 602                      }
 603  
 604                      echo "<img src='img_pack/rien.gif' width=$largeur height=$difference style='background-color:$couleur;'>";
 605                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:#333333;'>";
 606                      echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur_moyenne style='background-color:$couleur;'>";
 607                  }
 608                  else {
 609                      echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
 610                      if (ereg("-01", $key)) { // janvier en couleur foncee
 611                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_foncee;'>";
 612                      }
 613                      else {
 614                          echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
 615                      }
 616                  }
 617              }
 618  
 619              echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
 620              echo "</td>\n";
 621  
 622              $jour_prec = $key;
 623              $val_prec = $value;
 624          }
 625  
 626          echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=1></td>";
 627          echo "</tr></table>";
 628          echo "</td>";
 629          echo "<td background='img_pack/fond-stats.gif' valign='bottom'><img src='img_pack/rien.gif' style='background-color:black;' width=3 height=1></td>";
 630          echo "<td><img src='img_pack/rien.gif' width=5 height=1></td>";
 631          echo "<td valign='top'><font face='Verdana,Arial,Sans,sans-serif' size=2>";
 632          echo "<table cellpadding=0 cellspacing=0 border=0>";
 633          echo "<tr><td height=15 valign='top'>";
 634          echo "<font face='arial,helvetica,sans-serif' size=1><b>" . round($maxgraph). "</b></font>";
 635          echo "</td></tr>";
 636          echo "<tr><td height=25 valign='middle'>";
 637          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(7 * ($maxgraph / 8)). "</font>";
 638          echo "</td></tr>";
 639          echo "<tr><td height=25 valign='middle'>";
 640          echo "<font face='arial,helvetica,sans-serif' size=1>" . round(3 * ($maxgraph / 4)). "</font>";
 641          echo "</td></tr>";
 642          echo "<tr><td height=25 valign='middle'>";
 643          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(5 * ($maxgraph / 8)). "</font>";
 644          echo "</td></tr>";
 645          echo "<tr><td height=25 valign='middle'>";
 646          echo "<font face='arial,helvetica,sans-serif' size=1><b>" . round($maxgraph / 2). "</b></font>";
 647          echo "</td></tr>";
 648          echo "<tr><td height=25 valign='middle'>";
 649          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(3 * ($maxgraph / 8)). "</font>";
 650          echo "</td></tr>";
 651          echo "<tr><td height=25 valign='middle'>";
 652          echo "<font face='arial,helvetica,sans-serif' size=1>" . round($maxgraph / 4). "</font>";
 653          echo "</td></tr>";
 654          echo "<tr><td height=25 valign='middle'>";
 655          echo "<font face='arial,helvetica,sans-serif' size=1 color='#999999'>" . round(1 * ($maxgraph / 8)). "</font>";
 656          echo "</td></tr>";
 657          echo "<tr><td height=10 valign='bottom'>";
 658          echo "<font face='arial,helvetica,sans-serif' size=1><b>0</b></font>";
 659          echo "</td>";
 660          echo "</tr></table>";
 661          echo "</td></tr></table>";
 662          echo "</div>";
 663      }
 664  
 665      /////
 666  
 667      fin_cadre_relief();
 668  }
 669  
 670  //
 671  // Affichage des referers
 672  //
 673  if (lire_meta("activer_statistiques_ref") != "non") {
 674  
 675      // nombre de referers a afficher
 676      $limit = intval($limit); //secu
 677  
 678      if ($limit == 0)
 679          $limit = 100;
 680  
 681      // afficher quels referers ?
 682      $vis = "visites";
 683  
 684      if ($origine) {
 685          $where = "visites_jour>0";
 686          $vis = "visites_jour";
 687          $table_ref = $GLOBALS['table_prefix']. "_referers";
 688      }
 689  
 690      //Modification fxlacroix@clever-age.com (degueulasse)
 691      if ($where == 1)
 692          $where = "1=1";
 693  
 694      $query = "SELECT referer, $vis AS vis FROM $table_ref WHERE $where ORDER BY $vis DESC";
 695      //Fin modification
 696      //die($where);
 697  
 698      echo "<br><br><br>";
 699      gros_titre (_T("onglet_origine_visites"));
 700  
 701      echo "<p><font face='Verdana,Arial,Sans,sans-serif' size=2>";
 702      echo aff_referers($query, $limit);
 703      echo "</font></p>";
 704  }
 705  
 706  echo "</font>";
 707  
 708  fin_page();
 709  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7