Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 353 Rev 485
1
<?php
1
<?php
2
class GenerateurNomSciHtml {
2
class GenerateurNomSciHtml {
3
	protected $bdd = null;
3
	protected $bdd = null;
4
	protected $table = null;
4
	protected $table = null;
5
 
5
 
6
	protected $num = null;
6
	protected $num = null;
7
	protected $compo_nom = array();
7
	protected $compo_nom = array();
8
 
8
 
9
	protected $abbr = array (
9
	protected $abbr = array (
10
			'infra-gen.' 	=>	'Infra-Genre',
10
			'infra-gen.' 	=>	'Infra-Genre',
11
			'sect.'			=> 'Section',
11
			'sect.'			=> 'Section',
12
			'subsect.'		=> 'Sous-Section',
12
			'subsect.'		=> 'Sous-Section',
13
			'ser.'			=> 'Série',
13
			'ser.'			=> 'Série',
14
			'subser.'		=> 'Sous-Série',
14
			'subser.'		=> 'Sous-Série',
15
			'gr.'			=> 'Groupe',
15
			'gr.'			=> 'Groupe',
16
			'agg.' 			=> 'Agrégat',
16
			'agg.' 			=> 'Agrégat',
17
			'sp.' 			=> 'Espèce',
17
			'sp.' 			=> 'Espèce',
18
			'subsp.'		=> 'Sous-Espèce',
18
			'subsp.'		=> 'Sous-Espèce',
19
			'infra-sp.'		=> 'Infra-Espèce',
19
			'infra-sp.'		=> 'Infra-Espèce',
20
			'var.'			=> 'Variété',
20
			'var.'			=> 'Variété',
21
			'subvar.'		=> 'Sous-Variété',
21
			'subvar.'		=> 'Sous-Variété',
22
			'fa'			=> 'Forme',
22
			'fa'			=> 'Forme',
23
			'subf.'			=> 'Sous-Forme',
23
			'subf.'			=> 'Sous-Forme',
24
			'f. sp.'		=> 'Forma species',
24
			'f. sp.'		=> 'Forma species',
25
			'proles' 		=> 'Race prole'
25
			'proles' 		=> 'Race prole'
26
	);
26
	);
27
 
27
 
28
	private $nomSciTpl = '<span class="sci">%s</span>';
28
	private $nomSciTpl = '<span class="sci">%s</span>';
29
 
29
 
30
	private $nomSupraGenTpl = '<span class="supra_gen">%s</span>';
30
	private $nomSupraGenTpl = '<span class="supra_gen">%s</span>';
31
	private $genTpl = '<span class="gen">%s</span>';
31
	private $genTpl = '<span class="gen">%s</span>';
32
	private $infraGenTpl = '<span class="infra-gen">%s</span>';
32
	private $infraGenTpl = '<span class="infra-gen">%s</span>';
33
	private $spFHTpl = '<span class="gen">%s</span> <span class="sp">%s</span>';
33
	private $spFHTpl = '<span class="gen">%s</span> <span class="sp">%s</span>';
34
	private $typeEpitheteTpl = '<abbr class="type_epithete" title="%s">%s</abbr>';
34
	private $typeEpitheteTpl = '<abbr class="type_epithete" title="%s">%s</abbr>';
35
	private $infraSpFHTpl = '<span class="gen">%s</span> <span class="sp">%s</span> <abbr class="type-epithete" title="%s">%s</abbr> <span class="infra-sp">%s</span>';
35
	private $infraSpFHTpl = '<span class="gen">%s</span> <span class="sp">%s</span> <abbr class="type-epithete" title="%s">%s</abbr> <span class="infra-sp">%s</span>';
36
 
36
 
37
	private $hybrideTpl = '<span class="hyb">× <span class="%s">%s</span></span>';
37
	private $hybrideTpl = '<span class="hyb">× <span class="%s">%s</span></span>';
38
	private $chimereTpl = '<span class="chimere">+ <span class="%s">%s</span></span>';
38
	private $chimereTpl = '<span class="chimere">+ <span class="%s">%s</span></span>';
39
	private $formuleHybTpl = '<span class="formule-hyb">%s</span>';
39
	private $formuleHybTpl = '<span class="formule-hyb">%s</span>';
40
	private $hybriditeTpl = '<span class="%s">%s</span>';
40
	private $hybriditeTpl = '<span class="%s">%s</span>';
41
 
41
 
42
	private $gpGxAvecCvarTpl = '<span class="gp">%s <abbr title="grex">gx</abbr>(%s <abbr title="groupe">Gp</abbr>)</span>';
42
	private $gpGxAvecCvarTpl = '<span class="gp">%s <abbr title="grex">gx</abbr>(%s <abbr title="groupe">Gp</abbr>)</span>';
43
	private $gpGxSansCvarTpl = '<span class="gp">%s <abbr title="grex">gx</abbr>%s <abbr title="groupe">Gp</abbr></span>';
43
	private $gpGxSansCvarTpl = '<span class="gp">%s <abbr title="grex">gx</abbr>%s <abbr title="groupe">Gp</abbr></span>';
44
	private $gxTpl = '<span class="gp">%s <abbr title="grex">gx</abbr></span>';
44
	private $gxTpl = '<span class="gp">%s <abbr title="grex">gx</abbr></span>';
45
	private $gpAvecCvarTpl = '<span class="gp">(%s <abbr title="groupe">Gp</abbr>)</span>';
45
	private $gpAvecCvarTpl = '<span class="gp">(%s <abbr title="groupe">Gp</abbr>)</span>';
46
	private $gpSansCvarTpl = '<span class="gp">%s <abbr title="groupe">Gp</abbr></span>';
46
	private $gpSansCvarTpl = '<span class="gp">%s <abbr title="groupe">Gp</abbr></span>';
47
	private $commTpl = '<span class="commercial">%s</span>';
47
	private $commTpl = '<span class="commercial">%s</span>';
48
	private $cvarTpl = '<span class="cultivar">\'%s\'</span>';
48
	private $cvarTpl = '<span class="cultivar">\'%s\'</span>';
49
 
49
 
50
	public function generer(Array $nomsDecomposes) {
50
	public function generer(Array $nomsDecomposes) {
51
		$nomsSciHtml = array();
51
		$nomsSciHtml = array();
52
		foreach ($nomsDecomposes as $infos) {
52
		foreach ($nomsDecomposes as $infos) {
53
			$this->initialiserVariables($infos);
-
 
54
 
-
 
55
			$nomSciHtml = '';
-
 
56
			$nomSciHtml .= $this->ajouterBaliseNomSupraGen();
-
 
57
			$nomSciHtml .= $this->verifierHybridite($this->compo_nom['genre'], 'gen');
-
 
58
			$nomSciHtml .= $this->ajouterBaliseInfraGen();
53
			$nom = $this->genererNomSciHtml($infos);
59
			$nomSciHtml .= $this->verifierHybridite($this->compo_nom['epithete_sp'], 'sp');
-
 
60
			$nomSciHtml .= $this->ajouterBaliseTypeInfraSp();
-
 
61
			$nomSciHtml .= $this->verifierHybridite($this->compo_nom['epithete_infra_sp'], 'infra-sp');
-
 
62
			$nomSciHtml .= $this->ajouterCultivarGpComm();
-
 
63
 
-
 
64
			if ($nomSciHtml != '') {
54
			if ($nom != '') {
65
				$nomsSciHtml[$this->num] = sprintf($this->nomSciTpl, trim($nomSciHtml));
55
				$nomsSciHtml[$this->num] = $nom;
66
			}
56
			}
67
		}
57
		}
68
		return $nomsSciHtml;
58
		return $nomsSciHtml;
69
	}
59
	}
-
 
60
 
-
 
61
	public function genererNomSciHtml(Array $nomDecomposes) {
-
 
62
		$this->initialiserVariables($nomDecomposes);
-
 
63
 
-
 
64
		$nomSciHtml = '';
-
 
65
		$nomSciHtml .= $this->ajouterBaliseNomSupraGen();
-
 
66
		$nomSciHtml .= $this->verifierHybridite($this->compo_nom['genre'], 'gen');
-
 
67
		$nomSciHtml .= $this->ajouterBaliseInfraGen();
-
 
68
		$nomSciHtml .= $this->verifierHybridite($this->compo_nom['epithete_sp'], 'sp');
-
 
69
		$nomSciHtml .= $this->ajouterBaliseTypeInfraSp();
-
 
70
		$nomSciHtml .= $this->verifierHybridite($this->compo_nom['epithete_infra_sp'], 'infra-sp');
-
 
71
		$nomSciHtml .= $this->ajouterCultivarGpComm();
-
 
72
 
-
 
73
		if ($nomSciHtml != '') {
-
 
74
			$nomSciHtml = sprintf($this->nomSciTpl, trim($nomSciHtml));
-
 
75
		}
-
 
76
		return $nomSciHtml;
-
 
77
	}
70
 
78
 
71
	private function initialiserVariables($infos) {
79
	private function initialiserVariables($infos) {
72
		$this->num = $infos['num_nom'];
80
		$this->num = $infos['num_nom'];
73
		$this->compo_nom = $infos;
81
		$this->compo_nom = $infos;
74
	}
82
	}
75
 
83
 
76
	private function ajouterBaliseNomSupraGen() {
84
	private function ajouterBaliseNomSupraGen() {
77
		$html = '';
85
		$html = '';
78
		if ($this->compo_nom['nom_supra_generique'] != '') {
86
		if ($this->compo_nom['nom_supra_generique'] != '') {
79
			$html = sprintf($this->nomSupraGenTpl, $this->compo_nom['nom_supra_generique']);
87
			$html = sprintf($this->nomSupraGenTpl, $this->compo_nom['nom_supra_generique']);
80
		}
88
		}
81
		return $html;
89
		return $html;
82
	}
90
	}
83
 
91
 
84
	private function ajouterTypeEpithete($type) {
92
	private function ajouterTypeEpithete($type) {
85
		if (!array_key_exists($type, $this->abbr)) {
93
		if (!array_key_exists($type, $this->abbr)) {
86
			$this->abbr[$type] = $type;
94
			$this->abbr[$type] = $type;
87
		}
95
		}
88
	}
96
	}
89
 
97
 
90
	private function ajouterBaliseInfraGen() {
98
	private function ajouterBaliseInfraGen() {
91
		$html = '';
99
		$html = '';
92
		if ($this->verifierTypeInfraGen()) {
100
		if ($this->verifierTypeInfraGen()) {
93
			$html .= $this->ajouterBaliseTypeInfraGen();
101
			$html = $this->ajouterBaliseTypeInfraGen();
94
		} else {
102
		} else {
95
			if ($this->avoirInfo('epithete_infra_generique')) {
103
			if ($this->avoirInfo('epithete_infra_generique')) {
96
				$html .= sprintf($this->infraGenTpl, $this->compo_nom['epithete_infra_generique']);
104
				$html = sprintf($this->infraGenTpl, $this->compo_nom['epithete_infra_generique']);
97
			}
105
			}
98
		}
106
		}
99
		return $html;
107
		return $html;
100
	}
108
	}
101
 
109
 
102
	private function verifierTypeInfraGen() {
110
	private function verifierTypeInfraGen() {
103
		$ok = false;
111
		$ok = false;
104
		if ($this->compo_nom['type_epithete'] != '' && $this->compo_nom['epithete_infra_generique'] != '') {
112
		if ($this->compo_nom['type_epithete'] != '' && $this->compo_nom['epithete_infra_generique'] != '') {
105
			$this->ajouterTypeEpithete($this->compo_nom['type_epithete']);
113
			$this->ajouterTypeEpithete($this->compo_nom['type_epithete']);
106
			$ok = true;
114
			$ok = true;
107
		}
115
		}
108
		return $ok;
116
		return $ok;
109
	}
117
	}
110
 
118
 
111
	private function ajouterBaliseTypeInfraGen() {
119
	private function ajouterBaliseTypeInfraGen() {
112
		$html = '';
120
		$html = '';
113
		$type = $this->compo_nom['type_epithete'];
121
		$type = $this->compo_nom['type_epithete'];
114
 
122
 
115
		if ($type == 'agg.') {
123
		if ($type == 'agg.') {
116
			// Ajout de l'infra gen avant le type s'il est égal à agg.
124
			// Ajout de l'infra gen avant le type s'il est égal à agg.
117
			$html .= ' '.$this->ajouterBaliseInfraGen().
125
			$html = ' '.$this->ajouterBaliseInfraGen().
118
					' '.sprintf($this->typeEpitheteTpl, $this->abbr[$type], $type);
126
					' '.sprintf($this->typeEpitheteTpl, $this->abbr[$type], $type);
119
		} else {
127
		} else {
120
			$html .= ' '.sprintf($this->typeEpitheteTpl, $this->abbr[$type], $type).
128
			$html = ' '.sprintf($this->typeEpitheteTpl, $this->abbr[$type], $type).
121
					' '.$this->ajouterBaliseInfraGen();
129
					' '.$this->ajouterBaliseInfraGen();
122
		}
130
		}
123
		return $html;
131
		return $html;
124
	}
132
	}
125
 
133
 
126
	private function ajouterBaliseTypeInfraSp() {
134
	private function ajouterBaliseTypeInfraSp() {
127
		$html = '';
135
		$html = '';
128
		$type = $this->compo_nom['type_epithete'];
136
		$type = $this->compo_nom['type_epithete'];
129
		$infraSp = $this->compo_nom['epithete_infra_sp'];
137
		$infraSp = $this->compo_nom['epithete_infra_sp'];
130
 
138
 
131
		if ($infraSp != '') {
139
		if ($infraSp != '') {
132
			if ($type != '') {
140
			if ($type != '') {
133
				$this->ajouterTypeEpithete($type);
141
				$this->ajouterTypeEpithete($type);
134
				$html = ' '.sprintf($this->typeEpitheteTpl, $this->abbr[$type], $type);
142
				$html = ' '.sprintf($this->typeEpitheteTpl, $this->abbr[$type], $type);
135
			} else {
143
			} else {
136
				$message = "Nom #%s contient un épithète infra-spécifique mais son type n'est pas renseigné.";
144
				$message = "Nom #%s contient un épithète infra-spécifique mais son type n'est pas renseigné.";
137
				$this->traiterErreur($message, array($this->num));
145
				$this->traiterErreur($message, array($this->num));
138
			}
146
			}
139
		}
147
		}
140
		return $html;
148
		return $html;
141
	}
149
	}
142
 
150
 
143
	private function ajouterCultivarGpComm() {
151
	private function ajouterCultivarGpComm() {
144
		$html = '';
152
		$html = '';
145
		if ($this->avoirInfo('cultivar_groupe')) {
153
		if ($this->avoirInfo('cultivar_groupe')) {
146
			$html .= ' '.$this->ajouterCultivarGroupe();
154
			$html .= ' '.$this->ajouterCultivarGroupe();
147
		}
155
		}
148
		if ($this->avoirInfo('nom_commercial')) {
156
		if ($this->avoirInfo('nom_commercial')) {
149
			$html .= ' '.sprintf($this->commTpl, $this->compo_nom['nom_commercial']);
157
			$html .= ' '.sprintf($this->commTpl, $this->compo_nom['nom_commercial']);
150
		}
158
		}
151
		if ($this->avoirInfo('cultivar')) {
159
		if ($this->avoirInfo('cultivar')) {
152
			$html .= ' '.sprintf($this->cvarTpl, $this->compo_nom['cultivar']);
160
			$html .= ' '.sprintf($this->cvarTpl, $this->compo_nom['cultivar']);
153
		}
161
		}
154
		return $html;
162
		return $html;
155
	}
163
	}
156
 
164
 
157
	private function avoirInfo($valeur) {
165
	private function avoirInfo($valeur) {
158
		return (isset($this->compo_nom[$valeur]) && $this->compo_nom[$valeur] != '') ? true : false;
166
		return (isset($this->compo_nom[$valeur]) && $this->compo_nom[$valeur] != '') ? true : false;
159
	}
167
	}
160
 
168
 
161
	/**
169
	/**
162
	 * Permet d'ajouter les groupes de cultivar en fonction de la présence d'un cultivar et de la présence d'un grex
170
	 * Permet d'ajouter les groupes de cultivar en fonction de la présence d'un cultivar et de la présence d'un grex
163
	 *
171
	 *
164
	 * L'ensemble des individus obtenu par une fécondation particulière s'appelle un le Grex (que pour les orchidées).
172
	 * L'ensemble des individus obtenu par une fécondation particulière s'appelle un le Grex (que pour les orchidées).
165
	 * Au sein du grex, certains individus peuvent se distinguer par des formes, des coloris ou autres qui font que
173
	 * Au sein du grex, certains individus peuvent se distinguer par des formes, des coloris ou autres qui font que
166
	 * l'obtenteur du grex va les sélectionner.
174
	 * l'obtenteur du grex va les sélectionner.
167
	 * les noms de groupes de cultivars sont suivis de l'abréviation « Gp » et placés entre parenthèses
175
	 * les noms de groupes de cultivars sont suivis de l'abréviation « Gp » et placés entre parenthèses
168
	 * les noms de grex, s'ils sont utilisés devant une épithète de cultivar, ne se mettent pas entre parenthèses
176
	 * les noms de grex, s'ils sont utilisés devant une épithète de cultivar, ne se mettent pas entre parenthèses
169
	 *	 ex : Cymbidium Alexanderi gx 'Westonbirt' (cultivar_groupe = Alexanderi gx) ;
177
	 *	 ex : Cymbidium Alexanderi gx 'Westonbirt' (cultivar_groupe = Alexanderi gx) ;
170
	 * les noms de groupe se mettent entre parenthèses s'ils sont devant une épithète de cultivar
178
	 * les noms de groupe se mettent entre parenthèses s'ils sont devant une épithète de cultivar
171
	 *	 ex : Dracaena fragrans (Deremenis Gp) 'Christianne' (cultivar_groupe = Deremenis)
179
	 *	 ex : Dracaena fragrans (Deremenis Gp) 'Christianne' (cultivar_groupe = Deremenis)
172
	 * Un grex peut contenir des groupes (rédaction d'un exemple de l'ICNCP)
180
	 * Un grex peut contenir des groupes (rédaction d'un exemple de l'ICNCP)
173
	 *	 ex : × Rhyncosophrocattleya Marie Lemon Stick grex Francis Suzuki Group
181
	 *	 ex : × Rhyncosophrocattleya Marie Lemon Stick grex Francis Suzuki Group
174
	 *	 ou : × Rhyncosophrocattleya Marie Lemon Stick gx Francis Suzuki Gp
182
	 *	 ou : × Rhyncosophrocattleya Marie Lemon Stick gx Francis Suzuki Gp
175
	 * @param unknown_type $val
183
	 * @param unknown_type $val
176
	 *
184
	 *
177
	 */
185
	 */
178
	private function ajouterCultivarGroupe() {
186
	private function ajouterCultivarGroupe() {
179
		$html = '';
187
		$html = '';
180
		// si le champ cultivar_groupe n'est pas vide
188
		// si le champ cultivar_groupe n'est pas vide
181
		if ($this->avoirInfo('cultivar_groupe')) {
189
		if ($this->avoirInfo('cultivar_groupe')) {
182
			$groupe = trim($this->compo_nom['cultivar_groupe']);
190
			$groupe = trim($this->compo_nom['cultivar_groupe']);
183
 
191
 
184
			// Sélection des templates
192
			// Sélection des templates
185
			$tplGx = $this->gxTpl;
193
			$tplGx = $this->gxTpl;
186
			$tplGpGx = $this->gpGxSansCvarTpl;
194
			$tplGpGx = $this->gpGxSansCvarTpl;
187
			$tplGp = $this->gpSansCvarTpl;
195
			$tplGp = $this->gpSansCvarTpl;
188
			// s'il y a un cultivar, on ajoute des parenthèses au groupe (mais pas au grex)
196
			// s'il y a un cultivar, on ajoute des parenthèses au groupe (mais pas au grex)
189
			if ($this->avoirInfo('cultivar')) {
197
			if ($this->avoirInfo('cultivar')) {
190
				$tplGpGx = $this->gpGxAvecCvarTpl;
198
				$tplGpGx = $this->gpGxAvecCvarTpl;
191
				$tplGp = $this->gpAvecCvarTpl;
199
				$tplGp = $this->gpAvecCvarTpl;
192
			}
200
			}
193
 
201
 
194
			// Création du HTML du groupe de cultivar
202
			// Création du HTML du groupe de cultivar
195
			if (strrpos($groupe, ' gx ') !== false) {//si le grex est composé de groupe
203
			if (strrpos($groupe, ' gx ') !== false) {//si le grex est composé de groupe
196
				$gpEtGx = explode(' gx ', $groupe);
204
				$gpEtGx = explode(' gx ', $groupe);
197
				$html = sprintf($tplGpGx, $gpEtGx[0], $gpEtGx[1]);
205
				$html = sprintf($tplGpGx, $gpEtGx[0], $gpEtGx[1]);
198
			} else if (preg_match('/ gx$/', $groupe)) {//s'il y a un grex et pas de groupe
206
			} else if (preg_match('/ gx$/', $groupe)) {//s'il y a un grex et pas de groupe
199
				$gx = str_replace(' gx', '', $groupe);
207
				$gx = str_replace(' gx', '', $groupe);
200
				$html = sprintf($tplGx, $gx);
208
				$html = sprintf($tplGx, $gx);
201
			} else { //s'il n'y a pas de grex mais un groupe
209
			} else { //s'il n'y a pas de grex mais un groupe
202
				$html = sprintf($tplGp, $groupe);
210
				$html = sprintf($tplGp, $groupe);
203
			}
211
			}
204
		}
212
		}
205
		return $html;
213
		return $html;
206
	}
214
	}
207
 
215
 
208
	/**
216
	/**
209
	 *
217
	 *
210
	 * Permet de repérer s'il s'agit d'un hybride (infra-sp, genre, sp) ou d'une chimère.
218
	 * Permet de repérer s'il s'agit d'un hybride (infra-sp, genre, sp) ou d'une chimère.
211
	 * @param unknown_type $val
219
	 * @param unknown_type $val
212
	 * @param unknown_type $type
220
	 * @param unknown_type $type
213
	 */
221
	 */
214
	private function verifierHybridite($epithete, $type) {
222
	private function verifierHybridite($epithete, $type) {
215
		$html = '';
223
		$html = '';
216
		if ($epithete != '') {
224
		if ($epithete != '') {
217
			if (substr($epithete, 0, 2) == 'x ') {
225
			if (substr($epithete, 0, 2) == 'x ') {
218
				$hybride = str_replace('x ', '', $epithete);
226
				$hybride = str_replace('x ', '', $epithete);
219
				$html = ' '.sprintf($this->hybrideTpl, $type, $hybride);
227
				$html = ' '.sprintf($this->hybrideTpl, $type, $hybride);
220
			} elseif (substr($epithete, 0, 2) == '+ ') {
228
			} elseif (substr($epithete, 0, 2) == '+ ') {
221
				$hybride = str_replace('+ ', '', $epithete);
229
				$hybride = str_replace('+ ', '', $epithete);
222
				$html = ' '.sprintf($this->chimereTpl, $type, $hybride);
230
				$html = ' '.sprintf($this->chimereTpl, $type, $hybride);
223
			} else if (substr_count($epithete, ' x ') > 1) {// Cas d'une formule d'hybridité comprenant des parents hybrides
231
			} else if (substr_count($epithete, ' x ') > 1) {// Cas d'une formule d'hybridité comprenant des parents hybrides
224
				$html = ' '.$this->insererBaliseFormuleHyb($epithete);
232
				$html = ' '.$this->insererBaliseFormuleHyb($epithete);
225
			} elseif (substr_count($epithete, ' x ') == 1) {// Cas d'une formule d'hybridité simple
233
			} elseif (substr_count($epithete, ' x ') == 1) {// Cas d'une formule d'hybridité simple
226
				$html = ' '.$this->ajouterFomuleHybridite($epithete, $type);
234
				$html = ' '.$this->ajouterFomuleHybridite($epithete, $type);
227
			} else {// Autre cas...
235
			} else {// Autre cas...
228
				$html = ' '.sprintf($this->hybriditeTpl, $type, $epithete);
236
				$html = ' '.sprintf($this->hybriditeTpl, $type, $epithete);
229
			}
237
			}
230
		}
238
		}
231
		return $html;
239
		return $html;
232
	}
240
	}
233
 
241
 
234
	private function ajouterFomuleHybridite($formule, $type) {
242
	private function ajouterFomuleHybridite($formule, $type) {
235
		$tab_x = explode(' x ', $formule);
243
		$tab_x = explode(' x ', $formule);
236
		$formule_hyb = array();
244
		$formule_hyb = array();
237
		switch ($type) {
245
		switch ($type) {
238
			case 'gen' 		:
246
			case 'gen' 		:
239
				foreach ($tab_x as $hyb) {
247
				foreach ($tab_x as $hyb) {
240
					$formule_hyb[] = sprintf($this->genTpl, $hyb);
248
					$formule_hyb[] = sprintf($this->genTpl, $hyb);
241
				}
249
				}
242
				break;
250
				break;
243
			case 'sp'		:
251
			case 'sp'		:
244
				foreach ($tab_x as $hyb) {
252
				foreach ($tab_x as $hyb) {
245
					if (substr_count($hyb, ' ') >= 1) {
253
					if (substr_count($hyb, ' ') >= 1) {
246
						list($gen, $sp) = explode(' ', $hyb);
254
						list($gen, $sp) = explode(' ', $hyb);
247
						$formule_hyb[] = sprintf($this->spFHTpl, $gen, $sp);
255
						$formule_hyb[] = sprintf($this->spFHTpl, $gen, $sp);
248
					} else if (preg_match('/^[A-Z]/', $hyb)) {
256
					} else if (preg_match('/^[A-Z]/', $hyb)) {
249
						$gen = $hyb;
257
						$gen = $hyb;
250
						$formule_hyb[] = sprintf($this->genTpl, $gen);
258
						$formule_hyb[] = sprintf($this->genTpl, $gen);
251
					}
259
					}
252
				}
260
				}
253
				break;
261
				break;
254
			case 'infra-sp' :
262
			case 'infra-sp' :
255
				foreach ($tab_x as $hyb) {
263
				foreach ($tab_x as $hyb) {
256
					list($gen, $sp, $typeEpithete, $infraSp) = explode (' ', $hyb);
264
					list($gen, $sp, $typeEpithete, $infraSp) = explode (' ', $hyb);
257
					$formule_hyb[] = sprintf($this->infraSpFHTpl, $gen, $sp, $this->abbr[$typeEpithete], $typeEpithete, $infraSp);
265
					$formule_hyb[] = sprintf($this->infraSpFHTpl, $gen, $sp, $this->abbr[$typeEpithete], $typeEpithete, $infraSp);
258
				}
266
				}
259
				break;
267
				break;
260
			default : break;
268
			default : break;
261
		}
269
		}
262
		return $this->insererBaliseFormuleHyb(implode(' x ', $formule_hyb));
270
		return $this->insererBaliseFormuleHyb(implode(' x ', $formule_hyb));
263
	}
271
	}
264
 
272
 
265
	private function insererBaliseFormuleHyb($formule) {
273
	private function insererBaliseFormuleHyb($formule) {
266
		return sprintf($this->formuleHybTpl, $formule);
274
		return sprintf($this->formuleHybTpl, $formule);
267
	}
275
	}
268
}
276
}
269
?>
277
?>