Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 11 | Rev 249 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 242
1
<?php
1
<?php
2
class Chorodep extends Script {
2
class Chorodep extends EfloreScript {
3
	protected $nbre_dep = 0;
3
	protected $nbre_dep = 0;
4
	private $type_donnee = '';
4
	private $type_donnee = '';
5
	protected $aso_num_nomenc = array();
5
	protected $aso_num_nomenc = array();
6
	protected $nbre_ligne = 0;
6
	protected $nbre_ligne = 0;
7
	protected $nbre_plte_presente = 0;
7
	protected $nbre_plte_presente = 0;
8
	protected $nbre_plte_a_confirmer = 0;
8
	protected $nbre_plte_a_confirmer = 0;
9
	protected $nbre_plte_douteux = 0;
9
	protected $nbre_plte_douteux = 0;
10
	protected $nbre_plte_erreur = 0;
10
	protected $nbre_plte_erreur = 0;
11
	protected $nbre_plte_disparue = 0;
11
	protected $nbre_plte_disparue = 0;
-
 
12
	protected $nbre_plte_erreur_a_confirmer = 0;
12
	protected $nc_autres_valeur_champ = 0;
13
	protected $nc_autres_valeur_champ = 0;
-
 
14
	protected $nc_nbre_plte_presente = 0;
-
 
15
	protected $nc_nbre_plte_a_confirmer = 0;
-
 
16
	protected $nc_nbre_plte_douteux = 0;
-
 
17
	protected $nc_nbre_plte_disparue = 0;
-
 
18
	protected $nc_nbre_plte_erreur = 0;
-
 
19
	protected $nc_nbre_plte_erreur_a_confirmer = 0;
-
 
20
 
13
	protected $aso_totaux_dep = array();
21
	protected $aso_totaux_dep = array();
-
 
22
	private $fichier_verif = './chorodep_verif.html';
-
 
23
 
-
 
24
	public function executer() {
-
 
25
		try {
14
 
26
			$this->initialiserProjet('chorodep');
15
 
27
 
-
 
28
			// Lancement de l'action demandée
-
 
29
			$cmd = $this->getParametre('a');
-
 
30
			switch ($cmd) {
-
 
31
 
-
 
32
				case 'chargerTous' :
-
 
33
					$this->chargerStructureSql();
-
 
34
					$this->chargerVersions();
-
 
35
					$this->chargerChorodepContributeurs();
-
 
36
					$this->chargerChorodepSources();
-
 
37
					$this->chargerChorodepOntologies();
-
 
38
					break;
-
 
39
				case 'chargerStructureSql' :
-
 
40
					$this->chargerStructureSql();
-
 
41
					break;
-
 
42
				case 'chargerVersions' :
-
 
43
					$this->chargerVersions();
-
 
44
					break;
16
	public function __construct($cmd, $parametres = array()) {
45
				case 'chargerChorodep' :
-
 
46
					$this->chargerChorodepContributeurs();
-
 
47
					$this->chargerChorodepSources();
-
 
48
					$this->chargerChorodepOntologies();
-
 
49
					break;
-
 
50
				case 'verifierDonnees' :
-
 
51
					$this->initialiserTraitement();
-
 
52
					$this->verifierDonnees();
-
 
53
					break;
-
 
54
				case 'supprimerTous' :
-
 
55
					$this->supprimerTous();
-
 
56
					break;
-
 
57
				default :
-
 
58
					throw new Exception("Erreur : la commande '$cmd' n'existe pas!");
-
 
59
			}
-
 
60
		} catch (Exception $e) {
17
		parent::__construct($cmd, $parametres);
61
			$this->traiterErreur($e->getMessage());
18
		$this->fichier_verif = './chorodep_verif.html';
62
		}
19
	}
63
	}
20
 
64
 
-
 
65
	private function chargerChorodepContributeurs() {
-
 
66
		$chemin = Config::get('chemins.chorodepContributeurs');
-
 
67
		$table = Config::get('tables.chorodepContributeurs');
21
	public function executer() {
68
		$requete = "LOAD DATA INFILE '$chemin' ".
22
		$this->bdd = new Bdd();
-
 
23
		$cmd = $this->getParametre('a');
69
						"REPLACE INTO TABLE $table ".
-
 
70
						'CHARACTER SET utf8 '.
24
		switch ($cmd) {
71
						'FIELDS '.
-
 
72
						"	TERMINATED BY '\t' ".
25
 
73
						"	ENCLOSED BY '' ".
26
			case 'verifier-donnees' :
74
						"	ESCAPED BY '\\\' ".
-
 
75
						'IGNORE 2 LINES';
-
 
76
		$this->getBdd()->requeter($requete);
-
 
77
	}
-
 
78
 
-
 
79
	private function chargerChorodepSources() {
-
 
80
		$chemin = Config::get('chemins.chorodepSources');
27
				$this->initialiserTraitement();
81
		$table = Config::get('tables.chorodepSources');
28
				$this->verifierDonnees();
82
		$requete = "LOAD DATA INFILE '$chemin' ".
-
 
83
							"REPLACE INTO TABLE $table ".
-
 
84
							'CHARACTER SET utf8 '.
29
				break;
85
							'FIELDS '.
-
 
86
							"	TERMINATED BY '\t' ".
30
 
87
							"	ENCLOSED BY '' ".
31
			default :
88
							"	ESCAPED BY '\\\' ".
-
 
89
							'IGNORE 2 LINES';
-
 
90
		$this->getBdd()->requeter($requete);
32
				echo 'Erreur : la commande "'.$cmd.'" n\'existe pas!'."\n";
91
	}
-
 
92
 
33
		}
93
	private function chargerChorodepOntologies() {
34
	}
94
		$chemin = Config::get('chemins.chorodepOntologies');
35
 
95
		$table = Config::get('tables.chorodepOntologies');
36
	private function initialiserTableaux($dep) {
96
		$requete = "LOAD DATA INFILE '$chemin' ".
37
		//$departements = new ZgFrDepartements();
97
								"REPLACE INTO TABLE $table ".
-
 
98
								'CHARACTER SET utf8 '.
38
		//$dep = $departements->get();
99
								'FIELDS '.
-
 
100
								"	TERMINATED BY '\t' ".
-
 
101
								"	ENCLOSED BY '' ".
39
		//$a = array();
102
								"	ESCAPED BY '\\\' ".
40
		foreach ($dep as $code_dep) {
103
								'IGNORE 1 LINES';
41
			if ( preg_match('/^\d{2}$/', $code_dep) ) {
104
		$this->getBdd()->requeter($requete);
42
				$this->aso_totaux_dep[$code_dep]['plte_presente'] = 0;
105
	}
43
				$this->aso_totaux_dep[$code_dep]['plte_a_confirmer'] = 0;
106
 
44
				$this->aso_totaux_dep[$code_dep]['plte_douteux'] = 0;
107
	private function chargerVersions() {
-
 
108
		$versions = explode(',', Config::get('versions'));
45
				$this->aso_totaux_dep[$code_dep]['plte_erreur'] = 0;
109
		$versionsDonnees = explode(',', Config::get('versionsDonnees'));
46
				$this->aso_totaux_dep[$code_dep]['plte_disparue'] = 0;
110
		$tableTpl = Config::get('tables.chorodepTpl');
-
 
111
		$fichierSqlTpl = Config::get('chemins.structureSqlVersionTpl');
47
				$this->aso_totaux_dep[$code_dep]['autres_valeur_champ'] = 0;
112
		$fichierTsvTpl = Config::get('chemins.chorodepTpl');
48
				$this->aso_totaux_dep[$code_dep]['nc_plte_presente'] = 0;
113
 
49
				$this->aso_totaux_dep[$code_dep]['nc_plte_a_confirmer'] = 0;
-
 
50
				$this->aso_totaux_dep[$code_dep]['nc_plte_douteux'] = 0;
114
		foreach ($versions as $id => $version) {
51
				$this->aso_totaux_dep[$code_dep]['nc_plte_erreur'] = 0;
115
			$versionDonnees = $versionsDonnees[$id];
-
 
116
 
-
 
117
			$this->chargerStructureSqlVersion($versionDonnees);
-
 
118
			$this->chargerDonneesVersion($versionDonnees, $version);
-
 
119
		}
-
 
120
	}
-
 
121
 
-
 
122
	private function chargerStructureSqlVersion($versionDonnees) {
-
 
123
		$fichierSql = sprintf($fichierSqlTpl, $versionDonnees, $versionDonnees);
-
 
124
		$contenuSql = $this->recupererContenu($fichierSql);
-
 
125
		$this->executerScripSql($contenuSql);
-
 
126
	}
-
 
127
 
-
 
128
	private function chargerDonneesVersion($versionDonnees, $version) {
-
 
129
		$fichierTsv = sprintf($fichierTsvTpl, $versionDonnees, $versionDonnees);
-
 
130
		$table = sprintf($tableTpl, $version);
-
 
131
		$champs = Config::get('chorodepChamps');
-
 
132
		$requete = "LOAD DATA INFILE '$fichierTsv' ".
-
 
133
						"REPLACE INTO TABLE $table ".
-
 
134
						'CHARACTER SET utf8 '.
-
 
135
						'FIELDS '.
-
 
136
						"	TERMINATED BY '\t' ".
-
 
137
						"	ENCLOSED BY '' ".
-
 
138
						"	ESCAPED BY '\\\' ".
52
				$this->aso_totaux_dep[$code_dep]['nc_plte_disparue'] = 0;
139
						'IGNORE 1 LINES '.
53
				$this->aso_totaux_dep[$code_dep]['nc_autres_valeur_champ'] = 0;
140
						"($champs) ";
54
			}
141
		$this->getBdd()->requeter($requete);
55
		}
142
	}
56
	}
143
 
57
	private function initialiserTraitement() {
144
	private function initialiserTraitement() {
58
		//------------------------------------------------------------------------------------------------------------//
145
		//------------------------------------------------------------------------------------------------------------//
59
		// Récupération des informations à vérifier
146
		// Récupération des informations à vérifier
-
 
147
		$table = $this->getNomTableDernierVersion();
60
		$requete = 	'SELECT * '.
148
		$requete = 	'SELECT * '.
61
					'FROM chorodep ';
149
					"FROM $table ";
62
		$taxons = $this->bdd->recupererTous($requete);
150
		$taxons = $this->getBdd()->recupererTous($requete);
63
		$tax_col = $taxons[1];
151
		$tax_col = $taxons[1];
64
		$col = array_keys($tax_col);
152
		$col = array_keys($tax_col);
65
		$this->initialiserTableaux($col);
153
		$this->initialiserTableaux($col);
66
		//------------------------------------------------------------------------------------------------------------//
154
		//------------------------------------------------------------------------------------------------------------//
67
		// Analyse des données
155
		// Analyse des données
68
		echo 'Traitement de la ligne n° :';
156
		echo 'Traitement de la ligne n° :';
69
		$i = 0;
157
		$i = 0;
70
		$j = 0;
158
		$j = 0;
71
		$aso_departements_analyses = array();
159
		$aso_departements_analyses = array();
72
		$this->nbre_ligne_avec_guillemet = 0;
160
		$this->nbre_ligne_avec_guillemet = 0;
73
		foreach ($taxons as $aso_champs) {
161
		foreach ($taxons as $aso_champs) {
74
			$nom = $aso_champs['nom_sci'];
162
			$nom = $aso_champs['nom_sci'];
75
			$num_taxo = $aso_champs['num_tax'];
163
			$num_taxo = $aso_champs['num_tax'];
76
			$num_nomenc = $aso_champs['num_nom'];
164
			$num_nomenc = $aso_champs['num_nom'];
77
			if ($num_nomenc == 'nc') {
165
			if ($num_nomenc == 'nc') {
78
				$this->nc_nbre_nom++;
166
				$this->nc_nbre_nom++;
79
			} else if ($num_nomenc != 'nc') {
167
			} else if ($num_nomenc != 'nc') {
80
				$this->nbre_nom++;
168
				$this->nbre_nom++;
81
				// Vérification de la nom duplication des numéros nomenclaturaux
169
				// Vérification de la nom duplication des numéros nomenclaturaux
82
				if ( !array_key_exists($num_nomenc, (array) $this->aso_num_nomenc) ) {
170
				if ( !array_key_exists($num_nomenc, (array) $this->aso_num_nomenc) ) {
83
					$this->aso_num_nomenc[$num_nomenc]['compteur'] = 1;
171
					$this->aso_num_nomenc[$num_nomenc]['compteur'] = 1;
84
					$this->aso_num_nomenc[$num_nomenc]['ligne'] = ($this->nbre_ligne+1);
172
					$this->aso_num_nomenc[$num_nomenc]['ligne'] = ($this->nbre_ligne+1);
85
				} else {
173
				} else {
86
					$this->aso_num_nomenc[$num_nomenc]['compteur']++;
174
					$this->aso_num_nomenc[$num_nomenc]['compteur']++;
87
					$this->aso_num_nomenc[$num_nomenc]['ligne'] .= ' - '.($this->nbre_ligne+1);
175
					$this->aso_num_nomenc[$num_nomenc]['ligne'] .= ' - '.($this->nbre_ligne+1);
88
				}
176
				}
89
			}
177
			}
90
			foreach ($aso_champs as $cle => $val ) {# Pour chaque département du taxon, on regarde la valeur
178
			foreach ($aso_champs as $cle => $val ) {# Pour chaque département du taxon, on regarde la valeur
91
				$this->nbre_ligne_avec_guillemet += preg_match('/"/', $val);
179
				$this->nbre_ligne_avec_guillemet += preg_match('/"/', $val);
92
				if ( preg_match('/^\d{2}$/', $cle) ) {# Nous vérifions que le nom du champs comprend bien le numéro du département entre ()
180
				if ( preg_match('/^\d{2}$/', $cle) ) {# Nous vérifions que le nom du champs comprend bien le numéro du département entre ()
93
					$nd = $cle;# Numéro du département
181
					$nd = $cle;# Numéro du département
94
					// Nous comptons le nombre de département en base de données
182
					// Nous comptons le nombre de département en base de données
95
					if (!isset($aso_departements_analyses[$nd])) {
183
					if (!isset($aso_departements_analyses[$nd])) {
96
						$this->nbre_dep_analyse++;
184
						$this->nbre_dep_analyse++;
97
						$aso_departements_analyses[$nd] = $nd;
185
						$aso_departements_analyses[$nd] = $nd;
98
					}
186
					}
99
					if ( $num_nomenc != 'nc' && isset($val) && $val != '') {# Si le taxon n'est pas abscent du département
187
					if ( $num_nomenc != 'nc' && isset($val) && $val != '') {# Si le taxon n'est pas abscent du département
100
						if ($val == '1') {# Présent
188
						if ($val == '1') {# Présent
101
							// Calcul du nombre de plante ayant un statut "Présent"
189
							// Calcul du nombre de plante ayant un statut "Présent"
102
							$this->nbre_plte_presente++;
190
							$this->nbre_plte_presente++;
103
							// Stockage par département du nombre de plante ayant un statut "Présent"
191
							// Stockage par département du nombre de plante ayant un statut "Présent"
104
							$this->aso_totaux_dep[$nd]['plte_presente']++;
192
							$this->aso_totaux_dep[$nd]['plte_presente']++;
105
							// Stockage des informations
193
							// Stockage des informations
106
							$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 3, $this->id_donnee_choro++);
194
							$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 3, $this->id_donnee_choro++);
107
						} else if ($val == '1?') {# Présence à confirmer
195
						} else if ($val == '1?') {# Présence à confirmer
108
							// Calcul du nombre de plante ayant un statut "Présence à confirmer"
196
							// Calcul du nombre de plante ayant un statut "Présence à confirmer"
109
							$this->nbre_plte_a_confirmer++;
197
							$this->nbre_plte_a_confirmer++;
110
							// Stockage par département du nombre de plante ayant un statut "Présence à confirmer"
198
							// Stockage par département du nombre de plante ayant un statut "Présence à confirmer"
111
							$this->aso_totaux_dep[$nd]['plte_a_confirmer']++;
199
							$this->aso_totaux_dep[$nd]['plte_a_confirmer']++;
112
							// Stockage des informations
200
							// Stockage des informations
113
							$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 4, $this->id_donnee_choro++);
201
							$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 4, $this->id_donnee_choro++);
114
						} else if (preg_match('/^\s*(?:\?)\s*$/', $val)) {# Douteux
202
						} else if (preg_match('/^\s*(?:\?)\s*$/', $val)) {# Douteux
115
							// Calcul du nombre de plante ayant un statut "Disparu ou douteux"
203
							// Calcul du nombre de plante ayant un statut "Disparu ou douteux"
116
							$this->nbre_plte_douteux++;
204
							$this->nbre_plte_douteux++;
117
							// Stockage par département du nombre de plante ayant un statut "Douteux"
205
							// Stockage par département du nombre de plante ayant un statut "Douteux"
118
							$this->aso_totaux_dep[$nd]['plte_douteux']++;
206
							$this->aso_totaux_dep[$nd]['plte_douteux']++;
119
							// Stockage des informations
207
							// Stockage des informations
120
							$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 5, $this->id_donnee_choro++);
208
							$this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 5, $this->id_donnee_choro++);
121
							if (preg_match('/(?: \?|\? | \? )/', $val)) {# Douteux
209
							if (preg_match('/(?: \?|\? | \? )/', $val)) {# Douteux
122
								// Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "?".
210
								// Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "?".
123
								$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
211
								$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
124
														' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
212
														' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
125
							}
213
							}
126
						} elseif (preg_match('/^\s*(?:#)\s*$/', $val)) {# Erreur
214
						} elseif (preg_match('/^\s*(?:#)\s*$/', $val)) {# Erreur
127
	                        # Calcul du nombre de plante ayant un statut "Erreur"
215
	                        # Calcul du nombre de plante ayant un statut "Erreur"
128
	                        $this->nbre_plte_erreur++;
216
	                        $this->nbre_plte_erreur++;
129
	                        # Stockage par département du nombre de plante ayant un statut "Erreur"
217
	                        # Stockage par département du nombre de plante ayant un statut "Erreur"
130
	                        $this->aso_totaux_dep[$nd]['plte_erreur']++;
218
	                        $this->aso_totaux_dep[$nd]['plte_erreur']++;
131
	                        # Stockage des informations
219
	                        # Stockage des informations
132
	                        $this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
220
	                        $this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
133
	                        if (preg_match('/(?: #|# | # )/', $val)) {# Erreur avec espace
221
	                        if (preg_match('/(?: #|# | # )/', $val)) {# Erreur avec espace
134
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#".
222
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#".
135
	                            $autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
223
	                            $autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
136
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
224
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
137
	                        }
225
	                        }
138
                    	} elseif (preg_match('/^\s*(?:-\|-)\s*$/', $val)) {# Disparu
226
                    	} elseif (preg_match('/^\s*(?:-\|-)\s*$/', $val)) {# Disparu
139
	                        # Calcul du nombre de plante ayant un statut "Disparu"
227
	                        # Calcul du nombre de plante ayant un statut "Disparu"
140
	                        $this->nbre_plte_disparue++;
228
	                        $this->nbre_plte_disparue++;
141
	                        # Stockage par département du nombre de plante ayant un statut "Disparu"
229
	                        # Stockage par département du nombre de plante ayant un statut "Disparu"
142
	                        $this->aso_totaux_dep[$nd]['plte_disparue']++;
230
	                        $this->aso_totaux_dep[$nd]['plte_disparue']++;
143
	                        # Stockage des informations
231
	                        # Stockage des informations
144
	                        $this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
232
	                        $this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
145
	                        if (preg_match('/(?: -\|-|-\|- | -\|- )/', $val)) {# Disparu avec espace
233
	                        if (preg_match('/(?: -\|-|-\|- | -\|- )/', $val)) {# Disparu avec espace
146
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "-|-".
234
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "-|-".
147
	                            $autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
235
	                            $autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
148
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
236
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
149
	                        }
237
	                        }
-
 
238
                    	} elseif (preg_match('/^\s*(?:#\?)\s*$/', $val)) {# Erreur à confirmer
-
 
239
	                        # Calcul du nombre de plante ayant un statut "Erreur à confirmer"
-
 
240
	                        $this->nbre_plte_erreur_a_confirmer++;
-
 
241
	                        # Stockage par département du nombre de plante ayant un statut "Erreur à confirmer"
-
 
242
	                        $this->aso_totaux_dep[$nd]['plte_erreur_a_confirmer']++;
-
 
243
	                        # Stockage des informations
-
 
244
	                        $this->tab_choro_dep[$j] = array(ZgFrDepartements::getIdChaine($nd), $num_taxo, $num_nomenc, 6, $this->id_donnee_choro++);
-
 
245
                    		if (preg_match('/^(?:\s+#\?|#\?\s+|\s+#\?\s+)$/', $val)) {# Erreur à confirmer avec espace
-
 
246
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#?".
-
 
247
	                            $autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
-
 
248
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
-
 
249
	                        }
150
                    	} else {
250
                    	} else {
151
							// Ajout de la valeur dans une variable car elle n'est pas conforme.
251
							// Ajout de la valeur dans une variable car elle n'est pas conforme.
152
							$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
252
							$this->autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
153
													' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
253
													' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
154
						}
254
						}
155
						$j++;
255
						$j++;
156
					} else if (isset($val) && $val != '') {
256
					} else if (isset($val) && $val != '') {
157
						if ($val == '1') {# Présent
257
						if ($val == '1') {# Présent
158
							// Calcul du nombre de plante 'nc' ayant un statut "Présent"
258
							// Calcul du nombre de plante 'nc' ayant un statut "Présent"
159
							$this->nc_nbre_plte_presente++;
259
							$this->nc_nbre_plte_presente++;
160
							// Stockage par département du nombre de plante 'nc' ayant un statut "Présent"
260
							// Stockage par département du nombre de plante 'nc' ayant un statut "Présent"
161
							$this->aso_totaux_dep[$nd]['nc_plte_presente']++;
261
							$this->aso_totaux_dep[$nd]['nc_plte_presente']++;
162
						} elseif ($val == '1?') {# Présence à confirmer
262
						} elseif ($val == '1?') {# Présence à confirmer
163
							// Calcul du nombre de plante 'nc' ayant un statut "Présence à confirmer"
263
							// Calcul du nombre de plante 'nc' ayant un statut "Présence à confirmer"
164
							$this->nc_nbre_plte_a_confirmer++;
264
							$this->nc_nbre_plte_a_confirmer++;
165
							// Stockage par département du nombre de plante 'nc' ayant un statut "Présence à confirmer"
265
							// Stockage par département du nombre de plante 'nc' ayant un statut "Présence à confirmer"
166
							$this->aso_totaux_dep[$nd]['nc_plte_a_confirmer']++;
266
							$this->aso_totaux_dep[$nd]['nc_plte_a_confirmer']++;
167
						} elseif (preg_match('/^(?:\?| \?|\? | \?)$/', $val)) {# Douteux
267
						} elseif (preg_match('/^(?:\?| \?|\? | \?)$/', $val)) {# Douteux
168
							// Calcul du nombre de plante 'nc' ayant un statut "Douteux"
268
							// Calcul du nombre de plante 'nc' ayant un statut "Douteux"
169
							$this->nc_nbre_plte_douteux++;
269
							$this->nc_nbre_plte_douteux++;
170
							// Stockage par département du nombre de plante 'nc' ayant un statut "Douteux"
270
							// Stockage par département du nombre de plante 'nc' ayant un statut "Douteux"
171
							$this->aso_totaux_dep[$nd]['nc_plte_douteux']++;
271
							$this->aso_totaux_dep[$nd]['nc_plte_douteux']++;
172
							if (preg_match('/(?: \?|\? | \? )/', $val)) {# Douteux
272
							if (preg_match('/(?: \?|\? | \? )/', $val)) {# Douteux
173
								// Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "?".
273
								// Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "?".
174
								$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
274
								$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
175
														' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
275
														' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
176
							}
276
							}
177
						} elseif (preg_match('/^(?:#| #|# | # )$/', $val)) {# Erreur
277
						} elseif (preg_match('/^(?:#| #|# | # )$/', $val)) {# Erreur
178
	                        # Calcul du nombre de plante 'nc' ayant un statut "Erreur"
278
	                        # Calcul du nombre de plante 'nc' ayant un statut "Erreur"
179
	                        $this->nc_nbre_plte_erreur++;
279
	                        $this->nc_nbre_plte_erreur++;
180
	                        # Stockage par département du nombre de plante 'nc' ayant un statut "Erreur"
280
	                        # Stockage par département du nombre de plante 'nc' ayant un statut "Erreur"
181
	                        $this->aso_totaux_dep[$nd]['nc_plte_erreur']++;
281
	                        $this->aso_totaux_dep[$nd]['nc_plte_erreur']++;
182
	                        if (preg_match('/(?: #|# | # )/', $val)) {# Erreur avec espace
282
	                        if (preg_match('/(?: #|# | # )/', $val)) {# Erreur avec espace
183
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#".
283
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#".
184
	                            $nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
284
	                            $nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
185
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
285
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
186
	                        }
286
	                        }
187
                    	} elseif (preg_match('/^\s*(?:-\|-)\s*$/', $val)) {# Disparu
287
                    	} elseif (preg_match('/^\s*(?:-\|-)\s*$/', $val)) {# Disparu
188
	                        # Calcul du nombre de plante 'nc' ayant un statut "Disparu"
288
	                        # Calcul du nombre de plante 'nc' ayant un statut "Disparu"
189
	                        $this->nc_nbre_plte_disparue++;
289
	                        $this->nc_nbre_plte_disparue++;
190
	                        # Stockage par département du nombre de plante 'nc' ayant un statut "Disparu"
290
	                        # Stockage par département du nombre de plante 'nc' ayant un statut "Disparu"
191
	                        $this->aso_totaux_dep[$nd]['nc_plte_disparue']++;
291
	                        $this->aso_totaux_dep[$nd]['nc_plte_disparue']++;
192
	                        if (preg_match('/(?: -\|-|-\|- | -\|- )/', $val)) {# Disparu avec espace
292
	                        if (preg_match('/(?: -\|-|-\|- | -\|- )/', $val)) {# Disparu avec espace
193
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "-|-".
293
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "-|-".
194
	                            $nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
294
	                            $nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
195
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
295
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
196
	                        }
296
	                        }
-
 
297
                    	} elseif (preg_match('/^\s*(?:#\?)\s*$/', $val)) {# Erreur à confirmer
-
 
298
	                        # Calcul du nombre de plante 'nc' ayant un statut "Erreur à confirmer"
-
 
299
	                        $this->nc_nbre_plte_erreur_a_confirmer++;
-
 
300
	                        # Stockage par département du nombre de plante 'nc' ayant un statut "Erreur à confirmer"
-
 
301
	                        $this->aso_totaux_dep[$nd]['nc_plte_erreur_a_confirmer']++;
-
 
302
	                        if (preg_match('/^(?:\s+#\?|#\?\s+|\s+#\?\s+)$/', $val)) {# Erreur à confirmer avec espace
-
 
303
	                            # Ajout de la valeur dans une variable car elle n'est pas tout à fait conforme à "#?".
-
 
304
	                            $nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
-
 
305
	                                                    ' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
-
 
306
	                        }
197
                    	} else {
307
                    	} else {
198
							// Ajout de la valeur dans une variable car elle n'est pas conforme.
308
							// Ajout de la valeur dans une variable car elle n'est pas conforme.
199
							$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
309
							$this->nc_autres_valeur_champ .= '<'.$val.'> '.'(Ligne n°: '.($this->nbre_ligne+2).
200
													' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
310
													' - N° nomenclatural: '.$num_nomenc.' - N° département: '.$nd.')<br />';
201
						}
311
						}
202
					}
312
					}
203
					// Affichage dans la console du numéro de l'enregistrement analysé.
313
					// Affichage dans la console du numéro de l'enregistrement analysé.
204
					//echo str_repeat(chr(8), ( strlen( $i ) + 1 ))."\t".$i++;
314
					//echo str_repeat(chr(8), ( strlen( $i ) + 1 ))."\t".$i++;
205
				}
315
				}
206
			}// fin du foreach
316
			}// fin du foreach
