Subversion Repositories Applications.gtt

Rev

Rev 48 | Rev 58 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 48 Rev 56
Line 37... Line 37...
37
 
37
 
38
// Fichiers de la bibliotheque PEAR
38
// Fichiers de la bibliotheque PEAR
39
include 'Auth/Auth.php';
39
include 'Auth/Auth.php';
40
include 'DB.php';
40
include 'DB.php';
41
include 'gtt_config.inc.php';
41
include 'gtt_config.inc.php';
Line 42... Line 42...
42
include CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
42
include GTT_CHEMIN_LANGUE.'gtt_langue_fr.inc.php';
43
 
43
 
44
// Test des choix de menu a afficher
44
// Test des choix de menu a afficher
45
$action = 1;
45
$action = 'identification';
46
if (!empty($_GET['action'])) {
46
if (!empty($_GET['action'])) {
-
 
47
	$action = $_GET['action'];
-
 
48
}
-
 
49
 
-
 
50
// Initialisation du gestionnaire d'erreur
-
 
51
$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE, GTT_DEBOGAGE_NIVEAU, GTT_DEBOGAGE_PEAR, GTT_DEBOGAGE_PEAR_CHAINE);
-
 
52
 
-
 
53
// Connexion a la base de donnees
-
 
54
$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
-
 
