256 |
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é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_donnees = array(0);
|
|
|
19 |
$tps_debut = mktime(0,0,0,1,1);
|
|
|
20 |
$tps_courrant = $tps_debut;
|
|
|
21 |
$tps_fin = time();// jour courrant
|
|
|
22 |
$i = 1;
|
|
|
23 |
//Requete par mois
|
|
|
24 |
while ($tps_courrant <= $tps_fin) {
|
|
|
25 |
//$tps_semaine_suivante = $tps_courrant + (7 * 24 * 60 * 60);
|
|
|
26 |
$tps_mois_suivant = mktime(0,0,0,$i+1,1);
|
|
|
27 |
//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
|
|
|
28 |
$requete = 'SELECT U_DATE '.
|
|
|
29 |
'FROM annuaire_tela '.
|
|
|
30 |
'WHERE U_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
|
|
|
31 |
'AND U_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
|
|
|
32 |
$resultat = $db->query($requete) ;
|
|
|
33 |
$tab_donnees[$i] = $tab_donnees[$i-1] + $resultat->numRows();
|
|
|
34 |
//echo ' - '.$resultat->numRows().'<br/>';
|
|
|
35 |
$tps_courrant = $tps_mois_suivant;
|
|
|
36 |
$i++;
|
|
|
37 |
}
|
|
|
38 |
//echo '<pre>'.print_r($tab_donnees, true).'</pre>';
|
|
|
39 |
|
|
|
40 |
$graph = new Graph(500,440,"auto");
|
|
|
41 |
$graph->img->SetMargin(50,50,30,50);
|
|
|
42 |
$graph->SetMarginColor("white");
|
|
|
43 |
$graph->SetScale('textint');
|
|
|
44 |
$graph->xaxis->SetTickLabels($tab_mois);
|
|
|
45 |
$graph->SetShadow();
|
|
|
46 |
$graph->title->Set("Évolution des inscrits au Réseau au ".date('d-m-Y', $tps_fin));
|
|
|
47 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
48 |
$graph->xaxis->title->Set("Mois depuis le 1er janvier ".date('Y'));
|
|
|
49 |
|
|
|
50 |
$LinePlot = new LinePlot($tab_donnees);
|
|
|
51 |
$LinePlot->value->Show();
|
|
|
52 |
$LinePlot->value->SetFormat("%s");
|
|
|
53 |
$LinePlot->SetColor("brown") ;
|
|
|
54 |
|
|
|
55 |
$graph->Add($LinePlot);
|
|
|
56 |
$graph->Stroke();
|
|
|
57 |
?>
|