Subversion Repositories Applications.gtt

Rev

Rev 141 | Rev 177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 141 Rev 170
Line 1... Line 1...
1
<?php
1
<?php
2
// +------------------------------------------------------------------------------------------------------+
2
// +------------------------------------------------------------------------------------------------------+
3
// | PHP version 5.1.1                                                                                    |
3
// | PHP version 5.1.1                                                                                    |
4
// +------------------------------------------------------------------------------------------------------+
4
// +------------------------------------------------------------------------------------------------------+
5
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
5
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// +------------------------------------------------------------------------------------------------------+
6
// +------------------------------------------------------------------------------------------------------+
7
// | This file is part of eFlore.                                                                         |
7
// | This file is part of eFlore.                                                                         |
8
// |                                                                                                      |
8
// |                                                                                                      |
9
// | Foobar is free software; you can redistribute it and/or modify                                       |
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                                 |
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                                    |
11
// | the Free Software Foundation; either version 2 of the License, or                                    |
12
// | (at your option) any later version.                                                                  |
12
// | (at your option) any later version.                                                                  |
13
// |                                                                                                      |
13
// |                                                                                                      |
14
// | Foobar is distributed in the hope that it will be useful,                                            |
14
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
16
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | GNU General Public License for more details.                                                         |
17
// | GNU General Public License for more details.                                                         |
18
// |                                                                                                      |
18
// |                                                                                                      |
19
// | You should have received a copy of the GNU General Public License                                    |
19
// | You should have received a copy of the GNU General Public License                                    |
20
// | along with Foobar; if not, write to the Free Software                                                |
20
// | along with Foobar; if not, write to the Free Software                                                |
21
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// +------------------------------------------------------------------------------------------------------+
22
// +------------------------------------------------------------------------------------------------------+
23
// CVS : $Id$
23
// CVS : $Id$
24
/**
24
/**
25
* Classe Projet
25
* Classe Projet
26
*
26
*
27
* Description
27
* Description
28
*
28
*
29
*@package eFlore
29
*@package eFlore
30
*@subpackage modele
30
*@subpackage modele
31
//Auteur original :
31
//Auteur original :
32
*@version 3
32
*@version 3
33
*@author        Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
33
*@author        Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@version 4
35
*@version 4
36
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
36
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
37
*@author        aucun
37
*@author        aucun
38
*@copyright     Tela-Botanica 2000-2006
38
*@copyright     Tela-Botanica 2000-2006
39
*@version       $Revision$ $Date$
39
*@version       $Revision$ $Date$
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
*/
41
*/
42
 
42
 
43
/**
43
/**
44
* class Projet : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
44
* class Projet : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
45
* classe métier
46
*/
46
*/
47
class Projet extends aGttSql {
47
class Projet extends aGttSql {
48
	/*** Constantes : */
48
	/*** Constantes : */
49
	const GP_TOUS = 'PROJET_TOUS';
49
	const GP_TOUS = 'PROJET_TOUS';
50
	const GP_ID = 'PROJET_ID';
50
	const GP_ID = 'PROJET_ID';
51
	const GP_NOM = 'PROJET_NOM';
51
	const GP_NOM = 'PROJET_NOM';
52
	const GP_ID_MAX = 'PROJET_ID_MAX';
52
	const GP_ID_MAX = 'PROJET_ID_MAX';
53
	const GP_ID_LIST = 'PROJET_ID_LIST';
53
	const GP_ID_LIST = 'PROJET_ID_LIST';
54
	const GP_CE_CATEGORIE = 'PROJET_CE_CATEGORIE';
54
	const GP_CE_CATEGORIE = 'PROJET_CE_CATEGORIE';
55
 
55
 
56
	/*** Attributs : */
56
	/*** Attributs : */
57
	private $id_projet;
57
	private $id_projet;
58
	private $ce_projet_parent;
58
	private $ce_projet_parent;
59
	private $ce_categorie;
59
	private $ce_categorie;
60
	private $nom;
60
	private $nom;
61
	private $description;
61
	private $description;
62
	private $date_debut;
62
	private $date_debut;
63
	private $date_fin;
63
	private $date_fin;
64
	private $duree_prevue;
64
	private $duree_prevue;
65
	private $duree_finance;
65
	private $duree_finance;
66
	private $avancement;
66
	private $avancement;
67
 
67
 
68
	/*** Aggregations : */
68
	/*** Aggregations : */
69
 
69
 
70
	/*** Constructeur : */
70
	/*** Constructeur : */
71
	public function __construct($cmd = null, $parametres = null)
71
	public function __construct($cmd = null, $parametres = null)
72
	{
72
	{
73
		$this->dao_table_nom = 'gestion_projet';
73
		$this->dao_table_nom = GTT_BDD_PREFIXE . 'gestion_projet';
74
		$this->dao_correspondance = array(
74
		$this->dao_correspondance = array(
75
			'gp_id_projet'	=> 'id_projet',
75
			'gp_id_projet'	=> 'id_projet',
76
			'gp_ce_projet_parent'	=> 'ce_projet_parent',
76
			'gp_ce_projet_parent'	=> 'ce_projet_parent',
77
			'gp_ce_categorie'	=> 'ce_categorie',
77
			'gp_ce_categorie'	=> 'ce_categorie',
78
			'gp_nom'	=> 'nom',
78
			'gp_nom'	=> 'nom',
79
			'gp_description'	=> 'description',
79
			'gp_description'	=> 'description',
80
			'gp_date_debut'	=> 'date_debut',
80
			'gp_date_debut'	=> 'date_debut',
81
			'gp_date_fin'	=> 'date_fin',
81
			'gp_date_fin'	=> 'date_fin',
82
			'gp_duree_prevue'	=> 'duree_prevue',
82
			'gp_duree_prevue'	=> 'duree_prevue',
83
			'gp_duree_finance'	=> 'duree_finance',
83
			'gp_duree_finance'	=> 'duree_finance',
84
			'gp_avancement'	=> 'avancement');
84
			'gp_avancement'	=> 'avancement');
85
 
85
 
86
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
86
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
87
		if (!is_null($cmd)) {
87
		if (!is_null($cmd)) {
88
			$this->consulter($cmd, $parametres, true);
88
			$this->consulter($cmd, $parametres, true);
89
		}
89
		}
90
	}
90
	}
91
 
91
 
92
	/*** Accesseurs : */
92
	/*** Accesseurs : */
93
	// Id Projet
93
	// Id Projet
94
	public function getIdProjet()
94
	public function getIdProjet()
95
	{
95
	{
96
		return $this->id_projet;
96
		return $this->id_projet;
97
	}
97
	}
98
	public function setIdProjet( $ip )
98
	public function setIdProjet( $ip )
99
	{
99
	{
100
		$this->id_projet = $ip;
100
		$this->id_projet = $ip;
101
	}
101
	}
Line 102... Line 102...
102
 
102
 
103
	// Ce Projet Parent
103
	// Ce Projet Parent
104
	public function getCeProjetParent()
104
	public function getCeProjetParent()
105
	{
105
	{
Line 108... Line 108...
108
	public function setCeProjetParent( $cpp )
108
	public function setCeProjetParent( $cpp )
109
	{
109
	{
110
		$this->ce_projet_parent = $cpp;
110
		$this->ce_projet_parent = $cpp;
111
	}
111
	}
Line 112... Line 112...
112
 
112
 
113
 
113
 
114
	// Ce Categorie
114
	// Ce Categorie
115
	public function getCeCategorie()
115
	public function getCeCategorie()
116
	{
116
	{
117
		return $this->ce_categorie;
117
		return $this->ce_categorie;
118
	}
118
	}
119
	public function setCeCategorie( $cc )
119
	public function setCeCategorie( $cc )
120
	{
120
	{
121
		$this->ce_categorie = $cc;
121
		$this->ce_categorie = $cc;
122
	}
122
	}
123
 
123
 
124
	// Nom
124
	// Nom
125
	public function getNom()
125
	public function getNom()
126
	{
126
	{
127
		return $this->nom;
127
		return $this->nom;
128
	}
128
	}
129
	public function setNom( $n )
129
	public function setNom( $n )
130
	{
130
	{
131
		$this->nom = $n;
131
		$this->nom = $n;
132
	}
132
	}
133
 
133
 
134
	// Description
134
	// Description
135
	public function getDescription()
135
	public function getDescription()
136
	{
136
	{
137
		return $this->description;
137
		return $this->description;
138
	}
138
	}
139
	public function setDescription( $d )
139
	public function setDescription( $d )
140
	{
140
	{
141
		$this->description = $d;
141
		$this->description = $d;
142
	}
142
	}
143
 
143
 
144
	// Date Debut
144
	// Date Debut
145
	public function getDateDebut()
145
	public function getDateDebut()
146
	{
146
	{
147
		return $this->date_debut;
147
		return $this->date_debut;
148
	}
148
	}
149
	public function setDateDebut( $dd )
149
	public function setDateDebut( $dd )
150
	{
150
	{
151
		$this->date_debut = $dd;
151
		$this->date_debut = $dd;
Line 152... Line 152...
152
	}
152
	}
153
	
153
	
154
	// Date Fin
154
	// Date Fin
155
	public function getDateFin()
155
	public function getDateFin()
156
	{
156
	{
157
		return $this->date_fin;
157
		return $this->date_fin;
158
	}
158
	}
159
	public function setDateFin( $df )
159
	public function setDateFin( $df )
160
	{
160
	{
161
		$this->date_fin = $df;
161
		$this->date_fin = $df;
162
	}
162
	}
163
 
163
 
164
	// Duree Prevue
164
	// Duree Prevue
165
	public function getDureePrevue()
165
	public function getDureePrevue()
166
	{
166
	{
167
		return $this->duree_prevue;
167
		return $this->duree_prevue;
168
	}
168
	}
169
	public function setDureePrevue( $dp )
169
	public function setDureePrevue( $dp )
170
	{
170
	{
Line 171... Line 171...
171
		$this->duree_prevue = $dp;
171
		$this->duree_prevue = $dp;
172
	}
172
	}
173
 
173
 
174
	// Duree Finance
174
	// Duree Finance
175
	public function getDureeFinance()
175
	public function getDureeFinance()
176
	{
176
	{
177
		return $this->duree_finance;
177
		return $this->duree_finance;
178
	}
178
	}
179
	public function setDureeFinance( $df )
179
	public function setDureeFinance( $df )
180
	{
180
	{
181
		$this->duree_finance = $df;
181
		$this->duree_finance = $df;
182
	}
182
	}
183
 
183
 
184
	// Avancement
184
	// Avancement
185
	public function getAvancement()
185
	public function getAvancement()
186
	{
186
	{
187
		return $this->avancement;
187
		return $this->avancement;
188
	}
188
	}
189
	public function setAvancement( $a )
189
	public function setAvancement( $a )
190
	{
190
	{
191
		$this->avancement = $a;
191
		$this->avancement = $a;
192
	}
192
	}
193
 
193
 
194
	/*** Méthodes : */
194
	/*** Méthodes : */
195
 
195
 
196
	/**
196
	/**
197
	* Consulter la table gestion_projet.
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.
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
	*/
199
	*/
200
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
200
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
201
	{
201
	{
202
		switch ($cmd) {
202
		switch ($cmd) {
203
			case Projet::GP_TOUS:
203
			case Projet::GP_TOUS:
204
				$requete =	'SELECT * '.
204
				$requete =	'SELECT * '.
205
							'FROM gestion_projet LEFT JOIN gestion_projet_categorie ON (gp_ce_categorie = gpc_id_categorie) '.
205
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet LEFT JOIN ' . GTT_BDD_PREFIXE . 'gestion_projet_categorie ON (gp_ce_categorie = gpc_id_categorie) '.
206
							'ORDER BY gpc_libelle, gp_nom ASC';
206
							'ORDER BY gpc_libelle, gp_nom ASC';
207
				break;
207
				break;
208
			case Projet::GP_ID:
208
			case Projet::GP_ID:
209
				$requete = 	'SELECT * '.
209
				$requete = 	'SELECT * '.
210
							'FROM gestion_projet '.
210
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet '.
211
							'WHERE gp_id_projet =  #0 ';
211
							'WHERE gp_id_projet =  #0 ';
212
				break;
212
				break;
213
			case Projet::GP_NOM:
213
			case Projet::GP_NOM:
214
				$requete =	'SELECT * '.
214
				$requete =	'SELECT * '.
215
							'FROM gestion_projet '.
215
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet '.
216
							'WHERE gp_nom = "#0" ';
216
							'WHERE gp_nom = "#0" ';
217
				break;
217
				break;
218
			case Projet::GP_ID_MAX:
218
			case Projet::GP_ID_MAX:
219
				$requete =	'SELECT MAX(gp_id_projet) AS gp_id_projet '.
219
				$requete =	'SELECT MAX(gp_id_projet) AS gp_id_projet '.
220
							'FROM gestion_projet ';
220
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet ';
221
				break;
221
				break;
222
			case Projet::GP_ID_LIST:
222
			case Projet::GP_ID_LIST:
223
				$requete =	'SELECT * '.
223
				$requete =	'SELECT * '.
224
							'FROM gestion_projet LEFT JOIN gestion_projet_categorie ON (gp_ce_categorie = gpc_id_categorie) '.
224
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet LEFT JOIN ' . GTT_BDD_PREFIXE . 'gestion_projet_categorie ON (gp_ce_categorie = gpc_id_categorie) '.
225
							'WHERE gp_id_projet IN (#0) '.
225
							'WHERE gp_id_projet IN (#0) '.
226
							'ORDER BY gpc_libelle, gp_nom ASC';
226
							'ORDER BY gpc_libelle, gp_nom ASC';
227
				break;
227
				break;
228
			case Projet::GP_CE_CATEGORIE:
228
			case Projet::GP_CE_CATEGORIE:
229
				$requete =	'SELECT * '.
229
				$requete =	'SELECT * '.
230
							'FROM gestion_projet '.
230
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet '.
231
							'WHERE gp_ce_categorie = #0 ';
231
							'WHERE gp_ce_categorie = #0 ';
232
				break;
232
				break;
233
			default :
233
			default :
234
				$message = 'Commande '.$cmd.'inconnue!';
234
				$message = 'Commande '.$cmd.'inconnue!';
235
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
235
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
236
    			trigger_error($e, E_USER_ERROR);
236
    			trigger_error($e, E_USER_ERROR);
237
		}
237
		}
238
		return parent::consulter($requete, $parametres, $instancier);
238
		return parent::consulter($requete, $parametres, $instancier);
239
	}
239
	}
240
}
240
}
241
 
241
 
242
/* +--Fin du code ----------------------------------------------------------------------------------------+
242
/* +--Fin du code ----------------------------------------------------------------------------------------+
243
*
243
*
244
* $Log$
244
* $Log$
245
*
245
*
246
* +-- Fin du code ----------------------------------------------------------------------------------------+
246
* +-- Fin du code ----------------------------------------------------------------------------------------+