207
			// Affichage dans la console du numéro de l'enregistrement analysé.
317
			// Affichage dans la console du numéro de l'enregistrement analysé.
208
			echo str_repeat(chr(8), ( strlen( $this->nbre_ligne ) + 1 ))."\t".$this->nbre_ligne++;
318
			echo str_repeat(chr(8), ( strlen( $this->nbre_ligne ) + 1 ))."\t".$this->nbre_ligne++;
209
		}
319
		}
210
		echo "\n";
320
		echo "\n";
211
	}
321
	}
212
 
322
 
-
 
323
	private function initialiserTableaux($dep) {
-
 
324
		foreach ($dep as $code_dep) {
-
 
325
			if ( preg_match('/^\d{2}$/', $code_dep) ) {
-
 
326
				$this->aso_totaux_dep[$code_dep]['plte_presente'] = 0;
-
 
327
				$this->aso_totaux_dep[$code_dep]['plte_a_confirmer'] = 0;
-
 
328
				$this->aso_totaux_dep[$code_dep]['plte_douteux'] = 0;
-
 
329
				$this->aso_totaux_dep[$code_dep]['plte_erreur'] = 0;
-
 
330
				$this->aso_totaux_dep[$code_dep]['plte_disparue'] = 0;
-
 
331
				$this->aso_totaux_dep[$code_dep]['plte_erreur_a_confirmer'] = 0;
-
 
332
				$this->aso_totaux_dep[$code_dep]['autres_valeur_champ'] = 0;
-
 
333
				$this->aso_totaux_dep[$code_dep]['nc_plte_presente'] = 0;
-
 
334
				$this->aso_totaux_dep[$code_dep]['nc_plte_a_confirmer'] = 0;
-
 
335
				$this->aso_totaux_dep[$code_dep]['nc_plte_douteux'] = 0;
-
 
336
				$this->aso_totaux_dep[$code_dep]['nc_plte_erreur'] = 0;
-
 
337
				$this->aso_totaux_dep[$code_dep]['nc_plte_disparue'] = 0;
-
 
338
				$this->aso_totaux_dep[$code_dep]['nc_plte_erreur_a_confirmer'] = 0;
-
 
339
				$this->aso_totaux_dep[$code_dep]['nc_autres_valeur_champ'] = 0;
-
 
340
			}
213
	private function verifierDonnees()
341
		}
-
 
342
	}
-
 
343
 
214
	{
344
	private function verifierDonnees() {
215
		// Ouverture du fichier contenant les résultats (sortie)
345
		// Ouverture du fichier contenant les résultats (sortie)
216
		if (!$handle = fopen($this->fichier_verif, 'w')) {
346
		if (!$handle = fopen($this->fichier_verif, 'w')) {
217
			echo "Impossible d'ouvrir le fichier ($this->fichier_verif)";
347
			echo "Impossible d'ouvrir le fichier ($this->fichier_verif)";
218
			exit;
348
			exit;
219
		}
349
		}
220
 
350
 
221
		// Création de la page
351
		// Création de la page
222
		$page = '<html>'."\n";
352
		$page = '<html>'."\n";
223
		$page .= '<head>'."\n";
353
		$page .= '<head>'."\n";
-
 
354
		$page .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'."\n";
224
		$page .= '<title>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</title>'."\n";
355
		$page .= '<title>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</title>'."\n";
225
		$page .= '</head>'."\n";
356
		$page .= '</head>'."\n";
226
		$page .= '<body>'."\n";
357
		$page .= '<body>'."\n";
227
		$page .= '<h1>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</h1>'."\n";
358
		$page .= '<h1>RESULTAT DE LA VERIFICATION DU FICHIER TABULE DE LA CHOROLOGIE</h1>'."\n";
228
		$page .= '<hr/>'."\n";
359
		$page .= '<hr/>'."\n";
229
		$page .= 	'<p>'.
360
		$page .= 	'<p>'.
230
						'Adresse fichier analysé : '.'<br />'."\n".
361
						'Adresse fichier analysé : '.'<br />'."\n".
231
						'</p>'."\n";
362
						'</p>'."\n";
232
		$page .= '<hr/>'."\n";
363
		$page .= '<hr/>'."\n";
233
		$page .= '<h2>RESULTATS PROGRAMME DE VERIFICATION</h2>'."\n";
364
		$page .= '<h2>RESULTATS PROGRAMME DE VERIFICATION</h2>'."\n";
234
		$page .= 	'<p>'.
365
		$page .= 	'<p>'.
235
						'Nom du programme générant ce fichier : '.__FILE__.'<br />'."\n".
366
						'Nom du programme générant ce fichier : '.__FILE__.'<br />'."\n".
236
						'Nombre de lignes analysées : '.$this->nbre_ligne.'<br />'."\n".
367
						'Nombre de lignes analysées : '.$this->nbre_ligne.'<br />'."\n".
237
						'Nbre de départements analysés : '.$this->nbre_dep_analyse.'<br />'."\n".
368
						'Nbre de départements analysés : '.$this->nbre_dep_analyse.'<br />'."\n".
238
						'Date d\'exécution du programme : '.date('m.d.Y').'<br />'."\n".
369
						'Date d\'exécution du programme : '.date('d.m.Y').'<br />'."\n".
239
						'</p>'."\n";
370
						'</p>'."\n";
240
		$page .= '<hr/>'."\n";
371
		$page .= '<hr/>'."\n";
241
		$page .= '<h2>RESULTATS ANALYSE CHOROLOGIE</h2>'."\n";
372
		$page .= '<h2>RESULTATS ANALYSE CHOROLOGIE</h2>'."\n";
242
		$page .= 	'<p>'.
373
		$page .= 	'<p>'.
243
						'Nombre de nom "nc" : '.$this->nc_nbre_nom.'<br />'."\n".
374
						'Nombre de nom "nc" : '.$this->nc_nbre_nom.'<br />'."\n".
244
						'Nombre de nom : '.$this->nbre_nom.'<br />'."\n".
375
						'Nombre de nom : '.$this->nbre_nom.'<br />'."\n".
245
						'Valeurs autres que 1, 1?, ?, # et -|- : '.$this->autres_valeur_champ.'<br />'."\n".
376
						'Valeurs autres que 1, 1?, ?, #, #? et -|- : '.$this->autres_valeur_champ.'<br />'."\n".
246
						'Valeurs autres que 1, 1?, ?, # et -|- pour les plantes nc : <br />'."\n".$this->nc_autres_valeur_champ.'</br>'."\n".
377
						'Valeurs autres que 1, 1?, ?, #, #? et -|- pour les plantes nc : <br />'."\n".$this->nc_autres_valeur_champ.'</br>'."\n".
247
						'</p>'."\n";
378
						'</p>'."\n";
248
		$page .= '<hr/>'."\n";
379
		$page .= '<hr/>'."\n";
249
		$page .= '<h2>RESULTATS ANALYSE des CHAMPS</h2>'."\n";
380
		$page .= '<h2>RESULTATS ANALYSE des CHAMPS</h2>'."\n";
250
		$page .= 	'<p>'.
381
		$page .= 	'<p>'.
251
						'Nombre de guillemets antislashés: '.$this->nbre_ligne_avec_guillemet.'<br />'."\n".
382
						'Nombre de guillemets antislashés: '.$this->nbre_ligne_avec_guillemet.'<br />'."\n".
252
						'</p>'."\n";
383
						'</p>'."\n";
253
		$page .= '<hr/>'."\n";
384
		$page .= '<hr/>'."\n";
254
		$page .= '<h2>TABLEAUX</h2>'."\n";
385
		$page .= '<h2>TABLEAUX</h2>'."\n";
255
 
386
 
256
		// Tableau des numéros nomenclaturaux dupliqués
387
		// Tableau des numéros nomenclaturaux dupliqués
257
		$table = '<table><thead><tr><th colspan="3">Tableau des numéros nomenclaturaux dupliqués </th></tr>';
388
		$table = '<table><thead><tr><th colspan="3">Tableau des numéros nomenclaturaux dupliqués </th></tr>';
258
		$table .= '<tr><th>Numéro nomenclatural</th><th>Nbre d\'itération</th><th>Lignes</th></tr></thead>';
389
		$table .= '<tr><th>Numéro nomenclatural</th><th>Nbre d\'itération</th><th>Lignes</th></tr></thead>';
259
		$afficher_tab_num_duplique = 0;
390
		$afficher_tab_num_duplique = 0;
260
		ksort($this->aso_num_nomenc);
391
		ksort($this->aso_num_nomenc);
261
		$table .= '<tbody style="text-align: center;">';
392
		$table .= '<tbody style="text-align: center;">';
262
		foreach ($this->aso_num_nomenc as $cle_nomenc => $val ) {
393
		foreach ($this->aso_num_nomenc as $cle_nomenc => $val ) {
263
			$ligne = '<tr><td>'.$cle_nomenc.'</td><td>'.$val['compteur'].'</td><td>'.$val['ligne'].'</td></tr>';
394
			$ligne = '<tr><td>'.$cle_nomenc.'</td><td>'.$val['compteur'].'</td><td>'.$val['ligne'].'</td></tr>';
264
			if ($val['compteur'] > 1) {
395
			if ($val['compteur'] > 1) {
265
				$table .= $ligne;
396
				$table .= $ligne;
266
				$afficher_tab_num_duplique = 1;
397
				$afficher_tab_num_duplique = 1;
267
			}
398
			}
268
		}
399
		}
269
		if ( $afficher_tab_num_duplique == 1 ) {
400
		if ( $afficher_tab_num_duplique == 1 ) {
270
			$page .= $table.'</tbody></table>';
401
			$page .= $table.'</tbody></table>';
271
		}
402
		}
272
 
403
 
273
		// Tableau des résultats par départements
404
		// Tableau des résultats par départements
274
		$table = '<table><thead><tr><th colspan="12">Tableau des résulats par départements</th></tr>';
405
		$table = '<table><thead><tr><th colspan="14">Tableau des résulats par départements</th></tr>';
275
		$table .= '<tr><th>Département</th><th>Nbre pltes présentes</th><th>Nbre pltes à confirmer</th>'.
406
		$table .= '<tr><th>Département</th><th>Nbre pltes présentes</th><th>Nbre pltes à confirmer</th>'.
276
			'<th>Nbre pltes douteuses</th><th>Nbre pltes disparues</th><th>Nbre pltes erreur</th>'.
407
			'<th>Nbre pltes douteuses</th><th>Nbre pltes disparues</th><th>Nbre pltes erreur</th><th>Nbre pltes erreur à confirmer</th>'.
277
			'<th>Total</th><th>Nbre pltes nc présentes</th><th>Nbre pltes nc à confirmer</th>'.
408
			'<th>Total</th><th>Nbre pltes nc présentes</th><th>Nbre pltes nc à confirmer</th>'.
278
			'<th>Nbre nc pltes douteuses</th><th>Nbre nc pltes disparues</th><th>Nbre nc pltes erreur</th></tr></thead>';
409
			'<th>Nbre nc pltes douteuses</th><th>Nbre nc pltes disparues</th><th>Nbre nc pltes erreur</th><th>Nbre nc pltes erreur à confirmer</th></tr></thead>';
279
		$table .= '<tbody style="text-align: center;">';
410
		$table .= '<tbody style="text-align: center;">';
280
		ksort($this->aso_totaux_dep);
411
		ksort($this->aso_totaux_dep);
281
		foreach ($this->aso_totaux_dep as $cle_dep => $val ) {
412
		foreach ($this->aso_totaux_dep as $cle_dep => $val ) {
282
			$plt_total = $val{'plte_presente'} + $val{'plte_a_confirmer'} + $val{'plte_douteux'} + $val{'plte_disparue'} + $val{'plte_erreur'};
413
			$plt_total = $val{'plte_presente'} + $val{'plte_a_confirmer'} + $val{'plte_douteux'} + $val{'plte_disparue'} + $val{'plte_erreur'} + $val{'plte_erreur_a_confirmer'};
283
			$table .= '<tr><td>'.ZgFrDepartements::getNom($cle_dep).' ('.ZgFrDepartements::getIdChaine($cle_dep).') </td>'.
414
			$table .= '<tr><td>'.ZgFrDepartements::getNom($cle_dep).' ('.ZgFrDepartements::getIdChaine($cle_dep).') </td>'.
284
				'<td>'.$val{'plte_presente'}.'</td><td>'.$val{'plte_a_confirmer'}.'</td><td>'.$val{'plte_douteux'}.'</td>'.
415
				'<td>'.$val{'plte_presente'}.'</td><td>'.$val{'plte_a_confirmer'}.'</td><td>'.$val{'plte_douteux'}.'</td>'.
285
				'<td>'.$val{'plte_disparue'}.'</td><td>'.$val{'plte_erreur'}.'</td><td>'.$plt_total.'</td>'.
416
				'<td>'.$val{'plte_disparue'}.'</td><td>'.$val{'plte_erreur'}.'</td><td>'.$val{'plte_erreur_a_confirmer'}.'</td><td>'.$plt_total.'</td>'.
286
				'<td>'.$val{'nc_plte_presente'}.'</td><td>'.$val{'nc_plte_a_confirmer'}.'</td><td>'.$val{'nc_plte_douteux'}.'</td>'.
417
				'<td>'.$val{'nc_plte_presente'}.'</td><td>'.$val{'nc_plte_a_confirmer'}.'</td><td>'.$val{'nc_plte_douteux'}.'</td>'.
287
				'<td>'.$val{'nc_plte_disparue'}.'</td><td>'.$val{'nc_plte_erreur'}.'</td></tr>';
418
				'<td>'.$val{'nc_plte_disparue'}.'</td><td>'.$val{'nc_plte_erreur'}.'</td><td>'.$val{'nc_plte_erreur_a_confirmer'}.'</td></tr>';
288
		}
419
		}
289
 
420
 
290
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
421
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
291
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
422
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
292
		$plt_total = $this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur;
423
		$plt_total = $this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur + $this->nbre_plte_erreur_a_confirmer;
293
		$table .= '<tr><td>Totaux : '.$this->nbre_dep_analyse.' départements</td><td>'.$this->nbre_plte_presente.'</td>'.
424
		$table .= '<tr><td>Totaux : '.$this->nbre_dep_analyse.' départements</td><td>'.$this->nbre_plte_presente.'</td>'.
294
			'<td>'.$this->nbre_plte_a_confirmer.'</td><td>'.$this->nbre_plte_douteux.'</td><td>'.$this->nbre_plte_disparue.'</td>'.
425
			'<td>'.$this->nbre_plte_a_confirmer.'</td><td>'.$this->nbre_plte_douteux.'</td><td>'.$this->nbre_plte_disparue.'</td>'.
295
			'<td>'.$this->nbre_plte_erreur.'</td><td>'.$plt_total.'</td>'.
426
			'<td>'.$this->nbre_plte_erreur.'</td><td>'.$this->nbre_plte_erreur_a_confirmer.'</td><td>'.$plt_total.'</td>'.
296
			'<td>'.$this->nc_nbre_plte_presente.'</td>'.'<td>'.$this->nc_nbre_plte_a_confirmer.'</td>'.
427
			'<td>'.$this->nc_nbre_plte_presente.'</td>'.'<td>'.$this->nc_nbre_plte_a_confirmer.'</td>'.
297
			'<td>'.$this->nc_nbre_plte_douteux.'</td><td>'.$this->nc_nbre_plte_disparue.'</td><td>'.$this->nc_nbre_plte_erreur.'</td></tr>';
428
			'<td>'.$this->nc_nbre_plte_douteux.'</td><td>'.$this->nc_nbre_plte_disparue.'</td><td>'.$this->nc_nbre_plte_erreur.'</td><td>'.$this->nc_nbre_plte_erreur_a_confirmer.'</td></tr>';
298
 
429
 
299
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
430
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
300
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
431
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
301
		$total_nbre_plte = ($this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur);
432
		$total_nbre_plte = ($this->nbre_plte_presente + $this->nbre_plte_a_confirmer + $this->nbre_plte_douteux + $this->nbre_plte_disparue + $this->nbre_plte_erreur + $this->nbre_plte_erreur_a_confirmer);
302
		$total_nbre_plte_nc = ($this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nc_nbre_plte_douteux + $this->nc_nbre_plte_disparue + $this->nc_nbre_plte_erreur);
433
		$total_nbre_plte_nc = ($this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nc_nbre_plte_douteux + $this->nc_nbre_plte_disparue + $this->nc_nbre_plte_erreur + $this->nc_nbre_plte_erreur_a_confirmer);
303
		$table .= '<tr><td>Totaux plante / plante nc</td><td colspan="6">'.$total_nbre_plte.'</td>'.
434
		$table .= '<tr><td>Totaux plante / plante nc</td><td colspan="7">'.$total_nbre_plte.'</td>'.
304
			'<td colspan="5">'.$total_nbre_plte_nc.'</td></tr>';
435
			'<td colspan="6">'.$total_nbre_plte_nc.'</td></tr>';
305
 
436
 
306
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
437
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
307
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
438
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
308
		$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nbre_plte_a_confirmer;
439
		$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente + $this->nc_nbre_plte_a_confirmer + $this->nbre_plte_a_confirmer;
309
		$table .= '<tr><td>Total plantes présentes et à confirmer</td><td colspan="11">'.$plt_total.'</td></tr>';
440
		$table .= '<tr><td>Total plantes présentes et à confirmer</td><td colspan="13">'.$plt_total.'</td></tr>';
310
 
441
 
311
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
442
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
312
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
443
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
313
		$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente;
444
		$plt_total = $this->nbre_plte_presente + $this->nc_nbre_plte_presente;
314
		$table .= '<tr><td>Total plantes présentes</td><td colspan="11">'.$plt_total.'</td></tr>';
445
		$table .= '<tr><td>Total plantes présentes</td><td colspan="13">'.$plt_total.'</td></tr>';
315
 
446
 
316
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
447
		$table .= '<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>'.
317
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
448
				'<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
318
		$plt_total = $total_nbre_plte + $total_nbre_plte_nc;
449
		$plt_total = $total_nbre_plte + $total_nbre_plte_nc;
319
		$table .= '<tr><td>Total données chorologiques</td><td colspan="11">'.$plt_total.'</td></tr>';
450
		$table .= '<tr><td>Total données chorologiques</td><td colspan="13">'.$plt_total.'</td></tr>';
320
 
451
 
321
		$table .= '</tbody></table>';
452
		$table .= '</tbody></table>';
322
		$page .= $table;
453
		$page .= $table;
323
 
454
 
324
		$page .= '<hr/>'."\n";
455
		$page .= '<hr/>'."\n";
325
		$page .= '<h2>NOTES</h2>'."\n";
456
		$page .= '<h2>NOTES</h2>'."\n";
326
		$page .= 	'<p>'.
457
		$page .= 	'<p>'.
327
						'1.- Chaque champ précédé par "ATTENTION" doit être vide.'."\n".
458
						'1.- Chaque champ précédé par "ATTENTION" doit être vide.'."\n".
328
						'S\'il ne l\'est pas, il y a une erreur'."\n".
459
						'S\'il ne l\'est pas, il y a une erreur'."\n".
329
						'</p>'."\n";
460
						'</p>'."\n";
330
		$page .= '</body>'."\n";
461
		$page .= '</body>'."\n";
331
		$page .= '</html>'."\n";
462
		$page .= '</html>'."\n";
332
		// Fermeture de la poignée sur le fichier de sortie
463
		// Fermeture de la poignée sur le fichier de sortie
333
		if (fwrite($handle, $page) === FALSE) {
464
		if (fwrite($handle, $page) === FALSE) {
334
			echo "Impossible d'écrire dans le fichier ($this->fichier_verif)";
465
			echo "Impossible d'écrire dans le fichier ($this->fichier_verif)";
335
			exit;
466
			exit;
336
		}
467
		}
337
		echo 'Ecriture du fichier de vérification de la chorologie réalisée!'."\n";
468
		echo 'Ecriture du fichier de vérification de la chorologie réalisée!'."\n";
338
		fclose($handle);
469
		fclose($handle);
339
	}
470
	}
-
 
471
 
-
 
472
	private function supprimerTous() {
-
 
473
		$tablesChorodep = implode(',', $this->getNomsTablesChorodep());
-
 
474
		$tableContributeurs = Config::get('tables.chorodepContributeurs');
-
 
475
		$tableSources = Config::get('tables.chorodepSources');
-
 
476
		$tableOntologies = Config::get('tables.chorodepOntologies');
-
 
477
		$requete = "DROP TABLE chorodep_meta, $tablesChorodep, $tableContributeurs, $tableSources, $tableOntologies";
-
 
478
		$this->getBdd()->requeter($requete);
-
 
479
	}
-
 
480
 
-
 
481
	private function getNomsTablesChorodep() {
-
 
482
		$versions = explode(',', Config::get('versions'));
-
 
483
		$tableTpl = Config::get('tables.chorodepTpl');
-
 
484
		$tablesChorodep = array();
-
 
485
		foreach ($versions as $version) {
-
 
486
			$tablesChorodep[] = sprintf($tableTpl, $version);
-
 
487
		}
-
 
488
		return $tablesChorodep;
-
 
489
	}
-
 
490
 
-
 
491
	private function getNomTableDernierVersion() {
-
 
492
		$version = $this->getDerniereVersion();
-
 
493
		$table = sprintf(Config::get('tables.chorodepTpl'), $version);
-
 
494
		return $table;
-
 
495
	}
-
 
496
 
-
 
497
	private function getDerniereVersion() {
-
 
498
		$version = array_pop(explode(',', Config::get('versions')));
-
 
499
		return $version;
340
 
500
	}
341
}
501
}
342
 
502
 
343
class ZgFrDepartements {
503
class ZgFrDepartements {
344
	static private $departements =
504
	static private $departements =
345
        array(
505
        array(
346
        "01" => array("Ain", "01", 1),
506
        "01" => array("Ain", "01", 1),
347
        "02" => array("Aisne", "02", 2),
507
        "02" => array("Aisne", "02", 2),
348
        "03" => array("Allier", "03", 3),
508
        "03" => array("Allier", "03", 3),
349
        "04" => array("Alpes-de-Haute-Provence", "04", 4),
509
        "04" => array("Alpes-de-Haute-Provence", "04", 4),
350
        "05" => array("Hautes-Alpes", "05", 5),
510
        "05" => array("Hautes-Alpes", "05", 5),
351
        "06" => array("Alpes-Maritimes", "06", 6),
511
        "06" => array("Alpes-Maritimes", "06", 6),
352
        "07" => array("Ardèche", "07", 7),
512
        "07" => array("Ardèche", "07", 7),
353
        "08" => array("Ardennes", "08", 8),
513
        "08" => array("Ardennes", "08", 8),
354
        "09" => array("Ariège", "09", 9),
514
        "09" => array("Ariège", "09", 9),
355
        "10" => array("Aube", "10", 10),
515
        "10" => array("Aube", "10", 10),
356
        "11" => array("Aude", "11", 11),
516
        "11" => array("Aude", "11", 11),
357
        "12" => array("Aveyron", "12", 12),
517
        "12" => array("Aveyron", "12", 12),
358
        "13" => array("Bouches-du-Rhône", "13", 13),
518
        "13" => array("Bouches-du-Rhône", "13", 13),
359
        "14" => array("Calvados", "14", 14),
519
        "14" => array("Calvados", "14", 14),
360
        "15" => array("Cantal", "15", 15),
520
        "15" => array("Cantal", "15", 15),
361
        "16" => array("Charente", "16", 16),
521
        "16" => array("Charente", "16", 16),
362
        "17" => array("Charente-Maritime", "17", 17),
522
        "17" => array("Charente-Maritime", "17", 17),
363
        "18" => array("Cher", "18", 18),
523
        "18" => array("Cher", "18", 18),
364
        "19" => array("Corrèze", "19", 19),
524
        "19" => array("Corrèze", "19", 19),
365
        "20" => array("Corse", "20", 20),
525
        "20" => array("Corse", "20", 20),
366
        "2A" => array("Haute-Corse", "2A", 20),
526
        "2A" => array("Haute-Corse", "2A", 20),
367
        "2B" => array("Corse-du-Sud", "2B", 20),
527
        "2B" => array("Corse-du-Sud", "2B", 20),
368
        "21" => array("Côte-d'Or", "21", 21),
528
        "21" => array("Côte-d'Or", "21", 21),
369
        "22" => array("Côtes-d'Armor", "22", 22),
529
        "22" => array("Côtes-d'Armor", "22", 22),
370
        "23" => array("Creuse", "23", 23),
530
        "23" => array("Creuse", "23", 23),
371
        "24" => array("Dordogne", "24", 24),
531
        "24" => array("Dordogne", "24", 24),
372
        "25" => array("Doubs","25", 25),
532
        "25" => array("Doubs","25", 25),
373
        "26" => array("Drôme", "26", 26),
533
        "26" => array("Drôme", "26", 26),
374
        "27" => array("Eure", "27", 27),
534
        "27" => array("Eure", "27", 27),
375
        "28" => array("Eure-et-Loir", "28", 28),
535
        "28" => array("Eure-et-Loir", "28", 28),
376
        "29" => array("Finistère", "29", 29),
536
        "29" => array("Finistère", "29", 29),
377
        "30" => array("Gard", "30", 30),
537
        "30" => array("Gard", "30", 30),
378
        "31" => array("Haute-Garonne", "31", 31),
538
        "31" => array("Haute-Garonne", "31", 31),
379
        "32" => array("Gers", "32", 32),
539
        "32" => array("Gers", "32", 32),
380
        "33" => array("Gironde", "33", 33),
540
        "33" => array("Gironde", "33", 33),
381
        "34" => array("Hérault", "34", 34),
541
        "34" => array("Hérault", "34", 34),
382
        "35" => array("Ille-et-Vilaine", "35", 35),
542
        "35" => array("Ille-et-Vilaine", "35", 35),
383
        "36" => array("Indre", "36", 36),
543
        "36" => array("Indre", "36", 36),
384
        "37" => array("Indre-et-Loire", "37", 37),
544
        "37" => array("Indre-et-Loire", "37", 37),
385
        "38" => array("Isère", "38", 38),
545
        "38" => array("Isère", "38", 38),
386
        "39" => array("Jura", "39", 39),
546
        "39" => array("Jura", "39", 39),
387
        "40" => array("Landes", "40", 40),
547
        "40" => array("Landes", "40", 40),
388
        "41" => array("Loir-et-Cher", "41", 41),
548
        "41" => array("Loir-et-Cher", "41", 41),
389
        "42" => array("Loire", "42", 42),
549
        "42" => array("Loire", "42", 42),
390
        "43" => array("Haute-Loire", "43", 43),
550
        "43" => array("Haute-Loire", "43", 43),
391
        "44" => array("Loire-Atlantique", "44", 44),
551
        "44" => array("Loire-Atlantique", "44", 44),
392
        "45" => array("Loiret", "45", 45),
552
        "45" => array("Loiret", "45", 45),
393
        "46" => array("Lot", "46", 46),
553
        "46" => array("Lot", "46", 46),
394
        "47" => array("Lot-et-Garonne", "47", 47),
554
        "47" => array("Lot-et-Garonne", "47", 47),
395
        "48" => array("Lozére ", "48", 48),
555
        "48" => array("Lozére ", "48", 48),
396
        "49" => array("Maine-et-Loire", "49", 49),
556
        "49" => array("Maine-et-Loire", "49", 49),
397
        "50" => array("Manche", "50", 50),
557
        "50" => array("Manche", "50", 50),
398
        "51" => array("Marne", "51", 51),
558
        "51" => array("Marne", "51", 51),
399
        "52" => array("Haute-Marne", "52", 52),
559
        "52" => array("Haute-Marne", "52", 52),
400
        "53" => array("Mayenne", "53", 53),
560
        "53" => array("Mayenne", "53", 53),
401
        "54" => array("Meurthe-et-Moselle", "54", 54),
561
        "54" => array("Meurthe-et-Moselle", "54", 54),
402
        "55" => array("Meuse", "55", 55),
562
        "55" => array("Meuse", "55", 55),
403
        "56" => array("Morbihan", "56", 56),
563
        "56" => array("Morbihan", "56", 56),
404
        "57" => array("Moselle", "57", 57),
564
        "57" => array("Moselle", "57", 57),
405
        "58" => array("Nièvre", "58", 58),
565
        "58" => array("Nièvre", "58", 58),
406
        "59" => array("Nord", "59", 59),
566
        "59" => array("Nord", "59", 59),
407
        "60" => array("Oise", "60", 60),
567
        "60" => array("Oise", "60", 60),
408
        "61" => array("Orne", "61", 61),
568
        "61" => array("Orne", "61", 61),
409
        "62" => array("Pas-de-Calais", "62", 62),
569
        "62" => array("Pas-de-Calais", "62", 62),
410
        "63" => array("Puy-de-Dôme", "63", 63),
570
        "63" => array("Puy-de-Dôme", "63", 63),
411
        "64" => array("Pyrénées-Atlantiques", "64", 64),
571
        "64" => array("Pyrénées-Atlantiques", "64", 64),
412
        "65" => array("Hautes-Pyrénées", "65", 65),
572
        "65" => array("Hautes-Pyrénées", "65", 65),
413
        "66" => array("Pyrénées-Orientales", "66", 66),
573
        "66" => array("Pyrénées-Orientales", "66", 66),
414
        "67" => array("Bas-Rhin", "67", 67),
574
        "67" => array("Bas-Rhin", "67", 67),
415
        "68" => array("Haut-Rhin", "68", 68),
575
        "68" => array("Haut-Rhin", "68", 68),
416
        "69" => array("Rhône", "69", 69),
576
        "69" => array("Rhône", "69", 69),
417
        "70" => array("Haute-Saône", "70", 70),
577
        "70" => array("Haute-Saône", "70", 70),
418
        "71" => array("Saône-et-Loire", "71", 71),
578
        "71" => array("Saône-et-Loire", "71", 71),
419
        "72" => array("Sarthe", "72", 72),
579
        "72" => array("Sarthe", "72", 72),
420
        "73" => array("Savoie", "73", 73),
580
        "73" => array("Savoie", "73", 73),
421
        "74" => array("Haute-Savoie", "74", 74),
581
        "74" => array("Haute-Savoie", "74", 74),
422
        "75" => array("Paris", "75", 75),
582
        "75" => array("Paris", "75", 75),
423
        "76" => array("Seine-Maritime", "76", 76),
583
        "76" => array("Seine-Maritime", "76", 76),
424
        "77" => array("Seine-et-Marne", "77", 77),
584
        "77" => array("Seine-et-Marne", "77", 77),
425
        "78" => array("Yvelines", "78", 78),
585
        "78" => array("Yvelines", "78", 78),
426
        "79" => array("Deux-Sèvres", "79", 79),
586
        "79" => array("Deux-Sèvres", "79", 79),
427
        "80" => array("Somme", "80", 80),
587
        "80" => array("Somme", "80", 80),
428
        "81" => array("Tarn", "81", 81),
588
        "81" => array("Tarn", "81", 81),
429
        "82" => array("Tarn-et-Garonne", "82", 82),
589
        "82" => array("Tarn-et-Garonne", "82", 82),
430
        "83" => array("Var", "83", 83),
590
        "83" => array("Var", "83", 83),
431
        "84" => array("Vaucluse", "84", 84),
591
        "84" => array("Vaucluse", "84", 84),
432
        "85" => array("Vendée", "85", 85),
592
        "85" => array("Vendée", "85", 85),
433
        "86" => array("Vienne", "86", 86),
593
        "86" => array("Vienne", "86", 86),
434
        "87" => array("Haute-Vienne", "87", 87),
594
        "87" => array("Haute-Vienne", "87", 87),
435
        "88" => array("Vosges", "88", 88),
595
        "88" => array("Vosges", "88", 88),
436
        "89" => array("Yonne", "89", 89),
596
        "89" => array("Yonne", "89", 89),
437
        "90" => array("Territoire-de-Belfort", "90", 90),
597
        "90" => array("Territoire-de-Belfort", "90", 90),
438
        "91" => array("Essonne", "91", 91),
598
        "91" => array("Essonne", "91", 91),
439
        "92" => array("Hauts-de-Seine", "92", 92),
599
        "92" => array("Hauts-de-Seine", "92", 92),
440
        "93" => array("Seine-Saint-Denis", "93", 93),
600
        "93" => array("Seine-Saint-Denis", "93", 93),
441
        "94" => array("Val-de-Marne", "94", 94),
601
        "94" => array("Val-de-Marne", "94", 94),
442
        "95" => array("Val-d'Oise", "95", 95),
602
        "95" => array("Val-d'Oise", "95", 95),
443
        "96" => array("aaa", "96", 96),
603
        "96" => array("aaa", "96", 96),
444
        "971" => array("Guadeloupe", "971", 971),
604
        "971" => array("Guadeloupe", "971", 971),
445
        "972" => array("Martinique", "972", 972),
605
        "972" => array("Martinique", "972", 972),
446
        "973" => array("Guyane", "973", 973),
606
        "973" => array("Guyane", "973", 973),
447
        "974" => array("Réunion", "974", 974),
607
        "974" => array("Réunion", "974", 974),
448
        "99" => array("Etranger", "99", 99),
608
        "99" => array("Etranger", "99", 99),
449
        );
609
        );
450
 
610
 
451
	static public function get() {
611
	static public function get() {
452
		return self::$departements;
612
		return self::$departements;
453
	}
613
	}
454
 
614
 
455
    static public function getNom($n) {
615
    static public function getNom($n) {
456
		return self::$departements[$n][0];
616
		return self::$departements[$n][0];
457
	}
617
	}
458
 
618
 
459
	static public function getIdChaine($n) {
619
	static public function getIdChaine($n) {
460
		return self::$departements[$n][1];
620
		return self::$departements[$n][1];
461
	}
621
	}
462
 
622
 
463
	static public function getIdNumerique($n) {
623
	static public function getIdNumerique($n) {
464
		return (int)self::$departements[$n][2];
624
		return (int)self::$departements[$n][2];
465
	}
625
	}
466
 
626
 
467
	static public function getIdEflore($n) {
627
	static public function getIdEflore($n) {
468
		return (int)self::$departements[$n][3];
628
		return (int)self::$departements[$n][3];
469
	}
629
	}
470
}
630
}
471
?>
631
?>