Subversion Repositories Applications.gtt

Rev

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

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