Subversion Repositories Sites.tela-botanica.org

Compare Revisions

Ignore whitespace Rev 254 → Rev 255

/trunk/sites/reseau/fr/images/graph_inscrit_annee.php
File deleted
/trunk/sites/reseau/fr/images/histo_inscrit_annee.php
New file
0,0 → 1,57
<?php
 
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
 
include_once 'DB.php' ;
$db = DB::connect (PAP_DSN) ;
if (DB::isError($db)) {
echo 'Message Standard : ' . $db->getMessage() . "\n";
echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
echo 'Message DBMS/D&eacute;boguage : ' . $db->getDebugInfo() . "\n";
exit;
}
 
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");
$tab_donnees = array() ;
$tps_debut = mktime(0,0,0,1,1);
$tps_courrant = $tps_debut;
$tps_fin = time();// jour courrant
$i = 1;
//Requete par mois
while ($tps_courrant <= $tps_fin) {
//$tps_semaine_suivante = $tps_courrant + (7 * 24 * 60 * 60);
$tps_mois_suivant = mktime(0,0,0,$i+1,1);
//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
$requete = 'SELECT U_DATE '.
'FROM annuaire_tela '.
'WHERE U_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
'AND U_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
$resultat = $db->query($requete) ;
$tab_donnees[$i++] = $resultat->numRows();
//echo ' - '.$resultat->numRows().'<br/>';
$tps_courrant = $tps_mois_suivant;
}
//echo '<pre>'.print_r($tab_donnees, true).'</pre>';
$tab_donnees = array_values($tab_donnees);
 
$graph = new Graph(500,400,"auto");
$graph->img->SetMargin(30,30,30,40);
$graph->SetMarginColor("white");
$graph->SetScale('textint');
$graph->xaxis->SetTickLabels($tab_mois);
$graph->SetShadow();
$graph->title->Set("Nombre d'inscrits au Réseau au ".date('d-m-Y', $tps_fin));
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->Set("Mois depuis le 1er janvier ".date('Y'));
 
$bPlot = new BarPlot($tab_donnees);
$bPlot->value->Show();
$bPlot->value->SetFormat("%s");
$bPlot->SetColor("brown") ;
 
$graph->Add($bPlot);
$graph->Stroke();
?>
/trunk/sites/reseau/fr/images/graph_inscription_annee.php
New file
0,0 → 1,62
<?php
 
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
 
include_once 'DB.php' ;
$db = DB::connect (PAP_DSN) ;
if (DB::isError($db)) {
echo 'Message Standard : ' . $db->getMessage() . "\n";
echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
echo 'Message DBMS/D&eacute;boguage : ' . $db->getDebugInfo() . "\n";
exit;
}
 
$tab_mois = array('', "Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");
$tab_donnees = array(0);
$tps_debut = mktime(0,0,0,1,1);
$tps_courrant = $tps_debut;
$tps_fin = time();// jour courrant
$i = 1;
//Requete par mois
while ($tps_courrant <= $tps_fin) {
$tps_semaine_suivante = $tps_courrant + (7 * 24 * 60 * 60);
$tps_mois_suivant = mktime(0,0,0,$i+1,1);
//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
$requete = 'SELECT IS_ACTION '.
'FROM ins_STATS '.
'WHERE IS_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
'AND IS_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
$resultat = $db->query($requete) ;
$nbre = 0 ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
if ($ligne->IS_ACTION == 'add') $nbre++ ;
if ($ligne->IS_ACTION == 'del') $nbre-- ;
}
$tab_donnees[$i] = $nbre + $tab_donnees[$i-1];
//echo ' - '.$tab_donnees[$i-1].'<br/>';
$tps_courrant = $tps_mois_suivant;
$i++;
}
//echo '<pre>'.print_r($tab_donnees, true).'</pre>';
 
$graph = new Graph(500,440,"auto");
$graph->img->SetMargin(50,50,30,50);
$graph->SetMarginColor("white");
$graph->SetScale('textint');
$graph->xaxis->SetTickLabels($tab_mois);
$graph->SetShadow();
$graph->title->Set("Évolution des inscriptions au Réseau");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->Set("Mois depuis le 1er janvier ".date('Y'));
 
$LinePlot = new LinePlot($tab_donnees);
$LinePlot->value->Show();
$LinePlot->value->SetFormat("%s");
$LinePlot->SetColor("brown") ;
 
$graph->Add($LinePlot);
$graph->Stroke();
?>
/trunk/sites/reseau/fr/images/graph_inscrit.php
New file
0,0 → 1,68
<?php
 
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
 
