[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/exec/ -> statistiques_lang.php (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2007                                                *
   7   *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
   8   *                                                                         *
   9   *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
  10   *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
  11  \***************************************************************************/
  12  
  13  if (!defined("_ECRIRE_INC_VERSION")) return;
  14  
  15  include_spip('inc/presentation');
  16  
  17  // http://doc.spip.org/@exec_statistiques_lang_dist
  18  function exec_statistiques_lang_dist()
  19  {
  20      global $connect_statut, $couleur_foncee, $critere, $spip_ecran, $spip_lang_right;
  21  
  22      $commencer_page = charger_fonction('commencer_page', 'inc');
  23      echo $commencer_page(_T('onglet_repartition_lang'), "statistiques_visites", "repartition-langues");
  24  
  25      if ($spip_ecran == "large") {
  26          $largeur_table = 974;
  27      } else {
  28          $largeur_table = 750;
  29      }
  30      $taille = $largeur_table - 200;    
  31      echo "<table align='center' width='$largeur_table'><tr><td style='width: $largeur_table" . "px; text-align:center;' class='verdana2'>";
  32      echo "<br /><br />";
  33  
  34      gros_titre(_T('onglet_repartition_lang'));
  35  
  36  //barre_onglets("repartition", "langues");
  37  
  38      if ($critere == "debut") {
  39          $critere = "visites";
  40  //    gros_titre(_T('onglet_repartition_debut'));    
  41      } else {
  42          $critere = "popularite";
  43  //    gros_titre(_T('onglet_repartition_actuelle'));    
  44  }
  45  
  46      echo ($critere == "popularite") ? barre_onglets("rep_depuis", "popularite"): barre_onglets("rep_depuis", "debut");
  47  
  48  
  49      if ($connect_statut != '0minirezo') {
  50          echo _T('avis_non_acces_page');
  51          echo fin_gauche(), fin_page();
  52          exit;
  53      }
  54  
  55  //
  56  // Statistiques par langue
  57  //
  58  
  59  
  60      debut_cadre_enfonce("langues-24.gif");
  61  
  62      $result = spip_query("SELECT SUM(".$critere.") AS total_visites FROM spip_articles");
  63  
  64      $visites = 1;
  65      if ($row = spip_fetch_array($result))
  66              $total_visites = $row['total_visites'];
  67      else
  68              $total_visites = 1;
  69  
  70      $result = spip_query("SELECT lang, SUM(".$critere.") AS cnt FROM spip_articles WHERE statut='publie' GROUP BY lang");
  71          
  72      echo "\n<table cellpadding='2' cellspacing='0' border='0' width='100%' style='border: 1px solid #aaaaaa;'>";
  73      $ifond = 1;
  74          
  75      while ($row = spip_fetch_array($result)) {
  76  
  77          $lang = $row['lang'];
  78          $visites = round($row['cnt'] / $total_visites * $taille);
  79          $pourcent = round($row['cnt'] / $total_visites * 100);
  80  
  81          if ($visites > 0) {
  82  
  83                  if ($ifond==0){
  84                      $ifond=1;
  85                      $couleur="white";
  86                  }else{
  87                      $ifond=0;
  88                      $couleur="eeeeee";
  89                  }
  90      
  91                  echo "\n<tr style='background-color: $couleur'>";
  92                  $dir=lang_dir($lang,'',' dir=rtl');
  93                  echo "<td style='width: 100%; border-bottom: 1px solid #cccccc;'><span class='verdana2'$dir><span style='float: $spip_lang_right;'>$pourcent%</span>".traduire_nom_langue($lang)."</span></td>";
  94                  
  95                  echo "<td style='border-bottom: 1px solid #cccccc;'>";
  96                  echo "\n<table cellpadding='0' cellspacing='0' border='0' width='".($taille+5)."'>";
  97                  echo "\n<tr><td style='align:$spip_lang_right; background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>";
  98                  if ($visites_abs > 0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' width='$visites_abs' height='8' alt=' ' />";
  99                  if ($visites>0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' style='background-color: $couleur_foncee; border: 0px;' width='$visites' height='8' alt=' ' />";
 100                  echo "</td></tr></table>\n";
 101      
 102                  echo "</td>";
 103                  echo "</tr>";
 104                  $visites_abs += $visites;
 105          }
 106      }
 107      echo "</table>\n";
 108  
 109  
 110  //echo "<p><span class='verdana1 spip_medium'>"._T('texte_signification')."</span>";
 111  
 112      fin_cadre_enfonce();
 113  
 114      echo "</td></tr></table>";
 115      echo fin_page();
 116  }
 117  ?>


Généré le : Wed Nov 21 10:20:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics