Subversion Repositories Applications.framework

Rev

Rev 179 | Rev 188 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 179 Rev 185
Line 10... Line 10...
10
 // Auteur principal :
10
 // Auteur principal :
11
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
 * @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 // Autres auteurs :
12
 // Autres auteurs :
13
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
14
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
14
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
15
 * @version $$Id: Application.php 153 2010-03-04 10:48:32Z jpm $$
15
 * @version $Id: Application.php 185 2010-04-28 09:43:39Z jpm $
16
 * @copyright 1999-2009 Tela Botanica (accueil@tela-botanica.org)
16
 * @copyright 1999-2009 Tela Botanica (accueil@tela-botanica.org)
17
 */
17
 */
18
class Application {
18
class Application {
Line 19... Line 19...
19
 
19
 
20
	/**
20
	/**
21
	 * tableau d'informations sur l'application
21
	 * Tableau d'informations sur l'application
22
	 */
22
	 */
23
	private static $info = null;
23
	private static $info = null;
24
	/**
24
	/**
25
	 * chemin de base de l'application
25
	 * Chemin de base de l'application
26
	 */
26
	 */
Line 27... Line 27...
27
	private static $chemin = null;
27
	private static $chemin = null;
-
 
28
 
-
 
29
	/**
-
 
30
	 * Initialise différentes classes du Framework nécessaires pour le fonctionnement de l'application.
-
 
31
	 * Ces classes sont ensuites controlées via les fichiers de config.ini.
-
 
32
	 * Elle est appelée automatiquement suite à la définition du chemin de l'application via Application::setChemin().
-
 
33
	 */
-
 
34
	private static function initialiser() {
-
 
35
		// Instanciation du gestionnaire d'exception
-
 
36
		GestionnaireException::getInstance();
-
 
37
		// Instanciation du gestionnaire de logs
-
 
38
		Log::getInstance();
-
 
39
	}
28
 
40
	
-
 
41
	/**
29
	/**
42
	 * Permet d'indiquer le chemin de base de l'Application.
30
	 * Modificateur pour le chemin de base
43
	 * Cette méthode doit obligatoirement être utilisée par l'application pour que le Framework fonctionne correctement.
31
	 * @param string $chemin_fichier_principal chemin de base
44
	 * @param string $chemin_fichier_principal chemin de base
32
	 */
45
	 */
33
	public static function setChemin($chemin_fichier_principal) {
46
	public static function setChemin($chemin_fichier_principal) {
34
		if (self::$chemin === null) {
47
		if (self::$chemin === null) {
35
			if (!file_exists($chemin_fichier_principal)) {
48
			if (!file_exists($chemin_fichier_principal)) {
36
				trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode set().", E_USER_ERROR);
49
				trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode set().", E_USER_ERROR);
-
 
50
			} else {
37
			} else {
51
				self::$chemin = dirname($chemin_fichier_principal).DS;
38
				self::$chemin = dirname($chemin_fichier_principal).DS;
52
				self::initialiser();
39
			}
53
			}
40
		} else {
54
		} else {
41
			trigger_error("Le chemin de l'application a déjà été enregistré auprès du Framework", E_USER_WARNING);
55
			trigger_error("Le chemin de l'application a déjà été enregistré auprès du Framework", E_USER_WARNING);