Subversion Repositories Applications.gtt

Rev

Rev 7 | Rev 10 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 jpm 1
<?php
2
// +------------------------------------------------------------------------------------------------------+
3
// | PHP version 4.1                                                                                      |
4
// +------------------------------------------------------------------------------------------------------+
5
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// +------------------------------------------------------------------------------------------------------+
7
// | This library is free software; you can redistribute it and/or                                        |
8
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | License as published by the Free Software Foundation; either                                         |
10
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// |                                                                                                      |
12
// | This library is distributed in the hope that it will be useful,                                      |
13
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | Lesser General Public License for more details.                                                      |
16
// |                                                                                                      |
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                                  |
19
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// +------------------------------------------------------------------------------------------------------+
21
// |@author ABDOOL RAHEEM shaheen   shaheenar50@hotmail.com                                                 |
22
// |@version 3                                                                                            |
23
 
24
// +------------------------------------------------------------------------------------------------------+
25
/*
26
*fichier contenant le menu principal de l'application de gestion du temps de travail
27
*@package gtt_general
28
//Auteur original :
29
*@author        Dorian Bannier <dbannier@aol.com>
30
//Autres auteurs :
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
32
*@copyright     Copyright (C) 2003 Tela-Botanica
33
*/
34
// +------------------------------------------------------------------------------------------------------+
35
// |                                            INCLUSION DE FICHIERS                                       |
36
// +------------------------------------------------------------------------------------------------------+
5 jpm 37
 
38
// Fichiers de la bibliotheque PEAR
39
include_once 'Auth/Auth.php';
40
include_once 'DB.php';
7 jpm 41
include_once 'HTML/QuickForm.php';
2 jpm 42
include_once 'gtt_config.inc.php';
43
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
44
include_once CHEMIN_CLASSES.'gtt_authentification.php';
9 jpm 45
include_once CHEMIN_PRESENTATION.'gtt_fonctions_generique_affichage.php';
2 jpm 46
 
5 jpm 47
// Création du dsn
48
// Connexion a la base de donnees
49
$GLOBALS['db'] = DB::connect($GLOBALS['dsn']);
2 jpm 50
 
5 jpm 51
if (DB::isError($GLOBALS['db'])) {
52
	$GLOBALS['db']->getMessage();
9 jpm 53
	echo "Echec connexion a la base de donnees";
2 jpm 54
}
55
 
5 jpm 56
$params = array("dsn"=>$GLOBALS['dsn'],
57
				"table"=>GEST_UTILISATEUR,
58
				"usernamecol"=>GEST_CHAMPS_EMAIL,
59
				"passwordcol"=>GEST_CHAMPS_PASSWORD,
60
				"cryptype"=>"md5",
61
				"db_fields"=>"*");
2 jpm 62
 
5 jpm 63
// Création de l'objet auth
64
$a = new Auth('DB', $params, 'afficherMenuConnexion', true);
2 jpm 65
$a->setSessionname('temps_travail');
66
$a->setExpire(3600*24*30);
67
$a->start();
68
echo $a->getStatus();
69
 
5 jpm 70
if ($a->getAuth()) {
71
	$mail = $a->getUserName();
72
	$utilisateur = Utilisateur::recupIDUtilisateurMail($mail);
73
	$GLOBALS['idCurrentUser'] = $utilisateur;
74
	// Récuperation de l'identifiant de la personne
75
    // Test des choix de menu a afficher
9 jpm 76
    $action = 1;
77
	if (!empty($_GET['action'])) {
78
		$action = $_GET['action'];
5 jpm 79
	}
9 jpm 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
103
		switch ($action) {
104
			// Cas affichage menu travail 1
105
			case GESTION_TRAVAIL :
106
				include_once CHEMIN_MENU.'gtt_menu_travail.php';
107
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
108
	       		if (!isset($semaine)) {
109
					$semaine = date('W',mktime(0, 0, 0, date('m'), date('d') ,date('Y')));
110
				}
111
		 		if (!isset($annee)) {
112
					$annee = date('Y');
113
				}
114
	        	$text = traiterAdminTravail($_SERVER['PHP_SELF'], $semaine, $annee, $utilisateur);
115
				break;
116
 
117
			// Cas affichage du menu ajout autilisateurss 13
118
			case GESTION_ADMIN_UTILISATEUR :
119
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
120
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
121
				$text = traiterAdminUtilisateur('',0);
122
				break;
123
 
124
			// Cas editer des utilisateurs 14
125
			case GESTION_EDITER_UTILISATEUR :
126
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
127
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
128
				$text = traiterAdminUtilisateur(renvoyerDonneesUser(),1);
129
				break;
130
 
131
			// Cas afficher menu administration projet 15
132
			case GESTION_ADMIN_PROJET :
133
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
134
				$text = traiterAdminProjet();
135
				break;
136
 
137
			// Cas afficher menu administration categorie 16
138
			case GESTION_ADMIN_CATEGORIE :
139
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
140
				$text = traiterAdminCategorie();
141
				break;
142
 
143
			// Cas afficher menu admin motif absence 17
144
			case GESTION_ADMIN_MOTIF_ABSENCE :
145
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
146
				$text = traiterAdminMotif();
147
				break;
148
 
149
			// Cas afficher menu admin statut 18
150
			case GESTION_ADMIN_STATUT :
151
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
152
				$text = traiterAdminStatut();
153
				break;
154
 
155
			// Cas afficher admin editer frais 19
156
			case GESTION_ADMIN_FRAIS :
157
 
158
				$text = '';
159
				break;
160
 
161
			// Cas afficher admin editer taches 20
162
			case GESTION_ADMIN_TACHE :
163
				$text = '';
164
				break;
165
 
166
			// Cas editer preferences d'un utilisateur 21
167
			case GESTION_EDITER_PREFERENCES :
168
				include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';
169
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
170
				$text = traiterEditerPreferences($GLOBALS['idCurrentUser']);
171
				break;
172
 
173
			// Cas deconnexion 22
174
			case GESTION_DECONNEXION :
175
				$a->logout();
176
				$text = afficherMenuConnexion();
177
				//$GLOBALS['db']->disconnect();
178
				break;
179
		}
180
		$text .= fermerBalisesFin();
181
		echo $text;
182
	}
5 jpm 183
} else {
184
	echo afficherMenuConnexion();
2 jpm 185
}
186
//tester le choix de l'utilisateur
5 jpm 187
?>