X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=www%2Fplugins-dist%2Fstatistiques%2Fprive%2Fsquelettes%2Fcontenu%2Fstats_repartition_fonctions.php;h=7af6213c19256103f285e889b5a90d0d0e8d7335;hb=4f443dce95ff6f8221c189880a70c74ce1c1f238;hp=a239ff9ee40514fc780975451582a7e4c603c8e1;hpb=4a628e9b277d3617535f99d663ca79fa2e891177;p=lhc%2Fweb%2Fwww.git
diff --git a/www/plugins-dist/statistiques/prive/squelettes/contenu/stats_repartition_fonctions.php b/www/plugins-dist/statistiques/prive/squelettes/contenu/stats_repartition_fonctions.php
index a239ff9e..7af6213c 100644
--- a/www/plugins-dist/statistiques/prive/squelettes/contenu/stats_repartition_fonctions.php
+++ b/www/plugins-dist/statistiques/prive/squelettes/contenu/stats_repartition_fonctions.php
@@ -10,118 +10,135 @@
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/
-if (!defined("_ECRIRE_INC_VERSION")) return;
+if (!defined("_ECRIRE_INC_VERSION")) {
+ return;
+}
include_spip('inc/presentation');
// https://code.spip.net/@enfants
-function enfants($id_parent, $critere, &$nombre_branche, &$nombre_rub){
- $result = sql_select("id_rubrique", "spip_rubriques", "id_parent=".intval($id_parent));
+function enfants($id_parent, $critere, &$nombre_branche, &$nombre_rub) {
+ $result = sql_select("id_rubrique", "spip_rubriques", "id_parent=" . intval($id_parent));
$nombre = 0;
- while($row = sql_fetch($result)) {
+ while ($row = sql_fetch($result)) {
$id_rubrique = $row['id_rubrique'];
- $visites = intval(sql_getfetsel("SUM(".$critere.")", "spip_articles", "id_rubrique=".intval($id_rubrique)));
+ $visites = intval(sql_getfetsel("SUM(" . $critere . ")", "spip_articles", "id_rubrique=" . intval($id_rubrique)));
$nombre_rub[$id_rubrique] = $visites;
$nombre_branche[$id_rubrique] = $visites;
$nombre += $visites + enfants($id_rubrique, $critere, $nombre_branche, $nombre_rub);
}
- if (!isset($nombre_branche[$id_parent])) $nombre_branche[$id_parent]=0;
+ if (!isset($nombre_branche[$id_parent])) {
+ $nombre_branche[$id_parent] = 0;
+ }
$nombre_branche[$id_parent] += $nombre;
+
return $nombre;
}
// https://code.spip.net/@enfants_aff
-function enfants_aff($id_parent,$decalage, $taille, $critere, $gauche=0) {
+function enfants_aff($id_parent, $decalage, $taille, $critere, $gauche = 0) {
global $spip_lang_right, $spip_lang_left;
- static $total_site=null;
- static $niveau=0;
+ static $total_site = null;
+ static $niveau = 0;
static $nombre_branche;
static $nombre_rub;
- if (is_null($total_site)){
+ if (is_null($total_site)) {
$nombre_branche = array();
$nombre_rub = array();
$total_site = enfants(0, $critere, $nombre_branche, $nombre_rub);
- if ($total_site<1) $total_site=1;
+ if ($total_site < 1) {
+ $total_site = 1;
+ }
}
$visites_abs = 0;
$out = "";
- $width = intval(floor(($nombre_branche[$id_parent]/$total_site)*$taille));
+ $width = intval(floor(($nombre_branche[$id_parent] / $total_site) * $taille));
$width = "width:{$width}px;float:$spip_lang_left;";
- $result = sql_select("id_rubrique, titre, descriptif", "spip_rubriques", "id_parent=$id_parent",'', '0+titre,titre');
+ $result = sql_select("id_rubrique, titre, descriptif", "spip_rubriques", "id_parent=$id_parent", '', '0+titre,titre');
- while($row = sql_fetch($result)){
+ while ($row = sql_fetch($result)) {
$id_rubrique = $row['id_rubrique'];
$titre = typo($row['titre']);
- $descriptif = attribut_html(couper(typo($row['descriptif']),80));
+ $descriptif = attribut_html(couper(typo($row['descriptif']), 80));
- if ($nombre_branche[$id_rubrique]>0 OR $nombre_rub[$id_rubrique]>0){
+ if ($nombre_branche[$id_rubrique] > 0 or $nombre_rub[$id_rubrique] > 0) {
$largeur_branche = floor(($nombre_branche[$id_rubrique] - $nombre_rub[$id_rubrique]) * $taille / $total_site);
$largeur_rub = floor($nombre_rub[$id_rubrique] * $taille / $total_site);
-
- if ($largeur_branche+$largeur_rub>0){
-
- if ($niveau == 0) {
- $couleur="#cccccc";
- }
- else if ($niveau == 1) {
- $couleur="#eeeeee";
- }
- else {
- $couleur="white";
+ if ($largeur_branche + $largeur_rub > 0) {
+
+ if ($niveau == 0) {
+ $couleur = "#cccccc";
+ } else {
+ if ($niveau == 1) {
+ $couleur = "#eeeeee";
+ } else {
+ $couleur = "white";
+ }
}
$out .= "
";
$out .= "\n";
- $out .= "\n";
+ $out .= "\n | ";
-
- if ( $largeur_branche > 2)
- $out .= bouton_block_depliable("$titre","incertain", "stats$id_rubrique");
- else
+
+ if ($largeur_branche > 2) {
+ $out .= bouton_block_depliable("$titre", "incertain",
+ "stats$id_rubrique");
+ } else {
$out .= "";
+ }
$out .= " | ";
-
+
// pourcentage de visites dans la branche par rapport au total du site
- $pourcent = round($nombre_branche[$id_rubrique]/$total_site*1000)/10;
+ $pourcent = round($nombre_branche[$id_rubrique] / $total_site * 1000) / 10;
$out .= "\n$pourcent% | ";
-
- $out .= "\n";
-
-
- $out .= "\n";
+
+ $out .= "\n";
+
+
+ $out .= "\n";
$out .= "\n";
- if ($gauche > 0) $out .= " | ";
+ if ($gauche > 0) {
+ $out .= " | ";
+ }
$out .= "\n";
$out .= "";
- if ($visites_abs > 0) $out .= " ";
- if ($largeur_branche>0) $out .= " ";
- if ($largeur_rub>0) $out .= " ";
+ if ($visites_abs > 0) {
+ $out .= " ";
+ }
+ if ($largeur_branche > 0) {
+ $out .= " ";
+ }
+ if ($largeur_rub > 0) {
+ $out .= " ";
+ }
$out .= " ";
$out .= " | \n";
$out .= " | ";
- }
+ }
}
-
+
if (isset($largeur_branche) && ($largeur_branche > 0)) {
$niveau++;
- $out .= debut_block_depliable(false,"stats$id_rubrique");
- $out .= enfants_aff($id_rubrique,$largeur_branche, $taille, $critere, $visites_abs+$gauche);
+ $out .= debut_block_depliable(false, "stats$id_rubrique");
+ $out .= enfants_aff($id_rubrique, $largeur_branche, $taille, $critere, $visites_abs + $gauche);
$out .= fin_block();
$niveau--;
}
- $visites_abs = $visites_abs + round($nombre_branche[$id_rubrique]/$total_site*$taille);
+ $visites_abs = $visites_abs + round($nombre_branche[$id_rubrique] / $total_site * $taille);
}
+
return $out;
}
-
-?>
|