Subversion Repositories Applications.gtt

Rev

Rev 7 | Rev 10 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7 Rev 9
Line 40... Line 40...
40
include_once 'DB.php';
40
include_once 'DB.php';
41
include_once 'HTML/QuickForm.php';
41
include_once 'HTML/QuickForm.php';
42
include_once 'gtt_config.inc.php';
42
include_once 'gtt_config.inc.php';
43
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
43
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
44
include_once CHEMIN_CLASSES.'gtt_authentification.php';
44
include_once CHEMIN_CLASSES.'gtt_authentification.php';
45
include_once CHEMIN_FN_GENERIQUE_AFFICHAGE;
45
include_once CHEMIN_PRESENTATION.'gtt_fonctions_generique_affichage.php';
Line 46... Line 46...
46
 
46
 
47
// Création du dsn
47
// Création du dsn
48
// Connexion a la base de donnees
48
// Connexion a la base de donnees
Line 49... Line 49...
49
$GLOBALS['db'] = DB::connect($GLOBALS['dsn']);
49
$GLOBALS['db'] = DB::connect($GLOBALS['dsn']);
50
 
50
 
51
if (DB::isError($GLOBALS['db'])) {
51
if (DB::isError($GLOBALS['db'])) {
52
	$GLOBALS['db']->getMessage();
52
	$GLOBALS['db']->getMessage();
Line 53... Line 53...
53
	echo "echec connexion a la base de donnees";
53
	echo "Echec connexion a la base de donnees";
54
}
54
}
55
 
55
 
Line 71... Line 71...
71
	$mail = $a->getUserName();
71
	$mail = $a->getUserName();
72
	$utilisateur = Utilisateur::recupIDUtilisateurMail($mail);
72
	$utilisateur = Utilisateur::recupIDUtilisateurMail($mail);
73
	$GLOBALS['idCurrentUser'] = $utilisateur;
73
	$GLOBALS['idCurrentUser'] = $utilisateur;
74
	// Récuperation de l'identifiant de la personne
74
	// Récuperation de l'identifiant de la personne
75
    // Test des choix de menu a afficher
75
    // Test des choix de menu a afficher
-
 
76
    $action = 1;
76
	if (empty($action)) {
77
	if (!empty($_GET['action'])) {
77
		$action = 1 ;
78
		$action = $_GET['action'];
78
	} 
79
	}
-
 
80
	if (!preg_match('/^\d+$/', $action)) {
-
 
81
		// Utilisation du mécanisme MVC avec Squelette PHP et objet
-
 
82
		require_once GTT_CHEMIN_CLASSE.'Controlleur.class.php';
-
 
83
		require_once GTT_CHEMIN_CLASSE.'aAction.class.php';
-
 
84
		require_once GTT_CHEMIN_CLASSE.'Resultat.class.php';
-
 
85
		$module = 'Preference';
-
 
86
		if (isset($_GET['module']) && !empty($_GET['module'])) {
-
 
87
			$module = $_GET['module'];
-
 
88
		}
-
 
89
		$nom_module = 'GttControlleur'.$module;
-
 
90
		$fichier_module = GTT_CHEMIN_MODULE.$nom_module.'.class.php';
-
 
91
		$nom_module_general = 'Controlleur';
-
 
92
		$fichier_module_general = GTT_CHEMIN_CLASSE.$nom_module_general.'.class.php';
-
 
93
		if (file_exists($fichier_module)) {
-
 
94
			require_once $fichier_module;
-
 
95
			$Controlleur = new $nom_module;
-
 
96
		} else if (file_exists($fichier_module_general)) {
-
 
97
			require_once $fichier_module_general;
-
 
98
			$Controlleur = new $nom_module_general;
-
 
99
		}
-
 
100
		echo $Controlleur->executer($action);
-
 
101
	} else {
-
 
102
		// Utilisation de l'ancien mécanisme
79
	switch ($action) {
103
		switch ($action) {
80
		// Cas affichage menu travail 1
104
			// Cas affichage menu travail 1
81
		case GESTION_TRAVAIL :
105
			case GESTION_TRAVAIL :
82
			include_once CHEMIN_MENU.'gtt_menu_travail.php';
106
				include_once CHEMIN_MENU.'gtt_menu_travail.php';
83
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
107
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_travail.php';
84
       		if (!isset($semaine)) {
108
	       		if (!isset($semaine)) {
85
				$semaine = date('W',mktime(0, 0, 0, date('m'), date('d') ,date('Y')));
109
					$semaine = date('W',mktime(0, 0, 0, date('m'), date('d') ,date('Y')));
86
			}
110
				}
87
	 		if (!isset($annee)) {
111
		 		if (!isset($annee)) {
88
				$annee = date('Y');
112
					$annee = date('Y');
89
			}
113
				}
90
        	$text = traiterAdminTravail($_SERVER['PHP_SELF'], $semaine, $annee, $utilisateur);
114
	        	$text = traiterAdminTravail($_SERVER['PHP_SELF'], $semaine, $annee, $utilisateur);
91
			break;
115
				break;
92
		
116
			
93
		// Cas affichage du menu ajout autilisateurss 13
117
			// Cas affichage du menu ajout autilisateurss 13
94
		case GESTION_ADMIN_UTILISATEUR :
118
			case GESTION_ADMIN_UTILISATEUR :
95
			include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
119
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
96
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
120
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
97
			$text = traiterAdminUtilisateur('',0);
121
				$text = traiterAdminUtilisateur('',0);
98
			break;
122
				break;
99
		
123
			
100
		// Cas editer des utilisateurs 14
124
			// Cas editer des utilisateurs 14
101
		case GESTION_EDITER_UTILISATEUR :
125
			case GESTION_EDITER_UTILISATEUR :
102
			include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
126
				include_once CHEMIN_MENU.'gtt_menu_admin_utilisateur.php';
103
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
127
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_utilisateur.php';
104
			$text = traiterAdminUtilisateur(renvoyerDonneesUser(),1);
128
				$text = traiterAdminUtilisateur(renvoyerDonneesUser(),1);
105
			break;
129
				break;
106
		
130
			
107
		// Cas afficher menu administration projet 15
131
			// Cas afficher menu administration projet 15
108
		case GESTION_ADMIN_PROJET :
132
			case GESTION_ADMIN_PROJET :
109
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
133
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_projet.php';
110
			$text = traiterAdminProjet();
134
				$text = traiterAdminProjet();
111
			break;
135
				break;
112
		
136
			
113
		// Cas afficher menu administration categorie 16
137
			// Cas afficher menu administration categorie 16
114
		case GESTION_ADMIN_CATEGORIE :
138
			case GESTION_ADMIN_CATEGORIE :
115
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
139
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
116
			$text = traiterAdminCategorie();
140
				$text = traiterAdminCategorie();
117
			break;
141
				break;
118
		
142
			
119
		// Cas afficher menu admin motif absence 17 
143
			// Cas afficher menu admin motif absence 17 
120
		case GESTION_ADMIN_MOTIF_ABSENCE :
144
			case GESTION_ADMIN_MOTIF_ABSENCE :
121
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
145
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_motif_absence.php';
122
			$text = traiterAdminMotif();
146
				$text = traiterAdminMotif();
123
			break;
147
				break;
124
		
148
			
125
		// Cas afficher menu admin statut 18
149
			// Cas afficher menu admin statut 18
126
		case GESTION_ADMIN_STATUT :
150
			case GESTION_ADMIN_STATUT :
127
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
151
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_statut.php';
128
			$text = traiterAdminStatut();
152
				$text = traiterAdminStatut();
129
			break;
153
				break;
130
		
154
			
131
		// Cas afficher admin editer frais 19 
155
			// Cas afficher admin editer frais 19 
132
		case GESTION_ADMIN_FRAIS :
156
			case GESTION_ADMIN_FRAIS :
133
		
157
			
134
			$text = '';
158
				$text = '';
135
			break;
159
				break;
136
		
160
			
137
		// Cas afficher admin editer taches 20
161
			// Cas afficher admin editer taches 20
138
		case GESTION_ADMIN_TACHE :
162
			case GESTION_ADMIN_TACHE :
139
			$text = '';
163
				$text = '';
140
			break;
164
				break;
141
		
165
			
142
		// Cas editer preferences d'un utilisateur 21
166
			// Cas editer preferences d'un utilisateur 21
143
		case GESTION_EDITER_PREFERENCES :
167
			case GESTION_EDITER_PREFERENCES :
144
			include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';
168
				include_once CHEMIN_MENU.'gtt_menu_editer_preferences.php';
145
			include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
169
				include_once CHEMIN_CONTROLEUR.'gtt_controleur_editer_preferences.php';
146
			$text = traiterEditerPreferences($GLOBALS['idCurrentUser']);
170
				$text = traiterEditerPreferences($GLOBALS['idCurrentUser']);
147
			break;
171
				break;
148
		
172
			
149
		// Cas deconnexion 22
173
			// Cas deconnexion 22
150
		case GESTION_DECONNEXION :
174
			case GESTION_DECONNEXION :
151
			$a->logout();
175
				$a->logout();
152
			$text = afficherMenuConnexion();
176
				$text = afficherMenuConnexion();
153
			//$GLOBALS['db']->disconnect();
177
				//$GLOBALS['db']->disconnect();
154
			break;
178
				break;
-
 
179
		}
-
 
180
		$text .= fermerBalisesFin();
-
 
181
		echo $text;
155
	}
182
	}
156
	$text .= fermerBalisesFin();
-
 
157
	echo $text;
-
 
158
} else {
183
} else {
159
	echo afficherMenuConnexion();
184
	echo afficherMenuConnexion();
160
}
185
}
161
//tester le choix de l'utilisateur
186
//tester le choix de l'utilisateur
162
?>
187
?>
163
188