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