Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1792 → Rev 1793

/trunk/services/bibliotheque/Conteneur.php
1,15 → 1,17
<?php
/**
* Le conteneur encapsule les classe Masque, Navigation et GestionBdd
* Il gère leur instanciation, ainsi que la récupération des paramètres depuis l'url ou
* Le conteneur encapsule l'instanciation des classes ainsi que la récupération des paramètres depuis l'url ou
* les fichiers de configuration
*
* @category DEL
* @package Commun
* @author Grégoire Duché <gregoire@tela-botanica.org>
* @copyright Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @package Bibliotheque
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
//TODO : initialiser tous les objets dans le conteneur
//TODO : créer un tableau de partage
20,6 → 22,7
protected $masque;
protected $gestionBdd;
protected $sansLimite = false;
protected $partages = array();
 
/**
* Constructeur de la classe
69,6 → 72,8
$this->parametres[$cle] = $valeur;
}
 
//--------------------------------------------------------------------------------------------------------
// Ci-dessous méthode à revoir !
/**
* Charger la configuration depuis le fichier
* @param String $chemin le chemin relatif depuis le dossier configurations du fichier
82,7 → 87,7
}
Config::charger($cheminConfigurations.DS.$chemin);
 
if ($this->masque = $this->creerMasque()) {
if ($this->masque = new Masque(Config::get('masques_possibles'), $this->parametres)) {
$this->masque->chargerMasque();
} else {
$message = 'Erreur lors de la création du Masque';
90,7 → 95,7
throw new Exception($message, $code);
}
 
if ($this->navigation = $this->creerNavigation()) {
if ($this->navigation = new Navigation($this->parametres)) {
$this->navigation->chargerUrl();
} else {
$message = 'Erreur lors de la création de la Navigation';
98,34 → 103,10
throw new Exception($message, $code);
}
 
$this->creerGestionBdd($this->navigation, Config::get('schemaBdd'));
$this->gestionBdd = new GestionBdd($this->navigation, Config::get('schemaBdd'));
}
 
/**
* Créer l'objet Masque en fonction des configurations
* */
private function creerMasque() {
$this->masque = new Masque(Config::get('masques_possibles'), $this->parametres);
return $this->masque;
 
}
 
/**
* Créer l'objet navigation avec les paramètres
* */
private function creerNavigation() {
return ($this->navigation = new Navigation($this->parametres));
}
 
/**
* Créer l'objet Gestion BDD
* */
private function creerGestionBdd($navigation, $schemaBdd) {
$this->gestionBdd = new GestionBdd($navigation, $schemaBdd);
}
 
 
/**
* Changer la valeur de sans limite pour ne pas l'afficher dans l'entete
* */
public function setSansLimite() {
133,13 → 114,6
}
 
/**
* Récupérer l'objet GestionBdd
* */
public function getGestionBdd() {
return $this->gestionBdd;
}
 
/**
* Récupérer l'objet Navigation
* */
public function getNavigation() {
179,19 → 153,28
 
return $entete;
}
//--------------------------------------------------------------------------------------------------------
// Ci-dessous méthode ok !
 
public function getBdd() {
if (!isset($this->partages['Bdd'])){
$this->partages['Bdd'] = new Bdd();
}
return $this->partages['Bdd'];
}
 
public function getRestClient() {
if (!isset($this->restClient)) {
$this->restClient = new RestClient();
if (!isset($this->partages['restClient'])){
$this->partages['restClient'] = new RestClient();
}
return $this->restClient;
return $this->partages['restClient'];
}
 
public function getControleAcces() {
if (!isset($this->controleAcces)) {
$this->controleAcces = new ControleAcces($this);
if (!isset($this->partages['controleAcces'])) {
$this->partages['controleAcces'] = new ControleAcces($this);
}
return $this->controleAcces;
return $this->partages['controleAcces'];
}
}
?>