Subversion Repositories Applications.framework

Rev

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

Rev 95 Rev 96
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// declare(encoding='UTF-8');
-
 
3
/**
-
 
4
* Classe fournissant des informations au Framework sur l'application.
-
 
5
*
-
 
6
* @package Framework
-
 
7
* @category Debogage
-
 
8
// Auteur principal :
-
 
9
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
-
 
10
// Autres auteurs :
-
 
11
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
-
 
12
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
-
 
13
* @version $$Id$$
-
 
14
* @copyright 1999-2009 Tela Botanica (accueil@tela-botanica.org)
-
 
15
*/
2
class Application {
16
class Application {
3
	
17
 
4
	private static $nom = null;
18
	private static $info = null;
5
	private static $abreviation = null;
-
 
6
	private static $chemin = null;
19
	private static $chemin = null;
7
	
20
 
-
 
21
	/**
-
 
22
	 * Le tableau des informations sur l'application possède les clés suivantes :
-
 
23
	 * - nom : nom de l'application
-
 
24
	 * - abr : abréviation de l'application
-
 
25
	 * - encodage : encodage de l'application (ISO-8859-15, UTF-8...)
-
 
26
	 *
-
 
27
	 * @param string $chemin_fichier_principal
-
 
28
	 * @param array $info tableau fournissant des informations sur l'application
-
 
29
	 * @return void
-
 
30
	 */
8
	public static function set($nom, $abreviation, $chemin_fichier_principal) {
31
	public static function set($chemin_fichier_principal, $info = null) {
9
		if (self::$chemin === null) {
32
		if (self::$chemin === null) {
10
			if (!file_exists($chemin_fichier_principal)) {
33
			if (!file_exists($chemin_fichier_principal)) {
11
				trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode set().", E_USER_WARNING);
34
				trigger_error("Le fichier indiqué n'existe pas. Utilisez __FILE__ dans la méthode set().", E_USER_ERROR);
12
			} else {
35
			} else {
13
				self::$chemin = dirname($chemin_fichier_principal).DS;
36
				self::$chemin = dirname($chemin_fichier_principal).DS;
14
			}
37
			}
15
			self::$nom = $nom;
38
			self::$info = $info;
16
			self::$abreviation = $abreviation;
-
 
17
		} else {
39
		} else {
18
			trigger_error("L'application a déjà été enregistrée auprès du Framework", E_USER_WARNING);
40
			trigger_error("L'application a déjà été enregistrée auprès du Framework", E_USER_WARNING);
19
		}
41
		}
20
	}
42
	}
Line 21... Line 43...
21
 
43
 
22
	public static function getChemin() {
44
	public static function getChemin() {
23
		return self::$chemin;
45
		return self::$chemin;
24
	}
46
	}
25
	
47
 
-
 
48
	public static function getInfo($cle = null) {
-
 
49
		if ($cle !== null) {
26
	public static function getNom() {
50
			if (isset(self::$info[$cle])) {
27
		return self::$nom;
51
				return self::$info[$cle];
28
	}
-
 
29
	
52
			}
30
	public static function getAbreviation() {
53
		} else {
-
 
54
			return self::$info;
31
		return self::$code;
55
		}
32
	}
56
	}
33
}
57
}