Line 24... |
Line 24... |
24 |
'f. sp.' => 'Forma species',
|
24 |
'f. sp.' => 'Forma species',
|
25 |
'proles' => 'Race prole'
|
25 |
'proles' => 'Race prole'
|
26 |
);
|
26 |
);
|
Line 27... |
Line 27... |
27 |
|
27 |
|
- |
|
28 |
private $nomSciTpl = '<span class="sci">%s</span>';
|
28 |
private $nomSciTpl = '<span class="sci">%s</span>';
|
29 |
|
29 |
private $nomSupraGenTpl = '<span class="supra_gen">%s</span>';
|
30 |
private $nomSupraGenTpl = '<span class="supra_gen">%s</span>';
|
30 |
private $genTpl = '<span class="gen">%s</span>';
|
31 |
private $genTpl = '<span class="gen">%s</span>';
|
31 |
private $infraGenTpl = '<span class="infra-gen">%s</span>';
|
32 |
private $infraGenTpl = '<span class="infra-gen">%s</span>';
|
32 |
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>';
|
33 |
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>';
|
- |
|
36 |
|
- |
|
37 |
private $hybrideTpl = '<span class="hyb">× <span class="%s">%s</span></span>';
|
34 |
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>';
|
38 |
private $chimereTpl = '<span class="chimere">+ <span class="%s">%s</span></span>';
|
- |
|
39 |
private $formuleHybTpl = '<span class="formule-hyb">%s</span>';
|
- |
|
40 |
private $hybriditeTpl = '<span class="%s">%s</span>';
|
- |
|
41 |
|
- |
|
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>';
|
- |
|
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>';
|
- |
|
46 |
private $gpSansCvarTpl = '<span class="gp">%s <abbr title="groupe">Gp</abbr></span>';
|
- |
|
47 |
private $commTpl = '<span class="commercial">%s</span>';
|
Line 35... |
Line 48... |
35 |
private $formuleHybTpl = '<span class="formule-hyb">%s</span>';
|
48 |
private $cvarTpl = '<span class="cultivar">\'%s\'</span>';
|
36 |
|
49 |
|
37 |
public function generer(Array $nomsDecomposes) {
|
50 |
public function generer(Array $nomsDecomposes) {
|
38 |
$nomsSciHtml = array();
|
51 |
$nomsSciHtml = array();
|
Line 131... |
Line 144... |
131 |
$html = '';
|
144 |
$html = '';
|
132 |
if ($this->avoirInfo('cultivar_groupe')) {
|
145 |
if ($this->avoirInfo('cultivar_groupe')) {
|
133 |
$html .= ' '.$this->ajouterCultivarGroupe();
|
146 |
$html .= ' '.$this->ajouterCultivarGroupe();
|
134 |
}
|
147 |
}
|
135 |
if ($this->avoirInfo('nom_commercial')) {
|
148 |
if ($this->avoirInfo('nom_commercial')) {
|
136 |
$html .= ' <span class="commercial">'.$this->compo_nom['nom_commercial'].'</span>';
|
149 |
$html .= ' '.sprintf($this->commTpl, $this->compo_nom['nom_commercial']);
|
137 |
}
|
150 |
}
|
138 |
if ($this->avoirInfo('cultivar')) {
|
151 |
if ($this->avoirInfo('cultivar')) {
|
139 |
$html .= ' <span class="cultivar">\''.$this->compo_nom['cultivar'].'\'</span>';
|
152 |
$html .= ' '.sprintf($this->cvarTpl, $this->compo_nom['cultivar']);
|
140 |
}
|
153 |
}
|
141 |
return $html;
|
154 |
return $html;
|
142 |
}
|
155 |
}
|
Line 143... |
Line 156... |
143 |
|
156 |
|
Line 162... |
Line 175... |
162 |
* @param unknown_type $val
|
175 |
* @param unknown_type $val
|
163 |
*
|
176 |
*
|
164 |
*/
|
177 |
*/
|
165 |
private function ajouterCultivarGroupe() {
|
178 |
private function ajouterCultivarGroupe() {
|
166 |
$html = '';
|
179 |
$html = '';
|
- |
|
180 |
// si le champ cultivar_groupe n'est pas vide
|
167 |
if ($this->avoirInfo('cultivar_groupe')) {
|
181 |
if ($this->avoirInfo('cultivar_groupe')) {
|
168 |
$groupe = $this->compo_nom['cultivar_groupe'];
|
182 |
$groupe = trim($this->compo_nom['cultivar_groupe']);
|
- |
|
183 |
|
- |
|
184 |
// Sélection des templates
|
- |
|
185 |
$tplGx = $this->gxTpl;
|
- |
|
186 |
$tplGpGx = $this->gpGxSansCvarTpl;
|
- |
|
187 |
$tplGp = $this->gpSansCvarTpl;
|
169 |
//si le champ cultivar_groupe n'est pas vide
|
188 |
// s'il y a un cultivar, on ajoute des parenthèses au groupe (mais pas au grex)
|
170 |
if ($this->avoirInfo('cultivar')) {
|
189 |
if ($this->avoirInfo('cultivar')) {
|
171 |
//si il y a un cultivar, on ajoute des parenthèses au group (mais pas au grex)
|
- |
|
172 |
if (strrpos($groupe, ' gx ') !== false) {
|
- |
|
173 |
//si le grex est composé de groupe
|
- |
|
174 |
$gpEtGx = explode(' gx ', $groupe);
|
190 |
$tplGpGx = $this->gpGxAvecCvarTpl;
|
175 |
$html = ' <span class="gp">'.
|
191 |
$tplGp = $this->gpAvecCvarTpl;
|
176 |
$gpEtGx[0].' '.'<abbr title="grex">gx</abbr>'.
|
- |
|
177 |
' '.
|
- |
|
178 |
'('.$gpEtGx[1].' <abbr title="groupe">Gp</abbr>)'.
|
- |
|
179 |
'</span>';
|
- |
|
180 |
} elseif (strrpos($groupe, ' gx') !== false) {
|
- |
|
181 |
//si il y a un grex et pas de groupe
|
- |
|
182 |
$gx = str_replace(' gx', '', $groupe);
|
- |
|
183 |
$html = ' <span class="gp">'.$gx.' <abbr title="grex">gx</abbr></span>';
|
- |
|
184 |
} else { //si il n'y a pas de grex mais un groupe
|
- |
|
185 |
$html = ' <span class="gp">('.$groupe.' <abbr title="groupe">Gp</abbr>)</span>';
|
- |
|
186 |
}
|
192 |
}
|
- |
|
193 |
|
187 |
} else { //s'il n'y a pas de cultivar
|
194 |
// Création du HTML du groupe de cultivar
|
188 |
if (strrpos($groupe, ' gx ') !== false) {
|
195 |
if (strrpos($groupe, ' gx ') !== false) {//si le grex est composé de groupe
|
189 |
//si le grex est composé de groupe
|
- |
|
190 |
$gpEtGx = explode(' gx ', $groupe);
|
196 |
$gpEtGx = explode(' gx ', $groupe);
|
191 |
$html = ' <span class="gp">'.
|
- |
|
192 |
$gpEtGx[0].' <abbr title="grex">gx</abbr>'.
|
- |
|
193 |
' '.
|
- |
|
194 |
$gpEtGx[1].' <abbr title="groupe">Gp</abbr>'.
|
- |
|
195 |
'</span>';
|
- |
|
196 |
} elseif (strrpos($groupe, ' gx') !== false) {
|
197 |
$html = sprintf($tplGpGx, $gpEtGx[0], $gpEtGx[1]);
|
197 |
//si il y a un grex et pas de groupe
|
198 |
} else if (preg_match('/ gx$/', $groupe)) {//s'il y a un grex et pas de groupe
|
198 |
$gx = str_replace(' gx', '', $groupe);
|
199 |
$gx = str_replace(' gx', '', $groupe);
|
199 |
$html = ' <span class="gp">'.$gx.' <abbr title="grex">gx</abbr></span>';
|
200 |
$html = sprintf($tplGx, $gx);
|
200 |
} else { //si il n'y a pas de grex mais un groupe
|
201 |
} else { //s'il n'y a pas de grex mais un groupe
|
201 |
$html = ' <span class="gp">'.$groupe.' <abbr title="groupe">Gp</abbr></span>';
|
202 |
$html = sprintf($tplGp, $groupe);
|
202 |
}
|
- |
|
203 |
}
|
203 |
}
|
204 |
}
|
204 |
}
|
205 |
return $html;
|
205 |
return $html;
|
206 |
}
|
206 |
}
|
Line 213... |
Line 213... |
213 |
*/
|
213 |
*/
|
214 |
private function verifierHybridite($epithete, $type) {
|
214 |
private function verifierHybridite($epithete, $type) {
|
215 |
$html = '';
|
215 |
$html = '';
|
216 |
if ($epithete != '') {
|
216 |
if ($epithete != '') {
|
217 |
if (substr($epithete, 0, 2) == 'x ') {
|
217 |
if (substr($epithete, 0, 2) == 'x ') {
|
218 |
$html = ' <span class="hyb">x <span class="'.$type.'">'.str_replace('x ', '', $epithete).'</span></span>';
|
218 |
$hybride = str_replace('x ', '', $epithete);
|
- |
|
219 |
$html = ' '.sprintf($this->hybrideTpl, $type, $hybride);
|
219 |
} elseif (substr($epithete, 0, 2) == '+ ') {
|
220 |
} elseif (substr($epithete, 0, 2) == '+ ') {
|
220 |
$html = ' <span class="chimere">+ <span class="'.$type.'">'.str_replace('+ ', '', $epithete).'</span></span>';
|
221 |
$hybride = str_replace('+ ', '', $epithete);
|
221 |
} else if (substr_count($epithete, ' x ') > 1) {
|
222 |
$html = ' '.sprintf($this->chimereTpl, $type, $hybride);
|
222 |
// Cas d'une formule d'hybridité comprenant des parents hybrides
|
223 |
} else if (substr_count($epithete, ' x ') > 1) {// Cas d'une formule d'hybridité comprenant des parents hybrides
|
223 |
$html = ' '.$this->insererBaliseFormuleHyb($epithete);
|
224 |
$html = ' '.$this->insererBaliseFormuleHyb($epithete);
|
224 |
} elseif (substr_count($epithete, ' x ') == 1) {
|
225 |
} elseif (substr_count($epithete, ' x ') == 1) {// Cas d'une formule d'hybridité simple
|
225 |
// Cas d'une formule d'hybridité simple
|
- |
|
226 |
$html = ' '.$this->ajouterFomuleHybridite($epithete, $type);
|
226 |
$html = ' '.$this->ajouterFomuleHybridite($epithete, $type);
|
227 |
} else {
|
227 |
} else {// Autre cas...
|
228 |
$html = ' <span class="'.$type.'">'.$epithete.'</span>';
|
228 |
$html = ' '.sprintf($this->hybriditeTpl, $type, $epithete);
|
229 |
}
|
229 |
}
|
230 |
}
|
230 |
}
|
231 |
return $html;
|
231 |
return $html;
|
232 |
}
|
232 |
}
|