Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 843 | Details | Compare with Previous | Last modification | View Log | RSS feed

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