Subversion Repositories Applications.gtt

Rev

Rev 11 | Go to most recent revision | Details | 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 Projet
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 Projet : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
46
*/
47
class Projet extends aGttSql {
48
	/*** Constantes : */
49
	const GP_TOUS = 'PROJET_TOUS';
50
	const GP_ID = 'PROJET_ID';
51
	const GP_ID_MAX = 'PROJET_ID_MAX';
52
 
53
	/*** Attributs : */
54
	private $id_projet;
55
	private $ce_categorie;
56
	private $nom_projet;
57
	private $description;
58
	private $date_debut;
59
	private $duree_prevue;
60
	private $avancement;
61
 
62
	/*** Aggregations : */
63
 
64
	/*** Constructeur : */
65
	public function __construct($cmd = null, $parametres = null)
66
	{
67
		$this->dao_table_nom = 'gestion_projet';
68
		$this->dao_correspondance = array(
69
			'gp_id_projet'	=> 'id_projet',
70
			'gp_ce_categorie'	=> 'ce_categorie',
71
			'gp_nom_projet'	=> 'nom_projet',
72
			'gp_description'	=> 'description',
73
			'gp_date_debut'	=> 'date_debut',
74
			'gp_duree_prevue'	=> 'duree_prevue',
75
			'gp_avancement'	=> 'avancement');
76
 
77
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
78
		if (!is_null($cmd)) {
79
			$this->consulter($cmd, $parametres, true);
80
		}
81
	}
82
 
83
	/*** Accesseurs : */
84
	// Id Projet
85
	public function getIdProjet()
86
	{
87
		return $this->id_projet;
88
	}
89
	public function setIdProjet( $ip )
90
	{
91
		$this->id_projet = $ip;
92
	}
93
 
94
	// Ce Categorie
95
	public function getCeCategorie()
96
	{
97
		return $this->ce_categorie;
98
	}
99
	public function setCeCategorie( $cc )
100
	{
101
		$this->ce_categorie = $cc;
102
	}
103
 
104
	// Nom Projet
105
	public function getNomProjet()
106
	{
107
		return $this->nom_projet;
108
	}
109
	public function setNomProjet( $np )
110
	{
111
		$this->nom_projet = $np;
112
	}
113
 
114
	// Description
115
	public function getDescription()
116
	{
117
		return $this->description;
118
	}
119
	public function setDescription( $d )
120
	{
121
		$this->description = $d;
122
	}
123
 
124
	// Date Debut
125
	public function getDateDebut()
126
	{
127
		return $this->date_debut;
128
	}
129
	public function setDateDebut( $dd )
130
	{
131
		$this->date_debut = $dd;
132
	}
133
 
134
	// Duree Prevue
135
	public function getDureePrevue()
136
	{
137
		return $this->duree_prevue;
138
	}
139
	public function setDureePrevue( $dp )
140
	{
141
		$this->duree_prevue = $dp;
142
	}
143
 
144
	// Avancement
145
	public function getAvancement()
146
	{
147
		return $this->avancement;
148
	}
149
	public function setAvancement( $a )
150
	{
151
		$this->avancement = $a;
152
	}
153
 
154
	/*** Méthodes : */
155
 
156
	/**
157
	* Consulter la table gestion_projet.
158
	* @return mixed un tableau d'objets Projet s'il y en a plusieurs, l'objet Projet s'il y en a 1 seul sinon false.
159
	*/
160
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
161
	{
162
		if (!is_array($parametres)) {
163
			$parametres[0] = $parametres;
164
		}
165
		switch ($cmd) {
166
			case Projet::GP_TOUS:
167
				$requete =	'SELECT * '.
168
							'FROM gestion_projet ';
169
				break;
170
			case Projet::GP_ID:
171
				$requete = 	'SELECT * '.
172
							'FROM gestion_projet '.
173
							'WHERE gp_id_projet = '.$parametres[0].' ';
174
				break;
175
			case Projet::GP_ID_MAX:
176
				$requete =	'SELECT MAX(gp_id_projet) '.
177
							'FROM gestion_projet ';
178
				break;
179
			default :
180
				$message = 'Commande '.$cmd.'inconnue!';
181
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
182
    			trigger_error($e, E_USER_ERROR);
183
		}
184
 
185
		$resultat = $GLOBALS['db']->query($requete);
186
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
187
		$tab_resultat = array();
188
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
189
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
190
		}
191
 
192
		$resultat_nbre = count($tab_resultat);
193
		if ($resultat_nbre > 1) {
194
			return $tab_resultat;
195
		} else if ($resultat_nbre == 1) {
196
			return $tab_resultat[0];
197
		} else if ($resultat_nbre == 0) {
198
			return false;
199
		}
200
	}
201
 
202
	/** Afficher l'objet Projet */
203
	function afficherProjet()
204
	{
205
		echo '<pre>'.print_r($this, true).'</pre>';
206
	}
207
}
208
 
209
/* +--Fin du code ----------------------------------------------------------------------------------------+
210
*
211
* $Log$
212
*
213
* +-- Fin du code ----------------------------------------------------------------------------------------+
214
*/
215
?>