Subversion Repositories Applications.gtt

Rev

Rev 94 | Rev 123 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 104
1
<?php
1
<?php
2
// +------------------------------------------------------------------------------------------------------+
2
// +------------------------------------------------------------------------------------------------------+
3
// | PHP version 4.1                                                                                      |
3
// | PHP version 4.1                                                                                      |
4
// +------------------------------------------------------------------------------------------------------+
4
// +------------------------------------------------------------------------------------------------------+
5
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
5
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// +------------------------------------------------------------------------------------------------------+
6
// +------------------------------------------------------------------------------------------------------+
7
// | This library is free software; you can redistribute it and/or                                        |
7
// | This library is free software; you can redistribute it and/or                                        |
8
// | modify it under the terms of the GNU Lesser General Public                                           |
8
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | License as published by the Free Software Foundation; either                                         |
9
// | License as published by the Free Software Foundation; either                                         |
10
// | version 2.1 of the License, or (at your option) any later version.                                   |
10
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// |                                                                                                      |
11
// |                                                                                                      |
12
// | This library is distributed in the hope that it will be useful,                                      |
12
// | This library is distributed in the hope that it will be useful,                                      |
13
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
13
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
14
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | Lesser General Public License for more details.                                                      |
15
// | Lesser General Public License for more details.                                                      |
16
// |                                                                                                      |
16
// |                                                                                                      |
17
// | You should have received a copy of the GNU Lesser General Public                                     |
17
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | License along with this library; if not, write to the Free Software                                  |
18
// | License along with this library; if not, write to the Free Software                                  |
19
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
19
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// +------------------------------------------------------------------------------------------------------+
20
// +------------------------------------------------------------------------------------------------------+
21
// |@author ABDOOL RAHEEM shaheen   shaheenar50@hotmail.com                                                 |
21
// |@author ABDOOL RAHEEM shaheen   shaheenar50@hotmail.com                                                 |
22
// |@version 3                                                                                            |
22
// |@version 3                                                                                            |
23
 
23
 
24
// +------------------------------------------------------------------------------------------------------+
24
// +------------------------------------------------------------------------------------------------------+
25
/*
25
/*
26
*fichier contenant le menu principal de l'application de gestion du temps de travail
26
*fichier contenant le menu principal de l'application de gestion du temps de travail
27
*@package gtt_general
27
*@package gtt_general
28
//Auteur original :
28
//Auteur original :
29
*@author        Dorian Bannier <dbannier@aol.com>
29
*@author        Dorian Bannier <dbannier@aol.com>
30
//Autres auteurs :
30
//Autres auteurs :
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
32
*@copyright     Copyright (C) 2003 Tela-Botanica
32
*@copyright     Copyright (C) 2003 Tela-Botanica
33
*/
33
*/
34
// +------------------------------------------------------------------------------------------------------+
34
// +------------------------------------------------------------------------------------------------------+
35
// |                                            INCLUSION DE FICHIERS                                       |
35
// |                                            INCLUSION DE FICHIERS                                       |
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
 
37
 
38
// Fichiers de la bibliotheque PEAR
38
// Fichiers de la bibliotheque PEAR
39
include 'gtt_config.inc.php';
39
include 'gtt_config.inc.php';
40
if (!file_exists('config.inc.php')) {
40
if (!file_exists('config.inc.php')) {
41
	die('Veuillez configurer la base de données de la Gestion du Temps de travail en complétant puis en renommant en config.inc.php le fichier config.inc.defaut.php.');
41
	die('Veuillez configurer la base de données de la Gestion du Temps de travail en complétant puis en renommant en config.inc.php le fichier config.inc.defaut.php.');
42
}
42
}
43
include 'config.inc.php';
43
include 'config.inc.php';
44
include GTT_CHEMIN_LANGUE.'gtt_langue_fr.inc.php';
44
include GTT_CHEMIN_LANGUE.'gtt_langue_fr.inc.php';
45
 
45
 
46
// Test des choix de menu a afficher
46
// Test des choix de menu a afficher
47
$action = 'identification';
47
$action = 'identification';
48
if (!empty($_GET['action'])) {
48
if (!empty($_GET['action'])) {
49
	$action = $_GET['action'];
49
	$action = $_GET['action'];
50
}
50
}
51
 
51
 
52
// Initialisation du gestionnaire d'erreur
52
// Initialisation du gestionnaire d'erreur
53
$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE);
53
$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE);
54
$GLOBALS['_GTT_']['erreur']->setNiveauErreurCourrant(GTT_DEBOGAGE_NIVEAU);
54
$GLOBALS['_GTT_']['erreur']->setNiveauErreurCourrant(GTT_DEBOGAGE_NIVEAU);
55
 
55
 
56
// Connexion a la base de donnees
56
// Connexion à la base de données
57
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
57
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
58
if (PEAR::isError($GLOBALS['db'])) {
58
if (PEAR::isError($GLOBALS['db'])) {
-
 
59
	trigger_error("Échec connexion à la base de données : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
-
 
60
}
-
 
61
// Utilisation de l'utf-8
-
 
62
if (PEAR::isError($GLOBALS['db']->query('SET NAMES "utf8"'))) {
59
	trigger_error("Echec connexion a la base de donnees : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
63
	trigger_error("Échec de l'utilisation d'UTF-8 : ".$GLOBALS['db']->getMessage(), E_USER_WARNING);
60
}
64
}
61
 
65
 
62
// Utilisation du mécanisme MVC avec Squelette PHP et objet
66
// Utilisation du mécanisme MVC avec Squelette PHP et objet
63
$Controlleur = new ControlleurFrontal();
67
$Controlleur = new ControlleurFrontal();
64
echo $Controlleur->executer($action);
68
echo $Controlleur->executer($action);
65
 
69
 
66
/**
70
/**
67
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
71
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
68
*
72
*
69
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
73
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
70
*
74
*
71
*@param string le nom de la classe appelée.
75
*@param string le nom de la classe appelée.
72
*@return void le fichier contenant la classe doit être inclu par la fonction.
76
*@return void le fichier contenant la classe doit être inclu par la fonction.
73
*/
77
*/
74
function __autoload($classe)
78
function __autoload($classe)
75
{
79
{
76
	$fichier_classe_pear = GTT_CHEMIN_PEAR.str_replace('_', '/', $classe).'.php';
80
	$fichier_classe_pear = GTT_CHEMIN_PEAR.str_replace('_', '/', $classe).'.php';
77
	if (file_exists($fichier_classe_pear)) {
81
	if (file_exists($fichier_classe_pear)) {
78
		require_once $fichier_classe_pear;
82
		require_once $fichier_classe_pear;
79
	} else {
83
	} else {
80
		$nom_classe_gtt = $classe.'.class.php';
84
		$nom_classe_gtt = $classe.'.class.php';
81
		foreach ($GLOBALS['_GTT_']['tab_chemin_autoload'] as $chemin) {
85
		foreach ($GLOBALS['_GTT_']['tab_chemin_autoload'] as $chemin) {
82
			$fichier = $chemin.$nom_classe_gtt;
86
			$fichier = $chemin.$nom_classe_gtt;
83
			if (file_exists($fichier)) {
87
			if (file_exists($fichier)) {
84
				require_once $fichier;
88
				require_once $fichier;
85
			}
89
			}
86
		}
90
		}
87
	}
91
	}
88
}
92
}
89
 
93
 
90
?>
94
?>