Subversion Repositories Applications.gtt

Rev

Rev 64 | 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 ProjetTache
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 ProjetTache : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
46
*/
47
class ProjetTache extends aGttSql {
48
	/*** Constantes : */
49
	const GPT_ID = 'PROJETTACHE_ID';
50
	const GPT_ID_MAX = 'PROJETTACHE_ID_MAX';
71 jpm 51
	const GPT_PROJET = 'PROJETTACHE_ID_PROJET';
52
 
10 jpm 53
	/*** Attributs : */
54
	private $id_tache;
55
	private $ce_tache_precedente;
56
	private $ce_projet;
57
	private $libelle;
58
	private $description;
59
	private $date_debut;
60
	private $duree_prevue;
61
	private $avancement;
48 jpm 62
 
10 jpm 63
	/*** Aggregations : */
64
 
65
	/*** Constructeur : */
66
	public function __construct($cmd = null, $parametres = null)
67
	{
68
		$this->dao_table_nom = 'gestion_projet_tache';
69
		$this->dao_correspondance = array(
70
			'gpt_id_tache'	=> 'id_tache',
71
			'gpt_ce_tache_precedente'	=> 'ce_tache_precedente',
72
			'gpt_ce_projet'	=> 'ce_projet',
73
			'gpt_libelle'	=> 'libelle',
74
			'gpt_description'	=> 'description',
75
			'gpt_date_debut'	=> 'date_debut',
76
			'gpt_duree_prevue'	=> 'duree_prevue',
77
			'gpt_avancement'	=> 'avancement');
48 jpm 78
 
10 jpm 79
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
80
		if (!is_null($cmd)) {
81
			$this->consulter($cmd, $parametres, true);
82
		}
83
	}
48 jpm 84
 
10 jpm 85
	/*** Accesseurs : */
86
	// Id Tache
87
	public function getIdTache()
88
	{
89
		return $this->id_tache;
90
	}
91
	public function setIdTache( $it )
92
	{
93
		$this->id_tache = $it;
94
	}
48 jpm 95
 
10 jpm 96
	// Ce Tache Precedente
97
	public function getCeTachePrecedente()
98
	{
99
		return $this->ce_tache_precedente;
100
	}
101
	public function setCeTachePrecedente( $ctp )
102
	{
103
		$this->ce_tache_precedente = $ctp;
104
	}
48 jpm 105
 
10 jpm 106
	// Ce Projet
107
	public function getCeProjet()
108
	{
109
		return $this->ce_projet;
110
	}
111
	public function setCeProjet( $cp )
112
	{
113
		$this->ce_projet = $cp;
114
	}
48 jpm 115
 
10 jpm 116
	// Libelle
117
	public function getLibelle()
118
	{
119
		return $this->libelle;
120
	}
121
	public function setLibelle( $l )
122
	{
123
		$this->libelle = $l;
124
	}
48 jpm 125
 
10 jpm 126
	// Description
127
	public function getDescription()
128
	{
129
		return $this->description;
130
	}
131
	public function setDescription( $d )
132
	{
133
		$this->description = $d;
134
	}
48 jpm 135
 
10 jpm 136
	// Date Debut
137
	public function getDateDebut()
138
	{
139
		return $this->date_debut;
140
	}
141
	public function setDateDebut( $dd )
142
	{
143
		$this->date_debut = $dd;
144
	}
48 jpm 145
 
10 jpm 146
	// Duree Prevue
147
	public function getDureePrevue()
148
	{
149
		return $this->duree_prevue;
150
	}
151
	public function setDureePrevue( $dp )
152
	{
153
		$this->duree_prevue = $dp;
154
	}
48 jpm 155
 
10 jpm 156
	// Avancement
157
	public function getAvancement()
158
	{
159
		return $this->avancement;
160
	}
161
	public function setAvancement( $a )
162
	{
163
		$this->avancement = $a;
164
	}
48 jpm 165
 
10 jpm 166
	/*** Méthodes : */
167
 
168
	/**
169
	* Consulter la table gestion_projet_tache.
170
	* @return mixed un tableau d'objets ProjetTache s'il y en a plusieurs, l'objet ProjetTache s'il y en a 1 seul sinon false.
171
	*/
172
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
173
	{
48 jpm 174
		if (!is_array($parametres)) {
175
			$parametres[0] = $parametres;
176
		}
10 jpm 177
		switch ($cmd) {
178
			case ProjetTache::GPT_ID:
179
				$requete = 	'SELECT * '.
180
							'FROM gestion_projet_tache '.
181
							'WHERE gpt_id_tache = '.$parametres[0].' ';
182
				break;
183
			case ProjetTache::GPT_ID_MAX:
184
				$requete =	'SELECT MAX(gpt_id_tache) '.
185
							'FROM gestion_projet_tache ';
71 jpm 186
				break;
187
			case ProjetTache::GPT_PROJET:
188
				$requete =	'SELECT gpt_ce_projet '.
189
							'FROM gestion_projet_tache '.
190
							'WHERE gpt_ce_projet = '.$parametres[0];
10 jpm 191
				break;
192
			default :
193
				$message = 'Commande '.$cmd.'inconnue!';
194
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
195
    			trigger_error($e, E_USER_ERROR);
196
		}
48 jpm 197
 
10 jpm 198
		$resultat = $GLOBALS['db']->query($requete);
199
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
200
		$tab_resultat = array();
201
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
202
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
203
		}
48 jpm 204
 
205
		$resultat_nbre = count($tab_resultat);
10 jpm 206
		if ($resultat_nbre > 1) {
207
			return $tab_resultat;
208
		} else if ($resultat_nbre == 1) {
209
			return $tab_resultat[0];
210
		} else if ($resultat_nbre == 0) {
211
			return false;
212
		}
213
	}
48 jpm 214
 
10 jpm 215
	/** Afficher l'objet ProjetTache */
216
	function afficherProjetTache()
217
	{
218
		echo '<pre>'.print_r($this, true).'</pre>';
219
	}
220
}
221
 
222
/* +--Fin du code ----------------------------------------------------------------------------------------+
223
*
224
* $Log$
225
*
226
* +-- Fin du code ----------------------------------------------------------------------------------------+
227
*/
228
?>