Subversion Repositories Applications.gtt

Rev

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