Subversion Repositories Applications.gtt

Rev

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

Rev 11 Rev 48
Line 47... Line 47...
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_ID_MAX = 'PROJET_ID_MAX';
51
	const GP_ID_MAX = 'PROJET_ID_MAX';
52
	const GP_ID_LIST = 'PROJET_ID_LIST';
52
	const GP_ID_LIST = 'PROJET_ID_LIST';
-
 
53
	const GP_CE_CATEGORIE = 'PROJET_CE_CATEGORIE';
53
	
54
 
54
	/*** Attributs : */
55
	/*** Attributs : */
55
	private $id_projet;
56
	private $id_projet;
56
	private $ce_categorie;
57
	private $ce_categorie;
57
	private $nom_projet;
58
	private $nom_projet;
58
	private $description;
59
	private $description;
59
	private $date_debut;
60
	private $date_debut;
60
	private $duree_prevue;
61
	private $duree_prevue;
61
	private $avancement;
62
	private $avancement;
62
	
63
 
63
	/*** Aggregations : */
64
	/*** Aggregations : */
Line 64... Line 65...
64
 
65
 
65
	/*** Constructeur : */
66
	/*** Constructeur : */
66
	public function __construct($cmd = null, $parametres = null)
67
	public function __construct($cmd = null, $parametres = null)
Line 72... Line 73...
72
			'gp_nom_projet'	=> 'nom_projet',
73
			'gp_nom_projet'	=> 'nom_projet',
73
			'gp_description'	=> 'description',
74
			'gp_description'	=> 'description',
74
			'gp_date_debut'	=> 'date_debut',
75
			'gp_date_debut'	=> 'date_debut',
75
			'gp_duree_prevue'	=> 'duree_prevue',
76
			'gp_duree_prevue'	=> 'duree_prevue',
76
			'gp_avancement'	=> 'avancement');
77
			'gp_avancement'	=> 'avancement');
77
		
78
 
78
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
79
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
79
		if (!is_null($cmd)) {
80
		if (!is_null($cmd)) {
80
			$this->consulter($cmd, $parametres, true);
81
			$this->consulter($cmd, $parametres, true);
81
		}
82
		}
82
	}
83
	}
83
	
84
 
84
	/*** Accesseurs : */
85
	/*** Accesseurs : */
85
	// Id Projet
86
	// Id Projet
86
	public function getIdProjet()
87
	public function getIdProjet()
87
	{
88
	{
88
		return $this->id_projet;
89
		return $this->id_projet;
89
	}
90
	}
90
	public function setIdProjet( $ip )
91
	public function setIdProjet( $ip )
91
	{
92
	{
92
		$this->id_projet = $ip;
93
		$this->id_projet = $ip;
93
	}
94
	}
94
	
95
 
95
	// Ce Categorie
96
	// Ce Categorie
96
	public function getCeCategorie()
97
	public function getCeCategorie()
97
	{
98
	{
98
		return $this->ce_categorie;
99
		return $this->ce_categorie;
99
	}
100
	}
100
	public function setCeCategorie( $cc )
101
	public function setCeCategorie( $cc )
101
	{
102
	{
102
		$this->ce_categorie = $cc;
103
		$this->ce_categorie = $cc;
103
	}
104
	}
104
	
105
 
105
	// Nom Projet
106
	// Nom Projet
106
	public function getNomProjet()
107
	public function getNomProjet()
107
	{
108
	{
108
		return $this->nom_projet;
109
		return $this->nom_projet;
109
	}
110
	}
110
	public function setNomProjet( $np )
111
	public function setNomProjet( $np )
111
	{
112
	{
112
		$this->nom_projet = $np;
113
		$this->nom_projet = $np;
113
	}
114
	}
114
	
115
 
115
	// Description
116
	// Description
116
	public function getDescription()
117
	public function getDescription()
117
	{
118
	{
118
		return $this->description;
119
		return $this->description;
119
	}
120
	}
120
	public function setDescription( $d )
121
	public function setDescription( $d )
