Subversion Repositories Applications.gtt

Rev

Rev 64 | Rev 92 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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 UtilisateurStatut
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 UtilisateurStatut : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
46
*/
47
class UtilisateurStatut extends aGttSql {
48
	/*** Constantes : */
48 jpm 49
	const GUS_TOUS = 'UTILISATEURSTATUT_TOUS';
10 jpm 50
	const GUS_ID = 'UTILISATEURSTATUT_ID';
51
	const GUS_ID_MAX = 'UTILISATEURSTATUT_ID_MAX';
48 jpm 52
	const GUS_LIBELLE = 'UTILISATEURSTATUT_LIBELLE';
53
 
10 jpm 54
	/*** Attributs : */
55
	private $id_utilisateur_statut;
82 jpm 56
	private $libelle;
57
	private $mark_recapitulatif;
48 jpm 58
 
10 jpm 59
	/*** Aggregations : */
60
 
61
	/*** Constructeur : */
62
	public function __construct($cmd = null, $parametres = null)
63
	{
64
		$this->dao_table_nom = 'gestion_utilisateur_statut';
65
		$this->dao_correspondance = array(
66
			'gus_id_utilisateur_statut'	=> 'id_utilisateur_statut',
82 jpm 67
			'gus_libelle'	=> 'libelle',
68
			'gus_mark_recapitulatif'	=> 'mark_recapitulatif');
48 jpm 69
 
10 jpm 70
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
71
		if (!is_null($cmd)) {
72
			$this->consulter($cmd, $parametres, true);
73
		}
74
	}
48 jpm 75
 
10 jpm 76
	/*** Accesseurs : */
77
	// Id Utilisateur Statut
78
	public function getIdUtilisateurStatut()
79
	{
80
		return $this->id_utilisateur_statut;
81
	}
82
	public function setIdUtilisateurStatut( $ius )
83
	{
84
		$this->id_utilisateur_statut = $ius;
85
	}
48 jpm 86
 
10 jpm 87
	// Libelle
88
	public function getLibelle()
89
	{
90
		return $this->libelle;
91
	}
92
	public function setLibelle( $l )
93
	{
94
		$this->libelle = $l;
95
	}
82 jpm 96
 
97
	// Mark Recapitulatif
98
	public function getMarkRecapitulatif()
99
	{
100
		return $this->mark_recapitulatif;
101
	}
102
	public function setMarkRecapitulatif( $mr )
103
	{
104
		$this->mark_recapitulatif = $mr;
105
	}
48 jpm 106
 
10 jpm 107
	/*** Méthodes : */
108
 
109
	/**
110
	* Consulter la table gestion_utilisateur_statut.
111
	* @return mixed un tableau d'objets UtilisateurStatut s'il y en a plusieurs, l'objet UtilisateurStatut s'il y en a 1 seul sinon false.
112
	*/
113
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
114
	{
48 jpm 115
		if (!is_array($parametres)) {
116
			$parametres[0] = $parametres;
117
		}
10 jpm 118
		switch ($cmd) {
48 jpm 119
			case UtilisateurStatut::GUS_TOUS:
120
				$requete = 	'SELECT * '.
121
							'FROM gestion_utilisateur_statut ';
122
				break;
10 jpm 123
			case UtilisateurStatut::GUS_ID:
124
				$requete = 	'SELECT * '.
125
							'FROM gestion_utilisateur_statut '.
126
							'WHERE gus_id_utilisateur_statut = '.$parametres[0].' ';
127
				break;
128
			case UtilisateurStatut::GUS_ID_MAX:
48 jpm 129
				$requete =	'SELECT MAX(gus_id_utilisateur_statut) AS gus_id_utilisateur_statut '.
10 jpm 130
							'FROM gestion_utilisateur_statut ';
48 jpm 131
				break;
132
			case UtilisateurStatut::GUS_LIBELLE:
133
				$requete =	'SELECT * '.
134
							'FROM gestion_utilisateur_statut '.
135
							'WHERE gus_libelle = "'.$parametres[0].'" ';
10 jpm 136
				break;
137
			default :
138
				$message = 'Commande '.$cmd.'inconnue!';
139
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
140
    			trigger_error($e, E_USER_ERROR);
141
		}
48 jpm 142
 
10 jpm 143
		$resultat = $GLOBALS['db']->query($requete);
144
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
145
		$tab_resultat = array();
146
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
147
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
148
		}
48 jpm 149
 
150
		$resultat_nbre = count($tab_resultat);
10 jpm 151
		if ($resultat_nbre > 1) {
152
			return $tab_resultat;
153
		} else if ($resultat_nbre == 1) {
154
			return $tab_resultat[0];
155
		} else if ($resultat_nbre == 0) {
156
			return false;
157
		}
158
	}
48 jpm 159
 
10 jpm 160
	/** Afficher l'objet UtilisateurStatut */
161
	function afficherUtilisateurStatut()
162
	{
163
		echo '<pre>'.print_r($this, true).'</pre>';
164
	}
165
}
166
 
167
/* +--Fin du code ----------------------------------------------------------------------------------------+
168
*
169
* $Log$
170
*
171
* +-- Fin du code ----------------------------------------------------------------------------------------+
172
*/
173
?>