Subversion Repositories Applications.gtt

Rev

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

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