Rev 478 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php/**** fonctions* @author mathilde**/class EfloreCommun {private $Bdd = null;private $projetNom = null;public function initialiserProjet($projetNom) {$this->projetNom = $projetNom;$this->chargerConfigDuProjet();}//+------------------------------------------------------------------------------------------------------+// Méthodes d'accès aux objets du Framework/*** Méthode de connection à la base de données sur demande.* Tous les scripts n'ont pas besoin de s'y connecter.*/public function getBdd() {if (! isset($this->Bdd)) {$this->Bdd = new Bdd();}return $this->Bdd;}//+------------------------------------------------------------------------------------------------------+// Méthodes communes aux projets d'eFlorepublic function chargerConfigDuProjet() {$fichierIni = $this->getScriptChemin().$this->getProjetNom().'.ini';if (file_exists($fichierIni)) {Config::charger($fichierIni);} else {$m = "Veuillez configurer le projet en créant le fichier '{$this->projetNom}.ini' "."dans le dossier du module de script du projet à partir du fichier '{$this->projetNom}.defaut.ini'.";throw new Exception($m);}}//changéepublic function chargerStructureSql($structure_sql) {$contenuSql = $this->recupererContenu(Config::get($structure_sql));$this->executerScripSql($contenuSql);}public function executerScripSql($sql) {$requetes = Outils::extraireRequetes($sql);foreach ($requetes as $requete) {$this->getBdd()->requeter($requete);}}public function recupererContenu($chemin) {$contenu = file_get_contents($chemin);if ($contenu === false){throw new Exception("Impossible d'ouvrir le fichier SQL : $chemin");}return $contenu;}}?>