[ Index ]
 

Code source de SPIP 1.8.3

Accédez au Source d'autres logiciels libres | Soutenez Angelica Josefina !

title

Body

[fermer]

/ecrire/ -> statistiques_lang.php3 (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2005                                                *
   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  
  14  include  ("inc.php3");
  15  
  16  
  17  debut_page(_T('onglet_repartition_lang'), "suivi", "repartition-langues");
  18  
  19      if ($spip_ecran == "large") {
  20          $largeur_table = 974;
  21      } else {
  22          $largeur_table = 750;
  23      }    
  24      $taille = $largeur_table - 200;    
  25  echo "<center><table width='$largeur_table'><tr width='$largeur_table'><td width='$largeur_table' class='verdana2'>";
  26  
  27  
  28  
  29  echo "<br><br>";
  30  echo "<center>";
  31  gros_titre(_T('onglet_repartition_lang'));
  32  echo "</center>";
  33  //barre_onglets("repartition", "langues");
  34  
  35  if ($GLOBALS["critere"] == "debut") {
  36      $critere = "visites";
  37  //    gros_titre(_T('onglet_repartition_debut'));    
  38  }
  39  else {
  40      $critere = "popularite";
  41  //    gros_titre(_T('onglet_repartition_actuelle'));    
  42  }
  43  
  44  if ($critere == "popularite") barre_onglets("rep_depuis", "popularite");
  45  else barre_onglets("rep_depuis", "debut");
  46  
  47  
  48  
  49  if ($connect_statut != '0minirezo') {
  50      echo _T('avis_non_acces_page');
  51      fin_page();
  52      exit;
  53  }
  54  
  55  //
  56  // Statistiques par langue
  57  //
  58  
  59  
  60  debut_cadre_enfonce("langues-24.gif");
  61  
  62          $query = "SELECT SUM(".$critere.") AS total_visites FROM spip_articles";
  63          $result = spip_query($query);
  64          $visites = 1;
  65          if ($row = spip_fetch_array($result))
  66              $total_visites = $row['total_visites'];
  67          else
  68              $total_visites = 1;
  69          echo "<p>";
  70  
  71  
  72          $query = "SELECT lang, SUM(".$critere.") AS cnt FROM spip_articles WHERE statut='publie' GROUP BY lang";
  73          $result = spip_query($query);
  74          
  75          
  76          echo "<table cellpadding = 2 cellspacing = 0 border = 0 width='100%' style='border: 1px solid #aaaaaa;'>";
  77          $ifond = 1;
  78          
  79          while ($row = spip_fetch_array($result)) {
  80              $lang = $row['lang'];
  81              $visites = round($row['cnt'] / $total_visites * $taille);
  82              $pourcent = round($row['cnt'] / $total_visites * 100);
  83  
  84              if ($visites > 0) {
  85  
  86                  if ($ifond==0){
  87                      $ifond=1;
  88                      $couleur="white";
  89                  }else{
  90                      $ifond=0;
  91                      $couleur="eeeeee";
  92                  }
  93      
  94                  echo "<tr bgcolor='$couleur'>";
  95                  $dir=lang_dir($lang,'',' dir=rtl');
  96                  echo "<td width='100%' style='border-bottom: 1px solid #cccccc;'><span class='verdana2'$dir><div style='float: $spip_lang_right;'>$pourcent%</div>".traduire_nom_langue($lang)."</span></td>";
  97                  
  98                  echo "<td style='border-bottom: 1px solid #cccccc;'>";
  99                      echo "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH='".($taille+5)."' HEIGHT=8>";
 100                      echo "<TR><TD style='align:$spip_lang_right; background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>";
 101                      if ($visites_abs > 0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' width='$visites_abs' height='8'>";
 102                      if ($visites>0) echo "<IMG SRC='" . _DIR_IMG_PACK . "rien.gif' style='background-color: $couleur_foncee;' WIDTH='$visites' HEIGHT=8 BORDER=0>";
 103                      echo "</TD></TR></TABLE>\n";
 104      
 105                  echo "</td>";
 106                  echo "</tr>";
 107              $visites_abs += $visites;
 108              }
 109          }
 110          echo "</table>";
 111  
 112  
 113  //echo "<P><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('texte_signification')."</FONT>";
 114  
 115  
 116  fin_cadre_enfonce();
 117  
 118  
 119  
 120  echo "</td></tr></table></center>";
 121  
 122  ?>
 123  


Généré le : Thu Feb 22 22:27:47 2007 par Balluche grâce à PHPXref 0.7