Subversion Repositories Applications.referentiel

Rev

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

Rev 254 Rev 255
1
<?php
1
<?php
2
// Encodage : UTF-8
2
// Encodage : UTF-8
3
// +-------------------------------------------------------------------------------------------------------------------+
3
// +-------------------------------------------------------------------------------------------------------------------+
4
/**
4
/**
5
* Tests de référentiels de nomenclature et taxonomie
5
* Tests de référentiels de nomenclature et taxonomie
6
*
6
*
7
* Description : classe permettant de tester les référentiels selon le manuel technique
7
* Description : classe permettant de tester les référentiels selon le manuel technique
8
* Utilisation : php script.php tests -p bdnff -a tout
8
* Utilisation : php script.php tests -p bdnff -a tout
9
*
9
*
10
//Auteur original :
10
//Auteur original :
11
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
* @author       Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
* @copyright	Tela-Botanica 1999-2010
12
* @copyright	Tela-Botanica 1999-2010
13
* @link			http://www.tela-botanica.org/wikini/RTaxMethodo/wakka.php?wiki=MaNuel
13
* @link			http://www.tela-botanica.org/wikini/RTaxMethodo/wakka.php?wiki=MaNuel
14
* @licence		GPL v3 & CeCILL v2
14
* @licence		GPL v3 & CeCILL v2
15
* @version		$Id$
15
* @version		$Id$
16
*/
16
*/
17
// +-------------------------------------------------------------------------------------------------------------------+
17
// +-------------------------------------------------------------------------------------------------------------------+
18
// TODO : supprimer l'utilisation du paramêtres 'p' et chercher les infos depuis la bdd
18
// TODO : supprimer l'utilisation du paramêtres 'p' et chercher les infos depuis la bdd
19
class Tests extends ScriptCommande {
19
class Tests extends ScriptCommande {
20
	
20
	
21
	const SCRIPT_NOM = 'tests';
21
	const SCRIPT_NOM = 'tests';
22
	const MANUEL_VERSION = '4.3';
22
	const MANUEL_VERSION = '4.3';
23
	
23
	
24
	private $projet = null;
24
	private $projet = null;
25
	private $traitement = null;
25
	private $traitement = null;
26
	
26
	
27
	private $manuel = null;
27
	private $manuel = null;
28
	private $manuel_nom = null;
28
	private $manuel_nom = null;
29
	private $manuel_chemin = null;
29
	private $manuel_chemin = null;
30
	private $tests = null;
30
	private $tests = null;
31
	private $colonnes = null;
31
	private $colonnes = null;
32
	private $analyses = null;
32
	private $analyses = null;
33
	private $noms = null;
33
	private $noms = null;
34
	
34
	
35
	private $resultatDao = null;
35
	private $resultatDao = null;
36
	private $traitementDao = null;
36
	private $traitementDao = null;
37
	private $tableStructureDao = null;
37
	private $tableStructureDao = null;
38
	private $referentielDao = null;
38
	private $referentielDao = null;
39
	
39
	
40
	public function executer() {
40
	public function executer() {
41
		$this->manuel_nom = 'mtpr_v'.str_replace('.', '_', self::MANUEL_VERSION).'.pdf';
41
		$this->manuel_nom = 'mtpr_v'.str_replace('.', '_', self::MANUEL_VERSION).'.pdf';
42
		$this->manuel_chemin = Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS;
42
		$this->manuel_chemin = Config::get('chemin_appli').DS.'..'.DS.'configurations'.DS;
43
		
43
		
44
		$manuel_config_nom = 'referentiel_v'.self::MANUEL_VERSION.'.ini';
44
		$manuel_config_nom = 'referentiel_v'.self::MANUEL_VERSION.'.ini';
45
		$this->manuel = parse_ini_file($this->manuel_chemin.$manuel_config_nom);
45
		$this->manuel = parse_ini_file($this->manuel_chemin.$manuel_config_nom);
46
		
46
		
47
		$this->definirConstantes();
47
		$this->definirConstantes();
48
		$this->tests = parse_ini_file($this->getModuleChemin().DS.'configurations'.DS.'tests.ini', true);
48
		$this->tests = parse_ini_file($this->getModuleChemin().DS.'configurations'.DS.'tests.ini', true);
49
		
49
		
50
		$this->resultatDao = new ResultatDao();
50
		$this->resultatDao = new ResultatDao();
51
		$this->traitementDao = new TraitementDao();
51
		$this->traitementDao = new TraitementDao();
52
		Debug::printr('Dans le script test');
52
		Debug::printr('Dans le script test');
53
		// Récupération du dernier traitement demandé
53
		// Récupération du dernier traitement demandé
54
		$this->traitement = $this->traitementDao->getDernierTraitement('tout', self::SCRIPT_NOM);
54
		$this->traitement = $this->traitementDao->getDernierTraitement('tout', self::SCRIPT_NOM);
55
		if (isset($this->traitement)) {
55
		if (isset($this->traitement)) {
56
			$this->projet = $this->traitement['referentiel_code']; // Récupération du nom de projet
56
			$this->projet = $this->traitement['referentiel_code']; // Récupération du nom de projet
57
			Debug::printr($this->traitement);
57
			Debug::printr($this->traitement);
58
			// Écriture de la date de début du traitement
58
			// Écriture de la date de début du traitement
59
			Debug::printr('Debute:'.$this->traitementDao->debuterTraitement($this->traitement['id_traitement']));
59
			Debug::printr('Debute:'.$this->traitementDao->debuterTraitement($this->traitement['id_traitement']));
60
			
60
			
61
			// Nettoyage des traitements obsolètes
61
			// Nettoyage des traitements obsolètes
62
			$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet, self::SCRIPT_NOM);
62
			$traitements_obsoletes = $this->traitementDao->getTraitementsObsoletes($this->projet, self::SCRIPT_NOM);
63
			if (isset($traitements_obsoletes)) {
63
			if (isset($traitements_obsoletes)) {
64
				Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
64
				Debug::printr('Supp. obsoletes:'.$this->traitementDao->supprimer($traitements_obsoletes));
65
			}
65
			}
66
			
66
			
67
			$this->tableStructureDao = new TableStructureDao();
67
			$this->tableStructureDao = new TableStructureDao();
68
			$this->referentielDao = new ReferentielDao();
68
			$this->referentielDao = new ReferentielDao();
69
			
69
			
70
			// Lancement du test demandé
70
			// Lancement du test demandé
71
			$cmd = $this->getParam('a');
71
			$cmd = $this->getParam('a');
72
	    	switch ($cmd) {
72
	    	switch ($cmd) {
73
				case 'tout' :
73
				case 'tout' :
74
					Debug::printr('Départ lancement test:');
74
					Debug::printr('Départ lancement test:');
75
					$this->recupererDonnees();
75
					$this->recupererDonnees();
76
					$this->lancerTestsAuto();
76
					$this->lancerTestsAuto();
77
					break;
77
					break;
78
				case 'test11' :
78
				case 'test11' :
79
					$this->recupererDonnees();
79
					$this->recupererDonnees();
80
					Debug::printr('Départ lancement test 11 :');
80
					Debug::printr('Départ lancement test 11 :');
81
					$this->testerExitenceTaxonSuperieurTransmis();
81
					$this->testerExitenceTaxonSuperieurTransmis();
82
					break;
82
					break;
83
				default :
83
				default :
84
					$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
84
					$this->traiterErreur('Erreur : la commande "%s" n\'existe pas!', array($cmd));
85
			}
85
			}
86
			// Écriture de la date de fin du traitement
86
			// Écriture de la date de fin du traitement
87
			Debug::printr('Termine:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
87
			Debug::printr('Termine:'.$this->traitementDao->terminerTraitement($this->traitement['id_traitement']));
88
		} else {
88
		} else {
89
			Debug::printr("Aucun dernier traitement trouvé pour le script '".self::SCRIPT_NOM."' !");
89
			Debug::printr("Aucun dernier traitement trouvé pour le script '".self::SCRIPT_NOM."' !");
90
		}
90
		}
91
    }
91
    }
92
    
92
    
93
    /**
93
    /**
94
     * Cette méthode définie des constantes qui peuvent ensuite être utilisée dans les fichier ini.
94
     * Cette méthode définie des constantes qui peuvent ensuite être utilisée dans les fichier ini.
95
     * Surtout utile pour le fichier tests.ini
95
     * Surtout utile pour le fichier tests.ini
96
     */
96
     */
97
    private function definirConstantes() {
97
    private function definirConstantes() {
98
    	define('RANG_GENRE', $this->manuel['rang_genre']);
98
    	define('RANG_GENRE', $this->manuel['rang_genre']);
99
    	define('RANG_SP', $this->manuel['rang_sp']);
99
    	define('RANG_SP', $this->manuel['rang_sp']);
100
    	date_default_timezone_set('Europe/Berlin');
100
    	date_default_timezone_set('Europe/Berlin');
101
    	define('ANNEE_EN_COURS', date('Y'));
101
    	define('ANNEE_EN_COURS', date('Y'));
102
    	define('ANNEE_MINIMUM', 1753);
102
    	define('ANNEE_MINIMUM', 1753);
103
    }
103
    }
104
    
104
    
105
    public function recupererDonnees() {
105
    public function recupererDonnees() {
106
		// Récupération des données à tester
106
		// Récupération des données à tester
107
		$this->colonnes = $this->tableStructureDao->getColonnes($this->projet);
107
		$this->colonnes = $this->tableStructureDao->getColonnes($this->projet);
108
		$this->analyses = $this->tableStructureDao->getAnalyse($this->projet);
108
		$this->analyses = $this->tableStructureDao->getAnalyse($this->projet);
109
		$this->noms = $this->referentielDao->getTout($this->projet);
109
		$this->noms = $this->referentielDao->getTout($this->projet);
110
		Debug::printr('Nbre noms :'.count($this->noms));
110
		Debug::printr('Nbre noms :'.count($this->noms));
111
    }
111
    }
112
    
112
    
113
    public function lancerTestsAuto() {
113
    public function lancerTestsAuto() {
114
		$resultats = array();
114
		$resultats = array();
115
 
115
 
116
		// Lancement des tests unitaires
116
		// Lancement des tests unitaires
117
		Debug::printr('Lancement des tests unitaires');
117
		Debug::printr('Lancement des tests unitaires');
118
		$tests_numeros = array_keys($this->tests);
118
		$tests_numeros = array_keys($this->tests);
119
		Debug::printr($tests_numeros);
119
		Debug::printr($tests_numeros);
120
    	foreach ($tests_numeros as &$numero) {
120
    	foreach ($tests_numeros as &$numero) {
121
			$info = $this->getInfosTest($numero);
121
			$info = $this->getInfosTest($numero);
122
    		
122
    		
123
    		if ($numero < 5) {
123
    		if ($numero < 5) {
124
    			// Tests spéciaux vérifiant la structure de la table
124
    			// Tests spéciaux vérifiant la structure de la table
125
    			$resultats[] = $this->lancerTestUnitaire($info);
125
    			$resultats[] = $this->lancerTestUnitaire($info);
126
    		} else if ($numero >= 5 && $this->verifierResultats($resultats)) {		
126
    		} else if ($numero >= 5 && $this->verifierResultats($resultats)) {		
127
				// Si la structure est bonne nous lançons les autres tests
127
				// Si la structure est bonne nous lançons les autres tests
128
				$this->lancerTestUnitaire($info);
128
				$this->lancerTestUnitaire($info);
129
    		}
129
    		}
130
		}
130
		}
131
    }
131
    }
132
	
132
	
133
    private function getInfosTest($numero) {
133
    private function getInfosTest($numero) {
134
		$info = $this->tests[$numero];
134
		$info = $this->tests[$numero];
135
		$info['methode'] = 'tester'.implode('', explode(' ', ucwords($info['abr'])));
135
		$info['methode'] = 'tester'.implode('', explode(' ', ucwords($info['abr'])));
136
		$info['numero'] = $numero;
136
		$info['numero'] = $numero;
137
		$info['nom'] = '#'.$numero.' - '.$info['nom'];
137
		$info['nom'] = '#'.$numero.' - '.$info['nom'];
138
		$info['resultat'] = false;
138
		$info['resultat'] = false;
139
		return $info;
139
		return $info;
140
	}
140
	}
141
    
141
    
142
    public function lancerTestUnitaire($info) {
142
    public function lancerTestUnitaire($info) {
143
		Debug::printr($info['numero'].'::'.$info['methode']);
143
		Debug::printr($info['numero'].'::'.$info['methode']);
144
    	$methodeDeTest = $info['methode'];
144
    	$methodeDeTest = $info['methode'];
145
    	$erreurs = $this->$methodeDeTest();
145
    	$erreurs = $this->$methodeDeTest();
146
    	
146
    	
147
    	// Analyse des résultats
147
    	// Analyse des résultats
148
    	if (isset($erreurs['special'])) {
148
    	if (isset($erreurs['special'])) {
149
    		$info = $erreurs;
149
    		$info = $erreurs;
150
    	} else {
150
    	} else {
151
    		if (count($erreurs) > 0) {
151
    		if (count($erreurs) > 0) {
152
				$info['message']['entete'] = explode(',', $info['entete']);
152
				$info['message']['entete'] = explode(',', $info['entete']);
153
				if (isset($info['title'])) {
153
				if (isset($info['title'])) {
154
					$info['message']['title'] = explode(';', $info['title']);
154
					$info['message']['title'] = explode(';', $info['title']);
155
				}
155
				}
156
				$info['message']['lignes'] = $erreurs;
156
				$info['message']['lignes'] = $erreurs;
157
				unset($erreurs);
157
				unset($erreurs);
158
			} else {
158
			} else {
159
				$info['resultat'] = true;
159
				$info['resultat'] = true;
160
			}
160
			}
161
    	}
161
    	}
162
    	
162
    	
163
		$this->traiterResultatTest($info);
163
		$this->traiterResultatTest($info);
164
		
164
		
165
		if ($info['numero'] < 5) {
165
		if ($info['numero'] < 5) {
166
			return ($info['resultat'] ? '1' : '0');
166
			return ($info['resultat'] ? '1' : '0');
167
		}
167
		}
168
    }
168
    }
169
	
169
	
170
	private function verifierResultats(&$resultats) {
170
	private function verifierResultats(&$resultats) {
171
		$ok = true;
171
		$ok = true;
172
		foreach ($resultats as $resultat) {
172
		foreach ($resultats as $resultat) {
173
			if ($resultat == '0') {
173
			if ($resultat == '0') {
174
				$ok = false;
174
				$ok = false;
175
				break;
175
				break;
176
			}
176
			}
177
		}
177
		}
178
		return $ok;
178
		return $ok;
179
	}
179
	}
180
	
180
	
181
	private function traiterResultatTest($info) {
181
	private function traiterResultatTest($info) {
182
		if (isset($info['message'])) {
182
		if (isset($info['message'])) {
183
			if (is_array($info['message'])) {
183
			if (is_array($info['message'])) {
184
				$erreurs_nbre = count($info['message']['lignes']);
184
				$erreurs_nbre = count($info['message']['lignes']);
185
				$erreurs_max = 1000;
185
				$erreurs_max = 1000;
186
				if ($erreurs_nbre > $erreurs_max) {
186
				if ($erreurs_nbre > $erreurs_max) {
187
					$info['message']['lignes'] = array_slice($info['message']['lignes'], 0, $erreurs_max);
187
					$info['message']['lignes'] = array_slice($info['message']['lignes'], 0, $erreurs_max);
188
					$info['erreur'] = "$erreurs_nbre erreurs ont été détectées seules les $erreurs_max premières sont affichées";
188
					$info['erreur'] = "$erreurs_nbre erreurs ont été détectées seules les $erreurs_max premières sont affichées";
189
				}
189
				}
190
				$info['message'] = $this->getVue('tests/squelettes/message_table', $info);
190
				$info['message'] = $this->getVue('tests/squelettes/message_table', $info);
191
			} else {
191
			} else {
192
				$info['message'] = $this->getVue('tests/squelettes/message_p', $info);
192
				$info['message'] = $this->getVue('tests/squelettes/message_p', $info);
193
			}
193
			}
194
		}
194
		}
195
		Debug::printr($this->resultatDao->ajouter($this->traitement['id_traitement'], $info));
195
		Debug::printr($this->resultatDao->ajouter($this->traitement['id_traitement'], $info));
196
		$info = null;
196
		$info = null;
197
	}
197
	}
198
	
198
	
199
	//+--------------------------------------------------------------------------------------------------------------+//
199
	//+--------------------------------------------------------------------------------------------------------------+//
200
	// TESTS
200
	// TESTS
201
	
201
	
202
	/**
202
	/**
203
	 * Test #01
203
	 * Test #01
204
	 */
204
	 */
205
	private function testerNombreDeChamps() {
205
	private function testerNombreDeChamps() {
206
		$info = $this->getInfosTest(1);
206
		$info = $this->getInfosTest(1);
207
		$info['special'] = true;
207
		$info['special'] = true;
208
		
208
		
209
		$nbre_colonnes = count($this->colonnes);
209
		$nbre_colonnes = count($this->colonnes);
210
		$info['message'] = $nbre_colonnes;
210
		$info['message'] = $nbre_colonnes;
211
		if ($nbre_colonnes >= 35) {
211
		if ($nbre_colonnes >= 35) {
212
			$info['resultat'] = true;
212
			$info['resultat'] = true;
213
		}
213
		}
214
		
214
		
215
		return $info;
215
		return $info;
216
	}
216
	}
217
	
217
	
218
	/**
218
	/**
219
	 * Test #02
219
	 * Test #02
220
	 */
220
	 */
221
	private function testerNomDesChamps() {
221
	private function testerNomDesChamps() {
222
		$info = $this->getInfosTest(2);
222
		$info = $this->getInfosTest(2);
223
		$info['special'] = true;
223
		$info['special'] = true;
224
		
224
		
225
		$champs_attendus = explode(',', $this->manuel['champs']);
225
		$champs_attendus = explode(',', $this->manuel['champs']);
226
		$champs_presents = array();
226
		$champs_presents = array();
227
		foreach ($this->colonnes as &$colonne) {
227
		foreach ($this->colonnes as &$colonne) {
228
			$champs_presents[$colonne['Field']] = $colonne;
228
			$champs_presents[$colonne['Field']] = $colonne;
229
		}
229
		}
230
		
230
		
231
		$ok = true;
231
		$ok = true;
232
		$champs_manquant = array(); 
232
		$champs_manquant = array(); 
233
		foreach ($champs_attendus as &$champ_attendu) {
233
		foreach ($champs_attendus as &$champ_attendu) {
234
			if (!isset($champs_presents[$champ_attendu])) {
234
			if (!isset($champs_presents[$champ_attendu])) {
235
				$champs_manquant[] = $champ_attendu; 
235
				$champs_manquant[] = $champ_attendu; 
236
				$ok = false;
236
				$ok = false;
237
			}
237
			}
238
		}
238
		}
239
		
239
		
240
		$info['resultat'] = $ok;
240
		$info['resultat'] = $ok;
241
		if (!$ok) {
241
		if (!$ok) {
242
			$info['message'] = sprintf($info['message'], implode(', ', $champs_manquant));
242
			$info['message'] = sprintf($info['message'], implode(', ', $champs_manquant));
243
		}
243
		}
244
		
244
		
245
		return $info;
245
		return $info;
246
	}
246
	}
247
	
247
	
248
	/**
248
	/**
249
	 * Test #03
249
	 * Test #03
250
	 */
250
	 */
251
	private function testerTypeDesChamps() {
251
	private function testerTypeDesChamps() {
252
		$champs_attendus = explode(',', $this->manuel['champs_type']);
252
		$champs_attendus = explode(',', $this->manuel['champs_type']);
253
		$champs_presents = array();
253
		$champs_presents = array();
254
		foreach ($this->colonnes as &$colonne) {
254
		foreach ($this->colonnes as &$colonne) {
255
			$champs_presents[$colonne['Field']] = $colonne['Type'];
255
			$champs_presents[$colonne['Field']] = $colonne['Type'];
256
		}
256
		}
257
		
257
		
258
		// Recercherche des erreurs
258
		// Recercherche des erreurs
259
		$champs_erreur = array(); 
259
		$champs_erreur = array(); 
260
		foreach ($champs_attendus as &$champ_attendu) {
260
		foreach ($champs_attendus as &$champ_attendu) {
261
			list($champ_attendu_nom, $champ_attendu_type_taille) = explode('=', trim($champ_attendu));
261
			list($champ_attendu_nom, $champ_attendu_type_taille) = explode('=', trim($champ_attendu));
262
			list($champ_attendu_type, $champ_attendu_taille) = explode('|', trim($champ_attendu_type_taille));
262
			list($champ_attendu_type, $champ_attendu_taille) = explode('|', trim($champ_attendu_type_taille));
263
			
263
			
264
			if (isset($champs_presents[$champ_attendu_nom])) {
264
			if (isset($champs_presents[$champ_attendu_nom])) {
265
				$champs_present_type = $champs_presents[$champ_attendu_nom];
265
				$champs_present_type = $champs_presents[$champ_attendu_nom];
266
				
266
				
267
				if (($champ_attendu_type == 'VARCHAR' && strstr($champs_present_type, 'varchar') === false)
267
				if (($champ_attendu_type == 'VARCHAR' && strstr($champs_present_type, 'varchar') === false)
268
					|| ($champ_attendu_type == 'TEXT' && strstr($champs_present_type, 'text') === false)
268
					|| ($champ_attendu_type == 'TEXT' && strstr($champs_present_type, 'text') === false)
269
					|| ($champ_attendu_type == 'INT' && strstr($champs_present_type, 'int') === false) 
269
					|| ($champ_attendu_type == 'INT' && strstr($champs_present_type, 'int') === false) 
270
					|| ($champ_attendu_type == 'BOOL' && preg_match('/(?:bool|boolean|tinyint\(1\))/i', $champs_present_type) === false)) {
270
					|| ($champ_attendu_type == 'BOOL' && preg_match('/(?:bool|boolean|tinyint\(1\))/i', $champs_present_type) === false)) {
271
					$champs_erreur[] = array($champ_attendu, $champ_attendu_type, $champs_present_type);
271
					$champs_erreur[] = array($champ_attendu, $champ_attendu_type, $champs_present_type);
272
				}
272
				}
273
			}
273
			}
274
		}
274
		}
275
		return $champs_erreur;
275
		return $champs_erreur;
276
	}
276
	}
277
	
277
	
278
	/**
278
	/**
279
	 * Test #04
279
	 * Test #04
280
	 */
280
	 */
281
	private function testerNumNomClePrimaire() {
281
	private function testerNumNomClePrimaire() {
282
		$info = $this->getInfosTest(4);
282
		$info = $this->getInfosTest(4);
283
		$info['special'] = true;
283
		$info['special'] = true;
284
		
284
		
285
		foreach ($this->colonnes as &$colonne) {
285
		foreach ($this->colonnes as &$colonne) {
286
			if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
286
			if ($colonne['Field'] == 'num_nom' && $colonne['Key'] == 'PRI') {
287
				$info['resultat'] = true;
287
				$info['resultat'] = true;
288
				break;
288
				break;
289
			}
289
			}
290
		}
290
		}
291
		return $info;
291
		return $info;
292
	}
292
	}
293
	
293
	
294
	
294
	
295
	/**
295
	/**
296
	 * Test #05
296
	 * Test #05
297
	 */
297
	 */
298
	private function testerTailleDesChamps() {
298
	private function testerTailleDesChamps() {
299
		$tailles_champs_maxi = array();
299
		$tailles_champs_maxi = array();
300
		foreach ($this->colonnes as &$colonne) {
300
		foreach ($this->colonnes as &$colonne) {
301
			if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
301
			if (preg_match('/^varchar\(([0-9]+)\)$/', $colonne['Type'], $match)) {
302
				$tailles_champs_maxi[$colonne['Field']] = $match[1];
302
				$tailles_champs_maxi[$colonne['Field']] = $match[1];
303
			}
303
			}
304
		}
304
		}
305
		
305
		
306
		$tailles_trouvees = array();
306
		$tailles_trouvees = array();
307
		foreach ($this->analyses as &$analyse) {
307
		foreach ($this->analyses as &$analyse) {
308
			if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
308
			if (preg_match('/\.([^.]+)$/', $analyse['Field_name'], $match)) {
309
				$tailles_trouvees[$match[1]] = $analyse['Max_length'];
309
				$tailles_trouvees[$match[1]] = $analyse['Max_length'];
310
			}
310
			}
311
		}
311
		}
312
		
312
		
313
		$champs_erreur = array();
313
		$champs_erreur = array();
314
		$champs_attendus = explode(',', $this->manuel['champs']);
314
		$champs_attendus = explode(',', $this->manuel['champs']);
315
		foreach ($champs_attendus as &$champ_attendu) {
315
		foreach ($champs_attendus as &$champ_attendu) {
316
			if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
316
			if (isset($tailles_champs_maxi[$champ_attendu]) && isset($tailles_trouvees[$champ_attendu])) {
317
				if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
317
				if ($tailles_champs_maxi[$champ_attendu] == $tailles_trouvees[$champ_attendu]) {
318
					$champs_erreur[] = array($champ_attendu, $tailles_champs_maxi[$champ_attendu], $tailles_trouvees[$champ_attendu]);
318
					$champs_erreur[] = array($champ_attendu, $tailles_champs_maxi[$champ_attendu], $tailles_trouvees[$champ_attendu]);
319
				}
319
				}
320
			}
320
			}
321
		}
321
		}
322
		return $champs_erreur;
322
		return $champs_erreur;
323
	}
323
	}
324
		
324
		
325
	/**
325
	/**
326
	 * Test #06
326
	 * Test #06
327
	 */
327
	 */
328
	private function testerNumNomSuperieurAZero() {
328
	private function testerNumNomSuperieurAZero() {
329
		$noms_erreur = array();
329
		$noms_erreur = array();
330
		foreach ($this->noms as &$nom) {
330
		foreach ($this->noms as &$nom) {
331
			if ($nom['num_nom'] <= 0) {
331
			if ($nom['num_nom'] <= 0) {
332
				$noms_erreur[] = array($nom['num_nom']);
332
				$noms_erreur[] = array($nom['num_nom']);
333
			}
333
			}
334
		}
334
		}
335
		return $noms_erreur;
335
		return $noms_erreur;
336
	}
336
	}
337
	
337
	
338
	/**
338
	/**
339
	 * Test #07
339
	 * Test #07
340
	 */
340
	 */
341
	private function testerNumNomRetenuSuperieurAZero() {
341
	private function testerNumNomRetenuSuperieurAZero() {
342
		$noms_erreur = array();
342
		$noms_erreur = array();
343
		foreach ($this->noms as &$nom) {
343
		foreach ($this->noms as &$nom) {
344
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
344
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] <= 0) {
345
				$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']);
345
				$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu']);
346
			}
346
			}
347
		}
347
		}
348
		return $noms_erreur;
348
		return $noms_erreur;
349
	}
349
	}
350
	
350
	
351
	/**
351
	/**
352
	 * Test #08
352
	 * Test #08
353
	 */
353
	 */
354
	private function testerExistenceNumNomRetenu() {
354
	private function testerExistenceNumNomRetenu() {
355
		$noms_erreur = array();
355
		$noms_erreur = array();
356
		foreach ($this->noms as &$nom) {
356
		foreach ($this->noms as &$nom) {
357
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] != $nom['num_nom']) {
357
			if ($nom['num_nom_retenu'] != '' && $nom['num_nom_retenu'] != $nom['num_nom']) {
358
				if ($nom['num_nom_retenu'] != 0 && !isset($this->noms[$nom['num_nom_retenu']])) {
358
				if ($nom['num_nom_retenu'] != 0 && !isset($this->noms[$nom['num_nom_retenu']])) {
359
					$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $nom['exclure_taxref']);
359
					$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $nom['exclure_taxref']);
360
				} 
360
				} 
361
			}
361
			}
362
		}
362
		}
363
		return $noms_erreur;
363
		return $noms_erreur;
364
	}
364
	}
365
	
365
	
366
	/**
366
	/**
367
	 * Test #09
367
	 * Test #09
368
	 */
368
	 */
369
	private function testerTransmissionNumNomRetenu() {
369
	private function testerTransmissionNumNomRetenu() {
370
		$noms_erreur = array();
370
		$noms_erreur = array();
371
		foreach ($this->noms as &$nom) {
371
		foreach ($this->noms as &$nom) {
372
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
372
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
373
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
373
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
374
					if ($this->noms[$nom['num_nom_retenu']]['exclure_taxref'] != 0) {
374
					if ($this->noms[$nom['num_nom_retenu']]['exclure_taxref'] != 0) {
375
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['exclure_taxref']);
375
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['exclure_taxref']);
376
					}
376
					}
377
				} 
377
				} 
378
			}
378
			}
379
		}
379
		}
380
		return $noms_erreur;
380
		return $noms_erreur;
381
	}
381
	}
382
	
382
	
383
	/**
383
	/**
384
	 * Test #10
384
	 * Test #10
385
	 */
385
	 */
386
	private function testerSynonymeNumNomRetenu() {
386
	private function testerSynonymeNumNomRetenu() {
387
		$noms_erreur = array();
387
		$noms_erreur = array();
388
		foreach ($this->noms as &$nom) {
388
		foreach ($this->noms as &$nom) {
389
			if ($nom['num_nom_retenu'] != $nom['num_nom']) {
389
			if ($nom['num_nom_retenu'] != $nom['num_nom']) {
390
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
390
				if ($nom['num_nom_retenu'] != 0 && isset($this->noms[$nom['num_nom_retenu']])) {
391
					if ($this->noms[$nom['num_nom_retenu']]['num_nom'] != $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']) {
391
					if ($this->noms[$nom['num_nom_retenu']]['num_nom'] != $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']) {
392
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']);
392
						$noms_erreur[] = array($nom['num_nom'], $nom['num_nom_retenu'], $this->noms[$nom['num_nom_retenu']]['num_nom_retenu']);
393
					}
393
					}
394
				} 
394
				} 
395
			}
395
			}
396
		}
396
		}
397
		return $noms_erreur;
397
		return $noms_erreur;
398
	}
398
	}
399
	
399
	
400
	
400
	
401
	/**
401
	/**
402
	 * Test #11
402
	 * Test #11
403
	 */
403
	 */
404
	private function testerNumTaxSupEgalZeroUnique() {
404
	private function testerNumTaxSupEgalZeroUnique() {
405
		$noms_erreur = array();
405
		$noms_erreur = array();
406
		foreach ($this->noms as &$nom) {
406
		foreach ($this->noms as &$nom) {
407
			if (preg_match('/^0$/', $nom['num_tax_sup'])) {
407
			if (preg_match('/^0$/', $nom['num_tax_sup'])) {
408
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
408
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup']);
409
			}
409
			}
410
		}
410
		}
411
		// Ce test est spécial car le nombre de noms en erreurs doit être supérieur à 1 et non à 0 pour être KO.
411
		// Ce test est spécial car le nombre de noms en erreurs doit être supérieur à 1 et non à 0 pour être KO.
412
		if (count($noms_erreur) == 1) {
412
		if (count($noms_erreur) == 1) {
413
			$noms_erreur = array();
413
			$noms_erreur = array();
414
		}
414
		}
415
		return $noms_erreur;
415
		return $noms_erreur;
416
	}
416
	}
417
	
417
	
418
	/**
418
	/**
419
	 * Test #12
419
	 * Test #12
420
	 */
420
	 */
