Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 1

/obs_saisons/SPIP-v1-8-3/modules/graphiques/manscaleex1.php
New file
0,0 → 1,23
<?php
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
 
$ydata = array(12,17,22,19,5,15);
 
$graph = new Graph(220,200);
$graph->SetScale("textlin",3,35);
$graph->yscale->ticks->Set(7,2);
 
$graph->title->Set('Manual scale, manual ticks');
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$line = new LinePlot($ydata);
$graph->Add($line);
 
// Output graph
$graph->Stroke();
 
?>
 
 
/obs_saisons/SPIP-v1-8-3/modules/graphiques/manscaleex2.php
New file
0,0 → 1,22
<?php
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
 
$ydata = array(12,17,22,19,5,15);
 
$graph = new Graph(220,200);
$graph->SetScale("textlin",3,35);
 
$graph->title->Set('Manual scale, exact limits');
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$line = new LinePlot($ydata);
$graph->Add($line);
 
// Output graph
$graph->Stroke();
 
?>
 
 
/obs_saisons/SPIP-v1-8-3/modules/graphiques/manscaleex3.php
New file
0,0 → 1,24
<?php
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
 
$ydata = array(12,17,22,19,5,15);
 
$graph = new Graph(250,200);
$graph->SetScale("textlin",3,35);
$graph->SetTickDensity(TICKD_DENSE);
$graph->yscale->SetAutoTicks();
 
$graph->title->Set('Manual scale, auto ticks');
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$line = new LinePlot($ydata);
$graph->Add($line);
 
// Output graph
$graph->Stroke();
 
?>
 
 
/obs_saisons/SPIP-v1-8-3/modules/graphiques/manscaleex4.php
New file
0,0 → 1,23
<?php
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
 
$ydata = array(12,17,22,19,5,15);
 
$graph = new Graph(220,200);
$graph->SetScale("textlin",3,35);
$graph->yscale->SetAutoTicks();
 
$graph->title->Set('Manual scale, allow adjustment');
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$line = new LinePlot($ydata);
$graph->Add($line);
 
// Output graph
$graph->Stroke();
 
?>
 
 
/obs_saisons/SPIP-v1-8-3/modules/graphiques/index.php
New file
0,0 → 1,116
<?
$erreurs = array();
 
include("modules/connect.php");
include("modules/messages.php");
 
$nbEtapes = 5;
 
$nom_etape = $provenance."etape";
 
if (isset($_POST[$nom_etape]))
$etape = $_POST[$nom_etape];
else if (isset($_GET[$nom_etape]))
$etape = $_GET[$nom_etape];
else
$etape = 1;
 
if ($_POST[$provenance]=='1') {
echo "<script language='javascript'>
function gotoEtape (numetape) {
document.navigation.".$provenance."etape.value=numetape;
document.navigation.submit();
}
</script>
<form name='navigation' method='post' action='$url_page'><input type='hidden' name='".$provenance."etape'>
<input type='hidden' name='$provenance' value='1'></form>";
}
 
if ($etape==1 || $_POST[$provenance]!='1') {
if ($_POST[$provenance]!='1' || !isset($_POST['valid_typesp'])) {
include("modules/observations/type_espece.php");
}
else {
$requete_comm = mysql_query("select CARACTERISTIQUE_ESP_VALEUR_LIB from CARACTERISTIQUE_ESP_VALEUR where CARACTERISTIQUE_ESP_VALEUR_ID=".$_POST['typespece']);
$comm_ligne = mysql_fetch_row($requete_comm);
$_SESSION['observation']['type_espece_id'] = $_POST['typespece'];
$_SESSION['observation']['type_espece'] = $comm_ligne[0];
$etape++;
}
}
if ($_POST[$provenance]=='1') {
if ($etape >1)
echo "<div class='erreurs'>Pour revenir en arrière, n'utilisez pas le bouton \"précédent\" de votre navigateur, mais cliquez sur le nom à modifier.</div>";
if ($etape==2) {
if (!isset($_POST['valid_espece']) || sizeof($erreurs)>0) {
echo "<div class='recap'>";
echo "Type d'espèce choisi : ".etape($_SESSION['observation']['type_espece'],1)."<br>";
echo "</div><br>";
include("modules/observations/espece.php");
}
else {
$requete_comm = mysql_query("select ESPECE_NOM_VERNACULAIRE from ESPECE where ESPECE_ID=".$_POST['espece']);
$comm_ligne = mysql_fetch_row($requete_comm);
$_SESSION['observation']['espece_id'] = $_POST['espece'];
$_SESSION['observation']['espece'] = $comm_ligne[0];
$etape++;
}
}
if ($etape==3) {
if (!isset($_POST['valid_evenement']) || sizeof($erreurs)>0) {
echo "<div class='recap'>";
echo "Type d'espèce choisi : ".etape($_SESSION['observation']['type_espece'],1)."<br>";
echo "Espèce choisie : ".etape($_SESSION['observation']['espece'],2)."<br>";
echo "</div><br>";
include("modules/observations/evenement.php");
}
else {
$requete_comm = mysql_query("select EVENEMENT_NOM from EVENEMENT where EVENEMENT_ID=".$_POST['evenement']);
$comm_ligne = mysql_fetch_row($requete_comm);
$_SESSION['observation']['evenement_id'] = $_POST['evenement'];
$_SESSION['observation']['evenement'] = $comm_ligne[0];
$etape++;
}
}
if ($etape==4) {
//si on arrive à peine sur la page
if (isset($_POST['valid_station'])) {
$requete_comm = mysql_query("select STATION_NOM from STATION where STATION_ID=".$_POST['station']);
$comm_ligne = mysql_fetch_row($requete_comm);
$_SESSION['observation']['station_id'] = $_POST['station'];
$_SESSION['observation']['station'] = $comm_ligne[0];
$etape++;
}
if (!isset($_POST['valid_station']) || sizeof($erreurs)>0) {
echo "<div class='recap'>";
echo "Type d'espèce choisi : ".etape($_SESSION['observation']['type_espece'],1)."<br>";
echo "Espèce choisie : ".etape($_SESSION['observation']['espece'],2)."<br>";
echo "Evènement choisi : ".etape($_SESSION['observation']['evenement'],3)."<br>";
echo "</div><br>";
include("modules/observations/commune.php");
 
}
}
if ($etape==5) {
echo "<div class='recap'>";
echo "Type d'espèce choisi : ".etape($_SESSION['observation']['type_espece'],1)."<br>";
echo "Espèce choisie : ".etape($_SESSION['observation']['espece'],2)."<br>";
echo "Evènement choisi : ".etape($_SESSION['observation']['evenement'],3)."<br>";
echo "Commune choisie : ".etape($_SESSION['observation']['station'],4)."<br>";
echo "</div><br>";
 
if (sizeof($erreurs)>0) {
echo "<div class='erreurs'>";
foreach ($erreurs as $err)
echo $err."<br>";
echo "</div>";
} else
echo "<center><img src='modules/graphiques/gen_graph.php?esp=".$_SESSION['observation']['espece_id']."&ev=".$_SESSION['observation']['evenement_id']."&com=".$_SESSION['observation']['station_id']."'></center>";
//include ("modules/graphiques/gen_graph.php") ;
//header ("Location: modules/graphiques/gen_graph.php") ;
 
}
}
 
?>
/obs_saisons/SPIP-v1-8-3/modules/graphiques/gen_graphbon.php
New file
0,0 → 1,138
<?
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
//$jpgraph = "/home/fiastre/Desktop/jpgraph-2.1.2/src";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
//include ("$jpgraph/jpgraph_utils.inc");
/*echo "{".$_SESSION['observation']['espece_id'];
echo $_SESSION['observation']['evenement_id'];
echo $_SESSION['observation']['commune_id']."}";
*/
 
// Some data
//$ydata = array(11,3, 8,12,5 ,1,9, 13,5,7 );
include ("../connect.php");
 
$evenement_id = $_GET['ev'];
$commune_id = $_GET['com'];
$espece_id=$_GET['esp'];
 
$req_dates = mysql_query("SELECT DATE_FORMAT(MESURE_DATE,'%d%m'), DATE_FORMAT(MESURE_DATE,'%Y') as ANNEE FROM MESURE,SEQUENCE".
" where SEQUENCE.SEQUENCE_ID=MESURE.SEQUENCE_ID and".
" EVENEMENT_ID=$evenement_id and ESPECE_ID=$espece_id".
" AND MESURE_DATE!='0000-00-00'".
" and STATION_ID=$commune_id".
" order by ANNEE");
$dates = array();
$lastannee = 0;
$nbdates = 1;
while ($obs = mysql_fetch_row($req_dates)) {
$jour_crt = substr($obs[0],0,2);
$mois_crt = substr($obs[0],2,2);
$annee_crt = $obs[1];
if ($obs[1]!=$lastannee) {
//on calcule la moyenne pour la commune précédente :
if ($lastannee != 0)
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
//on initialise les variables pour la nouvelle commune
$nbdates = 1;
$lastannee=$obs[1];
$dates[$lastannee] = mktime(0,0,0,$mois_crt,$jour_crt);
} else {
$nbdates++;
$dates[$lastannee] += mktime(0,0,0,$mois_crt,$jour_crt);
}
}
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
 
if (sizeof($dates)>0) {
$dateMin = min ($dates);
$dateMax = max ($dates);
$nbDates = sizeof ($dates);
}
else {
$erreurs[] = "Il n'y a pas encore de données cette année pour cette observation.";
}
 
$jours = array();
$annees = array();
 
foreach ($dates as $annee => $date) {
$annees[] = "$annee";
$jours[] = $date;
 
}
 
//on définit les labels pour les dates
$labelsjours = array();
$nbDemiMois = 0;
while ($dateMin + $nbDemiMois*1209600 <= $dateMax) {
$labelsjours[$nbDemiMois] = date('d/m',$dateMin+$nbDemiMois*1209600);
$nbDemiMois++;
}
 
/*foreach ($labelsjours as $l)
echo $l;
 
/*list($tickPositions,$minTickPositions) =
DateScaleUtils::GetTicks($jours);
*/
$mois = $gDateLocale->GetShortMonth();
//on tente de trouver l'indice du mois de la date min
$moisMin = date('m',$dateMin);
$derniersMois = array_slice($mois,$moisMin-1);
//on prend le tableau à l'envers : dec, nov, oct, sept etc.
//l'indice où couper est : la taille du tableau moins l'indice du mois
//on réinverse le tableau et obtient au final les premiers mois
$premiersMois = array_reverse(array_slice(
array_reverse($mois),sizeof($mois)-$moisMin));
$tickLabels = array_merge($derniersMois,$premiersMois);
 
/*$tickPositions = array();
$tickLabels = array();
$tickPositions[0] = 0;
$tickLabels[0] = $dateMin;
foreach ($dates as $date) {
$tickPositions[] = $date;
$tickLabels[] = date('d/m',$date);
}*/
 
/*$annees = array('2006','2007');
$jours = array(1508,3008);
for ($i=0; $i<sizeof($annees); $i++) {
echo "année ".$annees[$i]." : ".$jours[$i].":".is_numeric($jours[$i]).",";
}
*/
 
 
// Create the graph. These two calls are always required
$graph = new Graph(600, 800,"auto");
$graph->SetScale( "textint",$dateMin,$dateMax);
$graph->yscale->ticks->Set(1209600,86400);
 
 
//$annees = array('2000','2005','2010');
$graph->xaxis->SetTickLabels($annees);
$graph->yaxis->SetTickLabels($tickLabels);
 
// Create the linear plot
$lineplot =new LinePlot($jours);
$lineplot ->SetColor("blue");
 
// Add the plot to the graph
$graph->Add( $lineplot);
 
//Un peu de forme
$graph->title->Set("Date de floraison du pommier");
$graph->img->SetMargin(80,20,20,40);
$graph->xaxis->title->Set("Année");
//$graph->yaxis->title->Set("Date observée");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$lineplot->mark->SetType(MARK_SQUARE);
 
// Display the graph
$graph->Stroke();
 
?>
/obs_saisons/SPIP-v1-8-3/modules/graphiques/gen_graph.php
New file
0,0 → 1,90
<?
$jpgraph = "../bibliotheque/jpgraph";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
 
include ("../connect.php");
 
$evenement_id = $_GET['ev'];
$commune_id = $_GET['com'];
$espece_id=$_GET['esp'];
 
$req_dates = mysql_query("SELECT DATE_FORMAT(MESURE_DATE,'%j'), DATE_FORMAT(MESURE_DATE,'%Y') as ANNEE FROM MESURE,SEQUENCE".
" where SEQUENCE.SEQUENCE_ID=MESURE.SEQUENCE_ID and".
" EVENEMENT_ID=$evenement_id and ESPECE_ID=$espece_id".
" AND MESURE_DATE!='0000-00-00'".
" and STATION_ID=$commune_id".
" order by ANNEE");
$dates = array();
$lastannee = 0;
$nbdates = 1;
while ($obs = mysql_fetch_row($req_dates)) {
$jourjulien_crt = $obs[0];
$annee_crt = $obs[1];
if ($obs[1]!=$lastannee) {
//on calcule la moyenne pour l'année précédente :
if ($lastannee != 0)
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
//on initialise les variables pour la nouvelle commune
$nbdates = 1;
$lastannee=$obs[1];
$dates[$lastannee] = $jourjulien_crt;
} else {
$nbdates++;
$dates[$lastannee] += $jourjulien_crt;
}
}
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
 
if (sizeof($dates)>0) {
$dateMin = min ($dates);
$dateMax = max ($dates);
$nbDates = sizeof ($dates);
}
else {
$erreurs[] = "Il n'y a pas encore de données cette année pour cette observation.";
}
 
$jours = array();
$annees = array();
 
foreach ($dates as $annee => $date) {
$annees[] = "$annee";
$jours[] = $date - $dateMin;
}
 
$dateMin = cal_from_jd($dateMin, CAL_GREGORIAN);
 
// Create the graph. These two calls are always required
$graph = new Graph();//600, 800,"auto");
$graph->SetScale( "intint");
 
 
//$annees = array('2000','2005','2010');
$graph->xaxis->SetTickLabels($annees);
//$graph->yaxis->SetTickLabels($tickLabels);
 
// Create the linear plot
$lineplot =new LinePlot($jours);
$lineplot ->SetColor("darkgreen");
 
// Add the plot to the graph
$graph->Add( $lineplot);
 
//Un peu de forme
$graph->SetBackgroundGradient('#ffcc55','#ffeb55',3,BGRAD_FRAME);
$graph->title->Set("Dates moyennes d'observation");
$graph->img->SetMargin(60,20,20,40);
$graph->xaxis->title->Set("Année");
$graph->yaxis->title->Set("Jours partir du ".$dateMin['day']."/".$dateMin['month']);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$lineplot->mark->SetType(MARK_SQUARE);
 
// Display the graph
$graph->Stroke();
 
?>
/obs_saisons/SPIP-v1-8-3/modules/graphiques/gen_graphexemple.php
New file
0,0 → 1,82
<?
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
include ("$jpgraph/jpgraph.php");
include ("$jpgraph/jpgraph_line.php");
 
include ("../connect.php");
 
$evenement_id = $_GET['ev'];
$commune_id = $_GET['com'];
$espece_id=$_GET['esp'];
 
$req_dates = mysql_query("SELECT DATE_FORMAT(MESURE_DATE,'%d%m'), DATE_FORMAT(MESURE_DATE,'%Y') as ANNEE FROM MESURE,SEQUENCE".
" where SEQUENCE.SEQUENCE_ID=MESURE.SEQUENCE_ID and".
" EVENEMENT_ID=$evenement_id and ESPECE_ID=$espece_id".
" AND MESURE_DATE!='0000-00-00'".
" and STATION_ID=$commune_id".
" order by ANNEE");
echo mysql_error();
$dates = array();
$lastannee = 0;
$nbdates = 1;
while ($obs = mysql_fetch_row($req_dates)) {
$jour_crt = substr($obs[0],0,2);
$mois_crt = substr($obs[0],2,2);
$annee_crt = $obs[1];
if ($obs[1]!=$lastannee) {
//on calcule la moyenne pour la commune précédente :
if ($lastannee != 0)
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
//on initialise les variables pour la nouvelle commune
$nbdates = 1;
$lastannee=$obs[1];
$dates[$lastannee] = mktime(0,0,0,$mois_crt,$jour_crt);
} else {
$nbdates++;
$dates[$lastannee] += mktime(0,0,0,$mois_crt,$jour_crt);
}
}
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
 
if (sizeof($dates)>0) {
$dateMin = min ($dates);
$dateMax = max ($dates);
$nbDates = sizeof ($dates);
}
else {
$erreurs[] = "Il n'y a pas encore de données cette année pour cette observation.";
}
 
// Some data
$ydata = array(11,3, 8,12,5 ,1,9, 13,5,7 );
 
/*foreach ($ydata as $y)
echo $y;
*/
// Create the graph. These two calls are always required
$graph = new Graph(350, 250,"auto");
$graph->SetScale( "textint");
 
$annees = array('2000','2005','2010');
$graph->xaxis->SetTickLabels($annees);
 
// Create the linear plot
$lineplot =new LinePlot($ydata);
$lineplot ->SetColor("blue");
 
// Add the plot to the graph
$graph->Add( $lineplot);
 
//Un peu de forme
$graph->title->Set("Date de floraison du pommier");
$graph->img->SetMargin(40,20,20,40);
$graph->xaxis->title->Set("Année");
$graph->yaxis->title->Set("Date observée");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$lineplot->mark->SetType(MARK_SQUARE);
 
// Display the graph
$graph->Stroke();
?>
/obs_saisons/SPIP-v1-8-3/modules/graphiques/traitement.php
New file
0,0 → 1,45
<?
include ("../connect.php");
 
$evenement_id = $_SESSION['observation']['evenement_id'];
$commune_id = $_SESSION['observation']['commune_id'];
$espece_id=$_SESSION['observation']['espece_id'];
 
$req_dates = mysql_query("SELECT DATE_FORMAT(MESURE_DATE,'%d%m'), DATE_FORMAT(MESURE_DATE,'%Y') as ANNEE FROM MESURE,SEQUENCE".
" where SEQUENCE.SEQUENCE_ID=MESURE.SEQUENCE_ID and".
" EVENEMENT_ID=$evenement_id and ESPECE_ID=$espece_id".
" AND MESURE_DATE!='0000-00-00'".
" and STATION_ID=$commune_id".
" order by ANNEE");
echo mysql_error();
$dates = array();
$lastannee = 0;
$nbdates = 1;
while ($obs = mysql_fetch_row($req_dates)) {
$jour_crt = substr($obs[0],0,2);
$mois_crt = substr($obs[0],2,2);
$annee_crt = $obs[1];
if ($obs[1]!=$lastannee) {
//on calcule la moyenne pour la commune précédente :
if ($lastannee != 0)
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
//on initialise les variables pour la nouvelle commune
$nbdates = 1;
$lastannee=$obs[1];
$dates[$lastannee] = mktime(0,0,0,$mois_crt,$jour_crt);
} else {
$nbdates++;
$dates[$lastannee] += mktime(0,0,0,$mois_crt,$jour_crt);
}
}
$dates[$lastannee] = $dates[$lastannee]/$nbdates;
 
if (sizeof($dates)>0) {
$dateMin = min ($dates);
$dateMax = max ($dates);
$nbDates = sizeof ($dates);
}
else {
$erreurs[] = "Il n'y a pas encore de données cette année pour cette observation.";
}
?>