Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 163 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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