Subversion Repositories Applications.gtt

Rev

Rev 124 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 124 Rev 138
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_'.GTT_LANGUE.'.inc.php';
45
 
45
 
46
// Gestion de l'action à executer par défaut
46
// Gestion de l'action à executer par défaut
47
if (empty($_GET['action'])) {
47
if (empty($_GET['action'])) {
48
	$_GET['action'] = 'identification';
48
	$_GET['action'] = 'identification';
49
}
49
}
50
// Gestion du format du template
50
// Gestion du format du template
51
if (empty($_GET['format'])) {
51
if (empty($_GET['format'])) {
52
	$_GET['format'] = 'html';
52
	$_GET['format'] = 'html';
53
}
53
}
54
// Gestion du type de sortie par défaut
54
// Gestion du type de sortie par défaut
55
if (empty($_GET['sortie'])) {
55
if (empty($_GET['sortie'])) {
56
	$_GET['sortie'] = $_GET['format'];
56
	$_GET['sortie'] = $_GET['format'];
57
}
57
}
58
 
58
 
59
// Initialisation du Gestionnaire d'erreurs
59
// Initialisation du Gestionnaire d'erreurs
60
$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE);
60
$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE);
61
$GLOBALS['_GTT_']['erreur']->setNiveauErreurCourrant(GTT_DEBOGAGE_NIVEAU);
61
$GLOBALS['_GTT_']['erreur']->setNiveauErreurCourrant(GTT_DEBOGAGE_NIVEAU);
62
 
62
 
63
// Initialisation du Chronomêtre
63
// Initialisation du Chronomêtre
64
$GLOBALS['_GTT_']['chrono'] = new Chronometre();
64
$GLOBALS['_GTT_']['chrono'] = new Chronometre();
65
 
65
 
66
// Connexion à la base de données
66
// Connexion à la base de données
67
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
67
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
68
if (PEAR::isError($GLOBALS['db'])) {
68
if (PEAR::isError($GLOBALS['db'])) {
69
	trigger_error("Échec connexion à la base de données : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
69
	trigger_error("Échec connexion à la base de données : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
70
}
70
}
71
// Utilisation de l'utf-8
71
// Utilisation de l'utf-8
72
if (PEAR::isError($GLOBALS['db']->query('SET NAMES "utf8"'))) {
72
if (PEAR::isError($GLOBALS['db']->query('SET NAMES "utf8"'))) {
73
	trigger_error("Échec de l'utilisation d'UTF-8 : ".$GLOBALS['db']->getMessage(), E_USER_WARNING);
73
	trigger_error("Échec de l'utilisation d'UTF-8 : ".$GLOBALS['db']->getMessage(), E_USER_WARNING);
74
}
74
}
75
 
75
 
76
// Utilisation du mécanisme MVC avec Squelette PHP et objet
76
// Utilisation du mécanisme MVC avec Squelette PHP et objet
77
$Controlleur = new ControlleurFrontal($_GET['action'], $_GET['format'], $_GET['sortie']);
77
$Controlleur = new ControlleurFrontal($_GET['action'], $_GET['format'], $_GET['sortie']);
78
$Controlleur->executer();
78
$Controlleur->executer();
79
 
79
 
80
/**
80
/**
81
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
81
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
82
*
82
*
83
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
83
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
84
*
84
*
85
*@param string le nom de la classe appelée.
85
*@param string le nom de la classe appelée.
86
*@return void le fichier contenant la classe doit être inclu par la fonction.
86
*@return void le fichier contenant la classe doit être inclu par la fonction.
87
*/
87
*/
88
function __autoload($classe)
88
function __autoload($classe)
89
{
89
{
90
	$fichier_classe_pear = GTT_CHEMIN_PEAR.str_replace('_', '/', $classe).'.php';
90
	$fichier_classe_pear = GTT_CHEMIN_PEAR.str_replace('_', '/', $classe).'.php';
91
	if (file_exists($fichier_classe_pear)) {
91
	if (file_exists($fichier_classe_pear)) {
92
		require_once $fichier_classe_pear;
92
		require_once $fichier_classe_pear;
93
	} else {
93
	} else {
94
		$nom_classe_gtt = $classe.'.class.php';
94
		$nom_classe_gtt = $classe.'.class.php';
95
		foreach ($GLOBALS['_GTT_']['tab_chemin_autoload'] as $chemin) {
95
		foreach ($GLOBALS['_GTT_']['tab_chemin_autoload'] as $chemin) {
96
			$fichier = $chemin.$nom_classe_gtt;
96
			$fichier = $chemin.$nom_classe_gtt;
97
			if (file_exists($fichier)) {
97
			if (file_exists($fichier)) {
98
				require_once $fichier;
98
				require_once $fichier;
99
			}
99
			}
100
		}
100
		}
101
	}
101
	}
102
}
102
}
103
 
103
 
104
?>
104
?>