Subversion Repositories Applications.gtt

Rev

Rev 2 | Rev 7 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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