Subversion Repositories Applications.gtt

Rev

Rev 75 | Rev 85 | 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;
60
	private $nom_projet;
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;
150
	}
48 jpm 151
 
10 jpm 152
	// Duree Prevue
153
	public function getDureePrevue()
154
	{
155
		return $this->duree_prevue;
156
	}
157
	public function setDureePrevue( $dp )
158
	{
159
		$this->duree_prevue = $dp;
160
	}
48 jpm 161
 
10 jpm 162
	// Avancement
163
	public function getAvancement()
164
	{
165
		return $this->avancement;
166
	}
167
	public function setAvancement( $a )
168
	{
169
		$this->avancement = $a;
170
	}
48 jpm 171
 
10 jpm 172
	/*** Méthodes : */
173
 
174
	/**
175
	* Consulter la table gestion_projet.
176
	* @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.
177
	*/
178
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
75 jpm 179
	{
10 jpm 180
		switch ($cmd) {
181
			case Projet::GP_TOUS:
182
				$requete =	'SELECT * '.
183
							'FROM gestion_projet ';
184
				break;
185
			case Projet::GP_ID:
186
				$requete = 	'SELECT * '.
187
							'FROM gestion_projet '.
75 jpm 188
							'WHERE gp_id_projet =  #0 ';
71 jpm 189
				break;
190
			case Projet::GP_NOM:
191
				$requete =	'SELECT * '.
192
							'FROM gestion_projet '.
75 jpm 193
							'WHERE gp_nom_projet = "#0" ';
10 jpm 194
				break;
195
			case Projet::GP_ID_MAX:
71 jpm 196
				$requete =	'SELECT MAX(gp_id_projet) AS gp_id_projet '.
197
							'FROM gestion_projet ';
11 jpm 198
				break;
199
			case Projet::GP_ID_LIST:
200
				$requete =	'SELECT * '.
201
							'FROM gestion_projet '.
75 jpm 202
							'WHERE gp_id_projet IN (#0) ';
48 jpm 203
				break;
204
			case Projet::GP_CE_CATEGORIE:
205
				$requete =	'SELECT * '.
206
							'FROM gestion_projet '.
75 jpm 207
							'WHERE gp_ce_categorie = #0 ';
10 jpm 208
				break;
209
			default :
210
				$message = 'Commande '.$cmd.'inconnue!';
211
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
212
    			trigger_error($e, E_USER_ERROR);
213
		}
75 jpm 214
		return parent::consulter($requete, $parametres, $instancier);
10 jpm 215
	}
48 jpm 216
 
10 jpm 217
	/** Afficher l'objet Projet */
218
	function afficherProjet()
219
	{
220
		echo '<pre>'.print_r($this, true).'</pre>';
221
	}
222
}
223
 
224
/* +--Fin du code ----------------------------------------------------------------------------------------+
225
*
226
* $Log$
227
*
228
* +-- Fin du code ----------------------------------------------------------------------------------------+
229
*/
230
?>