1 |
aurelien |
1 |
<script language="javascript">
|
|
|
2 |
function gotoEtape (numetape) {
|
|
|
3 |
document.navigation.etape.value=numetape;
|
|
|
4 |
document.navigation.submit();
|
|
|
5 |
}
|
|
|
6 |
</script>
|
|
|
7 |
|
|
|
8 |
<?
|
|
|
9 |
|
|
|
10 |
$CHEMIN_DOCS = "uploaddocs";
|
|
|
11 |
$URL_DOCS = "http://www.obs-saisons.fr/uploaddocs";
|
|
|
12 |
|
|
|
13 |
/*$URL_PROTOS = "http://shiva/depot/protocoles/";
|
|
|
14 |
$URL_IDENT = "http://shiva/depot/identifications/";
|
|
|
15 |
$URL_PHOTOS = "file:///home/fiastre/depot/photos/";
|
|
|
16 |
*/$CHEMIN_PROTOS = "$CHEMIN_DOCS/protocoles/";
|
|
|
17 |
$CHEMIN_IDENT = "$CHEMIN_DOCS/identifications/";
|
|
|
18 |
$CHEMIN_ESPECE = "$CHEMIN_DOCS/especes/";
|
|
|
19 |
$CHEMIN_PHOTOS = "$CHEMIN_DOCS/photos/";
|
|
|
20 |
$URL_PROTOS = "$URL_DOCS/protocoles/";
|
|
|
21 |
$URL_IDENT = "$URL_DOCS/identifications/";
|
|
|
22 |
$URL_ESPECE = "$URL_DOCS/especes/";
|
|
|
23 |
$URL_PHOTOS = "$URL_DOCS/photos/";
|
|
|
24 |
|
|
|
25 |
function etape($nom_etape,$num_etape) {
|
|
|
26 |
global $url_page;
|
|
|
27 |
return"<a href='javascript:gotoEtape($num_etape);'>$nom_etape</a>";
|
|
|
28 |
}
|
|
|
29 |
function afficherErreurs($tab_erreurs) {
|
|
|
30 |
if (sizeof($tab_erreurs)>0) {
|
|
|
31 |
echo "<div class='erreurs'>";
|
|
|
32 |
foreach ($tab_erreurs as $err)
|
|
|
33 |
echo $err."<br>";
|
|
|
34 |
echo "</div><br>";
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
$erreurs = array();
|
|
|
40 |
|
|
|
41 |
include("connect.php");
|
|
|
42 |
include("messages.php");
|
|
|
43 |
|
|
|
44 |
$choixCommune = false;
|
|
|
45 |
|
|
|
46 |
$nbEtapes = 3;
|
|
|
47 |
|
|
|
48 |
if (isset($_POST['etape']))
|
|
|
49 |
$etape = $_POST['etape'];
|
|
|
50 |
else if (isset($_GET['etape']))
|
|
|
51 |
$etape = $_GET['etape'];
|
|
|
52 |
else
|
|
|
53 |
$etape = 1;
|
|
|
54 |
|
|
|
55 |
echo "<form name='navigation' method='post' action='$url_page'><input type='hidden' name='etape'></form>";
|
|
|
56 |
|
|
|
57 |
if ($etape==1) {
|
|
|
58 |
if (!isset($_POST['valid_typesp'])) {
|
|
|
59 |
include("observations/type_espece.php");
|
|
|
60 |
}
|
|
|
61 |
else {
|
|
|
62 |
$requete_comm = mysql_query("select CARACTERISTIQUE_ESP_VALEUR_LIB from CARACTERISTIQUE_ESP_VALEUR where CARACTERISTIQUE_ESP_VALEUR_ID=".$_POST['typespece']);
|
|
|
63 |
$comm_ligne = mysql_fetch_row($requete_comm);
|
|
|
64 |
$_SESSION['observation']['type_espece_id'] = $_POST['typespece'];
|
|
|
65 |
$_SESSION['observation']['type_espece'] = $comm_ligne[0];
|
|
|
66 |
$etape++;
|
|
|
67 |
}
|
|
|
68 |
}
|
|
|
69 |
if ($etape >1)
|
|
|
70 |
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>";
|
|
|
71 |
if ($etape==2) {
|
|
|
72 |
/* if (!isset($_POST['valid_espece']) || sizeof($erreurs)>0) {
|
|
|
73 |
echo "<div class='recap'>";
|
|
|
74 |
echo "Type d'espèce à observer : ".etape($_SESSION['observation']['type_espece'],1)."<br>";
|
|
|
75 |
echo "</div><br>";
|
|
|
76 |
$multiple = true;
|
|
|
77 |
include("observations/espece.php");
|
|
|
78 |
}
|
|
|
79 |
else {
|
|
|
80 |
foreach ($_POST['espece'] as $e => $esp)
|
|
|
81 |
if (is_numeric($e))
|
|
|
82 |
$especes[] = $esp;
|
|
|
83 |
|
|
|
84 |
unset($_SESSION['observation']['especes']);
|
|
|
85 |
$requete_comm = mysql_query("select ESPECE_ID, ESPECE_NOM_VERNACULAIRE, ESPECE_DESCRIPTION, ESPECE_CLIMAT from ESPECE order by ESPECE_NOM_VERNACULAIRE");//where ESPECE_ID in (".implode(",",$especes).")");
|
|
|
86 |
|
|
|
87 |
while ($comm_ligne = mysql_fetch_row($requete_comm)) {
|
|
|
88 |
$_SESSION['observation']['especes'][$comm_ligne[0]] = array($comm_ligne[1], $comm_ligne[2],$comm_ligne[3]);
|
|
|
89 |
}
|
|
|
90 |
$etape++;
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
if ($etape==3) {*/
|
|
|
94 |
if (!isset($_POST['valid_saisie']) || sizeof($erreurs)>0) {
|
|
|
95 |
echo "<div class='recap'>";
|
|
|
96 |
echo "Type d'espèce à observer: ".etape($_SESSION['observation']['type_espece'],1)."<br>";
|
|
|
97 |
/* echo "Espèce(s) à observer : ";
|
|
|
98 |
foreach ($_SESSION['observation']['especes'] as $esp)
|
|
|
99 |
$especesrecap = $esp[0]." ";
|
|
|
100 |
echo etape($especesrecap,2);
|
|
|
101 |
echo "<br>";
|
|
|
102 |
*/ echo "</div><br>";
|
|
|
103 |
|
|
|
104 |
unset($_SESSION['observation']['especes']);
|
|
|
105 |
$requete_comm = mysql_query("select ESPECE.ESPECE_ID, ESPECE_NOM_VERNACULAIRE, ESPECE_DESCRIPTION, ESPECE_CLIMAT from ESPECE,CARACTERISTIQUE_ESP_LIEN where CARACTERISTIQUE_ESP_ID=1 and CARACTERISTIQUE_ESP_VALEUR_ID=".$_SESSION['observation']['type_espece_id']." and ESPECE.ESPECE_ID=CARACTERISTIQUE_ESP_LIEN.ESPECE_ID and ESPECE_ACTIVE=1 order by ESPECE_NOM_VERNACULAIRE");
|
|
|
106 |
while ($comm_ligne = mysql_fetch_row($requete_comm)) {
|
|
|
107 |
$_SESSION['observation']['especes'][$comm_ligne[0]] = array($comm_ligne[1], $comm_ligne[2],$comm_ligne[3]);
|
|
|
108 |
$id_espece_associe=$comm_ligne[0];
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
// Recherche du nombre d'evenement associe au type d'espece (on suppose qu'il est identique a celui associe a une espece appartenant a ce type d 'espece
|
|
|
112 |
$evenements_nombre=0;
|
|
|
113 |
$requete_nb_evenement= mysql_query("select count(*) FROM ESPECE_EVENEMENT where ESPECE_ID=".$id_espece_associe);
|
|
|
114 |
while ($evn = mysql_fetch_row($requete_nb_evenement)) {
|
|
|
115 |
$evenements_nombre = $evn[0];
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
echo "<table class='spip'>";
|
|
|
119 |
|
|
|
120 |
if ($evenements_nombre==1) {
|
|
|
121 |
echo "<tr class='row_even' style='font-weight: bold; font-size: 11px;'><td>Nom</td><td>Climat</td><td>Identifier l'espèce</td><td> </td><td>Fiche d'observation</td><td> </td></tr>";
|
|
|
122 |
}
|
|
|
123 |
else {
|
|
|
124 |
echo "<tr class='row_even' style='font-weight: bold; font-size: 11px;'><td>Nom</td><td>Climat</td><td>Identifier l'espèce</td><td>Identifier les stades phénologiques</td><td>Fiche d'observation</td><td> </td></tr>";
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
//recherche des fichiers de protocoles
|
|
|
128 |
$styleligne = array("odd","even");
|
|
|
129 |
$l = 0;
|
|
|
130 |
foreach ($_SESSION['observation']['especes'] as $id_esp => $espece) {
|
|
|
131 |
echo "<tr class='row_".$styleligne[$l]."'><td>";
|
|
|
132 |
if ($espece[1]) {
|
|
|
133 |
$liendescr = "<a target='_blank' href='".$espece[1]."'>";
|
|
|
134 |
$finliendescr = "</a>";
|
|
|
135 |
}
|
|
|
136 |
echo $liendescr.$espece[0].$finliendescr."</td><td>".$espece[2]."</td>";
|
|
|
137 |
if (file_exists($CHEMIN_ESPECE.$id_esp.".pdf")) {
|
|
|
138 |
echo "<td style='text-align: center;'><a href='".$URL_ESPECE.$id_esp.".pdf'><img src='IMG/icones/pdf-dist.png' border='0' height='30'></a></td>";
|
|
|
139 |
} else
|
|
|
140 |
echo "<td></td>";
|
|
|
141 |
if (file_exists($CHEMIN_IDENT.$id_esp.".pdf")) {
|
|
|
142 |
echo "<td style='text-align: center;'><a href='".$URL_IDENT.$id_esp.".pdf'><img src='IMG/icones/pdf-dist.png' border='0' height='30'></a></td>";
|
|
|
143 |
} else
|
|
|
144 |
echo "<td></td>";
|
|
|
145 |
if (file_exists($CHEMIN_PROTOS.$id_esp.".pdf")) {
|
|
|
146 |
echo "<td style='text-align: center;'><a href='".$URL_PROTOS.$id_esp.".pdf'><img src='IMG/icones/pdf-dist.png' border='0' height='30'></a></td>";
|
|
|
147 |
} else
|
|
|
148 |
echo "<td></td>";
|
|
|
149 |
if (file_exists($CHEMIN_PHOTOS.$id_esp.".jpeg")) {
|
|
|
150 |
echo "<td style='text-align: center;'><img src='".$URL_PHOTOS.$id_esp.".jpeg'></td>";
|
|
|
151 |
} else
|
|
|
152 |
echo "<td></td>";
|
|
|
153 |
echo "</tr>";
|
|
|
154 |
$l++;
|
|
|
155 |
if ($l==2)
|
|
|
156 |
$l=0;
|
|
|
157 |
}
|
|
|
158 |
echo "</table>";
|
|
|
159 |
//affichage des fichiers de protocoles
|
|
|
160 |
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
|
|
|
166 |
?>
|