Rev 776 | Rev 927 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
class Conteneur {
protected $parametres = array();
protected $partages = array();
public function __construct(array $parametres = null) {
$this->parametres = is_null($parametres) ? array() : $parametres;
}
public function getParametre($cle) {
$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
return $valeur;
}
public function getParametreTableau($cle) {
$tableau = array();
$parametre = $this->getParametre($cle);
if (empty($parametre) === false) {
$tableauPartiel = explode(',', $parametre);
$tableauPartiel = array_map('trim', $tableauPartiel);
foreach ($tableauPartiel as $champ) {
if (strpos($champ, '=') === false) {
$tableau[] = trim($champ);
} else {
list($cle, $val) = explode('=', $champ);
$tableau[trim($cle)] = trim($val);
}
}
}
return $tableau;
}
public function setParametre($cle, $valeur) {
$this->parametres[$cle] = $valeur;
}
public function getAppUrls() {
if (!isset($this->partages['AppUrls'])){
$this->partages['AppUrls'] = new AppUrls();
}
return $this->partages['AppUrls'];
}
public function getApiNoms() {
if (isset($this->getParametre('referentiel'))) {
$noms = new Noms($this->getParametre('referentiel'));
} else {
$noms = new Noms($this->getParametre('referentiel_defaut'));
}
return $noms;
}
public function getApiTaxons() {
if (isset($this->getParametre('referentiel'))) {
$taxons = new Taxons($this->getParametre('referentiel'));
} else {
$taxons = new Taxons($this->getParametre('referentiel_defaut'));
}
return $taxons;
}
public function getApiBiblioBota() {
$biblioBota = new BiblioBota();
return $biblioBota;
}
public function getApiImages() {
$images = new Images();
return $images;
}
public function getApiCartes() {
$cartes = new Cartes();
return $cartes;
}
public function getApiNomsVernaculaires() {
$nomsVernaculaires = new NomsVernaculaires();
return $nomsVernaculaires;
}
public function getApiTextes() {
$textes = new Textes();
return $textes;
}
public function getApiWikini() {
$wiki = new Wikini();
return $wiki;
}
public function getApiGraphiques() {
$graphique = new Graphiques();
return $graphique;
}
public function getApiSyntaxons() {
$syntaxon = new Syntaxons();
return $syntaxon;
}
public function getApiMetaDonnees() {
$meta = new MetaDonnees();
return $meta;
}
public function getApiInformations() {
$informations = new Informations();
return $informations;
}
public function getApiStatuts() {
$statuts = new Statuts();
return $statuts;
}
public function getNomCourant() {
if (!isset($this->partages['NomCourant'])){
$nns = $this->getParametre('num_nom');
$noms = $this->getApiNoms();
$taxons = $this->getApiTaxons();
$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
}
return $this->partages['NomCourant'];
}
public function getUtilisateur() {
if (!isset($this->partages['Utilisateur'])){
$this->partages['Utilisateur'] = new Utilisateur($this);
}
return $this->partages['Utilisateur'];
}
public function getBdd() {
if (!isset($this->partages['Bdd'])){
$this->partages['Bdd'] = new Bdd();
}
return $this->partages['Bdd'];
}
public function getRestClient() {
if (!isset($this->partages['RestClient'])){
$this->partages['RestClient'] = new RestClient();
}
return $this->partages['RestClient'];
}
}
?>