Subversion Repositories Applications.gtt

Rev

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