Subversion Repositories Applications.gtt

Rev

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

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