Subversion Repositories Applications.framework

Rev

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

Rev 78 Rev 83
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
3
/**
2
/**
4
 * Classe controleur pour l'application administration des administrateurs
3
 * Classe controleur pour l'application administration des administrateurs
5
 */
4
 */
6
class AdminAdministrateur extends Controleur {
5
class AdminAdministrateur extends Controleur {
Line 7... Line 6...
7
	
6
	
8
	/**
7
	/**
9
	 * Fonction d'affichage par défaut, elle appelle la liste des administrateurs
8
	 * Fonction d'affichage par défaut, elle appelle la liste des administrateurs
10
	 */
9
	 */
11
	function index() {
-
 
12
		
10
	public function index() {
13
		$this->charger_admin();
11
		$this->charger_admin();
Line 14... Line 12...
14
	}
12
	}
15
	
13
	
16
	/**
14
	/**
17
	 * Charge la liste des administrateurs et l'envoie à la vue
15
	 * Charge la liste des administrateurs et l'envoie à la vue
18
	 * @param array un tableau contenant les erreurs à afficher s'il y en a
16
	 * @param array un tableau contenant les erreurs à afficher s'il y en a
19
	 * @return string la vue correspondante
17
	 * @return string la vue correspondante
20
	 */
-
 
21
	function chargerAdmin($erreurs = array()) {
18
	 */
22
 
19
	public function chargerAdmin($erreurs = array()) {
23
		$this->chargerModele('ListeAdmin');
20
		$this->chargerModele('ListeAdmin');
24
		$data['erreurs'] = $erreurs;
21
		$data['erreurs'] = $erreurs;
Line 32... Line 29...
32
	 * Charge les détails d'un administrateur demandé et l'envoi à la
29
	 * Charge les détails d'un administrateur demandé et l'envoi à la
33
	 * vue qui permet de les modifier
30
	 * vue qui permet de les modifier
34
	 * @id string l'id de l'administrateur à modifier
31
	 * @id string l'id de l'administrateur à modifier
35
	 * @return string la vue correspondante
32
	 * @return string la vue correspondante
36
	 */
33
	 */
37
	function modifAdmin($id) {
34
	public function modifAdmin($id) {
38
		
-
 
39
		$this->chargerModele('ListeAdmin');
35
		$this->chargerModele('ListeAdmin');
40
		$data['admin'] = $this->ListeAdmin->loadDetailsAdmin($id);
36
		$data['admin'] = $this->ListeAdmin->loadDetailsAdmin($id);
41
		$this->chargerVue('modif_admin',$data);
37
		$this->chargerVue('modif_admin',$data);
Line 42... Line 38...
42
		 
38
		 
43
		return $this->modif_admin; 
-
 
44
		
39
		return $this->modif_admin;	
Line 45... Line 40...
45
	}
40
	}
46
	
41
	
47
	/**
42
	/**
Line 55... Line 50...
55
	 * @param string le mail
50
	 * @param string le mail
56
	 * @param string le mot de passe
51
	 * @param string le mot de passe
57
	 * @param string la confirmation du mot de passe
52
	 * @param string la confirmation du mot de passe
58
	 * @return string la vue correspondante
53
	 * @return string la vue correspondante
59
	 */
54
	 */
60
	function modifAdminVa($id,$nom,$prenom,$mail,$lang,$pass,$pass_conf) {
55
	public function modifAdminVa($id,$nom,$prenom,$mail,$lang,$pass,$pass_conf) {
61
		
-
 
62
	$this->chargerModele('ListeAdmin') ;
56
		$this->chargerModele('ListeAdmin') ;
63
	$res = $this->ListeAdmin->modifDetailsAdmin($id,$nom,$prenom,$mail,$lang,$pass,$pass_conf) ;
57
		$res = $this->ListeAdmin->modifDetailsAdmin($id,$nom,$prenom,$mail,$lang,$pass,$pass_conf) ;
Line 64... Line 58...
64
	
58
	
65
		if (count($res) == 0) {
59
		if (count($res) == 0) {
66
			return $this->chargerAdmin() ;	
60
			return $this->chargerAdmin() ;	
67
		} else {
-
 
68
 
61
		} else {
69
			$admin['ga_id_administrateur'] = $id;
62
			$admin['ga_id_administrateur'] = $id;
70
			$admin['ga_nom'] = $nom;
63
			$admin['ga_nom'] = $nom;
71
			$admin['ga_prenom'] = $prenom;
64
			$admin['ga_prenom'] = $prenom;
72
			$admin['ga_mail']  = $mail; 
65
			$admin['ga_mail']  = $mail; 
Line 75... Line 68...
75
			$data['erreurs'] = $res;
68
			$data['erreurs'] = $res;
76
			$this->chargerVue('modif_admin',$data);
69
			$this->chargerVue('modif_admin',$data);
Line 77... Line 70...
77
			
70
			
78
			return $this->modif_admin; 
71
			return $this->modif_admin; 
79
		}
-
 
80
		
72
		}
Line 81... Line 73...
81
	}
73
	}
82
	
74
	
83
	/**
75
	/**
84
	 * Supprime un administrateur dans la base de données,
76
	 * Supprime un administrateur dans la base de données,
85
	 * renvoie la liste des administrateurs, en affichant des erreurs
77
	 * renvoie la liste des administrateurs, en affichant des erreurs
86
	 * s'il y en a.
78
	 * s'il y en a.
87
	 * @return string la vue contenant la liste des administrateurs
79
	 * @return string la vue contenant la liste des administrateurs
88
	 * 
80
	 * 
89
	 */
-
 
90
	function supprAdmin($id) {
81
	 */
91
		
82
	public function supprAdmin($id) {
92
		$this->chargerModele('ListeAdmin');
83
		$this->chargerModele('ListeAdmin');
93
		$res = $this->ListeAdmin->suppAdmin($id);
84
		$res = $this->ListeAdmin->suppAdmin($id);
94
		if ($res == '') { 
85
		if ($res == '') { 
Line 102... Line 93...
102
	/**
93
	/**
103
	 * Appelle la vue contenant le formulaire d'ajout d'un administrateur
94
	 * Appelle la vue contenant le formulaire d'ajout d'un administrateur
104
	 * @return string la vue contenant le formulaire d'ajout 
95
	 * @return string la vue contenant le formulaire d'ajout 
105
	 */
96
	 */
106
	function ajoutAdmin() {
97
	function ajoutAdmin() {
107
		
-
 
108
		$admin['ga_id_administrateur'] = '';
98
		$admin['ga_id_administrateur'] = '';
109
		$admin['ga_nom'] = '';
99
		$admin['ga_nom'] = '';
110
		$admin['ga_prenom'] = '';
100
		$admin['ga_prenom'] = '';
111
		$admin['ga_mail']  = ''; 
101
		$admin['ga_mail']  = ''; 
112
		$admin['ga_ce_i18n'] = '';
102
		$admin['ga_ce_i18n'] = '';
Line 126... Line 116...
126
	 * @param string le mail
116
	 * @param string le mail
127
	 * @param string le mot de passe
117
	 * @param string le mot de passe
128
	 * @param string la confirmation du mot de passe
118
	 * @param string la confirmation du mot de passe
129
	 * @return string la vue correspondante
119
	 * @return string la vue correspondante
130
	 */
120
	 */
131
	function ajoutAdminVa($nom,$prenom,$mail,$lang,$pass,$pass_conf) {
121
	public function ajoutAdminVa($nom,$prenom,$mail,$lang,$pass,$pass_conf) {
132
	
-
 
133
	if (empty($nom) || empty($prenom) || empty($mail) || empty($pass) || empty($pass_conf)) {
122
		if (empty($nom) || empty($prenom) || empty($mail) || empty($pass) || empty($pass_conf)) {
134
		$res = array('champs' => 'Tous les champs sont obligatoires') ;
123
			$res = array('champs' => 'Tous les champs sont obligatoires') ;
135
		$data['erreurs'] = $res; 
124
			$data['erreurs'] = $res; 
136
		$admin['ga_nom'] = $nom;
125
			$admin['ga_nom'] = $nom;
137
		$admin['ga_prenom'] = $prenom;
126
			$admin['ga_prenom'] = $prenom;
138
		$admin['ga_mail']  = $mail; 
127
			$admin['ga_mail']  = $mail; 
139
		$admin['ga_ce_i18n'] = $lang;
128
			$admin['ga_ce_i18n'] = $lang;
140
		$data['admin'] = $admin;
129
			$data['admin'] = $admin;
141
		$this->chargerVue('ajout_admin',$data);
130
			$this->chargerVue('ajout_admin',$data);
-
 
131
			
-
 
132
			return $this->ajout_admin;
-
 
133
		}
Line 142... Line -...
142
		
-
 
143
		return $this->ajout_admin;
-
 
144
	}
-
 
145
	
134
		
146
	$this->chargerModele('ListeAdmin');	
135
		$this->chargerModele('ListeAdmin');	
147
	$res = $this->ListeAdmin->ajoutAdmin($nom,$prenom,$mail,$lang,$pass,$pass_conf);
136
		$res = $this->ListeAdmin->ajoutAdmin($nom,$prenom,$mail,$lang,$pass,$pass_conf);
148
		if (count($res) == 0) {
137
		if (count($res) == 0) {
149
			return $this->chargerAdmin();	
138
			return $this->chargerAdmin();	
150
		} else {
-
 
151
			
139
		} else {
152
			$admin['ga_nom'] = $nom;
140
			$admin['ga_nom'] = $nom;
153
			$admin['ga_prenom'] = $prenom;
141
			$admin['ga_prenom'] = $prenom;
154
			$admin['ga_mail']  = $mail; 
142
			$admin['ga_mail']  = $mail; 
155
			$admin['ga_ce_i18n'] = $lang;
143
			$admin['ga_ce_i18n'] = $lang;
Line 162... Line 150...
162
	}
150
	}
Line 163... Line 151...
163
	
151
	
164
	 /** Apelle le formulaire d'identification (dans le cas où l'utilisateur n'est pas identifié)
152
	 /** Apelle le formulaire d'identification (dans le cas où l'utilisateur n'est pas identifié)
165
	  * @return string la vue permettant de s'identifier
153
	  * @return string la vue permettant de s'identifier
166
	 */
154
	 */
167
	function demanderIdent() {
155
	public function demanderIdent() {
168
		$this->chargerVue('ident_admin',null);
-
 
169
		
156
		$this->chargerVue('ident_admin',null);
170
		return $this->ident_admin;
157
		return $this->ident_admin;
Line 171... Line 158...
171
	}
158
	}
172
	
159
	
173
	/**
160
	/**
174
	 * Renvoie la tête de page de l'application
161
	 * Renvoie la tête de page de l'application
175
	 * @return string la tete de page de l'application
162
	 * @return string la tete de page de l'application
176
	 */
-
 
177
	function adminTete() {
163
	 */
178
		
-
 
179
		$tete = '<h1>Gestion des administrateurs de Papyrus</h1>';
164
	public function adminTete() {
180
		
165
		$tete = '<h1>Gestion des administrateurs de Papyrus</h1>';
Line 181... Line 166...
181
		return $tete;
166
		return $tete;
182
	}
167
	}
183
	
168
	
184
	/**
169
	/**
185
	 * Renvoie le pied de page de l'application
170
	 * Renvoie le pied de page de l'application
186
	 * @return string le pied de page de l'application
-
 
187
	 */
171
	 * @return string le pied de page de l'application
188
	function adminPied() {
172
	 */
189
 
173
	public function adminPied() {
190
		$pied = '';
-
 
191
		return $pied;
174
		$pied = '';
192
	}
-
 
193
	
175
		return $pied;
194
}
176
	}