| 10 |
jpm |
1 |
<?php
|
|
|
2 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
3 |
// | PHP version 5.1.1 |
|
|
|
4 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
5 |
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
6 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
7 |
// | This file is part of eFlore. |
|
|
|
8 |
// | |
|
|
|
9 |
// | Foobar is free software; you can redistribute it and/or modify |
|
|
|
10 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
11 |
// | the Free Software Foundation; either version 2 of the License, or |
|
|
|
12 |
// | (at your option) any later version. |
|
|
|
13 |
// | |
|
|
|
14 |
// | Foobar is distributed in the hope that it will be useful, |
|
|
|
15 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
16 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
17 |
// | GNU General Public License for more details. |
|
|
|
18 |
// | |
|
|
|
19 |
// | You should have received a copy of the GNU General Public License |
|
|
|
20 |
// | along with Foobar; if not, write to the Free Software |
|
|
|
21 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
22 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
23 |
// CVS : $Id$
|
|
|
24 |
/**
|
|
|
25 |
* Classe Utilisateur
|
|
|
26 |
*
|
|
|
27 |
* Description
|
|
|
28 |
*
|
|
|
29 |
*@package eFlore
|
|
|
30 |
*@subpackage modele
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@version 3
|
|
|
33 |
*@author Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
|
|
|
34 |
//Autres auteurs :
|
|
|
35 |
*@version 4
|
|
|
36 |
*@author Jean-Pascal MILCENT <jpm@clapas.org>
|
|
|
37 |
*@author aucun
|
|
|
38 |
*@copyright Tela-Botanica 2000-2006
|
|
|
39 |
*@version $Revision$ $Date$
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
*/
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* class Utilisateur : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
|
|
|
45 |
* classe métier
|
|
|
46 |
*/
|
|
|
47 |
class Utilisateur extends aGttSql {
|
|
|
48 |
/*** Constantes : */
|
|
|
49 |
const GU_ID = 'UTILISATEUR_ID';
|
|
|
50 |
const GU_ID_MAX = 'UTILISATEUR_ID_MAX';
|
|
|
51 |
const GU_MAIL = 'UTILISATEUR_MAIL';
|
|
|
52 |
|
|
|
53 |
/*** Attributs : */
|
|
|
54 |
private $id_utilisateur;
|
|
|
55 |
private $gus_id_utilisateur_statut;
|
|
|
56 |
private $nom;
|
|
|
57 |
private $prenom;
|
|
|
58 |
private $password;
|
|
|
59 |
private $email;
|
|
|
60 |
private $telephone;
|
|
|
61 |
private $adresse;
|
|
|
62 |
private $code_postal;
|
|
|
63 |
private $ville;
|
|
|
64 |
private $quota_heures_supp;
|
|
|
65 |
private $conges_payes;
|
|
|
66 |
private $temps_de_travail;
|
|
|
67 |
private $mark_admin;
|
|
|
68 |
private $mark_recapitulatif;
|
|
|
69 |
private $notes;
|
|
|
70 |
|
|
|
71 |
/*** Aggregations : */
|
|
|
72 |
|
|
|
73 |
/*** Constructeur : */
|
|
|
74 |
public function __construct($cmd = null, $parametres = null)
|
|
|
75 |
{
|
|
|
76 |
$this->dao_table_nom = 'gestion_utilisateur';
|
|
|
77 |
$this->dao_correspondance = array(
|
|
|
78 |
'gu_id_utilisateur' => 'id_utilisateur',
|
|
|
79 |
'gus_id_utilisateur_statut' => 'gus_id_utilisateur_statut',
|
|
|
80 |
'gu_nom' => 'nom',
|
|
|
81 |
'gu_prenom' => 'prenom',
|
|
|
82 |
'gu_password' => 'password',
|
|
|
83 |
'gu_email' => 'email',
|
|
|
84 |
'gu_telephone' => 'telephone',
|
|
|
85 |
'gu_adresse' => 'adresse',
|
|
|
86 |
'gu_code_postal' => 'code_postal',
|
|
|
87 |
'gu_ville' => 'ville',
|
|
|
88 |
'gu_quota_heures_supp' => 'quota_heures_supp',
|
|
|
89 |
'gu_conges_payes' => 'conges_payes',
|
|
|
90 |
'gu_temps_de_travail' => 'temps_de_travail',
|
|
|
91 |
'gu_mark_admin' => 'mark_admin',
|
|
|
92 |
'gu_mark_recapitulatif' => 'mark_recapitulatif',
|
|
|
93 |
'gu_notes' => 'notes');
|
|
|
94 |
|
|
|
95 |
// Si l'on veut remplir l'objet à la création on lance la requete correspondante
|
|
|
96 |
if (!is_null($cmd)) {
|
|
|
97 |
$this->consulter($cmd, $parametres, true);
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
/*** Accesseurs : */
|
|
|
102 |
// Id Utilisateur
|
|
|
103 |
public function getIdUtilisateur()
|
|
|
104 |
{
|
|
|
105 |
return $this->id_utilisateur;
|
|
|
106 |
}
|
|
|
107 |
public function setIdUtilisateur( $iu )
|
|
|
108 |
{
|
|
|
109 |
$this->id_utilisateur = $iu;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
// Gus Id Utilisateur Statut
|
|
|
113 |
public function getGusIdUtilisateurStatut()
|
|
|
114 |
{
|
|
|
115 |
return $this->gus_id_utilisateur_statut;
|
|
|
116 |
}
|
|
|
117 |
public function setGusIdUtilisateurStatut( $gius )
|
|
|
118 |
{
|
|
|
119 |
$this->gus_id_utilisateur_statut = $gius;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
// Nom
|
|
|
123 |
public function getNom()
|
|
|
124 |
{
|
|
|
125 |
return $this->nom;
|
|
|
126 |
}
|
|
|
127 |
public function setNom( $n )
|
|
|
128 |
{
|
|
|
129 |
$this->nom = $n;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
// Prenom
|
|
|
133 |
public function getPrenom()
|
|
|
134 |
{
|
|
|
135 |
return $this->prenom;
|
|
|
136 |
}
|
|
|
137 |
public function setPrenom( $p )
|
|
|
138 |
{
|
|
|
139 |
$this->prenom = $p;
|
|
|
140 |
}
|
|
|
141 |
|
|
|
142 |
// Password
|
|
|
143 |
public function getPassword()
|
|
|
144 |
{
|
|
|
145 |
return $this->password;
|
|
|
146 |
}
|
|
|
147 |
public function setPassword( $p )
|
|
|
148 |
{
|
|
|
149 |
$this->password = $p;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
// Email
|
|
|
153 |
public function getEmail()
|
|
|
154 |
{
|
|
|
155 |
return $this->email;
|
|
|
156 |
}
|
|
|
157 |
public function setEmail( $e )
|
|
|
158 |
{
|
|
|
159 |
$this->email = $e;
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
// Telephone
|
|
|
163 |
public function getTelephone()
|
|
|
164 |
{
|
|
|
165 |
return $this->telephone;
|
|
|
166 |
}
|
|
|
167 |
public function setTelephone( $t )
|
|
|
168 |
{
|
|
|
169 |
$this->telephone = $t;
|
|
|
170 |
}
|
|
|
171 |
|
|
|
172 |
// Adresse
|
|
|
173 |
public function getAdresse()
|
|
|
174 |
{
|
|
|
175 |
return $this->adresse;
|
|
|
176 |
}
|
|
|
177 |
public function setAdresse( $a )
|
|
|
178 |
{
|
|
|
179 |
$this->adresse = $a;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
// Code Postal
|
|
|
183 |
public function getCodePostal()
|
|
|
184 |
{
|
|
|
185 |
return $this->code_postal;
|
|
|
186 |
}
|
|
|
187 |
public function setCodePostal( $cp )
|
|
|
188 |
{
|
|
|
189 |
$this->code_postal = $cp;
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
// Ville
|
|
|
193 |
public function getVille()
|
|
|
194 |
{
|
|
|
195 |
return $this->ville;
|
|
|
196 |
}
|
|
|
197 |
public function setVille( $v )
|
|
|
198 |
{
|
|
|
199 |
$this->ville = $v;
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
// Quota Heures Supp
|
|
|
203 |
public function getQuotaHeuresSupp()
|
|
|
204 |
{
|
|
|
205 |
return $this->quota_heures_supp;
|
|
|
206 |
}
|
|
|
207 |
public function setQuotaHeuresSupp( $qhs )
|
|
|
208 |
{
|
|
|
209 |
$this->quota_heures_supp = $qhs;
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
// Conges Payes
|
|
|
213 |
public function getCongesPayes()
|
|
|
214 |
{
|
|
|
215 |
return $this->conges_payes;
|
|
|
216 |
}
|
|
|
217 |
public function setCongesPayes( $cp )
|
|
|
218 |
{
|
|
|
219 |
$this->conges_payes = $cp;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
// Temps De Travail
|
|
|
223 |
public function getTempsDeTravail()
|
|
|
224 |
{
|
|
|
225 |
return $this->temps_de_travail;
|
|
|
226 |
}
|
|
|
227 |
public function setTempsDeTravail( $tdt )
|
|
|
228 |
{
|
|
|
229 |
$this->temps_de_travail = $tdt;
|
|
|
230 |
}
|
|
|
231 |
|
|
|
232 |
// Mark Admin
|
|
|
233 |
public function getMarkAdmin()
|
|
|
234 |
{
|
|
|
235 |
return $this->mark_admin;
|
|
|
236 |
}
|
|
|
237 |
public function setMarkAdmin( $ma )
|
|
|
238 |
{
|
|
|
239 |
$this->mark_admin = $ma;
|
|
|
240 |
}
|
|
|
241 |
|
|
|
242 |
// Mark Recapitulatif
|
|
|
243 |
public function getMarkRecapitulatif()
|
|
|
244 |
{
|
|
|
245 |
return $this->mark_recapitulatif;
|
|
|
246 |
}
|
|
|
247 |
public function setMarkRecapitulatif( $mr )
|
|
|
248 |
{
|
|
|
249 |
$this->mark_recapitulatif = $mr;
|
|
|
250 |
}
|
|
|
251 |
|
|
|
252 |
// Notes
|
|
|
253 |
public function getNotes()
|
|
|
254 |
{
|
|
|
255 |
return $this->notes;
|
|
|
256 |
}
|
|
|
257 |
public function setNotes( $n )
|
|
|
258 |
{
|
|
|
259 |
$this->notes = $n;
|
|
|
260 |
}
|
|
|
261 |
|
|
|
262 |
/*** Méthodes : */
|
|
|
263 |
|
|
|
264 |
/**
|
|
|
265 |
* Consulter la table gestion_utilisateur.
|
|
|
266 |
* @return mixed un tableau d'objets Utilisateur s'il y en a plusieurs, l'objet Utilisateur s'il y en a 1 seul sinon false.
|
|
|
267 |
*/
|
|
|
268 |
public function consulter($cmd = '', $parametres = array(), $instancier = false)
|
|
|
269 |
{
|
|
|
270 |
switch ($cmd) {
|
|
|
271 |
case Utilisateur::GU_ID:
|
|
|
272 |
$requete = 'SELECT * '.
|
|
|
273 |
'FROM gestion_utilisateur '.
|
|
|
274 |
'WHERE gu_id_utilisateur = '.$parametres[0].' ';
|
|
|
275 |
break;
|
|
|
276 |
case Utilisateur::GU_ID_MAX:
|
|
|
277 |
$requete = 'SELECT MAX(gu_id_utilisateur) '.
|
|
|
278 |
'FROM gestion_utilisateur ';
|
|
|
279 |
break;
|
|
|
280 |
case Utilisateur::GU_MAIL:
|
|
|
281 |
$requete = 'SELECT * '.
|
|
|
282 |
'FROM gestion_utilisateur '.
|
|
|
283 |
'WHERE gu_email = "'.$parametres[0].'" ';
|
|
|
284 |
break;
|
|
|
285 |
default :
|
|
|
286 |
$message = 'Commande '.$cmd.'inconnue!';
|
|
|
287 |
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
|
|
|
288 |
trigger_error($e, E_USER_ERROR);
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
$resultat = $GLOBALS['db']->query($requete);
|
|
|
292 |
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
|
|
|
293 |
$tab_resultat = array();
|
|
|
294 |
while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
295 |
$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
$resultat_nbre = count($tab_resultat);
|
|
|
299 |
if ($resultat_nbre > 1) {
|
|
|
300 |
return $tab_resultat;
|
|
|
301 |
} else if ($resultat_nbre == 1) {
|
|
|
302 |
return $tab_resultat[0];
|
|
|
303 |
} else if ($resultat_nbre == 0) {
|
|
|
304 |
return false;
|
|
|
305 |
}
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
/** Afficher l'objet Utilisateur */
|
|
|
309 |
function afficherUtilisateur()
|
|
|
310 |
{
|
|
|
311 |
echo '<pre>'.print_r($this, true).'</pre>';
|
|
|
312 |
}
|
|
|
313 |
|
|
|
314 |
/**augmenter le nombre d'heure sup
|
|
|
315 |
*un acces est fait a la bse de donnees pour enregistrer les changements en temps reel
|
|
|
316 |
*/
|
|
|
317 |
function augmenterQuotaHeuresSup($nb)
|
|
|
318 |
{
|
|
|
319 |
$this->quota_heures_sup = $this->quota_heures_sup + $nb;
|
|
|
320 |
}
|
|
|
321 |
|
|
|
322 |
/**diminuer le nb d'heures sup*/
|
|
|
323 |
public function diminuerQuotaHeuresSup($nb)
|
|
|
324 |
{
|
|
|
325 |
$this->quota_heures_sup = $this->quota_heures_sup - $nb;
|
|
|
326 |
/*un quota heure supp negatif implique qu'il y a des heures a rattraper*/
|
|
|
327 |
}
|
|
|
328 |
|
|
|
329 |
/**augmenter le nombre de jours de conges */
|
|
|
330 |
function augmenterCongesPayes($nb)
|
|
|
331 |
{
|
|
|
332 |
$this->conges_payes = $this->conges_payes + $nb;
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
/**diminuer le nombre de jour de conges */
|
|
|
336 |
function diminuerCongesPayes($nb)
|
|
|
337 |
{
|
|
|
338 |
$this->conges_payes = $this->conges_payes - $nb;
|
|
|
339 |
}
|
|
|
340 |
}
|
|
|
341 |
|
|
|
342 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
343 |
*
|
|
|
344 |
* $Log$
|
|
|
345 |
*
|
|
|
346 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
347 |
*/
|
|
|
348 |
?>
|