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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
37 |
error_reporting(E_ALL);
|
|
|
38 |
//fichiers de la bibliotheque PEAR
|
|
|
39 |
include_once "Auth/Auth.php";
|
|
|
40 |
include_once "DB.php";
|
|
|
41 |
include_once 'gtt_config.inc.php';
|
|
|
42 |
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
|
|
|
43 |
include_once CHEMIN_CLASSES.'gtt_authentification.php';
|
|
|
44 |
include_once CHEMIN_FN_GENERIQUE_AFFICHAGE;
|
|
|
45 |
include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
|
|
|
46 |
include_once CHEMIN_MENU.'gtt_menu_travail.php';
|
|
|
47 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
|
|
|
48 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
|
|
|
49 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
|
|
|
50 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
|
|
|
51 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
|
|
|
52 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
|
|
|
53 |
include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
|
|
|
54 |
include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
//definition des constantes
|
|
|
58 |
define ("GESTION_TRAVAIL",1);
|
|
|
59 |
define ("GESTION_ADMIN_UTILISATEUR", 13);
|
|
|
60 |
define ("GESTION_EDITER_UTILISATEUR",14);
|
|
|
61 |
define ("GESTION_ADMIN_PROJET",15);
|
|
|
62 |
define ("GESTION_ADMIN_CATEGORIE",16);
|
|
|
63 |
define ("GESTION_ADMIN_MOTIF_ABSENCE",17);
|
|
|
64 |
define ("GESTION_ADMIN_STATUT",18);
|
|
|
65 |
define ("GESTION_ADMIN_FRAIS",19);
|
|
|
66 |
define ("GESTION_ADMIN_TACHE",20);
|
|
|
67 |
define ("GESTION_EDITER_PREFERENCES",21);
|
|
|
68 |
define ("GESTION_DECONNEXION",22);
|
|
|
69 |
|
|
|
70 |
//creation du dsn
|
|
|
71 |
//connexion a la base de donnees
|
|
|
72 |
$GLOBALS['db']=DB::connect($GLOBALS['dsn']);
|
|
|
73 |
|
|
|
74 |
if (DB::isError($GLOBALS['db']))
|
|
|
75 |
{
|
|
|
76 |
$GLOBALS['db']->getMessage();
|
|
|
77 |
echo "echec connexion a la base de donnees";
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
$params=array(
|
|
|
83 |
"dsn"=>$GLOBALS['dsn'],
|
|
|
84 |
"table"=>GEST_UTILISATEUR,
|
|
|
85 |
"usernamecol"=>GEST_CHAMPS_EMAIL,
|
|
|
86 |
"passwordcol"=>GEST_CHAMPS_PASSWORD,
|
|
|
87 |
"cryptype"=>"md5",
|
|
|
88 |
"db_fields"=>"*");
|
|
|
89 |
|
|
|
90 |
//creation de l'objet auth
|
|
|
91 |
|
|
|
92 |
$a = new Auth("DB",$params,"afficherMenuConnexion",true);
|
|
|
93 |
|
|
|
94 |
$a->setSessionname('temps_travail');
|
|
|
95 |
$a->setExpire(3600*24*30);
|
|
|
96 |
|
|
|
97 |
$a->start();
|
|
|
98 |
echo $a->getStatus();
|
|
|
99 |
|
|
|
100 |
if ($a->getAuth())
|
|
|
101 |
{
|
|
|
102 |
$mail=$a->getUserName();
|
|
|
103 |
$utilisateur=&Utilisateur::recupIDUtilisateurMail($mail);
|
|
|
104 |
$GLOBALS['idCurrentUser']=$utilisateur;
|
|
|
105 |
//recuperation de l'identifiant de la personne
|
|
|
106 |
|
|
|
107 |
//test des choix de menu a afficher
|
|
|
108 |
|
|
|
109 |
if (empty($action)){ $action = 1 ;}
|
|
|
110 |
switch ($action)
|
|
|
111 |
{
|
|
|
112 |
//cas affichage menu travail 1
|
|
|
113 |
case GESTION_TRAVAIL :
|
|
|
114 |
if (!isset($semaine))
|
|
|
115 |
{
|
|
|
116 |
$semaine=date('W',mktime(0,0,0,date('m'),date('d'),date('Y')));
|
|
|
117 |
}
|
|
|
118 |
if (!isset($annee))
|
|
|
119 |
{
|
|
|
120 |
$annee=date('Y');
|
|
|
121 |
}
|
|
|
122 |
$text=traiterAdminTravail($_SERVER["PHP_SELF"],$semaine,$annee,$utilisateur);
|
|
|
123 |
|
|
|
124 |
break;
|
|
|
125 |
|
|
|
126 |
//cas affichage du menu ajout autilisateurss 13
|
|
|
127 |
case GESTION_ADMIN_UTILISATEUR :
|
|
|
128 |
$text=traiterAdminUtilisateur('',0);
|
|
|
129 |
break;
|
|
|
130 |
|
|
|
131 |
//cas editer des utilisateurs 14
|
|
|
132 |
case GESTION_EDITER_UTILISATEUR :
|
|
|
133 |
$text=traiterAdminUtilisateur(renvoyerDonneesUser(),1);
|
|
|
134 |
break;
|
|
|
135 |
|
|
|
136 |
//cas afficher menu administration projet 15
|
|
|
137 |
case GESTION_ADMIN_PROJET :
|
|
|
138 |
$text=traiterAdminProjet();
|
|
|
139 |
break;
|
|
|
140 |
|
|
|
141 |
//cas afficher menu administration categorie 16
|
|
|
142 |
case GESTION_ADMIN_CATEGORIE :
|
|
|
143 |
$text=traiterAdminCategorie();
|
|
|
144 |
break;
|
|
|
145 |
|
|
|
146 |
//cas afficher menu admin motif absence 17
|
|
|
147 |
case GESTION_ADMIN_MOTIF_ABSENCE :
|
|
|
148 |
$text=traiterAdminMotif();
|
|
|
149 |
break;
|
|
|
150 |
|
|
|
151 |
//cas afficher menu admin statut 18
|
|
|
152 |
case GESTION_ADMIN_STATUT :
|
|
|
153 |
$text=traiterAdminStatut();
|
|
|
154 |
break;
|
|
|
155 |
|
|
|
156 |
//cas afficher admin editer frais 19
|
|
|
157 |
case GESTION_ADMIN_FRAIS :
|
|
|
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 |
$text=traiterEditerPreferences($GLOBALS['idCurrentUser']);
|
|
|
169 |
break;
|
|
|
170 |
|
|
|
171 |
//cas deconnexion 22
|
|
|
172 |
case GESTION_DECONNEXION :
|
|
|
173 |
$a->logout();
|
|
|
174 |
$text=afficherMenuConnexion();
|
|
|
175 |
//$GLOBALS['db']->disconnect();
|
|
|
176 |
break;
|
|
|
177 |
|
|
|
178 |
}
|
|
|
179 |
$text.=fermerBalisesFin();
|
|
|
180 |
echo $text;
|
|
|
181 |
}else
|
|
|
182 |
{
|
|
|
183 |
echo afficherMenuConnexion();
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
//tester le choix de l'utilisateur
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
?>
|