mouais…
Le 26 janvier 2009 20:49, <cedric@yterium.com> a écrit :
Author: cedric@yterium.com
Date: Mon Jan 26 20:49:56 2009
New Revision: 26217Log:
"un tableau de visites en html a la place du graphique html.
A jquery flot de faire le reste !(tout cela meritera un nettoyage complementaire, du code ne servant plus)"
Added:
plugins/core/statistiques/prive/style_prive_plugin_stats.html
Modified:
plugins/core/statistiques/exec/statistiques_visites.php
plugins/core/statistiques/inc/statistiques.phpModified: plugins/core/statistiques/exec/statistiques_visites.php
— plugins/core/statistiques/exec/statistiques_visites.php (original)
+++ plugins/core/statistiques/exec/statistiques_visites.php Mon Jan 26 20:49:56 2009
@@ -22,7 +22,7 @@
$type = _request(‹ type ›);
if (!preg_match(‹ /^\w+$/ ›, $type)) $type = ‹ day ›;
$duree = intval(_request(‹ duree ›));
- if (!$duree) $duree = 105;
- if (!$duree) $duree = 1825;
$interval = intval(_request(‹ interval ›));
if (!$interval) {
if ($type == ‹ day ›)
@@ -128,19 +128,6 @@
if ($log)
$res = statistiques_tous($log, $id_article, $table, $where, $order, $serveur, $duree, $interval, $total_absolu, $val_popularite, $classement, $liste);
- $mois = statistiques_collecte_date(« SUM(visites) »,
- « FROM_UNIXTIME(UNIX_TIMESTAMP($order),‹ %Y-%m ›) »,
- $table,
- « $order > DATE_SUB(NOW(),INTERVAL 2700 DAY) »
- . ($where ? " AND $where" : ‹ ›),
- $serveur);
- if (count($mois)>1) {
- $res = «
»- . _T(‹ info_visites_par_mois ›)
- . « »
- . statistiques_par_mois($mois, ‹ ›);
- }
echo cadre_stat($res, $table, $id_article);if ($id_article) {
Modified: plugins/core/statistiques/inc/statistiques.php
— plugins/core/statistiques/inc/statistiques.php (original)
+++ plugins/core/statistiques/inc/statistiques.php Mon Jan 26 20:49:56 2009
@@ -177,34 +177,21 @@
if ($largeur > 50) $largeur = 50; elseif ($largeur < 1) $largeur = 1;list($moyenne,$prec, $res) = stat_log1($log, $agreg, $date_fin, $largeur, $rapport, $interval, $script);
- $stats = « \n » .
- « \n<td « .http_style_background(« fond-stats.gif »). »> »
- . « \n
»
- . « \n
»
+global $couleur_foncee,$couleur_claire;
- $stats =
- «
»
» . http_img_rien(1, 200) . « - . «
»- . «
»
. $res
. (!$liste ? ‹ › : // prevision que pour les visites
statistiques_prevision($id_article, $largeur, $moyenne, $rapport, $popularite, $last))»
- . « \n
- . «
»
»._T(‹ date ›).« »._T(‹ info_visites ›).« »._T(‹ info_moyenne ›).« »._T(‹ info_total ›).« » - . http_img_rien(1, 1) .«
- . "\n<td "
- . http_style_background(« fond-stats.gif »)." valign=‹ bottom ›>"
- . http_img_rien(3, 1, ‹ trait_bas ›) .« »
- . « \n » . http_img_rien(5, 1) .« »
- . « \n »
- . statistiques_echelle($maxgraph)
- . « »
- . « »;
- . « »
- . « »;
$total = « » . _T(‹ info_total ›) ." " . $total.« »;
if ($liste) {
$liste = statistiques_classement($id_article, $classement, $liste);
- $legend = statistiques_nom_des_mois($date_debut, $date_fin, $largeur, $interval,$agreg)
- . « »
- . _T(‹ texte_statistiques_visites ›)
- . «
»;
$resume = statistiques_resume($max, $moyenne, $last, $prec, $popularite);
} else {
$legend = «
» .
@@ -216,7 +203,7 @@
}$legend .=
- « »
- «
»
. $resume
. « \n »;
- $moyenne = round(statistiques_moyenne($evol),2);
- $res .= statistiques_jour($date_prec+$i, 0, $moyenne, $cumul, $script);
- if (date(‹ m ›,$date_prec+$i+$interval)!=date(‹ m ›,$date_prec+$i)){
- $res .= statistiques_jour(affdate_mois_annee(date(‹ Y-m-d ›,$date_prec+$i)), « », « », $cumul, $script);
- $cumul = 0;
- }
}
}- $cumul += $value;
$moyenne = round(statistiques_moyenne($evol),2);\n »;
- $hauteur = round($value * $rapport) - 1;
- $m = ($hauteur <= 0) ? ‹ › : statistiques_jour($key, $value, $largeur, $moyenne, $hauteur, $rapport, (date(« w »,$key) == « 0 »), $script);
- $res .= « \n
- $res .= statistiques_jour($key, $value, $moyenne, $cumul, $script);
- if (date(‹ m ›,$key+$interval)!=date(‹ m ›,$key)){
- $res .= statistiques_jour(affdate_mois_annee(date(‹ Y-m-d ›,$key)), « », « », $cumul, $script);
- $cumul = 0;
- }
$date_prec = $key;
$val_prec = $value;
}
@@ -359,34 +353,19 @@
return attribut_html(supprimer_tags($title));
}-// http://doc.spip.org/@statistiques_vides
-function statistiques_vides($prec, $largeur, $rapport, $moyenne, $script)
-{
- $hauteur_moyenne = round($moyenne*$rapport)-1;
- $title = statistiques_href($prec, $moyenne, $script);
- $tagtitle = $script ? ‹ › : $title;
- if ($hauteur_moyenne > 1) {
- $res = http_img_rien($largeur,1, ‹ trait_moyen ›, $tagtitle)
- . http_img_rien($largeur, $hauteur_moyenne, ‹ ›, $tagtitle);
- } else $res = ‹ ›;
- $res .= http_img_rien($largeur,1,‹ trait_bas ›, $tagtitle);
- if (!$script) return $res;
- return « $res »;
-}// http://doc.spip.org/@statistiques_prevision
function statistiques_prevision($id_article, $largeur, $moyenne, $rapport, $val_popularite, $visites_today)
{
- $hauteur = round($visites_today * $rapport) - 1;
// $total_absolu = $total_absolu + $visites_today;
// prevision de visites jusqu’a minuit
// basee sur la moyenne (site) ou popularite (article)
if (! $id_article) $val_popularite = $moyenne;
$prevision = (1 - (date(« H »)60 + date(« i »))/(2460)) * $val_popularite;- $hauteurprevision = ceil($prevision * $rapport);
- $prevision = (round($prevision,0)+$visites_today);
- /*
// preparer le texte de survol (prevision)
- $tagtitle= attribut_html(supprimer_tags(_T(‹ info_aujourdhui ›)." $visites_today → ".(round($prevision,0)+$visites_today)));
- $tagtitle= attribut_html(supprimer_tags(_T(‹ info_aujourdhui ›)." $visites_today → $prevision"));
$res .= « \n
»;
- */
- return $res;
- return statistiques_jour(_T(‹ info_aujourdhui ›),« $visites_today($prevision) »,« »,« »,« »);
}// Dimanche en couleur foncee
// http://doc.spip.org/@statistiques_jour
-function statistiques_jour($key, $value, $largeur, $moyenne, $hauteur, $rapport, $dimanche, $script)
+function statistiques_jour($key, $value, $moyenne, $cumul, $script)
{
- $hauteur_moyenne = round($moyenne * $rapport) - 1;
»
- if (is_int($key)){
- $couleur = « couleur_ ». date(« l »,$key);
- $res = «
- . «
»;- }
- else {
- if (strlen($value))
- $couleur = « couleur_ ». date(« l »)." couleur_today";
- else
- $couleur = « couleur_recap »;
- $res = «
»- . «
»;- }
- $res .= «
»- . «
»- . «
»- ."
";- /*
$title= statistiques_href($key, $moyenne, $script, $value);
$tagtitle = $script ? ‹ › : $title;
- $couleur = $dimanche ? « couleur_dimanche » : « couleur_jour »;
- if ($hauteur_moyenne > $hauteur) {
- $difference = ($hauteur_moyenne - $hauteur) -1;
- $res = http_img_rien($largeur, 1,‹ trait_moyen ›,$tagtitle)
- . http_img_rien($largeur, $difference, ‹ ›, $tagtitle)
- . http_img_rien($largeur, 1, « trait_haut », $tagtitle)
- . http_img_rien($largeur, $hauteur, $couleur, $tagtitle);
- } else if ($hauteur_moyenne < $hauteur) {
- $difference = ($hauteur - $hauteur_moyenne) -1;
- $res = http_img_rien($largeur,1,« trait_haut », $tagtitle)
- . http_img_rien($largeur, $difference, $couleur, $tagtitle)
- . http_img_rien($largeur,1,« trait_moyen », $tagtitle)
- . http_img_rien($largeur, $hauteur_moyenne, $couleur, $tagtitle);
- } else {
- $res = http_img_rien($largeur, 1, « trait_haut », $tagtitle)
- . http_img_rien($largeur, $hauteur, $couleur, $tagtitle);
- }
if ($script)
$script .= « &date=$key »;
else {
@@ -438,9 +418,10 @@
$d = date(« d », $key);
$script = generer_url_ecrire(‹ calendrier ›,
« type=semaine&annee=$y&mois=$m&jour=$d »);
- } */
- return $res;
}
- return « $res »;
-}
// http://doc.spip.org/@statistiques_nom_des_mois
function statistiques_nom_des_mois($date_debut, $date_today, $largeur, $pas, $agreg)[… 57 lines stripped …]
Spip-zone-commit@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-zone-commit
–
PRIGENT Yohann
»
. $total
@@ -225,13 +212,13 @@$x = (!$duree) ? 1 : (420/ $duree);
$zoom = statistiques_zoom($id_article, $x, $date_premier, $date_debut, $date_fin);
- return array($zoom, $stats, $mark, $legend);
- return array($zoom, $legend, $stats );
}// http://doc.spip.org/@statistiques_resume
function statistiques_resume($max, $moyenne, $last, $prec, $popularite)
{
- return « \n
»
- return « \n
»
. _T(‹ info_maximum ›)." "
. $max . «
»
. _T(‹ info_moyenne ›)." "
@@ -332,15 +319,22 @@
if ($decal == 30) $decal = 0;
$decal ++;
$evol[$decal] = $value;
- $m = statistiques_moyenne($evol);
- $m = statistiques_vides($date_prec+$i, $largeur, $rapport, $m, $script);
- $res .= « \n
$m $m$rien »;
if ($hauteur+$hauteurprevision>0)
@@ -401,35 +380,36 @@
// et afficher la ligne de base
$res .= http_img_rien($largeur, 1, ‹ trait_bas ›)
. «» . affdate(date(‹ Y-m-d ›,$key)) . « » . $key . « » . $value . « » . $moyenne . « » . $cumul . «