Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 162 → Rev 163

/trunk/services/bibliotheque/nom/NomDO.php
New file
0,0 → 1,25
<?php
class NomDO {
private $infos;
public function __construct(Array $infos) {
$this->infos = $infos;
}
public function getTag($tag) {
return $this->infos[$tag];
}
public function verifierTag($tag) {
$existe = true;
if ($this->getTag($tag) == null || $this->getTag($tag) == '') {
$existe = false;
}
return $existe;
}
 
public function getNomDetails() {
return $this->getTitle().' by '.$this->getAuthor();
}
}
?>
/trunk/services/bibliotheque/nom/decorateurs/NomBasionymeDecorateur.php
New file
0,0 → 1,39
<?php
class NomBasionymeDecorateur extends NomDecorateur {
 
private $nomDecorateur = null;
private $basionyme = null;
private $basionymeId = null;
private $detailsHrefTpl = null;
 
public function __construct(NomDecorateur $nomDecorateur, $detailsHrefTpl) {
$this->nomDecorateur = $nomDecorateur;
$this->detailsHrefTpl = $detailsHrefTpl;
if ($this->nomDecorateur->nom->verifierTag('basionyme')) {
$this->basionymeId = $this->nomDecorateur->nom->getTag('basionyme');
}
if ($this->nomDecorateur->nom->verifierTag('nb_nom_sci')) {
$this->basionyme = $this->nomDecorateur->nom->getTag('nb_nom_sci');
}
}
 
public function ajouterId() {
if (is_null($this->basionymeId) === false) {
$this->nomDecorateur->nomFormate['basionyme.id'] = $this->basionymeId;
}
}
 
public function ajouterHref() {
if (is_null($this->basionymeId) === false) {
$href = sprintf($this->detailsHrefTpl, $this->basionymeId);
$this->nomDecorateur->nomFormate['basionyme.href'] = $href;
}
}
 
public function ajouterIntitule() {
if (is_null($this->basionyme) === false) {
$this->nomDecorateur->nomFormate['basionyme'] = $this->basionyme;
}
}
}
?>
/trunk/services/bibliotheque/nom/decorateurs/NomRangDecorateur.php
New file
0,0 → 1,41
<?php
class NomRangDecorateur extends NomDecorateur {
 
private $nomDecorateur = null;
private $rang = null;
private $bdd = null;
private $ontologieHrefTpl = null;
 
public function __construct(NomDecorateur $nomDecorateur, Bdd $bdd = null, $ontologieHrefTpl) {
$this->nomDecorateur = $nomDecorateur;
$this->rang = $this->nomDecorateur->nom->getTag('rang');
$this->bdd = is_null($bdd) ? new Bdd() : $bdd;
$this->ontologieHrefTpl = $ontologieHrefTpl;
}
 
public function ajouterCode() {
$squelette = 'bdnt.rangTaxo:%s';
$rangCode = sprintf($squelette, $this->rang);
$this->nomDecorateur->nomFormate['rang.code'] = $rangCode;
}
 
public function ajouterHref() {
$href = sprintf($this->ontologieHrefTpl, $this->rang);
$this->nomDecorateur->nomFormate['rang.href'] = $href;
}
 
public function ajouterIntitule() {
$resultat = $this->rechercherOntologieNomParCode($this->rang);
$this->nomDecorateur->nomFormate['rang'] = $resultat['nom'];
}
 
private function rechercherOntologieNomParCode($code) {
$code = $this->bdd->proteger($code);
$requete = 'SELECT nom '.
'FROM bdnt_ontologies_v4_30 '.
"WHERE code = $code ";
$resultats = $this->bdd->recuperer($requete);
return $resultats;
}
}
?>
/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;
}
}
?>
/trunk/services/bibliotheque/nom/decorateurs/NomChampsProjetDecorateur.php
New file
0,0 → 1,21
<?php
class NomChampsProjetDecorateur extends NomDecorateur {
private $nomDecorateur = null;
private $champs = array();
public function __construct(NomDecorateur $nomDecorateur, Array $champs) {
$this->nomDecorateur = $nomDecorateur;
$this->champs = $champs;
}
public function ajouterChampsSupplementaires() {
foreach ($this->champs as $champBdd => $champSortie) {
if ($this->nomDecorateur->nom->verifierTag($champBdd)) {
$valeur = $this->nomDecorateur->nom->getTag($champBdd);
$this->nomDecorateur->nomFormate[$champSortie] = $valeur;
}
}
}
}
?>
/trunk/services/bibliotheque/nom/decorateurs/NomDecorateur.php
New file
0,0 → 1,63
<?php
class NomDecorateur {
protected $nom = null;
protected $nomFormate = array();
public function __construct(NomDO $nomADecorer) {
$this->nom = $nomADecorer;
$this->initialiserNomFormate();
}
public function ajouterId() {
$this->nomFormate['id'] = (int) $this->nom->getTag('num_nom');
}
public function ajouterIntitule() {
$this->nomFormate['nom_sci'] = $this->nom->getTag('nom_sci');
}
public function ajouterAuteur() {
if ($this->nom->verifierTag('auteur')) {
$this->nomFormate['auteur'] = $this->nom->getTag('auteur');
}
}
public function ajouterAnnee() {
if ($this->nom->verifierTag('annee')) {
$this->nomFormate['annee'] = $this->nom->getTag('annee');
}
}
public function ajouterBiblio() {
if ($this->nom->verifierTag('biblio_origine')) {
$this->nomFormate['biblio_origine'] = $this->nom->getTag('biblio_origine');
}
}
public function ajouterAddendum() {
if ($this->nom->verifierTag('nom_addendum')) {
$this->nomFormate['nom_addendum'] = $this->nom->getTag('nom_addendum');
}
}
public function ajouterNotes() {
if ($this->nom->verifierTag('notes')) {
$this->nomFormate['notes'] = $this->nom->getTag('notes');
}
}
public function ajouterHomonyme() {
if ($this->nom->verifierTag('homonyme') && $this->nom->getTag('homonyme') == 1) {
$this->nomFormate['homonyme'] = true;
}
}
public function initialiserNomFormate() {
$this->nomFormate = array();
}
public function getNomFormate() {
return $this->nomFormate;
}
}
?>
/trunk/services/bibliotheque/nom/decorateurs/NomRetenuDecorateur.php
New file
0,0 → 1,37
<?php
class NomRetenuDecorateur extends NomDecorateur {
 
private $nomDecorateur = null;
private $numNom = null;
private $numNomRetenu = null;
private $nomSci = null;
private $detailsHrefTpl = null;
 
public function __construct(NomDecorateur $nomDecorateur, $detailsHrefTpl) {
$this->nomDecorateur = $nomDecorateur;
$this->numNom = $this->nomDecorateur->nom->getTag('num_nom');
$this->numNomRetenu = $this->nomDecorateur->nom->getTag('num_nom_retenu');
$this->nomSci = $this->nomDecorateur->nom->getTag('nr_nom_sci');
$this->detailsHrefTpl = $detailsHrefTpl;
}
 
public function ajouterRetenu() {
$nn = (int) $this->numNom;
$nnr = (int) $this->numNomRetenu;
$this->nomDecorateur->nomFormate['retenu'] = ($nn == $nnr) ? true : false;
}
 
public function ajouterId() {
$this->nomDecorateur->nomFormate['nom_retenu.id'] = (int) $this->numNomRetenu;
}
 
public function ajouterHref() {
$href = sprintf($this->detailsHrefTpl, $this->numNomRetenu);
$this->nomDecorateur->nomFormate['nom_retenu.href'] = $href;
}
 
public function ajouterIntitule() {
$this->nomDecorateur->nomFormate['nom_retenu'] = $this->nomSci;
}
}
?>