Subversion Repositories Applications.gtt

Rev

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

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