Rev 208 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
class NomDetailsGenerique implements NomDetails {
private $parametres = null;
private $ressources = null;
private $bdd = null;
private $projet = null;
private $versions = null;
private $detailsHrefTpl = null;
private $ontologieHrefTpl = null;
private $nom = array();
private $champsProjet = array();
public function __construct(Ressources $ressources, Parametres $parametres, Bdd $bdd) {
$this->ressources = $ressources;
$this->parametres = $parametres;
$this->bdd = $bdd;
}
public function setProjet($projet) {
$this->projet = $projet;
}
public function setVersions($versions) {
$this->versions = $versions;
}
public function setChampsProjet($champsProjet) {
$this->champsProjet = $champsProjet;
}
public function setDetailsHrefTpl($tpl) {
$this->detailsHrefTpl = $tpl;
}
public function setOntologieHrefTpl($tpl) {
$this->ontologieHrefTpl = $tpl;
}
public function consulter() {
$infos = $this->rechercherInfosNom();
$retour = $this->formaterDetails($infos);
return $retour;
}
private function getTable() {
$versions = $this->versions->getVersions();
return $this->projet.'_v'.end($versions);
}
private function rechercherInfosNom() {
$table = $this->getTable();
$detailsId = $this->ressources->getDetailsId();
$detailsId = $this->bdd->proteger($detailsId);
$requete =
'SELECT ns.*, '.
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
"WHERE ns.num_nom = $detailsId ";
$resultats = $this->bdd->recuperer($requete);
return $resultats;
}
private function formaterDetails($infos) {
$nomAFormater = new NomDO($infos);
$formateur = new NomFormateur($nomAFormater);
$formateur->setBdd($this->bdd);
$formateur->setChampsProjet($this->champsProjet);
$formateur->setDetailsHrefTpl($this->detailsHrefTpl);
$formateur->setOntologieHrefTpl($this->ontologieHrefTpl);
$formateur->setChampsRetour($this->parametres->getListe('retour.champs'));
$details = $formateur->formaterDetails();
return $details;
}
}
?>