[ Index ] |
|
Code source de SPIP 1.8.3 |
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('titre_page_statistiques'), "suivi", "repartition"); 18 19 if ($spip_ecran == "large") { 20 $largeur_table = 974; 21 $taille = 550; 22 } else { 23 $largeur_table = 750; 24 $taille = 400; 25 } 26 27 echo "<center><table width='$largeur_table'><tr width='$largeur_table'><td width='$largeur_table' class='verdana2'>"; 28 29 30 echo "<br><br>"; 31 echo "<center>"; 32 gros_titre(_T('titre_page_statistiques')); 33 echo "</center>"; 34 //if (lire_meta('multi_articles') == 'oui' OR lire_meta('multi_rubriques') == 'oui') 35 // barre_onglets("repartition", "rubriques"); 36 37 if ($GLOBALS["critere"] == "debut") { 38 $critere = "visites"; 39 // gros_titre(_T('onglet_repartition_debut')); 40 } 41 else { 42 $critere = "popularite"; 43 // gros_titre(_T('onglet_repartition_actuelle')); 44 } 45 46 if ($critere == "popularite") barre_onglets("stat_depuis", "popularite"); 47 else barre_onglets("stat_depuis", "debut"); 48 49 50 51 //debut_gauche(); 52 53 //debut_droite(); 54 55 if ($connect_statut != '0minirezo') { 56 echo _T('avis_non_acces_page'); 57 fin_page(); 58 exit; 59 } 60 61 // 62 // Statistiques sur le site 63 // 64 65 66 function enfants($id_parent){ 67 global $nombre_vis; 68 global $total_vis; 69 global $nombre_abs; 70 global $critere; 71 72 $query = "SELECT id_rubrique FROM spip_rubriques WHERE id_parent='$id_parent'"; 73 $result = spip_query($query); 74 $nombre = 0; 75 76 while($row = spip_fetch_array($result)) { 77 $id_rubrique = $row['id_rubrique']; 78 79 $query2 = "SELECT SUM(".$critere.") AS cnt FROM spip_articles WHERE id_rubrique='$id_rubrique'"; 80 $result2 = spip_query($query2); 81 $visites = 0; 82 if ($row2 = spip_fetch_array($result2)) { 83 $visites = $row2['cnt']; 84 } 85 $nombre_abs[$id_rubrique] = $visites; 86 $nombre_vis[$id_rubrique] = $visites; 87 $nombre += $visites; 88 $nombre += enfants($id_rubrique); 89 } 90 $nombre_vis[$id_parent] += $nombre; 91 return $nombre; 92 } 93 94 95 function enfants_aff($id_parent,$decalage, $gauche=0) { 96 global $total_vis; 97 global $ifond; 98 global $niveau; 99 global $nombre_vis; 100 global $nombre_abs; 101 global $couleur_claire, $couleur_foncee, $spip_lang_right, $spip_lang_left; 102 global $abs_total; 103 global $taille; 104 105 $query="SELECT id_rubrique, titre FROM spip_rubriques WHERE id_parent='$id_parent' ORDER BY 0+titre, titre"; 106 $result=spip_query($query); 107 108 109 while($row = spip_fetch_array($result)){ 110 $id_rubrique = $row['id_rubrique']; 111 $titre = typo($row['titre']); 112 113 if ($nombre_vis[$id_rubrique]>0 OR $nombre_abs[$id_rubrique]>0){ 114 $largeur_rouge = floor(($nombre_vis[$id_rubrique] - $nombre_abs[$id_rubrique]) * $taille / $abs_total); 115 $largeur_vert = floor($nombre_abs[$id_rubrique] * $taille / $abs_total); 116 117 if ($largeur_rouge+$largeur_vert>0){ 118 119 if ($niveau == 0) { 120 $couleur="#cccccc"; 121 } 122 123 else if ($niveau == 1) { 124 $couleur="#eeeeee"; 125 } 126 else { 127 $couleur="white"; 128 } 129 echo "<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=0 width='100%'>"; 130 echo "<TR BGCOLOR='$couleur' BACKGROUND='" . _DIR_IMG_PACK . "rien.gif' width='100%'>"; 131 echo "<TD style='border-bottom: 1px solid #aaaaaa; padding-$spip_lang_left: ".($niveau*20+5)."px;'>"; 132 if ($niveau==0 OR 1==1){ 133 $pourcent = round($nombre_vis[$id_rubrique]/$abs_total*1000)/10; 134 echo "<div class='verdana1' style='float: $spip_lang_right;'>$pourcent%</div>"; 135 } 136 137 //echo "<IMG SRC='" . _DIR_IMG_PACK . "rien.gif' WIDTH='".($niveau*20+1)."' HEIGHT=8 BORDER=0>"; 138 139 140 if ( $largeur_rouge > 2) echo bouton_block_invisible("stats$id_rubrique"); 141 142 echo "<span class='verdana1'>"; 143 echo "<A HREF='naviguer.php3?id_rubrique=$id_rubrique' style='color: black;'>$titre</A>"; 144 145 146 echo "</span>"; 147 echo "</TD><TD ALIGN='right' width='".($taille+5)."' style='border-bottom: 1px solid #aaaaaa;'>"; 148 149 150 echo "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=".($decalage+1+$gauche)." HEIGHT=8>"; 151 echo "<TR>"; 152 if ($gauche > 0) echo "<td width='".$gauche."'></td>"; 153 echo "<TD style='background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>"; 154 if ($visites_abs > 0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' width='".$visites_abs."' height=8 border=0>"; 155 if ($largeur_rouge>0) echo "<IMG SRC='" . _DIR_IMG_PACK . "rien.gif' style='background-color: $couleur_foncee;' WIDTH=$largeur_rouge HEIGHT=8 BORDER=0>"; 156 if ($largeur_vert>0) echo "<IMG SRC='" . _DIR_IMG_PACK . "rien.gif' style='background-color: $couleur_claire;' WIDTH=$largeur_vert HEIGHT=8 BORDER=0>"; 157 158 echo "</TD></TR></TABLE>\n"; 159 echo "</TD></TR></table>"; 160 } 161 } 162 163 if ($largeur_rouge > 0) { 164 $niveau++; 165 echo debut_block_invisible("stats$id_rubrique"); 166 enfants_aff($id_rubrique,$largeur_rouge, $visites_abs+$gauche); 167 echo fin_block(); 168 $niveau--; 169 } 170 $visites_abs = $visites_abs + round($nombre_vis[$id_rubrique]/$abs_total*$taille); 171 } 172 } 173 174 175 176 $abs_total=enfants(0); 177 if ($abs_total<1) $abs_total=1; 178 $nombre_vis[0] = 0; 179 180 $query = "SELECT id_rubrique FROM spip_rubriques WHERE id_parent='0'"; 181 $result = spip_query($query); 182 183 while($row = spip_fetch_array($result)) { 184 $id_rubrique = $row['id_rubrique']; 185 if ($nombre_vis[$id_rubrique] > $total_vis) $total_vis+=$nombre_vis[$id_rubrique]; 186 } 187 188 if ($total_vis<1) $total_vis=1; 189 190 debut_cadre_relief("statistiques-24.gif"); 191 echo "<div style='border: 1px solid #aaaaaa;'>"; 192 enfants_aff(0,$taille); 193 echo "</div>"; 194 195 196 197 echo "<P><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=3>"._T('texte_signification')."</FONT>"; 198 199 200 fin_cadre_relief(); 201 202 echo "</td></tr></table></center>"; 203 204 //fin_page(); 205 206 ?> 207
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Feb 22 22:27:47 2007 | par Balluche grâce à PHPXref 0.7 |