Subversion Repositories Applications.gtt

Rev

Rev 82 | 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 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';
71 jpm 50
	const GP_ID = 'PROJET_ID';
51
	const GP_NOM = 'PROJET_NOM';
11 jpm 52
	const GP_ID_MAX = 'PROJET_ID_MAX';
48 jpm 53
	const GP_ID_LIST = 'PROJET_ID_LIST';
54
	const GP_CE_CATEGORIE = 'PROJET_CE_CATEGORIE';
55
 
10 jpm 56
	/*** Attributs : */
57
	private $id_projet;
82 jpm 58
	private $ce_projet_parent;
10 jpm 59
	private $ce_categorie;
85 jpm 60
	private $nom;
10 jpm 61
	private $description;
82 jpm 62
	private $date_debut;
63
	private $date_fin;
10 jpm 64
	private $duree_prevue;
65
	private $avancement;
48 jpm 66
 
10 jpm 67
	/*** Aggregations : */
68
 
69
	/*** Constructeur : */
70
	public function __construct($cmd = null, $parametres = null)
71
	{
72
		$this->dao_table_nom = 'gestion_projet';
73
		$this->dao_correspondance = array(
74
			'gp_id_projet'	=> 'id_projet',
82 jpm 75
			'gp_ce_projet_parent'	=> 'ce_projet_parent',
10 jpm 76
			'gp_ce_categorie'	=> 'ce_categorie',
82 jpm 77
			'gp_nom'	=> 'nom',
10 jpm 78
			'gp_description'	=> 'description',
79
			'gp_date_debut'	=> 'date_debut',
82 jpm 80
			'gp_date_fin'	=> 'date_fin',
10 jpm 81
			'gp_duree_prevue'	=> 'duree_prevue',
82
			'gp_avancement'	=> 'avancement');
48 jpm 83
 
10 jpm 84
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
85
		if (!is_null($cmd)) {
86
			$this->consulter($cmd, $parametres, true);
87
		}
88
	}
48 jpm 89
 
10 jpm 90
	/*** Accesseurs : */
91
	// Id Projet
92
	public function getIdProjet()
93
	{
94
		return $this->id_projet;
95
	}
96
	public function setIdProjet( $ip )
97
	{
98
		$this->id_projet = $ip;
99
	}
82 jpm 100
 
101
	// Ce Projet Parent
102
	public function getCeProjetParent()
103
	{
104
		return $this->ce_projet_parent;
105
	}
106
	public function setCeProjetParent( $cpp )
107
	{
108
		$this->ce_projet_parent = $cpp;
109
	}
110
 
48 jpm 111
 
10 jpm 112
	// Ce Categorie
113
	public function getCeCategorie()
114
	{
115
		return $this->ce_categorie;
116
	}
117
	public function setCeCategorie( $cc )
118
	{
119
		$this->ce_categorie = $cc;
120
	}
48 jpm 121
 
82 jpm 122
	// Nom
123
	public function getNom()
10 jpm 124
	{
82 jpm 125
		return $this->nom;
10 jpm 126
	}
82 jpm 127
	public function setNom( $n )
10 jpm 128
	{
82 jpm 129
		$this->nom = $n;
10 jpm 130
	}
48 jpm 131
 
10 jpm 132
	// Description
133
	public function getDescription()
134
	{
135
		return $this->description;
136
	}
137
	public function setDescription( $d )
138
	{
139
		$this->description = $d;
140
	}
48 jpm 141
 
10 jpm 142
	// Date Debut
143
	public function getDateDebut()
144
	{
145
		return $this->date_debut;
146
	}
147
	public function setDateDebut( $dd )
148
	{
149
		$this->date_debut = $dd;
85 jpm 150
	}
151
 
152
	// Date Fin
153
	public function getDateFin()
154
	{
155
		return $this->date_fin;
156
	}
157
	public function setDateFin( $df )
158
	{
159
		$this->date_fin = $df;
10 jpm 160
	}
48 jpm 161
 
10 jpm 162
	// Duree Prevue
163
	public function getDureePrevue()
164
	{
165
		return $this->duree_prevue;
166
	}
167
	public function setDureePrevue( $dp )
168
	{
169
		$this->duree_prevue = $dp;
170
	}
48 jpm 171
 
10 jpm 172
	// Avancement
173
	public function getAvancement()
174
	{
175
		return $this->avancement;
176
	}
177
	public function setAvancement( $a )
178
	{
179
		$this->avancement = $a;
180
	}
48 jpm 181
 
10 jpm 182
	/*** Méthodes : */
183
 
184
	/**
185
	* Consulter la table gestion_projet.
186
	* @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.
187
	*/
188
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
75 jpm 189
	{
10 jpm 190
		switch ($cmd) {
191
			case Projet::GP_TOUS:
192
				$requete =	'SELECT * '.
193
							'FROM gestion_projet ';
194
				break;
195
			case Projet::GP_ID:
196
				$requete = 	'SELECT * '.
197
							'FROM gestion_projet '.
75 jpm 198
							'WHERE gp_id_projet =  #0 ';
71 jpm 199
				break;
200
			case Projet::GP_NOM:
201
				$requete =	'SELECT * '.
202
							'FROM gestion_projet '.
85 jpm 203
							'WHERE gp_nom = "#0" ';
10 jpm 204
				break;
205
			case Projet::GP_ID_MAX:
71 jpm 206
				$requete =	'SELECT MAX(gp_id_projet) AS gp_id_projet '.
207
							'FROM gestion_projet ';
11 jpm 208
				break;
209
			case Projet::GP_ID_LIST:
210
				$requete =	'SELECT * '.
211
							'FROM gestion_projet '.
75 jpm 212
							'WHERE gp_id_projet IN (#0) ';
48 jpm 213
				break;
214
			case Projet::GP_CE_CATEGORIE:
215
				$requete =	'SELECT * '.
216
							'FROM gestion_projet '.
75 jpm 217
							'WHERE gp_ce_categorie = #0 ';
10 jpm 218
				break;
219
			default :
220
				$message = 'Commande '.$cmd.'inconnue!';
221
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
222
    			trigger_error($e, E_USER_ERROR);
223
		}
75 jpm 224
		return parent::consulter($requete, $parametres, $instancier);
10 jpm 225
	}
48 jpm 226
 
10 jpm 227
	/** Afficher l'objet Projet */
228
	function afficherProjet()
229
	{
230
		echo '<pre>'.print_r($this, true).'</pre>';
231
	}
232
}
233
 
234
/* +--Fin du code ----------------------------------------------------------------------------------------+
235
*
236
* $Log$
237
*
238
* +-- Fin du code ----------------------------------------------------------------------------------------+
239
*/
240
?>