Subversion Repositories Applications.gtt

Rev

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

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