Subversion Repositories Applications.gtt

Rev

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

Rev 48 Rev 56
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 'Auth/Auth.php';
39
include 'Auth/Auth.php';
40
include 'DB.php';
40
include 'DB.php';
41
include 'gtt_config.inc.php';
41
include 'gtt_config.inc.php';
42
include CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
42
include GTT_CHEMIN_LANGUE.'gtt_langue_fr.inc.php';
43
 
43
 
44
// Test des choix de menu a afficher
44
// Test des choix de menu a afficher
45
$action = 1;
45
$action = 'identification';
46
if (!empty($_GET['action'])) {
46
if (!empty($_GET['action'])) {
47
	$action = $_GET['action'];
47
	$action = $_GET['action'];
48
}
48
}
49
if (!preg_match('/^\d+$/', $action)) {
-
 
50
 
-
 
51
	/**
-
 
52
	* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
-
 
53
	*
-
 
54
	* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
-
 
55
	*
49
 
56
	*@param string le nom de la classe appelée.
-
 
57
	*@return void le fichier contenant la classe doit être inclu par la fonction.
-
 
58
	*/
-
 
59
	function __autoload($classe)
-
 
60
	{
50
// Initialisation du gestionnaire d'erreur
61
		$fichier_classe_pear = GTT_CHEMIN_PEAR.str_replace('_', '/', $classe).'.php';
-
 
62
		if (file_exists($fichier_classe_pear)) {
-
 
63
			require_once $fichier_classe_pear;
-
 
64
		} else {
-
 
65
			$nom_classe_gtt = $classe.'.class.php';
-
 
66
			foreach ($GLOBALS['_GTT_']['tab_chemin_autoload'] as $chemin) {
-
 
67
				$fichier = $chemin.$nom_classe_gtt;
-
 
68
				if (file_exists($fichier)) {
-
 
69
					require_once $fichier;
-
 
70
				}
-
 
71
			}
-
 
72
		}
-
 
73
	}
51
$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE, GTT_DEBOGAGE_NIVEAU, GTT_DEBOGAGE_PEAR, GTT_DEBOGAGE_PEAR_CHAINE);
-
 
52
 
-
 
53
// Connexion a la base de donnees
74
 
54
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
-
 
55
if (PEAR::isError($GLOBALS['db'])) {
75
	// Initialisation du gestionnaire d'erreur
56
	trigger_error("Echec connexion a la base de donnees : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
76
	$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE, GTT_DEBOGAGE_NIVEAU, GTT_DEBOGAGE_PEAR, GTT_DEBOGAGE_PEAR_CHAINE);
57
}
-
 
58
 
77
 
59
// Utilisation du mécanisme MVC avec Squelette PHP et objet
-
 
60
$nom_module_general = 'ControlleurFrontal';
78
	// Connexion a la base de donnees
61
$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
79
	$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
