Subversion Repositories Applications.gtt

Rev

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