3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2019 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined("_ECRIRE_INC_VERSION")) {
17 include_spip('inc/presentation');
19 // https://code.spip.net/@statistiques_lang_ok
20 function affiche_stats_lang($critere) {
21 global $spip_lang_right;
25 // Statistiques par langue
29 $r = sql_fetsel("SUM($critere) AS total_visites", "spip_articles");
33 if ($r and $r['total_visites'] > 0) {
34 $total_visites = $r['total_visites'];
39 $result = sql_select("lang, SUM(" . $critere . ") AS cnt", "spip_articles", "statut='publie' ", "lang");
41 $out .= "\n<table cellpadding='2' cellspacing='0' border='0' width='100%' style='border: 1px solid #aaaaaa;'>";
45 while ($row = sql_fetch($result)) {
49 $visites = round($row['cnt'] / $total_visites * $taille);
50 $pourcent = round($row['cnt'] / $total_visites * 100);
63 $out .= "\n<tr style='background-color: $couleur'>";
64 $dir = lang_dir($lang, '', ' dir="rtl"');
65 $out .= "<td style='width: 100%; border-bottom: 1px solid #cccccc;'><p $dir><span style='float: $spip_lang_right;'>$pourcent%</span>" . traduire_nom_langue($lang) . "</p></td>";
67 $out .= "<td style='border-bottom: 1px solid #cccccc;'>";
68 $out .= "\n<table cellpadding='0' cellspacing='0' border='0' width='" . ($taille +
5) . "'>";
69 $out .= "\n<tr><td style='align:$spip_lang_right; background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>";
70 if ($visites_abs > 0) {
71 $out .= "<img src='" . chemin_image('rien.gif') . "' width='$visites_abs' height='10' alt=' ' />";
74 $out .= "<img src='" . chemin_image('rien.gif') . "' class='couleur_langue' style='border: 0px;' width='$visites' height='8' alt=' ' />";
76 $out .= "</td></tr></table>\n";
80 $visites_abs +
= $visites;