121
	{
122
	{
122
		$this->description = $d;
123
		$this->description = $d;
123
	}
124
	}
124
	
125
 
125
	// Date Debut
126
	// Date Debut
126
	public function getDateDebut()
127
	public function getDateDebut()
127
	{
128
	{
128
		return $this->date_debut;
129
		return $this->date_debut;
129
	}
130
	}
130
	public function setDateDebut( $dd )
131
	public function setDateDebut( $dd )
131
	{
132
	{
132
		$this->date_debut = $dd;
133
		$this->date_debut = $dd;
133
	}
134
	}
134
	
135
 
135
	// Duree Prevue
136
	// Duree Prevue
136
	public function getDureePrevue()
137
	public function getDureePrevue()
137
	{
138
	{
138
		return $this->duree_prevue;
139
		return $this->duree_prevue;
139
	}
140
	}
140
	public function setDureePrevue( $dp )
141
	public function setDureePrevue( $dp )
141
	{
142
	{
142
		$this->duree_prevue = $dp;
143
		$this->duree_prevue = $dp;
143
	}
144
	}
144
	
145
 
145
	// Avancement
146
	// Avancement
146
	public function getAvancement()
147
	public function getAvancement()
147
	{
148
	{
148
		return $this->avancement;
149
		return $this->avancement;
149
	}
150
	}
150
	public function setAvancement( $a )
151
	public function setAvancement( $a )
151
	{
152
	{
152
		$this->avancement = $a;
153
		$this->avancement = $a;
153
	}
154
	}
154
	
155
 
155
	/*** Méthodes : */
156
	/*** Méthodes : */
Line 156... Line 157...
156
 
157
 
157
	/**
158
	/**
158
	* Consulter la table gestion_projet.
159
	* Consulter la table gestion_projet.
Line 179... Line 180...
179
				break;
180
				break;
180
			case Projet::GP_ID_LIST:
181
			case Projet::GP_ID_LIST:
181
				$requete =	'SELECT * '.
182
				$requete =	'SELECT * '.
182
							'FROM gestion_projet '.
183
							'FROM gestion_projet '.
183
							'WHERE gp_id_projet IN ('.$parametres[0].') ';
184
							'WHERE gp_id_projet IN ('.$parametres[0].') ';
-
 
185
				break;
-
 
186
			case Projet::GP_CE_CATEGORIE:
-
 
187
				$requete =	'SELECT * '.
-
 
188
							'FROM gestion_projet '.
-
 
189
							'WHERE gp_ce_categorie = '.$parametres[0].' ';
184
				break;
190
				break;
185
			default :
191
			default :
186
				$message = 'Commande '.$cmd.'inconnue!';
192
				$message = 'Commande '.$cmd.'inconnue!';
187
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
193
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
188
    			trigger_error($e, E_USER_ERROR);
194
    			trigger_error($e, E_USER_ERROR);
Line 191... Line 197...
191
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
197
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
192
		$tab_resultat = array();
198
		$tab_resultat = array();
193
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
199
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
194
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
200
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
195
		}
201
		}
196
				
202
 
197
		$resultat_nbre = count($tab_resultat); 
203
		$resultat_nbre = count($tab_resultat);
198
		if ($resultat_nbre > 1) {
204
		if ($resultat_nbre > 1) {
199
			return $tab_resultat;
205
			return $tab_resultat;
200
		} else if ($resultat_nbre == 1) {
206
		} else if ($resultat_nbre == 1) {
201
			return $tab_resultat[0];
207
			return $tab_resultat[0];
202
		} else if ($resultat_nbre == 0) {
208
		} else if ($resultat_nbre == 0) {
203
			return false;
209
			return false;
204
		}
210
		}
205
	}
211
	}
206
      
212
 
207
	/** Afficher l'objet Projet */
213
	/** Afficher l'objet Projet */
208
	function afficherProjet()
214
	function afficherProjet()
209
	{
215
	{
210
		echo '<pre>'.print_r($this, true).'</pre>';
216
		echo '<pre>'.print_r($this, true).'</pre>';
211
	}
217
	}