62
if (file_exists($fichier_module_general)) {
-
 
63
	require_once $fichier_module_general;
80
	if (PEAR::isError($GLOBALS['db'])) {
-
 
81
		trigger_error("Echec connexion a la base de donnees : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
-
 
82
	}
-
 
83
 
-
 
84
	// Utilisation du mécanisme MVC avec Squelette PHP et objet
-
 
85
	$nom_module_general = 'ControlleurFrontal';
-
 
86
	$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
-
 
87
	if (file_exists($fichier_module_general)) {
-
 
88
		require_once $fichier_module_general;
-
 
89
		$Controlleur = new $nom_module_general;
-
 
90
	}
-
 
91
	echo $Controlleur->executer($action);
-
 
92
} else {
-
 
93
	include 'HTML/QuickForm.php';
-
 
94
	include_once CHEMIN_CLASSES.'gtt_authentification.php';
-
 
95
	include_once CHEMIN_PRESENTATION.'gtt_fonctions_generique_affichage.php';
-
 
96
	// Connexion a la base de donnees
-
 
97
	$GLOBALS['db'] = DB::connect($GLOBALS['dsn_v3']);
-
 
98
	if (DB::isError($GLOBALS['db'])) {
-
 
99
		$GLOBALS['db']->getMessage();
-
 
100
		echo "Echec connexion a la base de donnees";
-
 
101
	}
-
 
102
 
-
 
103
	// Création de l'objet auth
-
 
104
	$params = array('dsn'=>$GLOBALS['dsn_v3'],
-
 
105
					'table'=>GEST_UTILISATEUR,
-
 
106
					'usernamecol'=>GEST_CHAMPS_EMAIL,
-
 
107
					'passwordcol'=>GEST_CHAMPS_PASSWORD,
-
 
108
					'cryptype'=>'md5',
-
 
109
					'db_fields'=>'*');
-
 
110
	$a = new Auth('DB', $params, 'afficherMenuConnexion', true);
-
 
111
	$a->setSessionname('temps_travail');
-
 
112
	$a->setExpire(3600*24*30);
-
 
113
	$a->start();
-
 
114
	echo $a->getStatus();
-
 
115
	if ($a->getAuth()) {
-
 
116
		// Récuperation de l'identifiant de la personne
-
 
117
		$mail = $a->getUserName();
-
 
118
		$utilisateur = Utilisateur::recupIDUtilisateurMail($mail);
-
 
119
		$GLOBALS['idCurrentUser'] = $utilisateur;
-
 
120
 
-
 
121
		// Utilisation de l'ancien mécanisme
-
 
122
		switch ($action) {
-
 
123
			// Cas affichage menu travail 1
-
 
124
			case GESTION_TRAVAIL :
64
	$Controlleur = new $nom_module_general;
125
				include_once CHEMIN_MENU.'gtt_menu_travail.php';
-
 
126
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
-
 
127
	       		if (!isset($semaine)) {
-
 
128
					$semaine = date('W',mktime(0, 0, 0, date('m'), date('d') ,date('Y')));
65
}
129
				}
-
 
130
		 		if (!isset($annee)) {
-
 
131
					$annee = date('Y');
-
 
132
				}
-
 
133
	        	$text = traiterAdminTravail($_SERVER['PHP_SELF'], $semaine, $annee, $utilisateur);
-
 
134
				break;
-
 
135
 
-
 
136
			// Cas affichage du menu ajout autilisateurss 13
-
 
137
			case GESTION_ADMIN_UTILISATEUR :
66
echo $Controlleur->executer($action);
138
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
-
 
139
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
-
 
140
				$text = traiterAdminUtilisateur('',0);
-
 
141
				break;
67
 
142
 
-
 
143
			// Cas editer des utilisateurs 14
-
 
144
			case GESTION_EDITER_UTILISATEUR :
68
 
145
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
69
/**
146
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
-
 
147
				$text = traiterAdminUtilisateur(renvoyerDonneesUser(),1);
-
 
148
				break;
-
 
149
 
-
 
150
			// Cas afficher menu administration projet 15
-
 
151
			case GESTION_ADMIN_PROJET :
70
* La fonction __autoload() charge dynamiquement les classes trouvées dans le code.
152
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
-
 
153
				$text = traiterAdminProjet();
-
 
154
				break;
-
 
155
 
-
 
156
			// Cas afficher menu administration categorie 16
-
 
157
			case GESTION_ADMIN_CATEGORIE :
-
 
158
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
-
 
159
				$text = traiterAdminCategorie();
-
 
160
				break;
-
 
161
 
-
 
162
			// Cas afficher menu admin motif absence 17
71
*
163
			case GESTION_ADMIN_MOTIF_ABSENCE :
-
 
164
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
-
 
165
				$text = traiterAdminMotif();
-
 
166
				break;
72
* Cette fonction est appelée par php5 quand il trouve une instanciation de classe dans le code.
167
 
-
 
168
			// Cas afficher menu admin statut 18
-
 
169
			case GESTION_ADMIN_STATUT :
-
 
170
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
-
 
171
				$text = traiterAdminStatut();
-
 
172
				break;
-
 
173
 
-
 
174
			// Cas afficher admin editer frais 19
-
 
175
			case GESTION_ADMIN_FRAIS :
-
 
176
 
-
 
177
				$text = '';
-
 
178
				break;
-
 
179
 
73
*
180
			// Cas afficher admin editer taches 20
-
 
181
			case GESTION_ADMIN_TACHE :
-
 
182
				$text = '';
74
*@param string le nom de la classe appelée.
183
				break;
-
 
184
 
-
 
185
			// Cas editer preferences d'un utilisateur 21
-
 
186
			case GESTION_EDITER_PREFERENCES :
-
 
187
				include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';
-
 
188
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
-
 
189
				$text = traiterEditerPreferences($GLOBALS['idCurrentUser']);
-
 
190
				break;
75
*@return void le fichier contenant la classe doit être inclu par la fonction.
191
 
-
 
192
			// Cas deconnexion 22
-
 
193
			case GESTION_DECONNEXION :
-
 
194
				$a->logout();
76
*/
195
				$text = afficherMenuConnexion();
-
 
196
				//$GLOBALS['db']->disconnect();
77
function __autoload($classe)
-
 
78
{
-
 
79
	$fichier_classe_pear = GTT_CHEMIN_PEAR.str_replace('_', '/', $classe).'.php';
-
 
80
	if (file_exists($fichier_classe_pear)) {
197
				break;
81
		require_once $fichier_classe_pear;
-
 
82
	} else {
-
 
83
		$nom_classe_gtt = $classe.'.class.php';
-
 
84
		foreach ($GLOBALS['_GTT_']['tab_chemin_autoload'] as $chemin) {
198
		}
85
			$fichier = $chemin.$nom_classe_gtt;
199
		$text .= fermerBalisesFin();
86
			if (file_exists($fichier)) {
-
 
87
				require_once $fichier;
200
		echo $text;
88
			}
201
	} else {
89
		}
202
		echo afficherMenuConnexion();
90
	}
203
	}
91
}
204
}
92
 
205
?>
93
?>