163 |
jpm |
1 |
<?php
|
|
|
2 |
class NomCompoDecorateur extends NomDecorateur {
|
|
|
3 |
|
|
|
4 |
private $nomDecorateur;
|
|
|
5 |
|
|
|
6 |
public function __construct(NomDecorateur $nomDecorateur) {
|
|
|
7 |
$this->nomDecorateur = $nomDecorateur;
|
|
|
8 |
}
|
|
|
9 |
|
|
|
10 |
public function ajouterCompo() {
|
|
|
11 |
$this->ajouterSupraGenre();
|
|
|
12 |
$this->ajouterGenre();
|
|
|
13 |
$this->ajouterInfraGenre();
|
|
|
14 |
$this->ajouterSp();
|
|
|
15 |
$this->ajouterTypeInfraSp();
|
|
|
16 |
$this->ajouterInfraSp();
|
|
|
17 |
$this->ajouterCultivarGroupe();
|
|
|
18 |
$this->ajouterCultivar();
|
|
|
19 |
$this->ajouterNomCommercial();
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
public function ajouterSupraGenre() {
|
|
|
23 |
$this->ajouterPourChampSonFormatage('nom_supra_generique', 'supra_generique');
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
public function ajouterGenre() {
|
|
|
27 |
$this->ajouterPourChampSonFormatage('genre', 'genre');
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public function ajouterInfraGenre() {
|
|
|
31 |
$this->ajouterPourChampSonFormatage('epithete_infra_generique', 'infra_generique');
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public function ajouterSp() {
|
|
|
35 |
$this->ajouterPourChampSonFormatage('epithete_sp', 'sp');
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
public function ajouterTypeInfraSp() {
|
|
|
39 |
$this->ajouterPourChampSonFormatage('type_epithete', 'type_epithete');
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
public function ajouterInfraSp() {
|
|
|
43 |
$this->ajouterPourChampSonFormatage('epithete_infra_sp', 'infra_sp');
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
public function ajouterCultivarGroupe() {
|
|
|
47 |
$this->ajouterPourChampSonFormatage('cultivar_groupe', 'cultivar_groupe');
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
public function ajouterCultivar() {
|
|
|
51 |
$this->ajouterPourChampSonFormatage('cultivar', 'cultivar');
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public function ajouterNomCommercial() {
|
|
|
55 |
$this->ajouterPourChampSonFormatage('nom_commercial', 'nom_commercial');
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
private function ajouterPourChampSonFormatage($champ, $format) {
|
|
|
59 |
$valeur = $this->nomDecorateur->nom->getTag($champ);
|
|
|
60 |
if ($this->exister($valeur)) {
|
|
|
61 |
$this->nomDecorateur->nomFormate["nom_sci.$format"] = $valeur;
|
|
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
private function exister($valeur) {
|
|
|
66 |
$existe = true;
|
|
|
67 |
if (is_null($valeur) || $valeur == '') {
|
|
|
68 |
$existe = false;
|
|
|
69 |
}
|
|
|
70 |
return $existe;
|
|
|
71 |
}
|
|
|
72 |
}
|
|
|
73 |
?>
|