1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
<html>
<head>
<title>
</title>
</head>
<body>
<img style='position:absolute;' src='img/CACB-logo-generique-couleur.png'></img>
<center><h2>Statistiques Borne Signalez-Vous</h2></center><br><br>
<br><br>
<br><br><br>
<?php
// Paramètres pour accéder à ta base MysQl
$host = "nedim-accueil.fr";
$user = "nedim_ca";
$password = "cGMP8v3QfncsGWsL";
$bdd = "ca_tb_champbourg";
// Connection à ta Base MySql
mysql_connect($host, $user, $password) or die ("impossible de se connecter au serveur" );
mysql_select_db($bdd) or die ("impossible de se connecter a la base de donnees" );
// Ta requête (ta question)
$sql = "SELECT * FROM MessageAccueil WHERE month(DateCreationMessage)=month(now()) AND year(DateCreationMessage)=year(now()) AND IDAgence = 27";
$sql2 = "SELECT DISTINCT month(DateCreationMessage) FROM MessageAccueil WHERE month(DateCreationMessage)=month(now()) AND year(DateCreationMessage)=year(now()) AND IDAgence = 27";
// Son résultat (réponse à ta qestion)
$resultat=mysql_query($sql);
$resultat2=mysql_query($sql2);
// Eventuellement le nombre de réponse à ta question
$nombre_de_reponse=mysql_num_rows($resultat);
$nombre_de_reponse2=mysql_num_rows($resultat2);
while($ligne = mysql_fetch_array($resultat2))
{
if (@$ligne["month(DateCreationMessage)"] == 1)
$janvier = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 2)
$fevrier = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 3)
$mars = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 4)
$avril = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 5)
$mai = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 6)
$juin = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 7)
$juillet = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 8)
$aout = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 9)
$septembre = $nombre_de_reponse;
$fp = fopen('file.csv', 'w');
fputcsv($fp, $nombre_de_reponse);
fclose($fp);
if (@$ligne["month(DateCreationMessage)"] == 10)
$octobre = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 11)
$novembre = $nombre_de_reponse;
if (@$ligne["month(DateCreationMessage)"] == 12)
$decembre = $nombre_de_reponse;
}
/* pChart library inclusions */
include("/class/pData.class.php");
include("/class/pDraw.class.php");
include("/class/pImage.class.php");
/* Create the pData object with some random values*/
$MyData = new pData();
$MyData->addPoints(array(@$janvier,@$fevrier,@$mars,@$avril,@$mai,@$juin,@$juillet,@$aout,@$septembre,@$octobre,@$novembre,@$decembre),"Dijon Darcy");
$MyData->addPoints(array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"),"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(1300,750,$MyData);
/* Create a solid background */
$Settings = array("R"=>255, "G"=>255, "B"=>255, "Dash"=>1, "DashR"=>199, "DashG"=>237, "DashB"=>111);
$myPicture->drawFilledRectangle(0,0,1300,750,$Settings);
/* Do a gradient overlay */
$Settings = array("StartR"=>255, "StartG"=>231, "StartB"=>255, "EndR"=>43, "EndG"=>107, "EndB"=>58, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,1300,750,DIRECTION_VERTICAL,$Settings);
$myPicture->drawGradientArea(0,0,1300,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>100));
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,1299,749,array("R"=>0,"G"=>0,"B"=>0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>"fonts/Silkscreen.ttf","FontSize"=>8));
$myPicture->drawText(10,13,"Evolution du nombre d'appels via la borne",array("R"=>255,"G"=>255,"B"=>255));
/* Draw the scale */
$myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>16));
$myPicture->setGraphArea(50,60,1270,710);
$myPicture->drawFilledRectangle(50,60,1270,730,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("CycleBackground"=>TRUE));
/* Graph title */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->drawText(50,52,"Nombre d'appels",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Draw the bar chart chart */
$myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>12));
$MyData->setSerieDrawable("Last year",FALSE);
$myPicture->drawBarChart();
$myPicture->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>4,"Surrounding"=>-80,"BorderAlpha"=>90));
/* Draw the line and plot chart */
/* Make sure all series are drawable before writing the scale */
$MyData->setSerieDrawable("This year",TRUE);
/* Write the legend */
$myPicture->drawLegend(540,35,array("Style"=>LEGEND_ROUND,"Alpha"=>20,"Mode"=>LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->Render("img/example.combo.png");
?>
<center><img src="img/example.combo.png"></img></center> |
Partager