Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
255 jpm 1
<?php
2
 
3
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
4
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
5
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
6
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
7
 
8
include_once 'DB.php' ;
9
$db = DB::connect (PAP_DSN) ;
10
if (DB::isError($db)) {
11
    echo 'Message Standard         : ' . $db->getMessage() . "\n";
12
    echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
13
    echo 'Message DBMS/D&eacute;boguage   : ' . $db->getDebugInfo() . "\n";
14
    exit;
15
}
16
 
17
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");
18
$tab_legende = array('');
19
$tab_donnees = array(0) ;
20
$annee_debut = 2002;
21
$mois = 4;
22
$annee = 2002;
23
$tps_debut = mktime(0,0,0,$mois,1,$annee);
24
$tps_courrant = $tps_debut;
25
$tps_fin = time();// jour courrant
26
//Requete par mois
27
$i = 1;
28
while  ($tps_courrant <= $tps_fin) {
29
	if (($mois)/12 > 1) {
30
		$mois = 1;
31
		$annee = $annee+1;
32
	}
33
	$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
34
	//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
35
	$requete = 	'SELECT U_DATE '.
36
				'FROM annuaire_tela '.
37
				'WHERE U_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
38
				'AND U_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
39
	$resultat = $db->query($requete) ;
40
	$tab_donnees[$i] = $tab_donnees[$i-1] + $resultat->numRows();
41
	//echo ' - '.$resultat->numRows().'<br/>';
42
	$tps_courrant = $tps_mois_suivant;
43
	$tab_legende[$i] = $tab_mois[$mois-1].' '.$annee;
44
	$mois++;
45
	$i++;
46
}
47
//echo '<pre>'.print_r($tab_donnees, true).'</pre>';
48
 
49
$graph = new Graph(500,490,"auto");
50
$graph->img->SetMargin(50,30,50,100);
51
$graph->SetMarginColor("white");
52
$graph->SetScale('textint');
53
$graph->xaxis->SetTickLabels($tab_legende);
54
$graph->xaxis->SetLabelAngle(90);
55
$graph->xaxis->SetTextLabelInterval(4);
56
$graph->SetShadow();
57
$graph->title->Set("Évolution des inscrits au Réseau au ".date('d-m-Y', $tps_fin));
58
$graph->title->SetFont(FF_FONT1,FS_BOLD);
59
 
60
$txt = new Text('Mois depuis le 1er avril 2002',270,460);
61
$graph->AddText($txt);
62
 
63
$LinePlot = new LinePlot($tab_donnees);
64
$LinePlot->SetColor("brown") ;
65
 
66
$graph->Add($LinePlot);
67
$graph->Stroke();
68
?>