421
	private function testerTaxSupPourTaxon() {
421
	private function testerTaxSupPourTaxon() {
422
		$noms_erreur = array();
422
		$noms_erreur = array();
423
		foreach ($this->noms as &$nom) {
423
		foreach ($this->noms as &$nom) {
424
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
424
			if ($nom['num_nom_retenu'] != $nom['num_nom'] && $nom['num_tax_sup'] != '') {
425
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']); 
425
				$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']); 
426
			}
426
			}
427
		}
427
		}
428
		return $noms_erreur;
428
		return $noms_erreur;
429
	}
429
	}
430
	
430
	
431
	/**
431
	/**
432
	 * Test #13
432
	 * Test #13
433
	 */
433
	 */
434
	private function testerExistenceTaxonSuperieur() {
434
	private function testerExistenceTaxonSuperieur() {
435
		$noms_erreur = array();
435
		$noms_erreur = array();
436
		foreach ($this->noms as &$nom) {
436
		foreach ($this->noms as &$nom) {
437
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
437
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
438
				if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
438
				if ($nom['num_tax_sup'] != 0 && !isset($this->noms[$nom['num_tax_sup']])) {
439
					$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']);
439
					$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $nom['exclure_taxref']);
440
				} 
440
				} 
441
			}
441
			}
442
		}
442
		}
443
		return $noms_erreur;
443
		return $noms_erreur;
444
	}
444
	}
445
	
445
	
446
	/**
446
	/**
447
	 * Test #14
447
	 * Test #14
448
	 */
448
	 */
449
	private function testerTransmissionTaxonSuperieur() {
449
	private function testerTransmissionTaxonSuperieur() {
450
		$noms_erreur = array();
450
		$noms_erreur = array();
451
		foreach ($this->noms as &$nom) {
451
		foreach ($this->noms as &$nom) {
452
			if ($nom['num_nom_retenu'] == $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
452
			if ($nom['num_nom_retenu'] == $nom['num_nom'] && $nom['exclure_taxref'] == 0) {
453
				if ($nom['num_tax_sup'] != 0 && isset($this->noms[$nom['num_tax_sup']])) {
453
				if ($nom['num_tax_sup'] != 0 && isset($this->noms[$nom['num_tax_sup']])) {
454
					if ($this->noms[$nom['num_tax_sup']]['exclure_taxref'] != 0) {
454
					if ($this->noms[$nom['num_tax_sup']]['exclure_taxref'] != 0) {
455
						$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $this->noms[$nom['num_tax_sup']]['exclure_taxref']);
455
						$noms_erreur[] = array($nom['num_nom'], $nom['num_tax_sup'], $this->noms[$nom['num_tax_sup']]['exclure_taxref']);
456
					}
456
					}
457
				} 
457
				} 
458
			}
458
			}
459
		}
459
		}
460
		return $noms_erreur;
460
		return $noms_erreur;
461
	}
461
	}
462
	
462
	
463
	
463
	
464
	/**
464
	/**
465
	 * Test #15
465
	 * Test #15
466
	 */
466
	 */
467
	private function testerClassificationRang() {
467
	private function testerClassificationRang() {
468
		$noms_erreur = array();
468
		$noms_erreur = array();
469
		foreach ($this->noms as &$nom) {
469
		foreach ($this->noms as &$nom) {
470
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
470
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
471
				if (isset($this->noms[$nom['num_tax_sup']])) {
471
				if (isset($this->noms[$nom['num_tax_sup']])) {
472
					$nom_sup = $this->noms[$nom['num_tax_sup']];
472
					$nom_sup = $this->noms[$nom['num_tax_sup']];
473
					if ($nom_sup['rang'] >= $nom['rang']) {
473
					if ($nom_sup['rang'] >= $nom['rang']) {
474
						// Prise en compte de l'exception des clades
474
						// Prise en compte de l'exception des clades
475
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
475
						if (! ($nom_sup['rang'] == 70 && $nom['rang'] == 70)) {
476
							$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom_sup['num_nom'], $nom_sup['rang'], $nom['exclure_taxref']);
476
							$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom_sup['num_nom'], $nom_sup['rang'], $nom['exclure_taxref']);
477
						}
477
						}
478
					}
478
					}
479
				}
479
				}
480
			}
480
			}
481
		}
481
		}
482
		return $noms_erreur;
482
		return $noms_erreur;
483
	}
483
	}
484
	
484
	
485
	/**
485
	/**
486
	 * Test #16
486
	 * Test #16
487
	 */
487
	 */
488
	private function testerClassification() {
488
	private function testerClassification() {
489
		$noms_erreur = array();
489
		$noms_erreur = array();
490
		$this->noms_ok = array();
490
		$this->noms_ok = array();
491
		foreach ($this->noms as &$nom) {
491
		foreach ($this->noms as &$nom) {
492
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
492
			if ($nom['num_nom_retenu'] == $nom['num_nom']) {
493
				if (isset($this->noms_ok[$nom['num_tax_sup']])) {
493
				if (isset($this->noms_ok[$nom['num_tax_sup']])) {
494
					$this->noms_ok[$nom['num_nom']] = true;
494
					$this->noms_ok[$nom['num_nom']] = true;
495
				} else {
495
				} else {
496
					$this->detection_boucle_infini = array();
496
					$this->detection_boucle_infini = array();
497
					$classif_ok = $this->remonterClassif($nom);
497
					$classif_ok = $this->remonterClassif($nom);
498
					unset($this->detection_boucle_infini); 
498
					unset($this->detection_boucle_infini); 
499
					
499
					
500
					if ($classif_ok === true) {
500
					if ($classif_ok === true) {
501
						$this->noms_ok[$nom['num_nom']] = $classif_ok;
501
						$this->noms_ok[$nom['num_nom']] = $classif_ok;
502
					} else {
502
					} else {
503
						$noms_erreur[] = array($nom['num_nom'], $classif_ok, $nom['exclure_taxref']);
503
						$noms_erreur[] = array($nom['num_nom'], $classif_ok, $nom['exclure_taxref']);
504
					}
504
					}
505
				}
505
				}
506
			}
506
			}
507
		}
507
		}
508
		unset($this->noms_ok);
508
		unset($this->noms_ok);
509
		return $noms_erreur;
509
		return $noms_erreur;
510
	}
510
	}
511
	
511
	
512
	private function remonterClassif(&$nom) {
512
	private function remonterClassif(&$nom) {
513
		$this->detection_boucle_infini[$nom['num_nom']] = true;
513
		$this->detection_boucle_infini[$nom['num_nom']] = true;
514
		if (preg_match('/^[0-9]*$/', $nom['num_tax_sup'])) {
514
		if (preg_match('/^[0-9]*$/', $nom['num_tax_sup'])) {
515
			if (isset($this->noms_ok[$nom['num_tax_sup']])) {
515
			if (isset($this->noms_ok[$nom['num_tax_sup']])) {
516
				$this->noms_ok[$nom['num_nom']] = true;
516
				$this->noms_ok[$nom['num_nom']] = true;
517
				return true;
517
				return true;
518
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
518
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] == '0') {
519
				$this->noms_ok[$nom['num_nom']] = true;
519
				$this->noms_ok[$nom['num_nom']] = true;
520
				return true;
520
				return true;
521
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
521
			} else if (!isset($this->noms[$nom['num_tax_sup']]) && $nom['num_tax_sup'] != '0') {
522
				return 'Hiérarchie avec le taxon #'.$nom['num_nom'].' ayant un taxon superieur #'.$nom['num_tax_sup'].' inexistant';
522
				return 'Hiérarchie avec le taxon #'.$nom['num_nom'].' ayant un taxon superieur #'.$nom['num_tax_sup'].' inexistant';
523
			} else if (isset($this->detection_boucle_infini[$nom['num_tax_sup']])) {
523
			} else if (isset($this->detection_boucle_infini[$nom['num_tax_sup']])) {
524
				return 'Boucle infinie pour le taxon #'.$nom['num_tax_sup'];
524
				return 'Boucle infinie pour le taxon #'.$nom['num_tax_sup'];
525
			} else {
525
			} else {
526
				$retour = $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
526
				$retour = $this->remonterClassif($this->noms[$nom['num_tax_sup']]);
527
				if ($retour === true) {
527
				if ($retour === true) {
528
					$this->noms_ok[$nom['num_tax_sup']] = true;
528
					$this->noms_ok[$nom['num_tax_sup']] = true;
529
				}
529
				}
530
				return $retour;
530
				return $retour;
531
			}
531
			}
532
		} else {
532
		} else {
533
			return 'Valeur num_tax_sup incorrecte : '.$nom['num_tax_sup'];
533
			return 'Valeur num_tax_sup incorrecte : '.$nom['num_tax_sup'];
534
		}
534
		}
535
	}
535
	}
536
	
536
	
537
	/**
537
	/**
538
	 * Test #17
538
	 * Test #17
539
	 */
539
	 */
540
	private function testerRang() {
540
	private function testerRang() {
541
		$rangs = array_flip(explode(',', $this->manuel['rangs']));
541
		$rangs = array_flip(explode(',', $this->manuel['rangs']));
542
		
542
		
543
		// Réalisation du test
543
		// Réalisation du test
544
		$noms_erreur = array();
544
		$noms_erreur = array();
545
		foreach ($this->noms as &$nom) {
545
		foreach ($this->noms as &$nom) {
546
			if (!isset($rangs[$nom['rang']])) {
546
			if (!isset($rangs[$nom['rang']])) {
547
				$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom['exclure_taxref']);
547
				$noms_erreur[] = array($nom['num_nom'], $nom['rang'], $nom['exclure_taxref']);
548
			}
548
			}
549
		}
549
		}
550
		return $noms_erreur;
550
		return $noms_erreur;
551
	}
551
	}
552
	
552
	
553
	/**
553
	/**
554
	 * Test #18
554
	 * Test #18
555
	 */
555
	 */
556
	private function testerNomCompletSupraGenerique() {
556
	private function testerNomCompletSupraGenerique() {
557
		$noms_erreur = array();
557
		$noms_erreur = array();
558
		foreach ($this->noms as &$nom) {
558
		foreach ($this->noms as &$nom) {
559
			if ($nom['rang'] < $this->manuel['rang_genre']) {
559
			if ($nom['rang'] < $this->manuel['rang_genre']) {
560
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
560
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
561
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['nom_supra_generique']);
561
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['nom_supra_generique']);
562
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
562
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
563
				if ($nom['nom_sci'] != $nom_sci_ideal) {
563
				if ($nom['nom_sci'] != $nom_sci_ideal) {
564
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
564
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
565
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
565
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
566
				}
566
				}
567
			}
567
			}
568
		}
568
		}
569
		return $noms_erreur;
569
		return $noms_erreur;
570
	}
570
	}
571
	
571
	
572
	/**
572
	/**
573
	 * Test #19
573
	 * Test #19
574
	 */
574
	 */
575
	private function testerNomCompletGenre() {
575
	private function testerNomCompletGenre() {
576
		$noms_erreur = array();
576
		$noms_erreur = array();
577
		foreach ($this->noms as &$nom) {
577
		foreach ($this->noms as &$nom) {
578
			if ($nom['rang'] == $this->manuel['rang_genre']) {
578
			if ($nom['rang'] == $this->manuel['rang_genre']) {
579
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
579
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
580
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
580
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']);
581
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
581
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
582
				if ($nom['nom_sci'] != $nom_sci_ideal) {
582
				if ($nom['nom_sci'] != $nom_sci_ideal) {
583
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
583
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
584
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
584
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
585
				}
585
				}
586
			}
586
			}
587
		}
587
		}
588
		return $noms_erreur;
588
		return $noms_erreur;
589
	}
589
	}
590
	
590
	
591
	/**
591
	/**
592
	 * Test #20
592
	 * Test #20
593
	 */
593
	 */
594
	private function testerNomCompletInfraGenre() {
594
	private function testerNomCompletInfraGenre() {
595
		$noms_erreur = array();
595
		$noms_erreur = array();
596
		foreach ($this->noms as &$nom) {
596
		foreach ($this->noms as &$nom) {
597
			if ($nom['rang'] > $this->manuel['rang_genre'] && $nom['rang'] < $this->manuel['rang_sp']) {
597
			if ($nom['rang'] > $this->manuel['rang_genre'] && $nom['rang'] < $this->manuel['rang_sp']) {
598
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
598
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
599
				$nom_sci_ideal = '';
599
				$nom_sci_ideal = '';
600
				if ($nom['type_epithete'] == 'agg.') {
600
				if ($nom['type_epithete'] == 'agg.') {
601
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
601
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
602
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']).' '.
602
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']).' '.
603
						$nom['type_epithete'];
603
						$nom['type_epithete'];
604
				} else {
604
				} else {
605
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
605
					$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
606
						$nom['type_epithete'].' '.
606
						$nom['type_epithete'].' '.
607
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']);
607
						$this->formaterStyleNomGenre($nom['epithete_infra_generique']);
608
				}
608
				}
609
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
609
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
610
				if ($nom['nom_sci'] != $nom_sci_ideal) {
610
				if ($nom['nom_sci'] != $nom_sci_ideal) {
611
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
611
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
612
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
612
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $nom['exclure_taxref']);
613
				}
613
				}
614
			}
614
			}
615
		}
615
		}
616
		return $noms_erreur;
616
		return $noms_erreur;
617
	}
617
	}
618
	
618
	
619
	/**
619
	/**
620
	 * Test #21
620
	 * Test #21
621
	 */
621
	 */
622
	private function testerNomCompletEspece() {
622
	private function testerNomCompletEspece() {
623
		$noms_erreur = array();
623
		$noms_erreur = array();
624
		$erreur = '';
624
		$erreur = '';
625
		foreach ($this->noms as &$nom) {
625
		foreach ($this->noms as &$nom) {
626
			if ($nom['rang'] == $this->manuel['rang_sp']) {
626
			if ($nom['rang'] == $this->manuel['rang_sp']) {
627
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
627
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
628
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' ';
628
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' ';
629
				if (strstr($nom['nom_sci'] , ' x ') != false) {
629
				if (strstr($nom['nom_sci'] , ' x ') != false) {
630
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteSpHybride($nom_sci_ideal, $nom['epithete_sp']);
630
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteSpHybride($nom_sci_ideal, $nom['epithete_sp']);
631
				} else {
631
				} else {
632
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
632
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_sp'])));
633
				}
633
				}
634
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
634
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
635
				$nom_sci_ideal = trim($nom_sci_ideal);
635
				$nom_sci_ideal = trim($nom_sci_ideal);
636
				if ($nom['nom_sci'] != $nom_sci_ideal) {
636
				if ($nom['nom_sci'] != $nom_sci_ideal) {
637
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
637
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
638
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
638
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
639
				}
639
				}
640
			}
640
			}
641
		}
641
		}
642
		return $noms_erreur;
642
		return $noms_erreur;
643
	}
643
	}
644
	
644
	
645
	/**
645
	/**
646
	 * Test #22
646
	 * Test #22
647
	 */
647
	 */
648
	private function testerNomCompletInfraSpecifique() {
648
	private function testerNomCompletInfraSpecifique() {
649
		$noms_erreur = array();
649
		$noms_erreur = array();
650
		$erreur = null;
650
		$erreur = null;
651
		foreach ($this->noms as &$nom) {
651
		foreach ($this->noms as &$nom) {
652
			if ($nom['rang'] > $this->manuel['rang_sp']) {
652
			if ($nom['rang'] > $this->manuel['rang_sp']) {
653
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
653
				$nom_sci_ideal = $this->formaterStyleNomGenre($nom['genre']).' '.
654
					utf8_encode(strtolower(utf8_decode($nom['epithete_sp']))).' '.
654
					utf8_encode(strtolower(utf8_decode($nom['epithete_sp']))).' '.
655
					utf8_encode(strtolower(utf8_decode($nom['type_epithete']))).' ';
655
					utf8_encode(strtolower(utf8_decode($nom['type_epithete']))).' ';
656
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
656
				$suffixe_plte_cultivee = $this->construireSuffixeNomPltCultivee($nom);
657
				if (strstr($nom['nom_sci'] , ' x ') != false) {
657
				if (strstr($nom['nom_sci'] , ' x ') != false) {
658
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteInfraSpHybride($nom_sci_ideal, $nom['epithete_infra_sp'], $nom['genre']);
658
					list($nom_sci_ideal, $erreur) = $this->formaterStyleEpitheteInfraSpHybride($nom_sci_ideal, $nom['epithete_infra_sp'], $nom['genre']);
659
				} else {
659
				} else {
660
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp'])));
660
					$nom_sci_ideal .= utf8_encode(strtolower(utf8_decode($nom['epithete_infra_sp'])));
661
				}
661
				}
662
				$nom_sci_ideal = trim($nom_sci_ideal);
662
				$nom_sci_ideal = trim($nom_sci_ideal);
663
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
663
				$nom_sci_ideal .= ($suffixe_plte_cultivee != '' ? ' '.$suffixe_plte_cultivee : '');
664
				if ($nom['nom_sci'] != $nom_sci_ideal) {
664
				if ($nom['nom_sci'] != $nom_sci_ideal) {
665
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
665
					$nom_sci_traite = $this->repererEspace($nom['nom_sci']);
666
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
666
					$noms_erreur[] = array($nom['num_nom'], $nom_sci_traite, $nom_sci_ideal, $erreur, $nom['exclure_taxref']);
667
				}
667
				}
668
			}
668
			}
669
		}
669
		}
670
		return $noms_erreur;
670
		return $noms_erreur;
671
	}
671
	}
672
	
672
	
673
	/**
673
	/**
674
	 * Test #23
674
	 * Test #23
675
	 */
675
	 */
676
	private function testerNomSupraGeneriqueEspaces() {
676
	private function testerNomSupraGeneriqueEspaces() {
677
		$noms_erreur = array();
677
		$noms_erreur = array();
678
		foreach ($this->noms as &$nom) {
678
		foreach ($this->noms as &$nom) {
679
			if ($nom['nom_supra_generique'] != '') {
679
			if ($nom['nom_supra_generique'] != '') {
680
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
680
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s+$)/', $nom['nom_supra_generique'])) {
681
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
681
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
682
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
682
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
683
				}
683
				}
684
			}
684
			}
685
		}
685
		}
686
		return $noms_erreur;
686
		return $noms_erreur;
687
	}
687
	}
688
	
688
	
689
	/**
689
	/**
690
	 * Test #24
690
	 * Test #24
691
	 */
691
	 */
692
	private function testerNomSupraGeneriqueSyntaxe() {
692
	private function testerNomSupraGeneriqueSyntaxe() {
693
		$noms_erreur = array();
693
		$noms_erreur = array();
694
		foreach ($this->noms as &$nom) {
694
		foreach ($this->noms as &$nom) {
695
			if ($nom['nom_supra_generique'] != '') {
695
			if ($nom['nom_supra_generique'] != '') {
696
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
696
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+$/', $nom['nom_supra_generique'])) {
697
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
697
					$nom_supra_generique_traite = $this->repererEspace($nom['nom_supra_generique']);
698
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
698
					$noms_erreur[] = array($nom['num_nom'], $nom_supra_generique_traite, $nom['exclure_taxref']);
699
				}
699
				}
700
			}
700
			}
701
		}
701
		}
702
		return $noms_erreur;
702
		return $noms_erreur;
703
	}
703
	}
704
	
704
	
705
	/**
705
	/**
706
	 * Test #25
706
	 * Test #25
707
	 */
707
	 */
708
	private function testerNomSupraGeneriqueRang() {
708
	private function testerNomSupraGeneriqueRang() {
709
		$noms_erreur = array();
709
		$noms_erreur = array();
710
		foreach ($this->noms as &$nom) {
710
		foreach ($this->noms as &$nom) {
711
			if ($nom['nom_supra_generique'] != '') {
711
			if ($nom['nom_supra_generique'] != '') {
712
				if ($nom['rang'] >= $this->manuel['rang_genre']) {
712
				if ($nom['rang'] >= $this->manuel['rang_genre']) {
713
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
713
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
714
				}
714
				}
715
			}
715
			}
716
		}
716
		}
717
		return $noms_erreur;
717
		return $noms_erreur;
718
	}
718
	}
719
	
719
	
720
	/**
720
	/**
721
	 * Test #26
721
	 * Test #26
722
	 */
722
	 */
723
	private function testerGenreEspaces() {
723
	private function testerGenreEspaces() {
724
		$noms_erreur = array();
724
		$noms_erreur = array();
725
		foreach ($this->noms as &$nom) {
725
		foreach ($this->noms as &$nom) {
726
			if ($nom['genre'] != '') {
726
			if ($nom['genre'] != '') {
727
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
727
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['genre'])) {
728
					$nom_traite = $this->repererEspace($nom['genre']);
728
					$nom_traite = $this->repererEspace($nom['genre']);
729
					$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
729
					$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
730
				}
730
				}
731
			}
731
			}
732
		}
732
		}
733
		return $noms_erreur;
733
		return $noms_erreur;
734
	}
734
	}
735
	
735
	
736
	/**
736
	/**
737
	 * Test #27
737
	 * Test #27
738
	 */
738
	 */
739
	private function testerGenreSyntaxe() {
739
	private function testerGenreSyntaxe() {
740
		$noms_erreur = array();
740
		$noms_erreur = array();
741
		foreach ($this->noms as &$nom) {
741
		foreach ($this->noms as &$nom) {
742
			if ($nom['genre'] != '') {
742
			if ($nom['genre'] != '') {
743
				$mots = explode(' ', $nom['genre']);
743
				$mots = explode(' ', $nom['genre']);
744
				foreach ($mots as $mot) {
744
				foreach ($mots as $mot) {
745
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteGenre($mot))) {
745
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteGenre($mot))) {
746
						$nom_traite = $this->repererEspace($nom['genre']);
746
						$nom_traite = $this->repererEspace($nom['genre']);
747
						$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
747
						$noms_erreur[] = array($nom['num_nom'], $nom_traite, $nom['exclure_taxref']);
748
						break;
748
						break;
749
					}
749
					}
750
				}
750
				}
751
			}
751
			}
752
		}
752
		}
753
		return $noms_erreur;
753
		return $noms_erreur;
754
	}
754
	}
755
	
755
	
756
	/**
756
	/**
757
	 * Test #28
757
	 * Test #28
758
	 */
758
	 */
759
	private function testerGenreRang() {
759
	private function testerGenreRang() {
760
		$noms_erreur = array();
760
		$noms_erreur = array();
761
		foreach ($this->noms as &$nom) {
761
		foreach ($this->noms as &$nom) {
762
			if ($nom['genre'] != '') {
762
			if ($nom['genre'] != '') {
763
				if ($nom['rang'] < $this->manuel['rang_genre']) {
763
				if ($nom['rang'] < $this->manuel['rang_genre']) {
764
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
764
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
765
				}
765
				}
766
			}
766
			}
767
		}
767
		}
768
		return $noms_erreur;
768
		return $noms_erreur;
769
	}
769
	}
770
		
770
		
771
	/**
771
	/**
772
	 * Test #29
772
	 * Test #29
773
	 */
773
	 */
774
	private function testerEpitheteInfraGeneriqueSyntaxe() {
774
	private function testerEpitheteInfraGeneriqueSyntaxe() {
775
		$noms_erreur = array();
775
		$noms_erreur = array();
776
		foreach ($this->noms as &$nom) {
776
		foreach ($this->noms as &$nom) {
777
			if ($nom['epithete_infra_generique'] != '') {
777
			if ($nom['epithete_infra_generique'] != '') {
778
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
778
				if (!preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ][-a-zäëḧïöẗüẅẍÿ]+/', $nom['epithete_infra_generique'])) {
779
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
779
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
780
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
780
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
781
				}
781
				}
782
			}
782
			}
783
		}
783
		}
784
		return $noms_erreur;
784
		return $noms_erreur;
785
	}
785
	}
786
	
786
	
787
	/**
787
	/**
788
	 * Test #30
788
	 * Test #30
789
	 */
789
	 */
790
	private function testerEpitheteInfraGeneriqueRang() {
790
	private function testerEpitheteInfraGeneriqueRang() {
791
		$noms_erreur = array();
791
		$noms_erreur = array();
792
		foreach ($this->noms as &$nom) {
792
		foreach ($this->noms as &$nom) {
793
			if ($nom['epithete_infra_generique'] != '') {
793
			if ($nom['epithete_infra_generique'] != '') {
794
				if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
794
				if ($nom['rang'] <= $this->manuel['rang_genre'] || $nom['rang'] >= $this->manuel['rang_sp']) {
795
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
795
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
796
				}
796
				}
797
			}
797
			}
798
		}
798
		}
799
		return $noms_erreur;
799
		return $noms_erreur;
800
	}
800
	}
801
	
801
	
802
	/**
802
	/**
803
	 * Test #31
803
	 * Test #31
804
	 */
804
	 */
805
	private function testerEpitheteInfraGeneriqueEspaces() {
805
	private function testerEpitheteInfraGeneriqueEspaces() {
806
		$noms_erreur = array();
806
		$noms_erreur = array();
807
		foreach ($this->noms as &$nom) {
807
		foreach ($this->noms as &$nom) {
808
			if ($nom['epithete_infra_generique'] != '') {
808
			if ($nom['epithete_infra_generique'] != '') {
809
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
809
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_generique'])) {
810
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
810
					$epithete_traite = $this->repererEspace($nom['epithete_infra_generique']);
811
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
811
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
812
				}
812
				}
813
			}
813
			}
814
		}
814
		}
815
		return $noms_erreur;
815
		return $noms_erreur;
816
	}
816
	}
817
	
817
	
818
	/**
818
	/**
819
	 * Test #32
819
	 * Test #32
820
	 */
820
	 */
821
	private function testerEpitheteSpEspaces() {
821
	private function testerEpitheteSpEspaces() {
822
		$noms_erreur = array();
822
		$noms_erreur = array();
823
		foreach ($this->noms as &$nom) {
823
		foreach ($this->noms as &$nom) {
824
			if ($nom['epithete_sp'] != '') {
824
			if ($nom['epithete_sp'] != '') {
825
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
825
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_sp'])) {
826
					$epithete_traite = $this->repererEspace($nom['epithete_sp']);
826
					$epithete_traite = $this->repererEspace($nom['epithete_sp']);
827
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
827
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
828
				}
828
				}
829
			}
829
			}
830
		}
830
		}
831
		return $noms_erreur;
831
		return $noms_erreur;
832
	}
832
	}
833
	
833
	
834
	/**
834
	/**
835
	 * Test #33
835
	 * Test #33
836
	 */
836
	 */
837
	private function testerEpitheteSpSyntaxe() {
837
	private function testerEpitheteSpSyntaxe() {
838
		$noms_erreur = array();
838
		$noms_erreur = array();
839
		foreach ($this->noms as &$nom) {
839
		foreach ($this->noms as &$nom) {
840
			if ($nom['epithete_sp'] != '') {
840
			if ($nom['epithete_sp'] != '') {
841
				$formule_hybridite = (strpos($nom['epithete_sp'], ' x ') !== false);
841
				$formule_hybridite = (strpos($nom['epithete_sp'], ' x ') !== false);
842
				$mots = explode(' ', $nom['epithete_sp']);
842
				$mots = explode(' ', $nom['epithete_sp']);
843
				foreach ($mots as $mot) {
843
				foreach ($mots as $mot) {
844
					// TODO: créer un test qui vérifie la formule d'hybridité en la reconstruisant à partir des parents
844
					// TODO: créer un test qui vérifie la formule d'hybridité en la reconstruisant à partir des parents
845
					// afin que seuls des formules valides parviennent à la fonction
845
					// afin que seuls des formules valides parviennent à la fonction
846
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteSp($mot) ||
846
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierEpitheteSp($mot) ||
847
						($formule_hybridite && $this->verifierEpitheteGenre($mot) && !$this->verifierEstAbbreviationInfraSp($mot)))) {
847
						($formule_hybridite && $this->verifierEpitheteGenre($mot) && !$this->verifierEstAbbreviationInfraSp($mot)))) {
848
						$epithete_traite = $this->repererEspace($nom['epithete_sp']);
848
						$epithete_traite = $this->repererEspace($nom['epithete_sp']);
849
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
849
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
850
						break;
850
						break;
851
					}
851
					}
852
				}
852
				}
853
			}
853
			}
854
		}
854
		}
855
		return $noms_erreur;
855
		return $noms_erreur;
856
	}
856
	}
857
	
857
	
858
	/**
858
	/**
859
	 * Test #34
859
	 * Test #34
860
	 */
860
	 */
861
	private function testerEpitheteSpRang() {
861
	private function testerEpitheteSpRang() {
862
		$noms_erreur = array();
862
		$noms_erreur = array();
863
		foreach ($this->noms as &$nom) {
863
		foreach ($this->noms as &$nom) {
864
			if ($nom['epithete_sp'] != '') {
864
			if ($nom['epithete_sp'] != '') {
865
				if ($nom['rang'] < $this->manuel['rang_sp']) {
865
				if ($nom['rang'] < $this->manuel['rang_sp']) {
866
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
866
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
867
				}
867
				}
868
			}
868
			}
869
		}
869
		}
870
		return $noms_erreur;
870
		return $noms_erreur;
871
	}
871
	}
872
	
872
	
873
	/**
873
	/**
874
	 * Test #35
874
	 * Test #35
875
	 */
875
	 */
876
	private function testerTypeEpitheteEspaces() {
876
	private function testerTypeEpitheteEspaces() {
877
		$noms_erreur = array();
877
		$noms_erreur = array();
878
		foreach ($this->noms as &$nom) {
878
		foreach ($this->noms as &$nom) {
879
			if ($nom['type_epithete'] != '') {
879
			if ($nom['type_epithete'] != '') {
880
				if (preg_match('/\s+/', $nom['type_epithete'])) {
880
				if (preg_match('/\s+/', $nom['type_epithete'])) {
881
					$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
881
					$valeur_traitee = $this->repererEspace($nom['epithete_sp']);
882
					$noms_erreur[] = array($nom['num_nom'], $valeur_traitee, $nom['exclure_taxref']);
882
					$noms_erreur[] = array($nom['num_nom'], $valeur_traitee, $nom['exclure_taxref']);
883
				}
883
				}
884
			}
884
			}
885
		}
885
		}
886
		return $noms_erreur;
886
		return $noms_erreur;
887
	}
887
	}
888
	
888
	
889
	/**
889
	/**
890
	 * Test #36
890
	 * Test #36
891
	 */
891
	 */
892
	private function testerTypeEpitheteSyntaxe() {
892
	private function testerTypeEpitheteSyntaxe() {
893
		$noms_erreur = array();
893
		$noms_erreur = array();
894
		foreach ($this->noms as &$nom) {
894
		foreach ($this->noms as &$nom) {
895
			if ($nom['type_epithete'] != '') {
895
			if ($nom['type_epithete'] != '') {
896
				if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
896
				if (!$this->verifierTypeEpithete($nom['type_epithete'])) {
897
					$noms_erreur[] = array($nom['num_nom'],  $nom['type_epithete'], $nom['exclure_taxref']);
897
					$noms_erreur[] = array($nom['num_nom'],  $nom['type_epithete'], $nom['exclure_taxref']);
898
				}
898
				}
899
			}
899
			}
900
		}
900
		}
901
		return $noms_erreur;
901
		return $noms_erreur;
902
	}
902
	}
903
	
903
	
904
	/**
904
	/**
905
	 * Test #37
905
	 * Test #37
906
	 */
906
	 */
907
	private function testerTypeEpitheteHybridite() {
907
	private function testerTypeEpitheteHybridite() {
908
		$noms_erreur = array();
908
		$noms_erreur = array();
909
		foreach ($this->noms as &$nom) {
909
		foreach ($this->noms as &$nom) {
910
			if ($nom['type_epithete'] != '') {
910
			if ($nom['type_epithete'] != '') {
911
				if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
911
				if (preg_match('/^(?:n-|notho-)/', $nom['type_epithete'])) {
912
					$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete'], $nom['exclure_taxref']);
912
					$noms_erreur[] = array($nom['num_nom'], $nom['type_epithete'], $nom['exclure_taxref']);
913
				}
913
				}
914
			}
914
			}
915
		}
915
		}
916
		return $noms_erreur;
916
		return $noms_erreur;
917
	}
917
	}
918
	
918
	
919
	/**
919
	/**
920
	 * Test #38
920
	 * Test #38
921
	 */
921
	 */
922
	private function testerEpitheteInfraSpEspaces() {
922
	private function testerEpitheteInfraSpEspaces() {
923
		$noms_erreur = array();
923
		$noms_erreur = array();
924
		foreach ($this->noms as &$nom) {
924
		foreach ($this->noms as &$nom) {
925
			if ($nom['epithete_infra_sp'] != '') {
925
			if ($nom['epithete_infra_sp'] != '') {
926
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
926
				if (preg_match('/(?:^\s+(?!:\s+)|(?!:\s+)\s{2,}(?!:\s+)|(?!:\s+)\s+$)/', $nom['epithete_infra_sp'])) {
927
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
927
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
928
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
928
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
929
				}
929
				}
930
			}
930
			}
931
		}
931
		}
932
		return $noms_erreur;
932
		return $noms_erreur;
933
	}
933
	}
934
	
934
	
935
	/**
935
	/**
936
	 * Test #39
936
	 * Test #39
937
	 */
937
	 */
938
	private function testerEpitheteInfraSpSyntaxe() {
938
	private function testerEpitheteInfraSpSyntaxe() {
939
		$noms_erreur = array();
939
		$noms_erreur = array();
940
		foreach ($this->noms as &$nom) {
940
		foreach ($this->noms as &$nom) {
941
			if ($nom['epithete_infra_sp'] != '') {
941
			if ($nom['epithete_infra_sp'] != '') {
942
				$mots = explode(' ', $nom['epithete_infra_sp']);
942
				$mots = explode(' ', $nom['epithete_infra_sp']);
-
 
943
				$hybride_contient_abbreviation_infra_sp = false;
-
 
944
				$formule_hybridite = (strpos($nom['epithete_infra_sp'], ' x ') !== false);				
943
				foreach ($mots as $mot) {
945
				foreach ($mots as $mot) {
-
 
946
					if($formule_hybridite && $this->verifierEstAbbreviationInfraSp($mot)) {
-
 
947
						$hybride_contient_abbreviation_infra_sp = true;
-
 
948
					}
-
 
949
					$formule_hybridite_valide = $this->verifierEpitheteGenre($mot) || $this->verifierEpitheteSp($mot) || $hybride_contient_abbreviation_infra_sp;
944
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierTypeEpithete($mot)|| $this->verifierEpitheteSp($mot))) {
950
					if (!(preg_match('/^[+x]$/', $mot) || $this->verifierTypeEpithete($mot) || $this->verifierEpitheteSp($mot) ||
-
 
951
						$formule_hybridite_valide)) {
945
						$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
952
						$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
946
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
953
						$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
947
						break;
954
						break;
948
					}
955
					}
949
				}
956
				}
-
 
957
				
-
 
958
				if($formule_hybridite && !$hybride_contient_abbreviation_infra_sp) {
-
 
959
					$epithete_traite = $this->repererEspace($nom['epithete_infra_sp']);
-
 
960
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
-
 
961
				}
950
			}
962
			}
951
		}
963
		}
952
		return $noms_erreur;
964
		return $noms_erreur;
953
	}
965
	}
954
	
966
	
955
	/**
967
	/**
956
	 * Test #40
968
	 * Test #40
957
	 */
969
	 */
958
	private function testerEpitheteInfraSpRang() {
970
	private function testerEpitheteInfraSpRang() {
959
		$noms_erreur = array();
971
		$noms_erreur = array();
960
		foreach ($this->noms as &$nom) {
972
		foreach ($this->noms as &$nom) {
961
			if ($nom['epithete_infra_sp'] != '') {
973
			if ($nom['epithete_infra_sp'] != '') {
962
				if ($nom['rang'] < $this->manuel['rang_sp']) {
974
				if ($nom['rang'] < $this->manuel['rang_sp']) {
963
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
975
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
964
				}
976
				}
965
			}
977
			}
966
		}
978
		}
967
		return $noms_erreur;
979
		return $noms_erreur;
968
	}
980
	}
969
	
981
	
970
	/**
982
	/**
971
	 * Test #41
983
	 * Test #41
972
	 */
984
	 */
973
	private function testerGroupeCultivarSyntaxe() {
985
	private function testerGroupeCultivarSyntaxe() {
974
		$noms_erreur = array();
986
		$noms_erreur = array();
975
		foreach ($this->noms as &$nom) {
987
		foreach ($this->noms as &$nom) {
976
			if ($nom['cultivar_groupe'] != '') {
988
			if ($nom['cultivar_groupe'] != '') {
977
				if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
989
				if (!$this->verifierEpitheteGroupeCultivar($nom['cultivar_groupe'])) {
978
					$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
990
					$epithete_traite = $this->repererEspace($nom['cultivar_groupe']);
979
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
991
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
980
				}
992
				}
981
			}
993
			}
982
		}
994
		}
983
		return $noms_erreur;
995
		return $noms_erreur;
984
	}
996
	}
985
	
997
	
986
	/**
998
	/**
987
	 * Test #42
999
	 * Test #42
988
	 */
1000
	 */
989
	private function testerGroupeCultivarRang() {
1001
	private function testerGroupeCultivarRang() {
990
		$noms_erreur = array();
1002
		$noms_erreur = array();
991
		foreach ($this->noms as &$nom) {
1003
		foreach ($this->noms as &$nom) {
992
			if ($nom['cultivar_groupe'] != '') {
1004
			if ($nom['cultivar_groupe'] != '') {
993
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1005
				if ($nom['rang'] < $this->manuel['rang_genre']) {
994
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1006
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
995
				}
1007
				}
996
			}
1008
			}
997
		}
1009
		}
998
		return $noms_erreur;
1010
		return $noms_erreur;
999
	}
1011
	}
1000
	
1012
	
1001
	/**
1013
	/**
1002
	 * Test #43
1014
	 * Test #43
1003
	 */
1015
	 */
1004
	private function testerCultivarSyntaxe() {
1016
	private function testerCultivarSyntaxe() {
1005
		$noms_erreur = array();
1017
		$noms_erreur = array();
1006
		foreach ($this->noms as &$nom) {
1018
		foreach ($this->noms as &$nom) {
1007
			if ($nom['cultivar'] != '') {
1019
			if ($nom['cultivar'] != '') {
1008
				if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
1020
				if (!$this->verifierEpitheteCultivar($nom['cultivar'])) {
1009
					$epithete_traite = $this->repererEspace($nom['cultivar']);
1021
					$epithete_traite = $this->repererEspace($nom['cultivar']);
1010
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1022
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1011
				}
1023
				}
1012
			}
1024
			}
1013
		}
1025
		}
1014
		return $noms_erreur;
1026
		return $noms_erreur;
1015
	}
1027
	}
1016
	
1028
	
1017
	/**
1029
	/**
1018
	 * Test #44
1030
	 * Test #44
1019
	 */
1031
	 */
1020
	private function testerCultivarRang() {
1032
	private function testerCultivarRang() {
1021
		$noms_erreur = array();
1033
		$noms_erreur = array();
1022
		foreach ($this->noms as &$nom) {
1034
		foreach ($this->noms as &$nom) {
1023
			if ($nom['cultivar'] != '') {
1035
			if ($nom['cultivar'] != '') {
1024
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1036
				if ($nom['rang'] < $this->manuel['rang_genre']) {
1025
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1037
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['rang'], $nom['exclure_taxref']);
1026
				}
1038
				}
1027
			}
1039
			}
1028
		}
1040
		}
1029
		return $noms_erreur;
1041
		return $noms_erreur;
1030
	}
1042
	}
1031
	
1043
	
1032
	/**
1044
	/**
1033
	 * Test #45
1045
	 * Test #45
1034
	 */
1046
	 */
1035
	private function testerNomCommercialSyntaxe() {
1047
	private function testerNomCommercialSyntaxe() {
1036
		$noms_erreur = array();
1048
		$noms_erreur = array();
1037
		foreach ($this->noms as &$nom) {
1049
		foreach ($this->noms as &$nom) {
1038
			if ($nom['nom_commercial'] != '') {
1050
			if ($nom['nom_commercial'] != '') {
1039
				if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
1051
				if (!$this->verifierNomCommercial($nom['nom_commercial'])) {
1040
					$epithete_traite = $this->repererEspace($nom['nom_commercial']);
1052
					$epithete_traite = $this->repererEspace($nom['nom_commercial']);
1041
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1053
					$noms_erreur[] = array($nom['num_nom'], $epithete_traite, $nom['exclure_taxref']);
1042
				}
1054
				}
1043
			}
1055
			}
1044
		}
1056
		}
1045
		return $noms_erreur;
1057
		return $noms_erreur;
1046
	}
1058
	}
1047
	
1059
	
1048
	/**
1060
	/**
1049
	 * Test #46
1061
	 * Test #46
1050
	 */
1062
	 */
1051
	private function testerNomCommercialPresenceCultivar() {
1063
	private function testerNomCommercialPresenceCultivar() {
1052
		$noms_erreur = array();
1064
		$noms_erreur = array();
1053
		foreach ($this->noms as &$nom) {
1065
		foreach ($this->noms as &$nom) {
1054
			if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
1066
			if ((isset($nom['nom_commercial']) && $nom['nom_commercial'] != '') && ($nom['cultivar'] == '' && $nom['cultivar_groupe'] == '')) {
1055
				$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1067
				$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1056
			}
1068
			}
1057
		}
1069
		}
1058
		return $noms_erreur;
1070
		return $noms_erreur;
1059
	}
1071
	}
1060
	
1072
	
1061
	/**
1073
	/**
1062
	 * Test #47
1074
	 * Test #47
1063
	 */
1075
	 */
1064
	private function testerAuteurSyntaxe() {
1076
	private function testerAuteurSyntaxe() {
1065
		$noms_erreur = array();
1077
		$noms_erreur = array();
1066
		foreach ($this->noms as &$nom) {
1078
		foreach ($this->noms as &$nom) {
1067
			if ($nom['auteur'] != '') {
1079
			if ($nom['auteur'] != '') {
1068
				if (!$this->verifierAuteur($nom['auteur'])) {
1080
				if (!$this->verifierAuteur($nom['auteur'])) {
1069
					$intitule_traite = $this->repererEspace($nom['auteur']);
1081
					$intitule_traite = $this->repererEspace($nom['auteur']);
1070
					$noms_erreur[] = array($nom['num_nom'], $intitule_traite, $nom['exclure_taxref']);
1082
					$noms_erreur[] = array($nom['num_nom'], $intitule_traite, $nom['exclure_taxref']);
1071
				}
1083
				}
1072
			}
1084
			}
1073
		}
1085
		}
1074
		return $noms_erreur;
1086
		return $noms_erreur;
1075
	}
1087
	}
1076
	
1088
	
1077
	/**
1089
	/**
1078
	 * Test #48
1090
	 * Test #48
1079
	 */
1091
	 */
1080
	private function testerAnneeSyntaxe() {
1092
	private function testerAnneeSyntaxe() {
1081
		$noms_erreur = array();
1093
		$noms_erreur = array();
1082
		foreach ($this->noms as &$nom) {
1094
		foreach ($this->noms as &$nom) {
1083
			if ($nom['annee'] != '') {
1095
			if ($nom['annee'] != '') {
1084
				if (!$this->verifierAnnee($nom['annee'])) {
1096
				if (!$this->verifierAnnee($nom['annee'])) {
1085
					$noms_erreur[] = array($nom['num_nom'], $nom['annee'], $nom['exclure_taxref']);
1097
					$noms_erreur[] = array($nom['num_nom'], $nom['annee'], $nom['exclure_taxref']);
1086
				}
1098
				}
1087
			}
1099
			}
1088
		}
1100
		}
1089
		return $noms_erreur;
1101
		return $noms_erreur;
1090
	}
1102
	}
1091
	
1103
	
1092
	/**
1104
	/**
1093
	 * Test #49
1105
	 * Test #49
1094
	 */
1106
	 */
1095
	private function testerBiblioOrigineSyntaxe() {
1107
	private function testerBiblioOrigineSyntaxe() {
1096
		$noms_erreur = array();
1108
		$noms_erreur = array();
1097
		foreach ($this->noms as &$nom) {
1109
		foreach ($this->noms as &$nom) {
1098
			if ($nom['biblio_origine'] != '') {
1110
			if ($nom['biblio_origine'] != '') {
1099
				if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
1111
				if (!$this->verifierBiblioOrigine($nom['biblio_origine'])) {
1100
					$biblio_traite = $this->repererEspace($nom['biblio_origine']);
1112
					$biblio_traite = $this->repererEspace($nom['biblio_origine']);
1101
					$noms_erreur[] = array($nom['num_nom'], $biblio_traite, $nom['exclure_taxref']);
1113
					$noms_erreur[] = array($nom['num_nom'], $biblio_traite, $nom['exclure_taxref']);
1102
				}
1114
				}
1103
			}
1115
			}
1104
		}
1116
		}
1105
		return $noms_erreur;
1117
		return $noms_erreur;
1106
	}
1118
	}
1107
	
1119
	
1108
	/**
1120
	/**
1109
	 * Test #50
1121
	 * Test #50
1110
	 */
1122
	 */
1111
	private function testerHomonymieSyntaxe() {
1123
	private function testerHomonymieSyntaxe() {
1112
		$noms_erreur = array();
1124
		$noms_erreur = array();
1113
		foreach ($this->noms as &$nom) {
1125
		foreach ($this->noms as &$nom) {
1114
			if ($nom['homonyme'] != '') {
1126
			if ($nom['homonyme'] != '') {
1115
				if (!$this->verifierBooleen($nom['homonyme'])) {
1127
				if (!$this->verifierBooleen($nom['homonyme'])) {
1116
					$noms_erreur[] = array($nom['num_nom'], $nom['homonyme'], $nom['exclure_taxref']);
1128
					$noms_erreur[] = array($nom['num_nom'], $nom['homonyme'], $nom['exclure_taxref']);
1117
				}
1129
				}
1118
			}
1130
			}
1119
		}
1131
		}
1120
		return $noms_erreur;
1132
		return $noms_erreur;
1121
	}
1133
	}
1122
	
1134
	
1123
	/**
1135
	/**
1124
	 * Test #51
1136
	 * Test #51
1125
	 */
1137
	 */
1126
	private function testerHomonymieExistence() {
1138
	private function testerHomonymieExistence() {
1127
		$noms_homonymie = $this->classerNomsParNomComplet();
1139
		$noms_homonymie = $this->classerNomsParNomComplet();
1128
		
1140
		
1129
		$noms_erreur = array();
1141
		$noms_erreur = array();
1130
		foreach ($this->noms as &$nom) {
1142
		foreach ($this->noms as &$nom) {
1131
			if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
1143
			if ($nom['homonyme'] != '0' && $nom['homonyme'] != '') {
1132
				if ($noms_homonymie[$nom['nom_sci']] <= 1) {
1144
				if ($noms_homonymie[$nom['nom_sci']] <= 1) {
1133
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1145
					$noms_erreur[] = array($nom['num_nom'], $nom['nom_sci'], $nom['exclure_taxref']);
1134
				}
1146
				}
1135
			}
1147
			}
1136
		}
1148
		}
1137
		$noms_homonymie = null;
1149
		$noms_homonymie = null;
1138
		return $noms_erreur;
1150
		return $noms_erreur;
1139
	}
1151
	}
1140
	
1152
	
1141
	/**
1153
	/**
1142
	 * Test #52
1154
	 * Test #52
1143
	 */
1155
	 */
1144
	private function testerBasionymeSyntaxe() {
1156
	private function testerBasionymeSyntaxe() {
1145
		$noms_erreur = array();
1157
		$noms_erreur = array();
1146
		foreach ($this->noms as &$nom) {
1158
		foreach ($this->noms as &$nom) {
1147
			if ($nom['basionyme'] != '') {
1159
			if ($nom['basionyme'] != '') {
1148
				if (!$this->verifierNombre($nom['basionyme'])) {
1160
				if (!$this->verifierNombre($nom['basionyme'])) {
1149
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1161
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1150
				}
1162
				}
1151
			}
1163
			}
1152
		}
1164
		}
1153
		return $noms_erreur;
1165
		return $noms_erreur;
1154
	}
1166
	}
1155
 
1167
 
1156
	/**
1168
	/**
1157
	 * Test #53
1169
	 * Test #53
1158
	 */
1170
	 */
1159
	private function testerBasionymeExistence() {
1171
	private function testerBasionymeExistence() {
1160
		$noms_erreur = array();
1172
		$noms_erreur = array();
1161
		foreach ($this->noms as &$nom) {
1173
		foreach ($this->noms as &$nom) {
1162
			if ($nom['basionyme'] != '') {
1174
			if ($nom['basionyme'] != '') {
1163
				if (!isset($this->noms[$nom['basionyme']])) {
1175
				if (!isset($this->noms[$nom['basionyme']])) {
1164
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1176
					$noms_erreur[] = array($nom['num_nom'], $nom['basionyme'], $nom['exclure_taxref']);
1165
				}
1177
				}
1166
			}
1178
			}
1167
		}
1179
		}
1168
		return $noms_erreur;
1180
		return $noms_erreur;
1169
	}
1181
	}
1170
	
1182
	
1171
	/**
1183
	/**
1172
	 * Test #54
1184
	 * Test #54
1173
	 */
1185
	 */
1174
	private function testerSynonymeProparteSyntaxe() {
1186
	private function testerSynonymeProparteSyntaxe() {
1175
		$noms_erreur = array();
1187
		$noms_erreur = array();
1176
		foreach ($this->noms as &$nom) {
1188
		foreach ($this->noms as &$nom) {
1177
			if ($nom['synonyme_proparte'] != '') {
1189
			if ($nom['synonyme_proparte'] != '') {
1178
				if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
1190
				if (!$this->verifierNombreSuite($nom['synonyme_proparte'])) {
1179
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte'], $nom['exclure_taxref']);
1191
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_proparte'], $nom['exclure_taxref']);
1180
				}
1192
				}
1181
			}
1193
			}
1182
		}
1194
		}
1183
		return $noms_erreur;
1195
		return $noms_erreur;
1184
	}
1196
	}
1185
	
1197
	
1186
	/**
1198
	/**
1187
	 * Test #55
1199
	 * Test #55
1188
	 */
1200
	 */
1189
	private function testerSynonymeProparteExistence() {
1201
	private function testerSynonymeProparteExistence() {
1190
		$noms_erreur = array();
1202
		$noms_erreur = array();
1191
		foreach ($this->noms as &$nom) {
1203
		foreach ($this->noms as &$nom) {
1192
			if ($nom['synonyme_proparte'] != '') {
1204
			if ($nom['synonyme_proparte'] != '') {
1193
				$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
1205
				$num_nom_a_verifier = explode(',', $nom['synonyme_proparte']);
1194
				$num_nom_en_erreur = array();
1206
				$num_nom_en_erreur = array();
1195
				foreach ($num_nom_a_verifier as $num_nom) {
1207
				foreach ($num_nom_a_verifier as $num_nom) {
1196
					if (!isset($this->noms[$num_nom])) {
1208
					if (!isset($this->noms[$num_nom])) {
1197
						$num_nom_en_erreur[] = $num_nom;
1209
						$num_nom_en_erreur[] = $num_nom;
1198
					}
1210
					}
1199
				}
1211
				}
1200
				if (count($nbre_en_erreur) > 0) {
1212
				if (count($nbre_en_erreur) > 0) {
1201
					$noms_erreur[] = array($nom['num_nom'], implode(',', $num_nom_en_erreur), $nom['exclure_taxref']);
1213
					$noms_erreur[] = array($nom['num_nom'], implode(',', $num_nom_en_erreur), $nom['exclure_taxref']);
1202
				}
1214
				}
1203
			}
1215
			}
1204
		}
1216
		}
1205
		return $noms_erreur;
1217
		return $noms_erreur;
1206
	}
1218
	}
1207
	
1219
	
1208
	/**
1220
	/**
1209
	 * Test #56
1221
	 * Test #56
1210
	 */
1222
	 */
1211
	private function testerSynonymeDouteuxSyntaxe() {
1223
	private function testerSynonymeDouteuxSyntaxe() {
1212
		$noms_erreur = array();
1224
		$noms_erreur = array();
1213
		foreach ($this->noms as &$nom) {
1225
		foreach ($this->noms as &$nom) {
1214
			if ($nom['synonyme_douteux'] != '') {
1226
			if ($nom['synonyme_douteux'] != '') {
1215
				if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
1227
				if (!$this->verifierBooleen($nom['synonyme_douteux'])) {
1216
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1228
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1217
				}
1229
				}
1218
			}
1230
			}
1219
		}
1231
		}
1220
		return $noms_erreur;		
1232
		return $noms_erreur;		
1221
	}
1233
	}
1222
	
1234
	
1223
	/**
1235
	/**
1224
	 * Test #57
1236
	 * Test #57
1225
	 */
1237
	 */
1226
	private function testerSynonymeDouteuxNumNomRetenu() {
1238
	private function testerSynonymeDouteuxNumNomRetenu() {
1227
		$noms_erreur = array();
1239
		$noms_erreur = array();
1228
		foreach ($this->noms as &$nom) {
1240
		foreach ($this->noms as &$nom) {
1229
			if ($nom['synonyme_douteux'] == 1 && !$this->verifierNombre($nom['num_nom_retenu'])) {
1241
			if ($nom['synonyme_douteux'] == 1 && !$this->verifierNombre($nom['num_nom_retenu'])) {
1230
				$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1242
				$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_douteux'], $nom['exclure_taxref']);
1231
			}
1243
			}
1232
		}
1244
		}
1233
		return $noms_erreur;
1245
		return $noms_erreur;
1234
	}
1246
	}
1235
	
1247
	
1236
	/**
1248
	/**
1237
	 * Test #58
1249
	 * Test #58
1238
	 */
1250
	 */
1239
	private function testerSynonymeMalAppliqueSyntaxe() {
1251
	private function testerSynonymeMalAppliqueSyntaxe() {
1240
		$noms_erreur = array();
1252
		$noms_erreur = array();
1241
		foreach ($this->noms as &$nom) {
1253
		foreach ($this->noms as &$nom) {
1242
			if ($nom['synonyme_mal_applique'] != '') {
1254
			if ($nom['synonyme_mal_applique'] != '') {
1243
				if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
1255
				if (!$this->verifierBooleen($nom['synonyme_mal_applique'])) {
1244
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique'], $nom['exclure_taxref']);
1256
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_mal_applique'], $nom['exclure_taxref']);
1245
				}
1257
				}
1246
			}
1258
			}
1247
		}
1259
		}
1248
		return $noms_erreur;
1260
		return $noms_erreur;
1249
	}
1261
	}
1250
	
1262
	
1251
	/**
1263
	/**
1252
	 * Test #59
1264
	 * Test #59
1253
	 */
1265
	 */
1254
	private function testerSynonymeOrthographiqueSyntaxe() {
1266
	private function testerSynonymeOrthographiqueSyntaxe() {
1255
		$noms_erreur = array();
1267
		$noms_erreur = array();
1256
		foreach ($this->noms as $nom) {
1268
		foreach ($this->noms as $nom) {
1257
			if ($nom['synonyme_orthographique'] != '') {
1269
			if ($nom['synonyme_orthographique'] != '') {
1258
				if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
1270
				if (!$this->verifierNombre($nom['synonyme_orthographique'])) {
1259
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1271
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1260
				}
1272
				}
1261
			}
1273
			}
1262
		}
1274
		}
1263
		return $noms_erreur;
1275
		return $noms_erreur;
1264
	}
1276
	}
1265
	
1277
	
1266
	/**
1278
	/**
1267
	 * Test #60
1279
	 * Test #60
1268
	 */
1280
	 */
1269
	private function testerSynonymeOrthographiqueExistence() {
1281
	private function testerSynonymeOrthographiqueExistence() {
1270
		$noms_erreur = array();
1282
		$noms_erreur = array();
1271
		foreach ($this->noms as &$nom) {
1283
		foreach ($this->noms as &$nom) {
1272
			if ($nom['synonyme_orthographique'] != '') {
1284
			if ($nom['synonyme_orthographique'] != '') {
1273
				if (!isset($this->noms[$nom['synonyme_orthographique']])) {
1285
				if (!isset($this->noms[$nom['synonyme_orthographique']])) {
1274
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1286
					$noms_erreur[] = array($nom['num_nom'], $nom['synonyme_orthographique'], $nom['exclure_taxref']);
1275
				}
1287
				}
1276
			}
1288
			}
1277
		}
1289
		}
1278
		return $noms_erreur;
1290
		return $noms_erreur;
1279
	}
1291
	}
1280
	
1292
	
1281
	/**
1293
	/**
1282
	 * Test #61
1294
	 * Test #61
1283
	 */
1295
	 */
1284
	private function testerHybrideParent01Syntaxe() {
1296
	private function testerHybrideParent01Syntaxe() {
1285
		$noms_erreur = array();
1297
		$noms_erreur = array();
1286
		foreach ($this->noms as &$nom) {
1298
		foreach ($this->noms as &$nom) {
1287
			if ($nom['hybride_parent_01'] != '') {
1299
			if ($nom['hybride_parent_01'] != '') {
1288
				if (!$this->verifierNombre($nom['hybride_parent_01'])) {
1300
				if (!$this->verifierNombre($nom['hybride_parent_01'])) {
1289
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1301
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1290
				}
1302
				}
1291
			}
1303
			}
1292
		}
1304
		}
1293
		return $noms_erreur;
1305
		return $noms_erreur;
1294
	}
1306
	}
1295
	
1307
	
1296
	/**
1308
	/**
1297
	 * Test #62
1309
	 * Test #62
1298
	 */
1310
	 */
1299
	private function testerHybrideParent01Existence() {
1311
	private function testerHybrideParent01Existence() {
1300
		$noms_erreur = array();
1312
		$noms_erreur = array();
1301
		foreach ($this->noms as &$nom) {
1313
		foreach ($this->noms as &$nom) {
1302
			if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
1314
			if ($nom['hybride_parent_01'] != '' && $nom['hybride_parent_01'] != '0') {
1303
				if (!isset($this->noms[$nom['hybride_parent_01']])) {
1315
				if (!isset($this->noms[$nom['hybride_parent_01']])) {
1304
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1316
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_01']), $nom['exclure_taxref']);
1305
				}
1317
				}
1306
			}
1318
			}
1307
		}
1319
		}
1308
		return $noms_erreur;
1320
		return $noms_erreur;
1309
	}
1321
	}
1310
	
1322
	
1311
	/**
1323
	/**
1312
	 * Test #63
1324
	 * Test #63
1313
	 */
1325
	 */
1314
	private function testerHybrideParent02Syntaxe() {
1326
	private function testerHybrideParent02Syntaxe() {
1315
		$noms_erreur = array();
1327
		$noms_erreur = array();
1316
		foreach ($this->noms as &$nom) {
1328
		foreach ($this->noms as &$nom) {
1317
			if ($nom['hybride_parent_02'] != '') {
1329
			if ($nom['hybride_parent_02'] != '') {
1318
				if (!$this->verifierNombre($nom['hybride_parent_02'])) {
1330
				if (!$this->verifierNombre($nom['hybride_parent_02'])) {
1319
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1331
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1320
				}
1332
				}
1321
			}
1333
			}
1322
		}
1334
		}
1323
		return $noms_erreur;
1335
		return $noms_erreur;
1324
	}
1336
	}
1325
	
1337
	
1326
	/**
1338
	/**
1327
	 * Test #64
1339
	 * Test #64
1328
	 */
1340
	 */
1329
	private function testerHybrideParent02Existence() {
1341
	private function testerHybrideParent02Existence() {
1330
		$noms_erreur = array();
1342
		$noms_erreur = array();
1331
		foreach ($this->noms as &$nom) {
1343
		foreach ($this->noms as &$nom) {
1332
			if ($nom['hybride_parent_02'] != '') {
1344
			if ($nom['hybride_parent_02'] != '') {
1333
				if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
1345
				if (!isset($this->noms[$nom['hybride_parent_02']]) && $nom['hybride_parent_02'] != '0') {
1334
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1346
					$noms_erreur[] = array($nom['num_nom'], $this->repererEspace($nom['hybride_parent_02']), $nom['exclure_taxref']);
1335
				}
1347
				}
1336
			}
1348
			}
1337
		}
1349
		}
1338
		return $noms_erreur;
1350
		return $noms_erreur;
1339
	}
1351
	}
1340
	
1352
	
1341
	/**
1353
	/**
1342
	 * Test #65
1354
	 * Test #65
1343
	 */
1355
	 */
1344
	private function testerPresenceSyntaxe() {
1356
	private function testerPresenceSyntaxe() {
1345
		$noms_erreur = array();
1357
		$noms_erreur = array();
1346
		foreach ($this->noms as &$nom) {
1358
		foreach ($this->noms as &$nom) {
1347
			if ($nom['presence'] != '') {
1359
			if ($nom['presence'] != '') {
1348
				if (!$this->verifierPresence($nom['presence'])) {
1360
				if (!$this->verifierPresence($nom['presence'])) {
1349
					$noms_erreur[] = array($nom['num_nom'], $nom['presence'], $nom['exclure_taxref']);
1361
					$noms_erreur[] = array($nom['num_nom'], $nom['presence'], $nom['exclure_taxref']);
1350
				}
1362
				}
1351
			}
1363
			}
1352
		}
1364
		}
1353
		return $noms_erreur;
1365
		return $noms_erreur;
1354
	}
1366
	}
1355
	
1367
	
1356
	/**
1368
	/**
1357
	 * Test #66
1369
	 * Test #66
1358
	 */
1370
	 */
1359
	private function testerStatutOrigineSyntaxe() {
1371
	private function testerStatutOrigineSyntaxe() {
1360
		$noms_erreur = array();
1372
		$noms_erreur = array();
1361
		foreach ($this->noms as &$nom) {
1373
		foreach ($this->noms as &$nom) {
1362
			if ($nom['statut_origine'] != '') {
1374
			if ($nom['statut_origine'] != '') {
1363
				if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
1375
				if (!$this->verifierStatutOrigine($nom['statut_origine'])) {
1364
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine'], $nom['exclure_taxref']);
1376
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_origine'], $nom['exclure_taxref']);
1365
				}
1377
				}
1366
			}
1378
			}
1367
		}
1379
		}
1368
		return $noms_erreur;
1380
		return $noms_erreur;
1369
	}
1381
	}
1370
	
1382
	
1371
	/**
1383
	/**
1372
	 * Test #67
1384
	 * Test #67
1373
	 */
1385
	 */
1374
	private function testerStatutIntroductionSyntaxe() {
1386
	private function testerStatutIntroductionSyntaxe() {
1375
		$noms_erreur = array();
1387
		$noms_erreur = array();
1376
		foreach ($this->noms as &$nom) {
1388
		foreach ($this->noms as &$nom) {
1377
			if ($nom['statut_introduction'] != '') {
1389
			if ($nom['statut_introduction'] != '') {
1378
				if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
1390
				if (!$this->verifierStatutIntroduction($nom['statut_introduction'])) {
1379
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction'], $nom['exclure_taxref']);
1391
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_introduction'], $nom['exclure_taxref']);
1380
				}
1392
				}
1381
			}
1393
			}
1382
		}
1394
		}
1383
		return $noms_erreur;
1395
		return $noms_erreur;
1384
	}
1396
	}
1385
	
1397
	
1386
	/**
1398
	/**
1387
	 * Test #68
1399
	 * Test #68
1388
	 */
1400
	 */
1389
	private function testerStatutCultureSyntaxe() {
1401
	private function testerStatutCultureSyntaxe() {
1390
		$noms_erreur = array();
1402
		$noms_erreur = array();
1391
		foreach ($this->noms as &$nom) {
1403
		foreach ($this->noms as &$nom) {
1392
			if ($nom['statut_culture'] != '') {
1404
			if ($nom['statut_culture'] != '') {
1393
				if (!$this->verifierStatutCulture($nom['statut_culture'])) {
1405
				if (!$this->verifierStatutCulture($nom['statut_culture'])) {
1394
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture'], $nom['exclure_taxref']);
1406
					$noms_erreur[] = array($nom['num_nom'], $nom['statut_culture'], $nom['exclure_taxref']);
1395
				}
1407
				}
1396
			}
1408
			}
1397
		}
1409
		}
1398
		return $noms_erreur;
1410
		return $noms_erreur;
1399
	}
1411
	}
1400
	
1412
	
1401
	/**
1413
	/**
1402
	 * Test #69
1414
	 * Test #69
1403
	 */
1415
	 */
1404
	private function testerExclureTaxRefSyntaxe() {
1416
	private function testerExclureTaxRefSyntaxe() {
1405
		$noms_erreur = array();
1417
		$noms_erreur = array();
1406
		foreach ($this->noms as &$nom) {
1418
		foreach ($this->noms as &$nom) {
1407
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
1419
			if ($nom['exclure_taxref'] != '' && $nom['exclure_taxref'] != null) {
1408
				if (!preg_match('/^(?:0|1|9)$/', $nom['exclure_taxref'])) {
1420
				if (!preg_match('/^(?:0|1|9)$/', $nom['exclure_taxref'])) {
1409
					$noms_erreur[] = array($nom['num_nom'], $nom['exclure_taxref']);
1421
					$noms_erreur[] = array($nom['num_nom'], $nom['exclure_taxref']);
1410
				}
1422
				}
1411
			}
1423
			}
1412
		}
1424
		}
1413
		return $noms_erreur;
1425
		return $noms_erreur;
1414
	}
1426
	}
1415
 
1427
 
1416
	
1428
	
1417
 
1429
 
1418
	//+--------------------------------------------------------------------------------------------------------------+//
1430
	//+--------------------------------------------------------------------------------------------------------------+//
1419
	// MÉTHODES COMMUNES aux TESTS
1431
	// MÉTHODES COMMUNES aux TESTS
1420
	
1432
	
1421
	private function verifierPresence(&$valeur) {
1433
	private function verifierPresence(&$valeur) {
1422
		$codes = $this->manuel['codes_presence'];
1434
		$codes = $this->manuel['codes_presence'];
1423
		$ok = $this->verifierStatuts($valeur, $codes);
1435
		$ok = $this->verifierStatuts($valeur, $codes);
1424
		return $ok;
1436
		return $ok;
1425
	}
1437
	}
1426
	
1438
	
1427
	private function verifierStatutOrigine(&$valeur) {
1439
	private function verifierStatutOrigine(&$valeur) {
1428
		$codes = $this->manuel['codes_statuts_origine'];
1440
		$codes = $this->manuel['codes_statuts_origine'];
1429
		$ok = $this->verifierStatuts($valeur, $codes);
1441
		$ok = $this->verifierStatuts($valeur, $codes);
1430
		return $ok;
1442
		return $ok;
1431
	}
1443
	}
1432
	
1444
	
1433
	private function verifierStatutIntroduction(&$valeur) {
1445
	private function verifierStatutIntroduction(&$valeur) {
1434
		$codes = $this->manuel['codes_statuts_introduction'];
1446
		$codes = $this->manuel['codes_statuts_introduction'];
1435
		$ok = $this->verifierStatuts($valeur, $codes);
1447
		$ok = $this->verifierStatuts($valeur, $codes);
1436
		return $ok;
1448
		return $ok;
1437
	}
1449
	}
1438
	
1450
	
1439
	private function verifierStatutCulture(&$valeur) {
1451
	private function verifierStatutCulture(&$valeur) {
1440
		$codes = $this->manuel['codes_statuts_culture'];
1452
		$codes = $this->manuel['codes_statuts_culture'];
1441
		$ok = $this->verifierStatuts($valeur, $codes);
1453
		$ok = $this->verifierStatuts($valeur, $codes);
1442
		return $ok;
1454
		return $ok;
1443
	}
1455
	}
1444
	
1456
	
1445
	private function verifierStatuts(&$valeur, &$codes) {
1457
	private function verifierStatuts(&$valeur, &$codes) {
1446
		$ok = true;
1458
		$ok = true;
1447
		if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
1459
		if (!preg_match("/^(?:|-|[$codes](?:-[A-Z])?)$/", $valeur)) {
1448
			$ok = false;
1460
			$ok = false;
1449
		}
1461
		}
1450
		return $ok;
1462
		return $ok;
1451
	}
1463
	}
1452
	
1464
	
1453
	private function verifierBooleen(&$valeur) {
1465
	private function verifierBooleen(&$valeur) {
1454
		$ok = true;
1466
		$ok = true;
1455
		if (!preg_match('/^1$/', $valeur)) {
1467
		if (!preg_match('/^1$/', $valeur)) {
1456
			$ok = false;
1468
			$ok = false;
1457
		}
1469
		}
1458
		return $ok;
1470
		return $ok;
1459
	}
1471
	}
1460
	
1472
	
1461
	private function verifierNombre(&$valeur) {
1473
	private function verifierNombre(&$valeur) {
1462
		$ok = true;
1474
		$ok = true;
1463
		if (!preg_match('/^[0-9]+$/', $valeur)) {
1475
		if (!preg_match('/^[0-9]+$/', $valeur)) {
1464
			$ok = false;
1476
			$ok = false;
1465
		}
1477
		}
1466
		return $ok;
1478
		return $ok;
1467
	}
1479
	}
1468
	
1480
	
1469
	private function verifierNombreSuite(&$valeur) {
1481
	private function verifierNombreSuite(&$valeur) {
1470
		$ok = true;
1482
		$ok = true;
1471
		if (!preg_match('/^(?:[0-9]+,)*[0-9]+$/', $valeur)) {
1483
		if (!preg_match('/^(?:[0-9]+,)*[0-9]+$/', $valeur)) {
1472
			$ok = false;
1484
			$ok = false;
1473
		}
1485
		}
1474
		return $ok;
1486
		return $ok;
1475
	}
1487
	}
1476
	
1488
	
1477
	private function verifierTypeEpithete(&$type) {
1489
	private function verifierTypeEpithete(&$type) {
1478
		$ok = false;
1490
		$ok = false;
1479
		$rejetes = $this->manuel['type_epithete_rejetes'];
1491
		$rejetes = $this->manuel['type_epithete_rejetes'];
1480
		if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
1492
		if (preg_replace("/^(?:$rejetes)$/", '', $type) == '') {
1481
			$ok = false;
1493
			$ok = false;
1482
		} else if (preg_match('/^[a-z][-a-z]*[.]?$/', $type)) {
1494
		} else if (preg_match('/^[a-z][-a-z]*[.]?$/', $type)) {
1483
			$ok = true;
1495
			$ok = true;
1484
		}
1496
		}
1485
		return $ok;
1497
		return $ok;
1486
	}
1498
	}
1487
	
1499
	
1488
	private function verifierBiblioOrigine(&$intitule) {
1500
	private function verifierBiblioOrigine(&$intitule) {
1489
		$ok = true;
1501
		$ok = true;
1490
		if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1502
		if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1491
			$ok = false;// Contient des espaces en trop
1503
			$ok = false;// Contient des espaces en trop
1492
		} else if (!preg_match('/^(?:in [^;]+[;]|)[^,]+?(?:[,][^:]+|)(?:[:].+|)$/', $intitule)) {
1504
		} else if (!preg_match('/^(?:in [^;]+[;]|)[^,]+?(?:[,][^:]+|)(?:[:].+|)$/', $intitule)) {
1493
			$ok = false;
1505
			$ok = false;
1494
		} else if (preg_match('/(?:(?:^|[,:])\s*(?:[:,]|$))/', $intitule)) {
1506
		} else if (preg_match('/(?:(?:^|[,:])\s*(?:[:,]|$))/', $intitule)) {
1495
			$ok = false;// Contient une mauvaise suite de caractères
1507
			$ok = false;// Contient une mauvaise suite de caractères
1496
		}
1508
		}
1497
		return $ok;
1509
		return $ok;
1498
	}
1510
	}
1499
	
1511
	
1500
	private function verifierAnnee(&$annee) {
1512
	private function verifierAnnee(&$annee) {
1501
		$ok = true;
1513
		$ok = true;
1502
		if (!preg_match('/^[0-9]{4}$/', $annee)) {
1514
		if (!preg_match('/^[0-9]{4}$/', $annee)) {
1503
			$ok = false;
1515
			$ok = false;
1504
		} else if ($annee < ANNEE_MINIMUM) {
1516
		} else if ($annee < ANNEE_MINIMUM) {
1505
			$ok = false;
1517
			$ok = false;
1506
		} else if ($annee > ANNEE_EN_COURS) {
1518
		} else if ($annee > ANNEE_EN_COURS) {
1507
			$ok = false;
1519
			$ok = false;
1508
		}
1520
		}
1509
		return $ok;
1521
		return $ok;
1510
	}
1522
	}
1511
	
1523
	
1512
	private function verifierAuteur(&$intitule) {
1524
	private function verifierAuteur(&$intitule) {
1513
		$ok = true;
1525
		$ok = true;
1514
		$acceptes = $this->manuel['auteur_acceptes'];
1526
		$acceptes = $this->manuel['auteur_acceptes'];
1515
		if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
1527
		if (!preg_match("/^(?:$acceptes)$/", $intitule)) {
1516
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1528
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $intitule)) {
1517
				$ok = false;// Contient des espaces en trop
1529
				$ok = false;// Contient des espaces en trop
1518
			} else {
1530
			} else {
1519
				$mots_rejetes = $this->manuel['auteur_mots_rejetes'];
1531
				$mots_rejetes = $this->manuel['auteur_mots_rejetes'];
1520
				$mots = explode(' ', $intitule);
1532
				$mots = explode(' ', $intitule);
1521
				foreach ($mots as $position => $mot) {
1533
				foreach ($mots as $position => $mot) {
1522
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1534
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1523
						$ok = false;// Mot rejeté
1535
						$ok = false;// Mot rejeté
1524
					} else if (preg_match("/^(?:(?:\p{L}|[.'\(\),-])+|[&])$/u", $mot)) {
1536
					} else if (preg_match("/^(?:(?:\p{L}|[.'\(\),-])+|[&])$/u", $mot)) {
1525
						continue;// Mot de l'intitulé auteur
1537
						continue;// Mot de l'intitulé auteur
1526
					} else {
1538
					} else {
1527
						$ok = false;
1539
						$ok = false;
1528
					}
1540
					}
1529
				}
1541
				}
1530
			}
1542
			}
1531
		}
1543
		}
1532
		return $ok;
1544
		return $ok;
1533
	}
1545
	}
1534
	
1546
	
1535
	private function verifierNomCommercial(&$epithete) {
1547
	private function verifierNomCommercial(&$epithete) {
1536
		$ok = false;
1548
		$ok = false;
1537
		if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
1549
		if (preg_match("/^[[:upper:][:punct:][:digit:][:space:]]+$/", $epithete)) {
1538
			$ok = true;
1550
			$ok = true;
1539
		}
1551
		}
1540
		return $ok;
1552
		return $ok;
1541
	}
1553
	}
1542
	
1554
	
1543
	private function verifierEpitheteCultivar(&$epithete) {
1555
	private function verifierEpitheteCultivar(&$epithete) {
1544
		$ok = true;
1556
		$ok = true;
1545
		$acceptes = $this->manuel['cultivar_acceptes'];
1557
		$acceptes = $this->manuel['cultivar_acceptes'];
1546
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1558
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1547
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1559
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1548
				$ok = false;// Contient des espaces en trop
1560
				$ok = false;// Contient des espaces en trop
1549
			} else {
1561
			} else {
1550
				$mots_rejetes = $this->manuel['cultivar_mots_rejetes'];
1562
				$mots_rejetes = $this->manuel['cultivar_mots_rejetes'];
1551
				$mots_mineurs = $this->manuel['mots_mineurs'];
1563
				$mots_mineurs = $this->manuel['mots_mineurs'];
1552
				$mots = explode(' ', $epithete);
1564
				$mots = explode(' ', $epithete);
1553
				foreach ($mots as $position => $mot) {
1565
				foreach ($mots as $position => $mot) {
1554
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1566
					if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1555
						$ok = false;// Mot rejeté
1567
						$ok = false;// Mot rejeté
1556
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1568
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1557
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1569
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1558
					} else {
1570
					} else {
1559
						$mots_tiret = explode('-', $mot);
1571
						$mots_tiret = explode('-', $mot);
1560
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1572
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1561
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1573
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1562
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position
1574
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position
1563
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1575
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1564
								continue;//Mot (ou 'mot-tiret') avec lettre initiale majuscule
1576
								continue;//Mot (ou 'mot-tiret') avec lettre initiale majuscule
1565
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1577
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1566
								continue;//Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1578
								continue;//Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1567
							} else {
1579
							} else {
1568
								$ok = false;
1580
								$ok = false;
1569
							}
1581
							}
1570
						}
1582
						}
1571
					}
1583
					}
1572
				}
1584
				}
1573
			}
1585
			}
1574
		}
1586
		}
1575
		return $ok;
1587
		return $ok;
1576
	}
1588
	}
1577
	
1589
	
1578
	private function verifierEpitheteGroupeCultivar(&$epithete) {
1590
	private function verifierEpitheteGroupeCultivar(&$epithete) {
1579
		$ok = true;
1591
		$ok = true;
1580
		$acceptes = $this->manuel['cultivar_gp_acceptes'];
1592
		$acceptes = $this->manuel['cultivar_gp_acceptes'];
1581
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1593
		if (!preg_match("/^(?:$acceptes)$/", $epithete)) {
1582
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1594
			if (preg_match('/(?:^\s+|\s{2,}|\s+$)/', $epithete)) {
1583
				$ok = false;// Contient des espaces en trop
1595
				$ok = false;// Contient des espaces en trop
1584
			} else {
1596
			} else {
1585
				$mots_acceptes = $this->manuel['cultivar_gp_mots_acceptes'];
1597
				$mots_acceptes = $this->manuel['cultivar_gp_mots_acceptes'];
1586
				$mots_rejetes = $this->manuel['cultivar_gp_mots_rejetes'];
1598
				$mots_rejetes = $this->manuel['cultivar_gp_mots_rejetes'];
1587
				$mots_mineurs = $this->manuel['mots_mineurs'];
1599
				$mots_mineurs = $this->manuel['mots_mineurs'];
1588
				$mots = explode(' ', $epithete);
1600
				$mots = explode(' ', $epithete);
1589
				foreach ($mots as $position => $mot) {
1601
				foreach ($mots as $position => $mot) {
1590
					if (preg_match("/^(?:$mots_acceptes)$/i", $mot)) {
1602
					if (preg_match("/^(?:$mots_acceptes)$/i", $mot)) {
1591
						continue;// Mot accepté
1603
						continue;// Mot accepté
1592
					} else if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1604
					} else if (preg_match("/^(?:$mots_rejetes)$/i", $mot)) {
1593
						$ok = false;// Mot rejeté
1605
						$ok = false;// Mot rejeté
1594
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1606
					} else if ($position > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot)) {
1595
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1607
						continue;// Mot mineur en minuscule qui n'est pas en 1ère position
1596
					} else {
1608
					} else {
1597
						$mots_tiret = explode('-', $mot);
1609
						$mots_tiret = explode('-', $mot);
1598
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1610
						foreach ($mots_tiret as $position_tiret => $mot_tiret) {
1599
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1611
							if ($position_tiret > 0 && preg_match("/^(?:$mots_mineurs)$/", $mot_tiret)) {
1600
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position dans le mot
1612
								continue;// Mot-tiret mineur en minuscule qui n'est pas en 1ère position dans le mot
1601
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1613
							} else if (preg_match('/^[[:upper:]][[:lower:]]+$/', $mot_tiret)) {
1602
								continue;// Mot (ou 'mot-tiret') avec lettre initiale majuscule
1614
								continue;// Mot (ou 'mot-tiret') avec lettre initiale majuscule
1603
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1615
							} else if ($position_tiret == count($mots_tiret) && preg_match('/^[:upper:][:lower:]+[:punct:]?$/', $mot_tiret)) {
1604
								continue;// Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1616
								continue;// Dernier mot (ou 'mot-tiret') avec lettre initiale majuscule, suivi d'un éventuel signe de ponctuation
1605
							} else {
1617
							} else {
1606
								$ok = false;
1618
								$ok = false;
1607
							}
1619
							}
1608
						}
1620
						}
1609
					}
1621
					}
1610
				}
1622
				}
1611
			}
1623
			}
1612
		}
1624
		}
1613
		return $ok;
1625
		return $ok;
1614
	}
1626
	}
1615
	
1627
	
1616
	private function verifierEpitheteSp(&$epithete) {
1628
	private function verifierEpitheteSp(&$epithete) {
1617
		$ok = false;
1629
		$ok = false;
1618
		if (preg_match('/^[a-zäëḧïöẗüẅẍÿ][-a-zäëḧïöẗüẅẍÿ]+$/', $epithete)) {
1630
		if (preg_match('/^[a-zäëḧïöẗüẅẍÿ][-a-zäëḧïöẗüẅẍÿ]+$/', $epithete)) {
1619
			$ok = true;
1631
			$ok = true;
1620
		} else if (preg_match('/^sp\.(?:[A-Z]|[1-9][0-9]*)$/', $epithete)) {
1632
		} else if (preg_match('/^sp\.(?:[A-Z]|[1-9][0-9]*)$/', $epithete)) {
1621
			$ok = true;
1633
			$ok = true;
1622
		}
1634
		}
1623
		return $ok;
1635
		return $ok;
1624
	}
1636
	}
1625
	
1637
	
1626
	private function verifierEpitheteGenre(&$epithete) {
1638
	private function verifierEpitheteGenre(&$epithete) {
1627
		$ok = false;
1639
		$ok = false;
1628
		if (preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ](?:[-a-zäëḧïöẗüẅẍÿ]+|[a-zäëḧïöẗüẅẍÿ]+-[A-ZÄËḦÏÖÜẄẌŸ][a-zäëḧïöẗüẅẍÿ]+)$/', $epithete)) {
1640
		if (preg_match('/^[A-ZÄËḦÏÖÜẄẌŸ](?:[-a-zäëḧïöẗüẅẍÿ]+|[a-zäëḧïöẗüẅẍÿ]+-[A-ZÄËḦÏÖÜẄẌŸ][a-zäëḧïöẗüẅẍÿ]+)$/', $epithete)) {
1629
			$ok = true;
1641
			$ok = true;
1630
		}
1642
		}
1631
		return $ok;
1643
		return $ok;
1632
	}
1644
	}
1633
	
1645
	
1634
	private function verifierEstAbbreviationInfraSp($mot) {
1646
	private function verifierEstAbbreviationInfraSp($mot) {
1635
		$ok = false;
1647
		$ok = false;
1636
		if(preg_match($this->manuel['abbr_rangs_infra_specifique'], $mot)) {
1648
		if(preg_match($this->manuel['abbr_rangs_infra_specifique'], $mot)) {
1637
			$ok = true;
1649
			$ok = true;
1638
		}
1650
		}
1639
		return $ok;
1651
		return $ok;
1640
	}
1652
	}
1641
	
1653
	
1642
	private function formaterStyleNomGenre(&$genre) {
1654
	private function formaterStyleNomGenre(&$genre) {
1643
		$genre_fmt = '';
1655
		$genre_fmt = '';
1644
		if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
1656
		if (preg_match('/^\s*([x+])\s+(.+)$/i', $genre, $match)) {
1645
			$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
1657
			$genre_fmt = utf8_encode(strtolower(utf8_decode($match[1]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[2]))));
1646
		} elseif (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $genre, $match)) {
1658
		} elseif (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $genre, $match)) {
1647
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1659
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1648
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1660
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1649
		} else {
1661
		} else {
1650
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
1662
			$genre_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($genre))));
1651
		}
1663
		}
1652
		return $genre_fmt;
1664
		return $genre_fmt;
1653
	}
1665
	}
1654
	
1666
	
1655
	private function formaterStyleEpitheteSpHybride(&$genre, &$epithete) {
1667
	private function formaterStyleEpitheteSpHybride(&$genre, &$epithete) {
1656
		$nom_fmt = '';
1668
		$nom_fmt = '';
1657
		$erreur = '';
1669
		$erreur = '';
1658
		if (trim($genre) == '') {
1670
		if (trim($genre) == '') {
1659
			if ($epithete != '') {
1671
			if ($epithete != '') {
1660
				$nom_fmt = $this->formaterFormuleHybridite($epithete);
1672
				$nom_fmt = $this->formaterFormuleHybridite($epithete);
1661
			} else {
1673
			} else {
1662
				$erreur = "Formule d'hybridité sans épithéte spécifique";
1674
				$erreur = "Formule d'hybridité sans épithéte spécifique";
1663
			}
1675
			}
1664
		} else {
1676
		} else {
1665
			$nom_fmt = $this->formaterNomHybride($genre, $epithete);
1677
			$nom_fmt = $this->formaterNomHybride($genre, $epithete);
1666
		}
1678
		}
1667
		return array($nom_fmt, $erreur);
1679
		return array($nom_fmt, $erreur);
1668
	}
1680
	}
1669
	
1681
	
1670
	private function formaterStyleEpitheteInfraSpHybride(&$nom_sci, &$infra, &$genre = null) {		
1682
	private function formaterStyleEpitheteInfraSpHybride(&$nom_sci, &$infra, &$genre = null) {		
1671
		$nom_fmt = '';
1683
		$nom_fmt = '';
1672
		$erreur = '';
1684
		$erreur = '';
1673
		if (trim($genre) == '') {
1685
		if (trim($genre) == '') {
1674
			if (trim($nom_sci) == '') {
1686
			if (trim($nom_sci) == '') {
1675
				if (trim($infra) != '') {
1687
				if (trim($infra) != '') {
1676
					$nom_fmt = $this->formaterFormuleHybridite($infra);
1688
					$nom_fmt = $this->formaterFormuleHybridite($infra);
1677
				} else {
1689
				} else {
1678
					$erreur = "Formule d'hybridité sans épithéte infraspécifique";
1690
					$erreur = "Formule d'hybridité sans épithéte infraspécifique";
1679
				}
1691
				}
1680
			} else {
1692
			} else {
1681
				$erreur = "Formule d'hybridité avec épithéte spécifique";
1693
				$erreur = "Formule d'hybridité avec épithéte spécifique";
1682
			}
1694
			}
1683
		} else {
1695
		} else {
1684
			$nom_fmt = $this->formaterNomHybride($nom_sci, $infra);
1696
			$nom_fmt = $this->formaterNomHybride($nom_sci, $infra);
1685
		}
1697
		}
1686
		return array($nom_fmt, $erreur);
1698
		return array($nom_fmt, $erreur);
1687
	}
1699
	}
1688
	
1700
	
1689
	private function formaterNomHybride(&$nom_sci, &$epithete) {
1701
	private function formaterNomHybride(&$nom_sci, &$epithete) {
1690
		if (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $epithete, $match) != '') {
1702
		if (preg_match('/^(.+)\s+([x+])\s+(.+)$/i', $epithete, $match) != '') {
1691
			$nom_fmt = $nom_sci.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1703
			$nom_fmt = $nom_sci.utf8_encode(ucfirst(strtolower(utf8_decode($match[1])))).' '.
1692
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.
1704
				utf8_encode(strtolower(utf8_decode($match[2]))).' '.
1693
				utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1705
				utf8_encode(ucfirst(strtolower(utf8_decode($match[3]))));
1694
		} elseif (preg_match('/^([x+])\s+(.+)$/i', $epithete, $match) != '') {
1706
		} elseif (preg_match('/^([x+])\s+(.+)$/i', $epithete, $match) != '') {
1695
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($match[1]))).' '.
1707
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($match[1]))).' '.
1696
				utf8_encode(strtolower(utf8_decode($match[2])));
1708
				utf8_encode(strtolower(utf8_decode($match[2])));
1697
		} else {
1709
		} else {
1698
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($epithete)));
1710
			$nom_fmt = $nom_sci.utf8_encode(strtolower(utf8_decode($epithete)));
1699
		}
1711
		}
1700
		return $nom_fmt;
1712
		return $nom_fmt;
1701
	}
1713
	}
1702
	
1714
	
1703
	private function formaterFormuleHybridite(&$epithete) {
1715
	private function formaterFormuleHybridite(&$epithete) {
1704
		$liste_parents = explode(' x ', $epithete);
1716
		$liste_parents = explode(' x ', $epithete);
1705
		if (count($liste_parents) == 2) {
1717
		if (count($liste_parents) == 2) {
1706
			$nom_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[0])))).' x '.
1718
			$nom_fmt = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[0])))).' x '.
1707
			utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[1]))));
1719
			utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[1]))));
1708
		} else {
1720
		} else {
1709
			for ($i=0; $i<count($liste_parents); $i++) {
1721
			for ($i=0; $i<count($liste_parents); $i++) {
1710
				if (strstr(trim($liste_parents[$i]), ' ') == false) {
1722
				if (strstr(trim($liste_parents[$i]), ' ') == false) {
1711
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode(trim($liste_parents[$i]))))).' x '.
1723
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode(trim($liste_parents[$i]))))).' x '.
1712
					utf8_encode(strtolower(utf8_decode(trim($liste_parents[$i+1]))));
1724
					utf8_encode(strtolower(utf8_decode(trim($liste_parents[$i+1]))));
1713
					$i++;
1725
					$i++;
1714
				} else {
1726
				} else {
1715
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[$i]))));
1727
					$nom[] = utf8_encode(ucfirst(strtolower(utf8_decode($liste_parents[$i]))));
1716
				}
1728
				}
1717
			}
1729
			}
1718
			$nom_fmt = implode(' x ', $nom);
1730
			$nom_fmt = implode(' x ', $nom);
1719
		}
1731
		}
1720
		return $nom_fmt;
1732
		return $nom_fmt;
1721
	}
1733
	}
1722
	
1734
	
1723
	private function repererEspace($nom_sci) {
1735
	private function repererEspace($nom_sci) {
1724
		$nom_sci = str_replace(' ', '<span class="espace">&nbsp;</span>', $nom_sci);
1736
		$nom_sci = str_replace(' ', '<span class="espace">&nbsp;</span>', $nom_sci);
1725
		return $nom_sci;
1737
		return $nom_sci;
1726
	}
1738
	}
1727
	
1739
	
1728
	private function construireSuffixeNomPltCultivee(&$nom) {
1740
	private function construireSuffixeNomPltCultivee(&$nom) {
1729
		$suffixe = array();
1741
		$suffixe = array();
1730
		$suffixe[] = $this->construireNomCultivarGroupe($nom);
1742
		$suffixe[] = $this->construireNomCultivarGroupe($nom);
1731
		$suffixe[] = $this->construireNomCommercial($nom);
1743
		$suffixe[] = $this->construireNomCommercial($nom);
1732
		$suffixe[] = $this->construireNomCultivar($nom);
1744
		$suffixe[] = $this->construireNomCultivar($nom);
1733
		$suffixe = array_filter($suffixe);
1745
		$suffixe = array_filter($suffixe);
1734
		return implode(' ', $suffixe);
1746
		return implode(' ', $suffixe);
1735
	}
1747
	}
1736
	
1748
	
1737
	private function construireNomCultivarGroupe(&$nom) {
1749
	private function construireNomCultivarGroupe(&$nom) {
1738
		$nom_groupe_cultivar = '';
1750
		$nom_groupe_cultivar = '';
1739
		if ($nom['cultivar_groupe'] != '') {
1751
		if ($nom['cultivar_groupe'] != '') {
1740
			if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
1752
			if (preg_match('/ gx$/', $nom['cultivar_groupe'])) {
1741
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].')';
1753
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].')';
1742
			} else {
1754
			} else {
1743
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].' Gp)';
1755
				$nom_groupe_cultivar =  '('.$nom['cultivar_groupe'].' Gp)';
1744
			}
1756
			}
1745
		}
1757
		}
1746
		return $nom_groupe_cultivar;
1758
		return $nom_groupe_cultivar;
1747
	}
1759
	}
1748
	
1760
	
1749
	private function construireNomCommercial(&$nom) {
1761
	private function construireNomCommercial(&$nom) {
1750
		$nom_commercial = '';
1762
		$nom_commercial = '';
1751
		if ($nom['nom_commercial'] != '') {
1763
		if ($nom['nom_commercial'] != '') {
1752
			$nom_commercial =  strtoupper($nom['nom_commercial']);
1764
			$nom_commercial =  strtoupper($nom['nom_commercial']);
1753
		}
1765
		}
1754
		return $nom_commercial;
1766
		return $nom_commercial;
1755
	}
1767
	}
1756
	
1768
	
1757
	private function construireNomCultivar(&$nom) {
1769
	private function construireNomCultivar(&$nom) {
1758
		$nom_cultivar = '';
1770
		$nom_cultivar = '';
1759
		if ($nom['cultivar'] != '') {
1771
		if ($nom['cultivar'] != '') {
1760
			$nom_cultivar =  "'".$nom['cultivar']."'";
1772
			$nom_cultivar =  "'".$nom['cultivar']."'";
1761
		}
1773
		}
1762
		return $nom_cultivar;
1774
		return $nom_cultivar;
1763
	}
1775
	}
1764
	
1776
	
1765
	private function classerNomsParNomComplet() {
1777
	private function classerNomsParNomComplet() {
1766
		$noms_classes = array();
1778
		$noms_classes = array();
1767
		foreach ($this->noms as &$nom) {
1779
		foreach ($this->noms as &$nom) {
1768
			if (!isset($noms_classes[$nom['nom_sci']])) {
1780
			if (!isset($noms_classes[$nom['nom_sci']])) {
1769
				$noms_classes[$nom['nom_sci']] = 1;
1781
				$noms_classes[$nom['nom_sci']] = 1;
1770
			} else {
1782
			} else {
1771
				$noms_classes[$nom['nom_sci']]++;
1783
				$noms_classes[$nom['nom_sci']]++;
1772
			}
1784
			}
1773
		}
1785
		}
1774
		return $noms_classes;
1786
		return $noms_classes;
1775
	}
1787
	}
1776
}
1788
}
1777
?>
1789
?>