Subversion Repositories Applications.gtt

Rev

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

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