Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 442 | Rev 521 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 442 Rev 478
Line 3... Line 3...
3
 * 
3
 *
4
 * fonctions 
4
 * fonctions
5
 * @author mathilde
5
 * @author mathilde
6
 *
6
 *
7
 */
7
 */
8
 
-
 
9
class EfloreCommun {
8
class EfloreCommun {
Line -... Line 9...
-
 
9
 
10
	
10
	private $Conteneur = null;
11
	private $Bdd = null;
11
	private $Bdd = null;
-
 
12
	private $projetNom = '';
Line -... Line 13...
-
 
13
	private $scriptChemin = '';
-
 
14
 
-
 
15
	public function __construct($conteneur) {
-
 
16
		$this->Conteneur = $conteneur;
Line 12... Line 17...
12
	private $projetNom = null;
17
		$this->Bdd = $this->Conteneur->getBdd();
13
	
18
	}
14
	
19
 
15
	public function initialiserProjet($projetNom) {
20
	public function initialiserProjet($projetNom) {
Line 16... Line 21...
16
		$this->projetNom = $projetNom;
21
		$this->projetNom = $projetNom;
17
		$this->chargerConfigDuProjet();
-
 
18
	}
-
 
19
	
-
 
20
	//+------------------------------------------------------------------------------------------------------+
-
 
21
	// Méthodes d'accès aux objets du Framework
-
 
22
	/**
-
 
23
	* Méthode de connection à la base de données sur demande.
-
 
24
	* Tous les scripts n'ont pas besoin de s'y connecter.
-
 
25
	*/
-
 
26
	public function getBdd() {
-
 
27
	if (! isset($this->Bdd)) {
-
 
28
	$this->Bdd = new Bdd();
-
 
29
	}
-
 
30
	return $this->Bdd;
22
		$this->chargerConfigDuProjet();
Line 31... Line 23...
31
	}
23
	}
-
 
24
 
32
	
25
	//+------------------------------------------------------------------------------------------------------+
33
	//+------------------------------------------------------------------------------------------------------+
26
	// Méthodes communes aux projets d'eFlore
34
	// Méthodes communes aux projets d'eFlore
27
 
35
	
28
	public function chargerConfigDuProjet() {
36
	public function chargerConfigDuProjet() {
29
		$scriptChemin = $this->Conteneur->getParametre('scriptChemin');
37
	$fichierIni = $this->getScriptChemin().$this->getProjetNom().'.ini';
30
		$fichierIni = $scriptChemin.$this->projetNom.'.ini';
38
	if (file_exists($fichierIni)) {
31
		if (file_exists($fichierIni)) {
39
	Config::charger($fichierIni);
32
			Config::charger($fichierIni);
40
	} else {
33
		} else {
Line 41... Line 34...
41
	$m = "Veuillez configurer le projet en créant le fichier '{$this->projetNom}.ini' ".
34
			$m = "Veuillez configurer le projet en créant le fichier '{$this->projetNom}.ini' ".
42
	"dans le dossier du module de script du projet à partir du fichier '{$this->projetNom}.defaut.ini'.";
35
			"dans le dossier du module de script du projet à partir du fichier '{$this->projetNom}.defaut.ini'.";
-
 
36
			throw new Exception($m);
43
	throw new Exception($m);
37
		}
44
			}
38
	}
45
		}
39
 
Line 46... Line 40...
46
	
40
	//changée
47
	//changée
41
	public function chargerStructureSql() {
48
	public function chargerStructureSql($structure_sql) {
42
		$fichierStructureSql = $this->Conteneur->getParametre('chemins.structureSql');
49
	$contenuSql = $this->recupererContenu(Config::get($structure_sql));
43
		$contenuSql = $this->recupererContenu($fichierStructureSql);
50
	$this->executerScripSql($contenuSql);
44
		$this->executerScripSql($contenuSql);
51
	}
45
	}
Line 52... Line 46...
52
	
46
 
53
	public function executerScripSql($sql) {
47
	public function executerScripSql($sql) {