Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 162 → Rev 163

/trunk/services/bibliotheque/nom/decorateurs/NomCompoDecorateur.php
New file
0,0 → 1,73
<?php
class NomCompoDecorateur extends NomDecorateur {
private $nomDecorateur;
public function __construct(NomDecorateur $nomDecorateur) {
$this->nomDecorateur = $nomDecorateur;
}
public function ajouterCompo() {
$this->ajouterSupraGenre();
$this->ajouterGenre();
$this->ajouterInfraGenre();
$this->ajouterSp();
$this->ajouterTypeInfraSp();
$this->ajouterInfraSp();
$this->ajouterCultivarGroupe();
$this->ajouterCultivar();
$this->ajouterNomCommercial();
}
public function ajouterSupraGenre() {
$this->ajouterPourChampSonFormatage('nom_supra_generique', 'supra_generique');
}
public function ajouterGenre() {
$this->ajouterPourChampSonFormatage('genre', 'genre');
}
public function ajouterInfraGenre() {
$this->ajouterPourChampSonFormatage('epithete_infra_generique', 'infra_generique');
}
public function ajouterSp() {
$this->ajouterPourChampSonFormatage('epithete_sp', 'sp');
}
public function ajouterTypeInfraSp() {
$this->ajouterPourChampSonFormatage('type_epithete', 'type_epithete');
}
public function ajouterInfraSp() {
$this->ajouterPourChampSonFormatage('epithete_infra_sp', 'infra_sp');
}
public function ajouterCultivarGroupe() {
$this->ajouterPourChampSonFormatage('cultivar_groupe', 'cultivar_groupe');
}
public function ajouterCultivar() {
$this->ajouterPourChampSonFormatage('cultivar', 'cultivar');
}
public function ajouterNomCommercial() {
$this->ajouterPourChampSonFormatage('nom_commercial', 'nom_commercial');
}
private function ajouterPourChampSonFormatage($champ, $format) {
$valeur = $this->nomDecorateur->nom->getTag($champ);
if ($this->exister($valeur)) {
$this->nomDecorateur->nomFormate["nom_sci.$format"] = $valeur;
}
}
private function exister($valeur) {
$existe = true;
if (is_null($valeur) || $valeur == '') {
$existe = false;
}
return $existe;
}
}
?>