55
if (PEAR::isError($GLOBALS['db'])) {
-
 
56
	trigger_error("Echec connexion a la base de donnees : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
-
 
57
}
-
 
58
 
-
 
59
// Utilisation du mécanisme MVC avec Squelette PHP et objet
47
	$action = $_GET['action'];
60
$nom_module_general = 'ControlleurFrontal';
-
 
61
$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
-
 
62
if (file_exists($fichier_module_general)) {
-
 
63
	require_once $fichier_module_general;
-
 
64
	$Controlleur = new $nom_module_general;
-
 
65
}
Line 48... Line 66...
48
}
66
echo $Controlleur->executer($action);
49
if (!preg_match('/^\d+$/', $action)) {
67
 
50
 
68
 
51
	/**
69
/**
Line 70... Line 88...
70
				}
88
			}
71
			}
89
		}
72
		}
90
	}
73
	}
91
}
Line 74... Line -...
74
 
-
 
75
	// Initialisation du gestionnaire d'erreur
-
 
76
	$GLOBALS['_GTT_']['erreur'] = new GestionnaireErreur(GTT_DEBOGAGE_CONTEXTE, GTT_DEBOGAGE_NIVEAU, GTT_DEBOGAGE_PEAR, GTT_DEBOGAGE_PEAR_CHAINE);
-
 
77
 
-
 
78
	// Connexion a la base de donnees
-
 
79
	$GLOBALS['db'] = DB::connect(GTT_BDD_DSN);
-
 
80
	if (PEAR::isError($GLOBALS['db'])) {
-
 
81
		trigger_error("Echec connexion a la base de donnees : ".$GLOBALS['db']->getMessage(), E_USER_ERROR);
-
 
82
	}
-
 
83
 
-
 
84
	// Utilisation du mécanisme MVC avec Squelette PHP et objet
-
 
85
	$nom_module_general = 'ControlleurFrontal';
-
 
86
	$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
-
 
87
	if (file_exists($fichier_module_general)) {
-
 
88
		require_once $fichier_module_general;
-
 
89
		$Controlleur = new $nom_module_general;
-
 
90
	}
-
 
91
	echo $Controlleur->executer($action);
-
 
92
} else {
-
 
93
	include 'HTML/QuickForm.php';
-
 
94
	include_once CHEMIN_CLASSES.'gtt_authentification.php';
-
 
95
	include_once CHEMIN_PRESENTATION.'gtt_fonctions_generique_affichage.php';
-
 
96
	// Connexion a la base de donnees
-
 
97
	$GLOBALS['db'] = DB::connect($GLOBALS['dsn_v3']);
-
 
98
	if (DB::isError($GLOBALS['db'])) {
-
 
99
		$GLOBALS['db']->getMessage();
-
 
100
		echo "Echec connexion a la base de donnees";
-
 
101
	}
-
 
102
 
-
 
103
	// Création de l'objet auth
-
 
104
	$params = array('dsn'=>$GLOBALS['dsn_v3'],
-
 
105
					'table'=>GEST_UTILISATEUR,
-
 
106
					'usernamecol'=>GEST_CHAMPS_EMAIL,
-
 
107
					'passwordcol'=>GEST_CHAMPS_PASSWORD,
-
 
108
					'cryptype'=>'md5',
-
 
109
					'db_fields'=>'*');
-
 
110
	$a = new Auth('DB', $params, 'afficherMenuConnexion', true);
-
 
111
	$a->setSessionname('temps_travail');
-
 
112
	$a->setExpire(3600*24*30);
-
 
113
	$a->start();
-
 
114
	echo $a->getStatus();
-
 
115
	if ($a->getAuth()) {
-
 
116
		// Récuperation de l'identifiant de la personne
-
 
117
		$mail = $a->getUserName();
-
 
118
		$utilisateur = Utilisateur::recupIDUtilisateurMail($mail);
-
 
119
		$GLOBALS['idCurrentUser'] = $utilisateur;
-
 
120
 
-
 
121
		// Utilisation de l'ancien mécanisme
-
 
122
		switch ($action) {
-
 
123
			// Cas affichage menu travail 1
-
 
124
			case GESTION_TRAVAIL :
-
 
125
				include_once CHEMIN_MENU.'gtt_menu_travail.php';
-
 
126
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
-
 
127
	       		if (!isset($semaine)) {
-
 
128
					$semaine = date('W',mktime(0, 0, 0, date('m'), date('d') ,date('Y')));
-
 
129
				}
-
 
130
		 		if (!isset($annee)) {
-
 
131
					$annee = date('Y');
-
 
132
				}
-
 
133
	        	$text = traiterAdminTravail($_SERVER['PHP_SELF'], $semaine, $annee, $utilisateur);
-
 
134
				break;
-
 
135
 
-
 
136
			// Cas affichage du menu ajout autilisateurss 13
-
 
137
			case GESTION_ADMIN_UTILISATEUR :
-
 
138
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
-
 
139
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
-
 
140
				$text = traiterAdminUtilisateur('',0);
-
 
141
				break;
-
 
142
 
-
 
143
			// Cas editer des utilisateurs 14
-
 
144
			case GESTION_EDITER_UTILISATEUR :
-
 
145
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
-
 
146
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
-
 
147
				$text = traiterAdminUtilisateur(renvoyerDonneesUser(),1);
-
 
148
				break;
-
 
149
 
-
 
150
			// Cas afficher menu administration projet 15
-
 
151
			case GESTION_ADMIN_PROJET :
-
 
152
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
-
 
153
				$text = traiterAdminProjet();
-
 
154
				break;
-
 
155
 
-
 
156
			// Cas afficher menu administration categorie 16
-
 
157
			case GESTION_ADMIN_CATEGORIE :
-
 
158
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
-
 
159
				$text = traiterAdminCategorie();
-
 
160
				break;
-
 
161
 
-
 
162
			// Cas afficher menu admin motif absence 17
-
 
163
			case GESTION_ADMIN_MOTIF_ABSENCE :
-
 
164
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
-
 
165
				$text = traiterAdminMotif();
-
 
166
				break;
-
 
167
 
-
 
168
			// Cas afficher menu admin statut 18
-
 
169
			case GESTION_ADMIN_STATUT :
-
 
170
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
-
 
171
				$text = traiterAdminStatut();
-
 
172
				break;
-
 
173
 
-
 
174
			// Cas afficher admin editer frais 19
-
 
175
			case GESTION_ADMIN_FRAIS :
-
 
176
 
-
 
177
				$text = '';
-
 
178
				break;
-
 
179
 
-
 
180
			// Cas afficher admin editer taches 20
-
 
181
			case GESTION_ADMIN_TACHE :
-
 
182
				$text = '';
-
 
183
				break;
-
 
184
 
-
 
185
			// Cas editer preferences d'un utilisateur 21
-
 
186
			case GESTION_EDITER_PREFERENCES :
-
 
187
				include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';
-
 
188
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
-
 
189
				$text = traiterEditerPreferences($GLOBALS['idCurrentUser']);
-
 
190
				break;
-
 
191
 
-
 
192
			// Cas deconnexion 22
-
 
193
			case GESTION_DECONNEXION :
-
 
194
				$a->logout();
-
 
195
				$text = afficherMenuConnexion();
-
 
196
				//$GLOBALS['db']->disconnect();
-
 
197
				break;
-
 
198
		}
-
 
199
		$text .= fermerBalisesFin();
-
 
200
		echo $text;
-
 
201
	} else {
-
 
202
		echo afficherMenuConnexion();
-
 
203
	}
-
 
204
}
92
 
205
?>
93
?>