| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
|
3 |
include ("../../../../api/jpgraph_1.12.2/jpgraph.php") ;
|
| 4 |
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
|
4 |
include ("../../../../api/jpgraph_1.12.2/jpgraph_line.php") ;
|
| 5 |
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
|
5 |
include ("../../../../api/jpgraph_1.12.2/jpgraph_bar.php");
|
| 6 |
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
|
- |
|
| 7 |
include_once 'DB.php' ;
|
- |
|
| 8 |
$month=array(
|
- |
|
| Line -... |
Line 6... |
| - |
|
6 |
include ("../../../../papyrus/configuration/pap_config.inc.php") ;
|
| 9 |
"Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
7 |
|
| 10 |
|
- |
|
| 11 |
$db = DB::connect (PAP_DSN) ;
|
8 |
include_once 'DB.php' ;
|
| 12 |
|
9 |
$db = DB::connect (PAP_DSN) ;
|
| 13 |
if (DB::isError($db)) {
|
10 |
if (DB::isError($db)) {
|
| 14 |
echo 'Message Standard : ' . $db->getMessage() . "\n";
|
11 |
echo 'Message Standard : ' . $db->getMessage() . "\n";
|
| 15 |
echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
|
12 |
echo 'Message DBMS/Utilisateur : ' . $db->getUserInfo() . "\n";
|
| 16 |
echo 'Message DBMS/Déboguage : ' . $db->getDebugInfo() . "\n";
|
13 |
echo 'Message DBMS/Déboguage : ' . $db->getDebugInfo() . "\n";
|
| Line -... |
Line 14... |
| - |
|
14 |
exit;
|
| 17 |
exit;
|
15 |
}
|
| 18 |
}
|
16 |
|
| - |
|
17 |
$tab_mois = array('', "Jan","Fev","Mar","Avr","Mai","Juin","Juil","Août","Sep","Oct","Nov","Dec");
|
| 19 |
|
18 |
$tab_donnees = array(0);
|
| - |
|
19 |
$tps_debut = mktime(0,0,0,1,1);
|
| 20 |
$GraphData = array() ;
|
20 |
$tps_courrant = $tps_debut;
|
| 21 |
$currentDate = date('Y').'-01-01';// 1er janvier de l'année courrante
|
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);
|
| 22 |
$date_fin = date('Y-m-d');// jour courrant
|
27 |
//echo date('Y-m-d H:i:s', $tps_courrant).' - '.date('Y-m-d H:i:s', $tps_mois_suivant);
|
| 23 |
//Requete pour les autres semaines
|
28 |
$requete = 'SELECT IS_ACTION '.
|
| 24 |
while ($currentDate <= $date_fin) {
|
- |
|
| 25 |
$query2 = "select IS_ACTION from ins_STATS where IS_DATE>=\"$currentDate\"
|
29 |
'FROM ins_STATS '.
|
| 26 |
and IS_DATE < DATE_ADD(\"$currentDate\", INTERVAL 7 DAY)" ;
|
30 |
'WHERE IS_DATE >= "'.date('Y-m-d H:i:s', $tps_courrant).'" '.
|
| 27 |
|
31 |
'AND IS_DATE < "'.date('Y-m-d H:i:s', $tps_mois_suivant).'" ';
|
| 28 |
$result2 = $db->query($query2) ;
|
32 |
$resultat = $db->query($requete) ;
|
| 29 |
$NBR = 0 ;
|
33 |
$nbre = 0 ;
|
| 30 |
while ($row2 = $result2->fetchRow(DB_FETCHMODE_OBJECT)) {
|
34 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
|
| 31 |
if ($row2->IS_ACTION=="add") $NBR++ ;
|
35 |
if ($ligne->IS_ACTION == 'add') $nbre++ ;
|
| 32 |
if ($row2->IS_ACTION=="del") $NBR-- ;
|
- |
|
| 33 |
}
|
- |
|
| 34 |
$GraphData[$i] = $NBR + $GraphData[$i-1];
|
36 |
if ($ligne->IS_ACTION == 'del') $nbre-- ;
|
| 35 |
$i++ ;
|
- |
|
| 36 |
$query4 = "select DATE_ADD(\"$currentDate\", INTERVAL 7 DAY) as new_date" ;
|
37 |
}
|
| - |
|
38 |
$tab_donnees[$i] = $nbre + $tab_donnees[$i-1];
|
| 37 |
$result4 = $db->query ($query4) ;
|
39 |
//echo ' - '.$tab_donnees[$i-1].'<br/>';
|
| - |
|
40 |
$tps_courrant = $tps_mois_suivant;
|
| Line 38... |
Line -... |
| 38 |
$row3 = $result4->fetchRow(DB_FETCHMODE_OBJECT);
|
- |
|
| 39 |
$currentDate = $row3->new_date ;
|
- |
|
| 40 |
}
|
41 |
$i++;
|
| 41 |
|
42 |
}
|
| 42 |
$datay = array_values($GraphData) ;
|
43 |
//echo '<pre>'.print_r($tab_donnees, true).'</pre>';
|
| 43 |
|
44 |
|
| - |
|
45 |
$graph = new Graph(500,440,"auto");
|
| 44 |
$graph = new Graph(500,400,"auto");
|
46 |
$graph->img->SetMargin(50,50,30,50);
|
| 45 |
$graph->img->SetMargin(30,30,30,40);
|
- |
|
| 46 |
$graph->SetMarginColor("white");
|
- |
|
| 47 |
$graph->SetScale("int");
|
47 |
$graph->SetMarginColor("white");
|
| 48 |
$graph->SetShadow();
|
48 |
$graph->SetScale('textint');
|
| - |
|
49 |
$graph->xaxis->SetTickLabels($tab_mois);
|
| Line 49... |
Line 50... |
| 49 |
|
50 |
$graph->SetShadow();
|
| 50 |
|
51 |
$graph->title->Set("Évolution des inscriptions au Réseau");
|
| 51 |
$graph->title->Set("Évolution du nombre d'inscrits au Réseau");
|
52 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
| 52 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
- |
|
| 53 |
|
53 |
$graph->xaxis->title->Set("Mois depuis le 1er janvier ".date('Y'));
|
| Line -... |
Line 54... |
| - |
|
54 |
|
| 54 |
$graph->xaxis->title->Set("Semaines depuis le 1er janvier ".date('Y'));
|
55 |
$LinePlot = new LinePlot($tab_donnees);
|
| 55 |
$p1 = new LinePlot($datay);
|
56 |
$LinePlot->value->Show();
|
| 56 |
$p1->SetColor("brown") ;
|
57 |
$LinePlot->value->SetFormat("%s");
|