[ Index ] |
|
Code source de SPIP Agora 1.4 |
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 debut_page(_T('titre_page_statistiques'), "suivi", "repartition"); 22 23 echo "<br><br>"; 24 gros_titre (_T('titre_statistiques')); 25 barre_onglets("repartition", "langues"); 26 27 if ($GLOBALS["critere"] == "debut") { 28 $critere = "visites"; 29 gros_titre (_T('onglet_repartition_debut')); 30 } 31 else { 32 $critere = "popularite"; 33 gros_titre (_T('onglet_repartition_actuelle')); 34 } 35 36 debut_gauche(); 37 38 if ($critere == "popularite") 39 icone_horizontale(_T('icone_repartition_debut'), "statistiques_lang.php?critere=debut", "langues-24.gif", ""); 40 else 41 icone_horizontale(_T('icone_repartition_actuelle'), "statistiques_lang.php", "langues-24.gif", ""); 42 43 debut_droite(); 44 45 $authorization = &recuperer_instance_authorization('afficherStatistiqueLang', 46 $GLOBALS['connect_id_auteur'], 47 array('connect_toutes_rubriques' => $connect_toutes_rubriques)); 48 49 if (!$authorization->isAuthorizedAction()) { 50 echo _T('avis_non_acces_page'); 51 fin_page(); 52 exit; 53 } 54 55 // 56 // Statistiques sur le site 57 // 58 59 function enfants ($id_parent) { 60 global $nombre_vis; 61 global $total_vis; 62 global $nombre_abs; 63 global $critere; 64 65 $rubriqueMetier = &recueperer_instance_rubrique(); 66 $rubriques = $rubriqueMetier->getAllForParentId($id_parent); 67 68 if (PEAR::isError($rubriques)) { 69 die ($rubriques->getMessage()); 70 } 71 72 $nombre = 0; 73 74 while (list(, $rubrique) = each($rubriques)) { 75 $id_rubrique = $rubrique->getRubriqueId(); 76 $articleMetier = &recuperer_instance_article(); 77 $visites = $articleMetier->howManyXForRubriqueId($critere); 78 79 $nombre_abs[$id_rubrique] = $visites; 80 $nombre_vis[$id_rubrique] = $visites; 81 $nombre += $visites; 82 $nombre += enfants($id_rubrique); 83 } 84 $nombre_vis[$id_parent] += $nombre; 85 return $nombre; 86 } 87 88 function enfants_aff ($id_parent, $decalage) { 89 global $total_vis; 90 global $ifond; 91 global $niveau; 92 global $nombre_vis; 93 global $nombre_abs; 94 global $couleur_claire; 95 global $abs_total; 96 97 /************ Modification elebescond@clever-age.com *****************************/ 98 $rubriqueMetier = &recueperer_instance_rubrique(); 99 $rubriques = $rubriqueMetier->getAllForParentId($id_parent, 'titre'); 100 101 if (PEAR::isError($rubriques)) { 102 die ($rubriques->getMessage()); 103 } 104 105 while (list(, $rubrique) = each($rubriques)) { 106 $id_rubrique = $rubrique->getRubriqueId(); 107 $titre = $rubrique->getTitre(); 108 109 if ($nombre_vis[$id_rubrique] > 0 OR $nombre_abs[$id_rubrique] > 0) { 110 $largeur_rouge = floor(($nombre_vis[$id_rubrique] - $nombre_abs[$id_rubrique]) * 100 / $total_vis); 111 $largeur_vert = floor($nombre_abs[$id_rubrique] * 100 / $total_vis); 112 if ($largeur_rouge + $largeur_vert > 0) { 113 if ($ifond == 0) { 114 $ifond = 1; 115 $couleur = "#FFFFFF"; 116 } 117 else { 118 $ifond = 0; 119 $couleur = "$couleur_claire"; 120 } 121 122 if ($niveau == 0) { 123 $couleur = '#DDDDCC'; 124 $titre = majuscules($titre); 125 } 126 127 echo "<TR BGCOLOR='$couleur' BACKGROUND='img_pack/rien.gif'><TD WIDTH=\"100%\">"; 128 echo "<IMG SRC='img_pack/rien.gif' WIDTH='" . ($niveau * 20 + 1). "' HEIGHT=8 BORDER=0>"; 129 echo "<FONT FACE='arial,helvetica,sans-serif' SIZE=2>"; 130 echo "<A HREF='naviguer.php?coll=$id_rubrique'>$titre</A>"; 131 132 if ($niveau == 0) { 133 $pourcent = round($nombre_vis[$id_rubrique] / $abs_total * 100); 134 echo " $pourcent %"; 135 } 136 137 echo "</FONT>"; 138 echo "</TD><TD ALIGN='right'>"; 139 140 echo "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=" . ($decalage + 1). " HEIGHT=8>"; 141 echo "<TR><TD BACKGROUND='img_pack/jauge-fond.gif' ALIGN='right'>"; 142 143 if ($largeur_vert > 0) 144 echo "<IMG SRC='img_pack/jauge-vert.gif' WIDTH=$largeur_vert HEIGHT=8 BORDER=0>"; 145 146 if ($largeur_rouge > 0) 147 echo "<IMG SRC='img_pack/jauge-rouge.gif' WIDTH=$largeur_rouge HEIGHT=8 BORDER=0>"; 148 149 echo "<IMG SRC='img_pack/rien.gif' HEIGHT=8 WIDTH=1 BORDER=0>"; 150 151 echo "</TD></TR></TABLE>\n"; 152 echo "</TD></TR>"; 153 } 154 } 155 156 $niveau++; 157 enfants_aff($id_rubrique, $largeur_rouge); 158 $niveau--; 159 } 160 } 161 162 if ($total_vis < 1) 163 $total_vis = 1; 164 165 debut_cadre_enfonce ("langues-24.gif"); 166 167 $articleMetier = &recuperer_instance_article(); 168 $visites = 1; 169 $total_visites = $articleMetier->howManyX($critere); 170 171 echo "<p>"; 172 173 $articleMetier = &recuperer_instance_article(); 174 $visites = 1; 175 $rows = $articleMetier->howManyXGroupByLang($critere); 176 echo "<table cellpadding = 4 cellspacing = 0 border = 0 width='100%'>"; 177 $ifond = 1; 178 179 foreach ($rows as $row) { 180 $lang = $row['lang']; 181 182 if ($total_visites > 0) { 183 $visites = round($row['cnt'] / $total_visites * 100); 184 } 185 else { 186 $visites = 0; 187 } 188 189 if ($ifond == 0) { 190 $ifond = 1; 191 $couleur = ""; 192 } 193 else { 194 $ifond = 0; 195 $couleur = "$couleur_claire"; 196 } 197 198 echo "<tr bgcolor='$couleur'>"; 199 $dir = lang_dir($lang, '', ' dir=rtl'); 200 echo "<td width='100%'><font face='verdana,arial,helvetica' size='2'><span$dir>" . traduire_nom_langue( 201 $lang). " : $visites%</span></font></td>"; 202 203 echo "<td>"; 204 echo "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH='100' HEIGHT=8>"; 205 echo "<TR><TD BACKGROUND='img_pack/jauge-fond.gif' ALIGN='right'>"; 206 207 if ($visites > 0) 208 echo "<IMG SRC='img_pack/jauge-vert.gif' WIDTH=$visites HEIGHT=8 BORDER=0>"; 209 210 echo "<IMG SRC='img_pack/rien.gif' HEIGHT=8 WIDTH=1 BORDER=0>"; 211 echo "</TD></TR></TABLE>\n"; 212 213 echo "</td>"; 214 echo "</tr>"; 215 } 216 217 echo "</table>"; 218 219 fin_cadre_enfonce(); 220 221 fin_page(); 222 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |