Subversion Repositories Applications.framework

Rev

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

Rev 128 Rev 233
Line 9... Line 9...
9
 * @category  Class
9
 * @category  Class
10
 * @author	aurelien <aurelien@tela-botanica.org>
10
 * @author	aurelien <aurelien@tela-botanica.org>
11
 * @copyright 2009 Tela-Botanica
11
 * @copyright 2009 Tela-Botanica
12
 * @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
13
 * @license   http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @license   http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
14
 * @version   SVN: $$Id: AdminAdministrateur.php 128 2009-09-02 12:20:55Z aurelien $$
14
 * @version   SVN: $$Id: AdminAdministrateur.php 233 2010-11-19 17:14:01Z jpm $$
15
 * @link	  /doc/framework/
15
 * @link	  /doc/framework/
16
 *
16
 *
17
 */
17
 */
18
class AdminAdministrateur extends Controleur {
18
class AdminAdministrateur extends Controleur {
Line 29... Line 29...
29
	 * @param array un tableau contenant les erreurs à afficher s'il y en a
29
	 * @param array un tableau contenant les erreurs à afficher s'il y en a
30
	 * @return string la vue correspondante
30
	 * @return string la vue correspondante
31
	 */
31
	 */
32
	public function chargerAdmin($erreurs = array()) {
32
	public function chargerAdmin($erreurs = array()) {
33
		$this->chargerModele('ListeAdmin');
33
		$this->chargerModele('ListeAdmin');
-
 
34
		$data['url'] = new Url(Config::get('url_base'));
34
		$data['erreurs'] = $erreurs;
35
		$data['erreurs'] = $erreurs;
35
		$data['admin'] = $this->ListeAdmin->chargerAdmin();
36
		$data['admin'] = $this->ListeAdmin->chargerAdmin();
36
		$this->chargerVue('liste_admin', $data);
37
		$html = $this->getVue('liste_admin', $data);
Line 37... Line 38...
37
 
38
 
38
		return $this->liste_admin;
39
		return $html;
Line 39... Line 40...
39
	}
40
	}
40
 
41
 
41
	/**
42
	/**
Line 45... Line 46...
45
	 * @return string la vue correspondante
46
	 * @return string la vue correspondante
46
	 */
47
	 */
47
	public function modifAdmin($id) {
48
	public function modifAdmin($id) {
48
		$this->chargerModele('ListeAdmin');
49
		$this->chargerModele('ListeAdmin');
49
		$data['admin'] = $this->ListeAdmin->loadDetailsAdmin($id);
50
		$data['admin'] = $this->ListeAdmin->loadDetailsAdmin($id);
50
		$this->chargerVue('modif_admin',$data);
51
		$html = $this->getVue('modif_admin',$data);
Line 51... Line 52...
51
 
52
 
52
		return $this->modif_admin;
53
		return $html;
Line 53... Line 54...
53
	}
54
	}
54
 
55
 
55
	/**
56
	/**
Line 63... Line 64...
63
	 * @param string le mail
64
	 * @param string le mail
64
	 * @param string le mot de passe
65
	 * @param string le mot de passe
65
	 * @param string la confirmation du mot de passe
66
	 * @param string la confirmation du mot de passe
66
	 * @return string la vue correspondante
67
	 * @return string la vue correspondante
67
	 */
68
	 */
68
	public function modifAdminVa($id,$nom,$prenom,$mail,$lang,$pass,$pass_conf) {
69
	public function modifAdminVa($id, $nom, $prenom, $mail, $lang, $pass, $pass_conf) {
69
		$this->chargerModele('ListeAdmin') ;
70
		$this->chargerModele('ListeAdmin') ;
70
		$res = $this->ListeAdmin->modifDetailsAdmin($id,$nom,$prenom,$mail,$lang,$pass,$pass_conf);
71
		$res = $this->ListeAdmin->modifDetailsAdmin($id, $nom, $prenom, $mail, $lang, $pass, $pass_conf);
Line 71... Line 72...
71
 
72
 
72
		if (count($res) == 0) {
73
		if (count($res) == 0) {
73
			return $this->chargerAdmin();
74
			return $this->chargerAdmin();
74
		} else {
75
		} else {
Line 77... Line 78...
77
			$admin['ga_prenom'] = $prenom;
78
			$admin['ga_prenom'] = $prenom;
78
			$admin['ga_mail']  = $mail;
79
			$admin['ga_mail']  = $mail;
79
			$admin['ga_ce_i18n'] = $lang;
80
			$admin['ga_ce_i18n'] = $lang;
80
			$data['admin'] = $admin;
81
			$data['admin'] = $admin;
81
			$data['erreurs'] = $res;
82
			$data['erreurs'] = $res;
82
			$this->chargerVue('modif_admin',$data);
83
			$html = $this->getVue('modif_admin', $data);
83
 
-
 
84
			return $this->modif_admin;
84
			return $html;
85
		}
85
		}
86
	}
86
	}
Line 87... Line 87...
87
 
87
 
88
	/**
88
	/**
Line 112... Line 112...
112
		$admin['ga_nom'] = '';
112
		$admin['ga_nom'] = '';
113
		$admin['ga_prenom'] = '';
113
		$admin['ga_prenom'] = '';
114
		$admin['ga_mail']  = '';
114
		$admin['ga_mail']  = '';
115
		$admin['ga_ce_i18n'] = '';
115
		$admin['ga_ce_i18n'] = '';
116
		$data['admin'] = $admin;
116
		$data['admin'] = $admin;
-
 
117
		$data['url'] = new Url(Config::get('url_base'));
117
		$this->chargerVue('ajout_admin',$data);
118
		$html = $this->getVue('ajout_admin', $data);
Line 118... Line 119...
118
 
119
 
119
		return $this->ajout_admin;
120
		return $html;
Line 120... Line 121...
120
	}
121
	}
121
 
122
 
122
	/**
123
	/**
Line 129... Line 130...
129
	 * @param string le mail
130
	 * @param string le mail
130
	 * @param string le mot de passe
131
	 * @param string le mot de passe
131
	 * @param string la confirmation du mot de passe
132
	 * @param string la confirmation du mot de passe
132
	 * @return string la vue correspondante
133
	 * @return string la vue correspondante
133
	 */
134
	 */
134
	public function ajoutAdminVa($nom,$prenom,$mail,$lang,$pass,$pass_conf) {
135
	public function ajoutAdminVa($nom, $prenom, $mail, $lang, $pass, $pass_conf) {
135
		if (empty($nom) || empty($prenom) || empty($mail) || empty($pass) || empty($pass_conf)) {
136
		if (empty($nom) || empty($prenom) || empty($mail) || empty($pass) || empty($pass_conf)) {
136
			$res = array('champs' => 'Tous les champs sont obligatoires');
137
			$data['url'] = new Url(Config::get('url_base'));
137
			$data['erreurs'] = $res;
138
			$data['erreurs'] = array('champs' => 'Tous les champs sont obligatoires');
138
			$admin['ga_nom'] = $nom;
139
			$admin['ga_nom'] = $nom;
139
			$admin['ga_prenom'] = $prenom;
140
			$admin['ga_prenom'] = $prenom;
140
			$admin['ga_mail']  = $mail;
141
			$admin['ga_mail']  = $mail;
141
			$admin['ga_ce_i18n'] = $lang;
142
			$admin['ga_ce_i18n'] = $lang;
142
			$data['admin'] = $admin;
143
			$data['admin'] = $admin;
143
			$this->chargerVue('ajout_admin',$data);
144
			$html = $this->getVue('ajout_admin', $data);
144
 
-
 
145
			return $this->ajout_admin;
-
 
146
		}
-
 
Line 147... Line -...
147
 
-
 
148
		$this->chargerModele('ListeAdmin');
-
 
149
		$res = $this->ListeAdmin->ajoutAdmin($nom,$prenom,$mail,$lang,$pass,$pass_conf);
-
 
150
		if (count($res) == 0) {
145
 
151
			return $this->chargerAdmin();
146
			return $html;
-
 
147
		} else {
-
 
148
			$this->chargerModele('ListeAdmin');
-
 
149
			$res = $this->ListeAdmin->ajoutAdmin($nom, $prenom, $mail, $lang, $pass, $pass_conf);
-
 
150
			if (count($res) == 0) {
-
 
151
				return $this->chargerAdmin();
152
		} else {
152
			} else {
153
			$admin['ga_nom'] = $nom;
153
				$admin['ga_nom'] = $nom;
154
			$admin['ga_prenom'] = $prenom;
154
				$admin['ga_prenom'] = $prenom;
155
			$admin['ga_mail']  = $mail;
155
				$admin['ga_mail']  = $mail;
-
 
156
				$admin['ga_ce_i18n'] = $lang;
156
			$admin['ga_ce_i18n'] = $lang;
157
				$data['url'] = new Url(Config::get('url_base'));
157
			$data['admin'] = $admin;
158
				$data['admin'] = $admin;
158
			$data['erreurs'] = $res;
159
				$data['erreurs'] = $res;
159
			$this->chargerVue('ajout_admin',$data);
160
				$html = $this->getVue('ajout_admin', $data);
160
 
161
	
-
 
162
				return $html;
161
			return $this->ajout_admin;
163
			}
162
		}
164
		}
Line 163... Line 165...
163
	}
165
	}
164
 
166
 
165
	 /** Apelle le formulaire d'identification (dans le cas où l'utilisateur n'est pas identifié)
167
	 /** Apelle le formulaire d'identification (dans le cas où l'utilisateur n'est pas identifié)
166
	  * @return string la vue permettant de s'identifier
168
	  * @return string la vue permettant de s'identifier
167
	 */
169
	 */
168
	public function demanderIdent() {
170
	public function demanderIdent() {
169
		$this->chargerVue('ident_admin', null);
171
		$html = $this->getVue('ident_admin', null);
Line 170... Line 172...
170
		return $this->ident_admin;
172
		return $html;
171
	}
173
	}
172
 
174