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