[ Index ] |
|
Code source de SPIP 1.9.2c |
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/@enfants 18 function enfants($id_parent, $critere){ 19 global $nombre_vis; 20 21 global $nombre_abs; 22 23 $result = spip_query("SELECT id_rubrique FROM spip_rubriques WHERE id_parent='$id_parent'"); 24 25 $nombre = 0; 26 27 while($row = spip_fetch_array($result)) { 28 $id_rubrique = $row['id_rubrique']; 29 30 $result2 = spip_query("SELECT SUM(".$critere.") AS cnt FROM spip_articles WHERE id_rubrique='$id_rubrique'"); 31 32 $visites = 0; 33 if ($row2 = spip_fetch_array($result2)) { 34 $visites = $row2['cnt']; 35 } 36 $nombre_abs[$id_rubrique] = $visites; 37 $nombre_vis[$id_rubrique] = $visites; 38 $nombre += $visites; 39 $nombre += enfants($id_rubrique, $critere); 40 } 41 $nombre_vis[$id_parent] += $nombre; 42 return $nombre; 43 } 44 45 46 // http://doc.spip.org/@enfants_aff 47 function enfants_aff($id_parent,$decalage, $critere, $gauche=0) { 48 49 global $ifond; 50 global $niveau; 51 global $nombre_vis; 52 global $nombre_abs; 53 global $couleur_claire, $couleur_foncee, $spip_lang_right, $spip_lang_left; 54 global $abs_total; 55 global $taille; 56 57 $result=spip_query("SELECT id_rubrique, titre, descriptif FROM spip_rubriques WHERE id_parent='$id_parent' ORDER BY 0+titre, titre"); 58 59 while($row = spip_fetch_array($result)){ 60 $id_rubrique = $row['id_rubrique']; 61 $titre = typo($row['titre']); 62 $descriptif = attribut_html(couper(typo($row['descriptif']),80)); 63 64 if ($nombre_vis[$id_rubrique]>0 OR $nombre_abs[$id_rubrique]>0){ 65 $largeur_rouge = floor(($nombre_vis[$id_rubrique] - $nombre_abs[$id_rubrique]) * $taille / $abs_total); 66 $largeur_vert = floor($nombre_abs[$id_rubrique] * $taille / $abs_total); 67 68 if ($largeur_rouge+$largeur_vert>0){ 69 70 if ($niveau == 0) { 71 $couleur="#cccccc"; 72 } 73 74 else if ($niveau == 1) { 75 $couleur="#eeeeee"; 76 } 77 else { 78 $couleur="white"; 79 } 80 echo "<table cellpadding='2' cellspacing='0' border='0' width='100%'>"; 81 echo "\n<tr style='background-color: $couleur'>"; 82 echo "\n<td style='border-bottom: 1px solid #aaaaaa; padding-$spip_lang_left: ".($niveau*20+5)."px;'>"; 83 if ($niveau==0 OR 1==1){ 84 $pourcent = round($nombre_vis[$id_rubrique]/$abs_total*1000)/10; 85 echo "\n<div class='verdana1' style='float: $spip_lang_right;'>$pourcent%</div>"; 86 } 87 88 if ( $largeur_rouge > 2) echo bouton_block_invisible("stats$id_rubrique"); 89 90 echo "<span class='verdana1'>"; 91 echo "<a href='" . generer_url_ecrire("naviguer","id_rubrique=$id_rubrique") . "' style='color: black;' title=\"$descriptif\">$titre</a>"; 92 93 94 echo "</span>"; 95 echo "</td>\n<td align='right' style='border-bottom: 1px solid #aaaaaa; width:" . ($taille+5) ."px'>"; 96 97 98 echo "\n<table cellpadding='0' cellspacing='0' border='0' width='".($decalage+1+$gauche)."'>"; 99 echo "\n<tr>"; 100 if ($gauche > 0) echo "<td style='width: " .$gauche."px'></td>"; 101 echo "\n<td style='background-color: #eeeeee; border: 1px solid #999999; white-space: nowrap;'>"; 102 if ($visites_abs > 0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' style='height: 8px; border: 0px; width: ".$visites_abs."px;' alt= ' '/>"; 103 if ($largeur_rouge>0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' style='background-color: $couleur_foncee; height: 8px; border: 0px; width: " . $largeur_rouge . "px;' alt=' ' />"; 104 if ($largeur_vert>0) echo "<img src='" . _DIR_IMG_PACK . "rien.gif' style='background-color: $couleur_claire; width: " . $largeur_vert ."px; height: 8px; border: 0px' alt=' ' />"; 105 106 echo "</td></tr></table>\n"; 107 echo "</td></tr></table>"; 108 } 109 } 110 111 if ($largeur_rouge > 0) { 112 $niveau++; 113 echo debut_block_invisible("stats$id_rubrique"); 114 enfants_aff($id_rubrique,$largeur_rouge, $critere, $visites_abs+$gauche); 115 echo fin_block(); 116 $niveau--; 117 } 118 $visites_abs = $visites_abs + round($nombre_vis[$id_rubrique]/$abs_total*$taille); 119 } 120 } 121 122 // http://doc.spip.org/@exec_statistiques_repartition_dist 123 function exec_statistiques_repartition_dist() 124 { 125 126 global $connect_statut, $connect_toutes_rubriques, $spip_ecran, $taille, 127 $abs_total, $nombre_vis, $critere; 128 129 $commencer_page = charger_fonction('commencer_page', 'inc'); 130 echo $commencer_page(_T('titre_page_statistiques'), "statistiques_visites", "repartition"); 131 132 if (($connect_statut != '0minirezo')|| !$connect_toutes_rubriques) { 133 echo _T('avis_non_acces_page'); 134 exit; 135 } 136 137 if ($spip_ecran == "large") { 138 $largeur_table = 974; 139 $taille = 550; 140 } else { 141 $largeur_table = 750; 142 $taille = 400; 143 } 144 145 echo "\n<br /><br /><table width='$largeur_table'><tr><td class='verdana2' style='text-align: center; width: $largeur_table" . "px;'>"; 146 gros_titre(_T('titre_page_statistiques')); 147 148 if ($critere == "debut") { 149 $critere = "visites"; 150 echo barre_onglets("stat_depuis", "debut"); 151 } 152 else { 153 $critere = "popularite"; 154 echo barre_onglets("stat_depuis", "popularite"); 155 } 156 157 $abs_total=enfants(0, $critere); 158 if ($abs_total<1) $abs_total=1; 159 $nombre_vis[0] = 0; 160 161 debut_cadre_relief("statistiques-24.gif"); 162 echo "<div style='border: 1px solid #aaaaaa;'>"; 163 enfants_aff(0,$taille, $critere); 164 echo "</div><br />", 165 "<div class='verdana3' style='text-align: left;'>", 166 _T('texte_signification'), 167 "</div>"; 168 fin_cadre_relief(); 169 170 echo "</td></tr></table>"; 171 172 echo fin_page(); 173 } 174 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 10:20:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |