Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 487 Rev 493
1
<?php
1
<?php
2
class Index {
2
class Index {
3
 
3
 
4
	const DOSSIER_V0 = '../../../donnees/coste/0.00/';
4
	const DOSSIER_V0 = '../../../donnees/coste/0.00/';
5
	const DOSSIER_V2 = '../../../donnees/coste/2.00/';
5
	const DOSSIER_V2 = '../../../donnees/coste/2.00/';
6
 
6
 
7
	private $conteneur = null;
7
	private $conteneur = null;
8
	private $outils = null;
8
	private $outils = null;
9
	private $messages = null;
9
	private $messages = null;
10
	private $generateur = null;
10
	private $generateur = null;
11
	private $dossierBase = '';
11
	private $dossierBase = '';
12
	private $spIndex = array();
12
	private $spIndex = array();
13
	private $supraSpIndex = array();
13
	private $supraSpIndex = array();
14
	private $imgIndex = array();
14
	private $imgIndex = array();
15
	private $indexFinal = array();
15
	private $indexFinal = array();
16
	private $tableauParDefaut = array();
16
	private $tableauParDefaut = array();
17
	private $nbreTaxonInf = array();
17
	private $nbreTaxonInf = array();
18
	private $enteteFinal = array(
18
	private $enteteFinal = array(
19
		'num_nom',
19
		'num_nom',
20
		'num_nom_retenu',
20
		'num_nom_retenu',
21
		'num_tax_sup',
21
		'num_tax_sup',
22
		'rang',
22
		'rang',
23
		'nom_sci',
23
		'nom_sci',
24
		'nom_supra_generique',
24
		'nom_supra_generique',
25
		'genre',
25
		'genre',
26
		'epithete_infra_generique',
26
		'epithete_infra_generique',
27
		'epithete_sp',
27
		'epithete_sp',
28
		'type_epithete',
28
		'type_epithete',
29
		'epithete_infra_sp',
29
		'epithete_infra_sp',
30
		'cultivar_groupe',
30
		'cultivar_groupe',
31
		'cultivar',
31
		'cultivar',
32
		'nom_commercial',
32
		'nom_commercial',
33
		'auteur',
33
		'auteur',
34
		'annee',
34
		'annee',
35
		'biblio_origine',
35
		'biblio_origine',
36
		'notes',
36
		'notes',
37
		'nom_addendum',
37
		'nom_addendum',
38
		'nom_francais',
38
		'nom_francais',
39
		'nom_coste',
39
		'nom_coste',
40
		'auteur_coste',
40
		'auteur_coste',
41
		'biblio_coste',
41
		'biblio_coste',
42
		'num_nom_coste',
42
		'num_nom_coste',
43
		'num_nom_retenu_coste',
43
		'num_nom_retenu_coste',
44
		'num_tax_sup_coste',
44
		'num_tax_sup_coste',
45
		'synonymie_coste',
45
		'synonymie_coste',
46
		'tome',
46
		'tome',
47
		'page',
47
		'page',
48
		'nbre_taxons',
48
		'nbre_taxons',
49
		'flore_bdtfx_nn',
49
		'flore_bdtfx_nn',
50
		'flore_bdtfx_nt',
50
		'flore_bdtfx_nt',
51
		'image',
51
		'image',
52
		'image_auteur',
52
		'image_auteur',
53
		'page_wiki_dsc',
53
		'page_wiki_dsc',
54
		'page_wiki_cle',
54
		'page_wiki_cle',
55
		'nom_sci_html');
55
		'nom_sci_html');
56
 
56
 
57
	public function __construct(Conteneur $conteneur) {
57
	public function __construct(Conteneur $conteneur) {
58
		mb_internal_encoding('UTF-8');
58
		mb_internal_encoding('UTF-8');
59
		setlocale(LC_ALL, 'fr_FR.UTF-8');
59
		setlocale(LC_ALL, 'fr_FR.UTF-8');
60
		$this->conteneur = $conteneur;
60
		$this->conteneur = $conteneur;
61
		$this->outils = $conteneur->getOutils();
61
		$this->outils = $conteneur->getOutils();
62
		$this->messages = $conteneur->getMessages();
62
		$this->messages = $conteneur->getMessages();
63
		$this->generateur = $conteneur->getGenerateurNomSciHtml();
63
		$this->generateur = $conteneur->getGenerateurNomSciHtml();
64
		$this->dossierBase = dirname(__FILE__).'/';
64
		$this->dossierBase = dirname(__FILE__).'/';
65
	}
65
	}
66
 
66
 
67
	public function fusionnerIndex() {
67
	public function fusionnerIndex() {
68
		$this->chargerIndexSp();
68
		$this->chargerIndexSp();
69
		$this->chargerIndexSupraSp();
69
		$this->chargerIndexSupraSp();
70
		$this->initialiserTableauLigneIndexFinal();
70
		$this->initialiserTableauLigneIndexFinal();
71
		$this->creerIndexFinal();
71
		$this->creerIndexFinal();
72
		$this->ajouterChampsDansIndexFinal();
72
		$this->ajouterChampsDansIndexFinal();
73
		$this->ajouteurAuteurImage();
73
		$this->ajouteurAuteurImage();
74
		$this->decomposerNomSci();
74
		$this->decomposerNomSci();
75
		$this->ajouteurNomSciHtml();
75
		$this->ajouteurNomSciHtml();
-
 
76
		$this->ajouterCorrections();
76
		$this->creerFichierCsvIndexFinal();
77
		$this->creerFichierCsvIndexFinal();
77
	}
78
	}
78
 
79
 
79
	private function chargerIndexSp() {
80
	private function chargerIndexSp() {
80
		$spIndexFichier = $this->dossierBase.self::DOSSIER_V0.'index_general_sp.tsv';
81
		$spIndexFichier = $this->dossierBase.self::DOSSIER_V0.'index_general_sp.tsv';
81
		$index = $this->outils->transformerTxtTsvEnTableau($spIndexFichier);
82
		$index = $this->outils->transformerTxtTsvEnTableau($spIndexFichier);
82
		$index = $this->reindexerParNumNomCoste($index);
83
		$index = $this->reindexerParNumNomCoste($index);
83
		foreach ($index as $numNomCoste => $infos) {
84
		foreach ($index as $numNomCoste => $infos) {
84
			$numTaxSup = '';
85
			$numTaxSup = '';
85
			if ($infos['num_nom_coste'] == $infos['num_nom_retenu_coste']) {
86
			if ($infos['num_nom_coste'] == $infos['num_nom_retenu_coste']) {
86
				$numTaxSup = $infos['num_tax_sup_coste'];
87
				$numTaxSup = $infos['num_tax_sup_coste'];
87
			} else {
88
			} else {
88
				$infosNomRetenu = $index[$infos['num_nom_retenu_coste']];
89
				$infosNomRetenu = $index[$infos['num_nom_retenu_coste']];
89
				$numTaxSup = $infosNomRetenu['num_tax_sup_coste'];
90
				$numTaxSup = $infosNomRetenu['num_tax_sup_coste'];
90
			}
91
			}
91
			$this->spIndex[$numTaxSup][] = $infos;
92
			$this->spIndex[$numTaxSup][] = $infos;
92
		}
93
		}
93
	}
94
	}
94
 
95
 
95
	private function reindexerParNumNomCoste($index) {
96
	private function reindexerParNumNomCoste($index) {
96
		$nouvelIndex = array();
97
		$nouvelIndex = array();
97
		foreach ($index as $infos) {
98
		foreach ($index as $infos) {
98
			$nouvelIndex[$infos['num_nom_coste']] = $infos;
99
			$nouvelIndex[$infos['num_nom_coste']] = $infos;
99
		}
100
		}
100
		return $nouvelIndex;
101
		return $nouvelIndex;
101
	}
102
	}
102
 
103
 
103
	private function chargerIndexSupraSp() {
104
	private function chargerIndexSupraSp() {
104
		$infraSpIndexFichier = $this->dossierBase.self::DOSSIER_V0.'index_general.tsv';
105
		$infraSpIndexFichier = $this->dossierBase.self::DOSSIER_V0.'index_general.tsv';
105
		$this->supraSpIndex = $this->outils->transformerTxtTsvEnTableau($infraSpIndexFichier);
106
		$this->supraSpIndex = $this->outils->transformerTxtTsvEnTableau($infraSpIndexFichier);
106
		foreach ($this->supraSpIndex as $cle => $infos) {
107
		foreach ($this->supraSpIndex as $cle => $infos) {
107
			$this->supraSpIndex[$cle]['num_nom_retenu_coste'] = $infos['num_nom_coste'];
108
			$this->supraSpIndex[$cle]['num_nom_retenu_coste'] = $infos['num_nom_coste'];
108
		}
109
		}
109
	}
110
	}
110
 
111
 
111
	private function initialiserTableauLigneIndexFinal() {
112
	private function initialiserTableauLigneIndexFinal() {
112
		$this->tableauParDefaut = array();
113
		$this->tableauParDefaut = array();
113
		foreach ($this->enteteFinal as $cle) {
114
		foreach ($this->enteteFinal as $cle) {
114
			$this->tableauParDefaut[$cle] = '';
115
			$this->tableauParDefaut[$cle] = '';
115
		}
116
		}
116
	}
117
	}
117
 
118
 
118
	private function creerIndexFinal() {
119
	private function creerIndexFinal() {
119
		foreach ($this->supraSpIndex as $infos) {
120
		foreach ($this->supraSpIndex as $infos) {
120
			$this->ajouterDansIndexFinal($infos);
121
			$this->ajouterDansIndexFinal($infos);
121
			if (preg_match('/^G[0-9]+$/', $infos['num_nom_coste'])) {
122
			if (preg_match('/^G[0-9]+$/', $infos['num_nom_coste'])) {
122
				foreach ($this->spIndex[$infos['num_nom_coste']] as $infosSp) {
123
				foreach ($this->spIndex[$infos['num_nom_coste']] as $infosSp) {
123
					$this->ajouterDansIndexFinal($infosSp);
124
					$this->ajouterDansIndexFinal($infosSp);
124
				}
125
				}
125
			}
126
			}
126
		}
127
		}
127
	}
128
	}
128
 
129
 
129
	private function ajouterDansIndexFinal($infos) {
130
	private function ajouterDansIndexFinal($infos) {
130
		$infos = array_merge($this->tableauParDefaut, $infos);
131
		$infos = array_merge($this->tableauParDefaut, $infos);
131
		$infos['num_nom'] = (count($this->indexFinal) + 1);
132
		$infos['num_nom'] = (count($this->indexFinal) + 1);
132
		$this->indexFinal[$infos['num_nom_coste']] = $infos;
133
		$this->indexFinal[$infos['num_nom_coste']] = $infos;
133
	}
134
	}
134
 
135
 
135
	private function ajouterChampsDansIndexFinal() {
136
	private function ajouterChampsDansIndexFinal() {
136
		$this->genererNbreTaxons();
137
		$this->genererNbreTaxons();
137
		foreach ($this->indexFinal as $nnc => $infos) {
138
		foreach ($this->indexFinal as $nnc => $infos) {
138
			if ($infos['num_nom_coste'] == $infos['num_nom_retenu_coste']) {
139
			if ($infos['num_nom_coste'] == $infos['num_nom_retenu_coste']) {
139
				$infos['num_nom_retenu'] = $infos['num_nom'];
140
				$infos['num_nom_retenu'] = $infos['num_nom'];
140
				if ($nnc != 'R') {
141
				if ($nnc != 'R') {
141
					$nomSuperieur = $this->indexFinal[$infos['num_tax_sup_coste']];
142
					$nomSuperieur = $this->indexFinal[$infos['num_tax_sup_coste']];
142
					$infos['num_tax_sup'] = $nomSuperieur['num_nom'];
143
					$infos['num_tax_sup'] = $nomSuperieur['num_nom'];
143
				}
144
				}
144
				$nomRetenu = $infos;
145
				$nomRetenu = $infos;
145
			} else {
146
			} else {
146
				$nomRetenu = $this->indexFinal[$infos['num_nom_retenu_coste']];
147
				$nomRetenu = $this->indexFinal[$infos['num_nom_retenu_coste']];
147
				$infos['num_nom_retenu'] = $nomRetenu['num_nom'];
148
				$infos['num_nom_retenu'] = $nomRetenu['num_nom'];
148
			}
149
			}
149
			$infos['image'] = $this->obtenirNomFichierImg($nomRetenu);
150
			$infos['image'] = $this->obtenirNomFichierImg($nomRetenu);
150
			$infos['nbre_taxons'] = $this->obtenirNbreTaxon($infos);
151
			$infos['nbre_taxons'] = $this->obtenirNbreTaxon($infos);
151
			$nomRetenu['nbre_taxons'] = $infos['nbre_taxons'];
152
			$nomRetenu['nbre_taxons'] = $infos['nbre_taxons'];
152
			$infos['page_wiki_dsc'] = $this->genererPageWikiDsc($nomRetenu);
153
			$infos['page_wiki_dsc'] = $this->genererPageWikiDsc($nomRetenu);
153
			$infos['page_wiki_cle'] = $this->genererPageWikiCle($nomRetenu);
154
			$infos['page_wiki_cle'] = $this->genererPageWikiCle($nomRetenu);
154
 
155
 
155
			$this->indexFinal[$nnc] = $infos;
156
			$this->indexFinal[$nnc] = $infos;
156
		}
157
		}
157
	}
158
	}
158
 
159
 
159
	private function genererNbreTaxons() {
160
	private function genererNbreTaxons() {
160
		foreach ($this->indexFinal as $infos) {
161
		foreach ($this->indexFinal as $infos) {
161
			if ($infos['num_tax_sup_coste'] != '') {
162
			if ($infos['num_tax_sup_coste'] != '') {
162
				if (isset($this->nbreTaxonInf[$infos['num_tax_sup_coste']])) {
163
				if (isset($this->nbreTaxonInf[$infos['num_tax_sup_coste']])) {
163
					$this->nbreTaxonInf[$infos['num_tax_sup_coste']] += 1;
164
					$this->nbreTaxonInf[$infos['num_tax_sup_coste']] += 1;
164
				} else {
165
				} else {
165
					$this->nbreTaxonInf[$infos['num_tax_sup_coste']] = 1;
166
					$this->nbreTaxonInf[$infos['num_tax_sup_coste']] = 1;
166
				}
167
				}
167
			}
168
			}
168
		}
169
		}
169
	}
170
	}
170
 
171
 
171
	private function genererPageWikiDsc($infos) {
172
	private function genererPageWikiDsc($infos) {
172
		$prefixe = $this->genererPrefixePage($infos);
173
		$prefixe = $this->genererPrefixePage($infos);
173
		if ($infos['rang'] == '180') {
174
		if ($infos['rang'] == '180') {
174
			$nomSci = str_replace(' ', '', ucwords(strtolower($infos['nom_coste'])));
175
			$nomSci = str_replace(' ', '', ucwords(strtolower($infos['nom_coste'])));
175
		} else {
176
		} else {
176
			$nomSci = str_replace(' ', '', ucwords(strtolower($infos['nom_sci'])));
177
			$nomSci = str_replace(' ', '', ucwords(strtolower($infos['nom_sci'])));
177
		}
178
		}
178
		$pageWiki = $prefixe.$nomSci;
179
		$pageWiki = $prefixe.$nomSci;
179
		return $pageWiki;
180
		return $pageWiki;
180
	}
181
	}
181
 
182
 
182
	private function genererPageWikiCle($infos) {
183
	private function genererPageWikiCle($infos) {
183
		$pageWiki = '';
184
		$pageWiki = '';
184
		if ($infos['nbre_taxons'] > 1) {
185
		if ($infos['nbre_taxons'] > 1) {
185
			$prefixe = $this->genererPrefixePage($infos);
186
			$prefixe = $this->genererPrefixePage($infos);
186
			if ($infos['rang'] == '20') {
187
			if ($infos['rang'] == '20') {
187
				$pageWiki = $prefixe.'TabClaEtEmb';
188
				$pageWiki = $prefixe.'TabClaEtEmb';
188
			} elseif ($infos['rang'] == '40' && ($infos['num_nom_coste'] == 'E2' || $infos['num_nom_coste'] == 'E3')) {
189
			} elseif ($infos['rang'] == '40' && ($infos['num_nom_coste'] == 'E2' || $infos['num_nom_coste'] == 'E3')) {
189
				$pageWiki = $prefixe.'TabFam';
190
				$pageWiki = $prefixe.'TabFam';
190
			} else if ($infos['rang'] == '80') {
191
			} else if ($infos['rang'] == '80') {
191
				$pageWiki = $prefixe.'TabFam';
192
				$pageWiki = $prefixe.'TabFam';
192
			} else if ($infos['rang'] == '180') {
193
			} else if ($infos['rang'] == '180') {
193
				$pageWiki = $prefixe.'TabGen';
194
				$pageWiki = $prefixe.'TabGen';
194
			} else if ($infos['rang'] == '220') {
195
			} else if ($infos['rang'] == '220') {
195
				$pageWiki = $prefixe.'TabSp';
196
				$pageWiki = $prefixe.'TabSp';
196
			}
197
			}
197
		}
198
		}
198
		return $pageWiki;
199
		return $pageWiki;
199
	}
200
	}
200
 
201
 
201
	private function genererPrefixePage($infos) {
202
	private function genererPrefixePage($infos) {
202
		$prefixe = '';
203
		$prefixe = '';
203
		$num = preg_replace('/^[a-z]*([0-9.]+)$/i', '$1', $infos['num_nom_coste']);
204
		$num = preg_replace('/^[a-z]*([0-9.]+)$/i', '$1', $infos['num_nom_coste']);
204
		if (preg_match('/^([0-9]+)[.][0-9]+$/i', $infos['num_nom_coste'], $match)) {
205
		if (preg_match('/^([0-9]+)[.][0-9]+$/i', $infos['num_nom_coste'], $match)) {
205
			$num = sprintf('%04s', $match[1]);
206
			$num = sprintf('%04s', $match[1]);
206
		} else if ($infos['rang'] == 20 ) {
207
		} else if ($infos['rang'] == 20 ) {
207
			$num = '';
208
			$num = '';
208
		} else if ($infos['rang'] < 80 ) {
209
		} else if ($infos['rang'] < 80 ) {
209
			$num = sprintf('%02s', $num);
210
			$num = sprintf('%02s', $num);
210
		} else if ($infos['rang'] < 290 ) {
211
		} else if ($infos['rang'] < 290 ) {
211
			$num = sprintf('%03s', $num);
212
			$num = sprintf('%03s', $num);
212
		} else {
213
		} else {
213
			$num = sprintf('%04s', $num);
214
			$num = sprintf('%04s', $num);
214
		}
215
		}
215
		$rangsTxt = array('20' => 'Reg', '40' => 'Emb', '80' => 'Cla', '180' => 'Fam', '220' => 'Gen', '290' => 'Esp', '340' => 'Var');
216
		$rangsTxt = array('20' => 'Reg', '40' => 'Emb', '80' => 'Cla', '180' => 'Fam', '220' => 'Gen', '290' => 'Esp', '340' => 'Var');
216
		$rang = $rangsTxt[$infos['rang']];
217
		$rang = $rangsTxt[$infos['rang']];
217
 
218
 
218
		$prefixe = $rang.$num;
219
		$prefixe = $rang.$num;
219
		return $prefixe;
220
		return $prefixe;
220
	}
221
	}
221
 
222
 
222
	private function obtenirNbreTaxon($infos) {
223
	private function obtenirNbreTaxon($infos) {
223
		$nbre = '';
224
		$nbre = '';
224
		if (isset($this->nbreTaxonInf[$infos['num_nom_coste']])) {
225
		if (isset($this->nbreTaxonInf[$infos['num_nom_coste']])) {
225
			$nbre = $this->nbreTaxonInf[$infos['num_nom_coste']];
226
			$nbre = $this->nbreTaxonInf[$infos['num_nom_coste']];
226
		}
227
		}
227
		return $nbre;
228
		return $nbre;
228
	}
229
	}
229
 
230
 
230
	private function obtenirNomFichierImg($infos) {
231
	private function obtenirNomFichierImg($infos) {
231
		$img = '';
232
		$img = '';
232
		if ($infos['rang'] == '290' && ($infos['num_nom'] == $infos['num_nom_retenu'])) {
233
		if ($infos['rang'] == '290' && ($infos['num_nom'] == $infos['num_nom_retenu'])) {
233
			$img = $infos['num_nom_coste'].'.png';
234
			$img = $infos['num_nom_coste'].'.png';
234
		}
235
		}
235
		return $img;
236
		return $img;
236
	}
237
	}
237
 
238
 
238
	private function ajouteurAuteurImage() {
239
	private function ajouteurAuteurImage() {
239
		$this->chargerAuteurImg();
240
		$this->chargerAuteurImg();
240
		foreach ($this->indexFinal as $nnc => $infos) {
241
		foreach ($this->indexFinal as $nnc => $infos) {
241
			$infos['image_auteur'] = $this->imgIndex[$infos['image']];
242
			$infos['image_auteur'] = $this->imgIndex[$infos['image']];
242
			$this->indexFinal[$nnc] = $infos;
243
			$this->indexFinal[$nnc] = $infos;
243
		}
244
		}
244
	}
245
	}
245
 
246
 
246
	private function chargerAuteurImg() {
247
	private function chargerAuteurImg() {
247
		$imgIndexFichier = $this->dossierBase.self::DOSSIER_V0.'coste_images_auteur_correspondance_bdnff.tsv';
248
		$imgIndexFichier = $this->dossierBase.self::DOSSIER_V0.'coste_images_auteur_correspondance_bdnff.tsv';
248
		$index = $this->outils->transformerTxtTsvEnTableau($imgIndexFichier);
249
		$index = $this->outils->transformerTxtTsvEnTableau($imgIndexFichier);
249
		foreach ($index as $infos) {
250
		foreach ($index as $infos) {
250
			$id = $infos['id_image'];
251
			$id = $infos['id_image'];
251
			$this->imgIndex[$id] = $infos['auteur'];
252
			$this->imgIndex[$id] = $infos['auteur'];
252
		}
253
		}
253
	}
254
	}
254
 
255
 
255
	private function decomposerNomSci() {
256
	private function decomposerNomSci() {
256
		$majuscule = "[ÆŒA-Z]";
257
		$majuscule = "[ÆŒA-Z]";
257
		$epithete = "[æœïa-z-]+";
258
		$epithete = "[æœïa-z-]+";
258
		foreach ($this->indexFinal as $nnc => $infos) {
259
		foreach ($this->indexFinal as $nnc => $infos) {
259
			$id = $infos['num_nom_coste'];
260
			$id = $infos['num_nom_coste'];
260
			$nomSci = $infos['nom_sci'];
261
			$nomSci = $infos['nom_sci'];
261
			$rang = $infos['rang'];
262
			$rang = $infos['rang'];
262
			if ($rang < 220) {
263
			if ($rang < 220) {
263
				$infos['nom_supra_generique'] = $nomSci;
264
				$infos['nom_supra_generique'] = $nomSci;
264
			} else if ($rang == 220) {
265
			} else if ($rang == 220) {
265
				$infos['genre'] = $nomSci;
266
				$infos['genre'] = $nomSci;
266
			} else if ($rang == 290) {
267
			} else if ($rang == 290) {
267
				if (preg_match("/^($majuscule$epithete) ($epithete)$/", $nomSci, $match)) {
268
				if (preg_match("/^($majuscule$epithete) ($epithete)$/", $nomSci, $match)) {
268
					$infos['genre'] = $match[1];
269
					$infos['genre'] = $match[1];
269
					$infos['epithete_sp'] = $match[2];
270
					$infos['epithete_sp'] = $match[2];
270
				} else {
271
				} else {
271
					$this->messages->traiterErreur("Le nom $nomSci ($id) de rang $rang n'est pas standard.");
272
					$this->messages->traiterErreur("Le nom $nomSci ($id) de rang $rang n'est pas standard.");
272
				}
273
				}
273
			} else if ($rang == 340) {
274
			} else if ($rang == 340) {
274
				if (preg_match("/^($majuscule$epithete) ($epithete) (var[.]) ($epithete)$/", $nomSci, $match)) {
275
				if (preg_match("/^($majuscule$epithete) ($epithete) (var[.]) ($epithete)$/", $nomSci, $match)) {
275
					$infos['genre'] = $match[1];
276
					$infos['genre'] = $match[1];
276
					$infos['epithete_sp'] = $match[2];
277
					$infos['epithete_sp'] = $match[2];
277
					$infos['type_epithete'] = $match[3];
278
					$infos['type_epithete'] = $match[3];
278
					$infos['epithete_infra_sp'] = $match[4];
279
					$infos['epithete_infra_sp'] = $match[4];
279
				} else {
280
				} else {
280
					$this->messages->traiterErreur("Le nom $nomSci ($id) de rang $rang n'est pas standard.");
281
					$this->messages->traiterErreur("Le nom $nomSci ($id) de rang $rang n'est pas standard.");
281
				}
282
				}
282
			}
283
			}
283
 
284
 
284
			$this->indexFinal[$nnc] = $infos;
285
			$this->indexFinal[$nnc] = $infos;
285
			$this->messages->afficherAvancement("Décomposition des noms scientifiques en cours");
286
			$this->messages->afficherAvancement("Décomposition des noms scientifiques en cours");
286
		}
287
		}
287
		echo "\n";
288
		echo "\n";
288
	}
289
	}
289
 
290
 
290
	private function ajouteurNomSciHtml() {
291
	private function ajouteurNomSciHtml() {
291
		foreach ($this->indexFinal as $nnc => $infos) {
292
		foreach ($this->indexFinal as $nnc => $infos) {
292
			$this->indexFinal[$nnc]['nom_sci_html'] = $this->generateur->genererNomSciHtml($infos);
293
			$this->indexFinal[$nnc]['nom_sci_html'] = $this->generateur->genererNomSciHtml($infos);
293
			$this->messages->afficherAvancement("Création des noms scientifiques HTML en cours");
294
			$this->messages->afficherAvancement("Création des noms scientifiques HTML en cours");
294
		}
295
		}
295
		echo "\n";
296
		echo "\n";
296
	}
297
	}
-
 
298
 
-
 
299
	private function ajouterCorrections() {
-
 
300
		$correctionsFichier = $this->dossierBase.self::DOSSIER_V2.'coste_v2_00_corrections.tsv';
-
 
301
		$corrections = $this->outils->transformerTxtTsvEnTableau($correctionsFichier);
-
 
302
		foreach ($corrections as $infos) {
-
 
303
			$nnc = $infos['num_nom_coste'];
-
 
304
			$infosACorriger = $this->indexFinal[$nnc];
-
 
305
			foreach ($corrections as $champ => $valeur) {
-
 
306
				$infosACorriger[$champ] = $valeur;
-
 
307
			}
-
 
308
			$this->indexFinal[$nnc] = $infosACorriger;
-
 
309
		}
-
 
310
	}
297
 
311
 
298
	private function creerFichierCsvIndexFinal() {
312
	private function creerFichierCsvIndexFinal() {
299
		$lignes = array();
313
		$lignes = array();
300
		array_unshift($this->indexFinal, $this->enteteFinal);
314
		array_unshift($this->indexFinal, $this->enteteFinal);
301
		foreach ($this->indexFinal as $infos) {
315
		foreach ($this->indexFinal as $infos) {
302
			$lignes[] = implode("\t", $infos);
316
			$lignes[] = implode("\t", $infos);
303
		}
317
		}
304
 
318
 
305
		$txt = '';
319
		$txt = '';
306
		$txt = implode("\n", $lignes);
320
		$txt = implode("\n", $lignes);
307
 
321
 
308
		$fichierTsvIndexFinal = $this->dossierBase.self::DOSSIER_V2.'coste_v2_00.tsv';
322
		$fichierTsvIndexFinal = $this->dossierBase.self::DOSSIER_V2.'coste_v2_00.tsv';
309
		file_put_contents($fichierTsvIndexFinal, $txt);
323
		file_put_contents($fichierTsvIndexFinal, $txt);
310
	}
324
	}
311
}
325
}
312
?>
326
?>