Skip to content
Extraits de code Groupes Projets
Valider 54a35295 rédigé par ARNO*'s avatar ARNO*
Parcourir les fichiers

Le graphique prend en compte les jours sans entrees (espacement entre les colonnes)

parent a26a9b8c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -41,14 +41,16 @@ if ($id_article) $page = "article$id_article";
else $page = "tout";
$query="SELECT * FROM spip_visites WHERE type = '$page' ORDER BY date";
$query="SELECT UNIX_TIMESTAMP(date) AS date_unix, visites FROM spip_visites WHERE type = '$page' ORDER BY date";
$result=spip_query($query);
while ($row = mysql_fetch_array($result)) {
$date = $row['date'];
$date = $row['date_unix'];
$visites = $row['visites'];
$log[$date] = $visites;
if ($i == 0) $date_debut = $date;
$i++;
}
// Visites du jour
......@@ -64,34 +66,53 @@ $visites_today = mysql_num_rows($result);
if (count($log)>0){
$max = max(max($log),$visites_today);
$date_today = time();
$nb_jours = floor(($date_today-$date_debut)/(3600*24));
if ($max>10) $maxgraph = substr(ceil(substr($max,0,2) / 10)."000000000000", 0, strlen($max));
else $maxgraph = 10;
$rapport = 200 / $maxgraph;
if (count($log) < 365) $largeur = floor(365 / (count($log)+1));
if (count($log) < 365) $largeur = floor(365 / ($nb_jours+1));
if ($largeur < 1) $largeur = 1;
debut_cadre_relief();
echo "<table cellpadding=0 cellspacing=0 border=0><tr>";
echo "<td bgcolor='black'><img src='img_pack/rien.gif' width=1 height=1></td>";
// Presentation graphique
while (list($key, $value) = each($log)) {
//inserer des jours vides si pas d'entrees
if ($jour_prec > 0) {
$ecart = floor(($key-$jour_prec)/(3600*24)-1);
for ($i=0; $i < $ecart; $i++){
echo "<td valign='bottom' width=$largeur>";
echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
echo "</td>";
}
}
$hauteur = round($value * $rapport) - 1;
echo "<td valign='bottom' width=5>";
echo "<td valign='bottom' width=$largeur>";
if ($hauteur > 0){
echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:$couleur_claire;'>";
}
echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:black;'>";
echo "</td>";
$jour_prec = $key;
}
// Dernier jour
$hauteur = round($visites_today * $rapport) - 1;
echo "<td valign='bottom' width=5>";
echo "<td valign='bottom' width=$largeur>";
if ($hauteur > 0){
echo "<img src='img_pack/rien.gif' width=$largeur height=1 style='background-color:$couleur_foncee;'>";
echo "<img src='img_pack/rien.gif' width=$largeur height=$hauteur style='background-color:#e4e4e4;'>";
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter