Subversion Repositories Applications.gtt

Rev

Rev 82 | Rev 92 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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