include_once 'DB.php' ;
$db = DB::connect (PAP_DSN) ;
if (DB::isError($db)) {
echo 'Message Standard : ' . $db->getMessage() . "\n";
echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
echo 'Message DBMS/D&eacute;boguage : ' . $db->getDebugInfo() . "\n";
exit;
}
 
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");
$tab_legende = array('');
$tab_donnees = array(0) ;
$annee_debut = 2002;
$mois = 4;
$annee = 2002;
$tps_debut = mktime(0,0,0,$mois,1,$annee);
$tps_courrant = $tps_debut;
$tps_fin = time();// jour courrant
//Requete par mois
$i = 1;
while ($tps_courrant <= $tps_fin) {
if (($mois)/12 > 1) {
$mois = 1;
$annee = $annee+1;
}
$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
$requete = 'SELECT U_DATE '.
'FROM annuaire_tela '.
'WHERE U_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
'AND U_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
$resultat = $db->query($requete) ;
$tab_donnees[$i] = $tab_donnees[$i-1] + $resultat->numRows();
//echo ' - '.$resultat->numRows().'<br/>';
$tps_courrant = $tps_mois_suivant;
$tab_legende[$i] = $tab_mois[$mois-1].' '.$annee;
$mois++;
$i++;
}
//echo '<pre>'.print_r($tab_donnees, true).'</pre>';
 
$graph = new Graph(500,490,"auto");
$graph->img->SetMargin(50,30,50,100);
$graph->SetMarginColor("white");
$graph->SetScale('textint');
$graph->xaxis->SetTickLabels($tab_legende);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTextLabelInterval(4);
$graph->SetShadow();
$graph->title->Set("Évolution des inscrits au Réseau au ".date('d-m-Y', $tps_fin));
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$txt = new Text('Mois depuis le 1er avril 2002',270,460);
$graph->AddText($txt);
 
$LinePlot = new LinePlot($tab_donnees);
$LinePlot->SetColor("brown") ;
 
$graph->Add($LinePlot);
$graph->Stroke();
?>
/trunk/sites/reseau/fr/images/histo_inscription_annee.php
New file
0,0 → 1,77
<?php
 
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
 
include_once 'DB.php' ;
$db = DB::connect (PAP_DSN) ;
if (DB::isError($db)) {
echo 'Message Standard : ' . $db->getMessage() . "\n";
echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
echo 'Message DBMS/D&eacute;boguage : ' . $db->getDebugInfo() . "\n";
exit;
}
 
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");
$tab_donnees_add = array() ;
$tab_donnees_del = array() ;
$tps_debut = mktime(0,0,0,1,1);
$tps_courrant = $tps_debut;
$tps_fin = time();// jour courrant
$i = 0;
//Requete par mois
while ($tps_courrant <= $tps_fin) {
$tps_semaine_suivante = $tps_courrant + (7 * 24 * 60 * 60);
$tps_mois_suivant = mktime(0,0,0,$i+2,1);
//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
$requete = 'SELECT IS_ACTION '.
'FROM ins_STATS '.
'WHERE IS_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
'AND IS_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
$resultat = $db->query($requete) ;
$tab_donnees_add[$i] = 0 ;
$tab_donnees_del[$i] = 0 ;
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
if ($ligne->IS_ACTION == 'add') $tab_donnees_add[$i]++ ;
if ($ligne->IS_ACTION == 'del') $tab_donnees_del[$i]++ ;
}
//echo ' - '.$tab_donnees[$i-1].'<br/>';
$tps_courrant = $tps_mois_suivant;
$i++;
}
 
// Création du graphique
$graph = new Graph(500,400,"auto");
$graph->img->SetMargin(30,30,30,40);
$graph->SetMarginColor("white");
$graph->SetScale('textint');
$graph->xaxis->SetTickLabels($tab_mois);
$graph->SetShadow();
$graph->title->Set("Évolution des inscriptions au Réseau");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->Set("Mois depuis le 1er janvier ".date('Y'));
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.5, 0.05, 'left', 'top');
 
// Création des barres
$BarPlotAdd = new BarPlot($tab_donnees_add);
$BarPlotAdd->SetFillColor("orange");
$BarPlotAdd->value->Show();
$BarPlotAdd->value->SetFormat("%s");
$BarPlotAdd->SetLegend ('Inscription');
 
$BarPlotDel = new BarPlot($tab_donnees_del);
$BarPlotDel->SetFillColor("green");
$BarPlotDel->value->Show();
$BarPlotDel->value->SetFormat("%s");
$BarPlotDel->SetLegend ('Désinscription');
 
// Nous assemblons les barres
//$ab1plot = new AccBarPlot (array($BarPlotAdd ,$BarPlotDel));
$gbplot = new GroupBarPlot(array($BarPlotAdd, $BarPlotDel));
 
$graph->Add($gbplot);
$graph->Stroke();
?>