Subversion Repositories Applications.gtt

Rev

Rev 130 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10 jpm 1
<?php
170 mathias 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
// +------------------------------------------------------------------------------------------------------+
10 jpm 23
// CVS : $Id$
170 mathias 24
/**
10 jpm 25
* Classe ProjetCategorie
170 mathias 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
10 jpm 39
*@version       $Revision$ $Date$
170 mathias 40
// +------------------------------------------------------------------------------------------------------+
41
*/
42
 
43
/**
44
* class ProjetCategorie : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
46
*/
47
class ProjetCategorie extends aGttSql {
48
	/*** Constantes : */
48 jpm 49
	const GPC_TOUS = 'PROJETCATEGORIE_TOUS';
170 mathias 50
	const GPC_ID = 'PROJETCATEGORIE_ID';
48 jpm 51
	const GPC_ID_MAX = 'PROJETCATEGORIE_ID_MAX';
170 mathias 52
	const GPC_LIBELLE = 'PROJETCATEGORIE_LIBELLE';
53
 
54
	/*** Attributs : */
55
	private $id_categorie;
68 jpm 56
	private $libelle;
170 mathias 57
	private $abreviation;
58
 
59
	/*** Aggregations : */
60
 
61
	/*** Constructeur : */
62
	public function __construct($cmd = null, $parametres = null)
63
	{
64
		$this->dao_table_nom = GTT_BDD_PREFIXE . 'gestion_projet_categorie';
65
		$this->dao_correspondance = array(
10 jpm 66
			'gpc_id_categorie'	=> 'id_categorie',
67 jpm 67
			'gpc_libelle'	=> 'libelle',
68
			'gpc_abreviation'	=> 'abreviation');
170 mathias 69
 
70
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
71
		if (!is_null($cmd)) {
72
			$this->consulter($cmd, $parametres, true);
73
		}
74
	}
75
 
76
	/*** Accesseurs : */
10 jpm 77
	// Id Categorie
170 mathias 78
	public function getIdCategorie()
79
	{
80
		return $this->id_categorie;
81
	}
82
	public function setIdCategorie( $ic )
83
	{
84
		$this->id_categorie = $ic;
85
	}
86
 
10 jpm 87
	// Libelle
170 mathias 88
	public function getLibelle()
89
	{
90
		return $this->libelle;
91
	}
92
	public function setLibelle( $l )
93
	{
94
		$this->libelle = $l;
95
	}
68 jpm 96
 
97
	// Abreviation
98
	public function getAbreviation()
99
	{
100
		return $this->abreviation;
101
	}
102
	public function setAbreviation( $a )
103
	{
104
		$this->abreviation = $a;
105
	}
106
 
170 mathias 107
 
108
	/*** Méthodes : */
109
 
110
	/**
111
	* Consulter la table gestion_projet_categorie.
112
	* @return mixed un tableau d'objets ProjetCategorie s'il y en a plusieurs, l'objet ProjetCategorie s'il y en a 1 seul sinon false.
113
	*/
114
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
75 jpm 115
	{
170 mathias 116
		switch ($cmd) {
48 jpm 117
			case ProjetCategorie::GPC_TOUS:
118
				$requete = 	'SELECT * '.
170 mathias 119
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet_categorie '.
130 jpm 120
							'ORDER BY gpc_libelle';
48 jpm 121
				break;
170 mathias 122
			case ProjetCategorie::GPC_ID:
123
				$requete = 	'SELECT * '.
124
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet_categorie '.
125
							'WHERE gpc_id_categorie = #0 ';
48 jpm 126
				break;
170 mathias 127
			case ProjetCategorie::GPC_ID_MAX:
128
				$requete =	'SELECT MAX(gpc_id_categorie) AS gpc_id_categorie '.
129
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet_categorie ';
130
				break;
48 jpm 131
			case ProjetCategorie::GPC_LIBELLE:
132
				$requete =	'SELECT * '.
170 mathias 133
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_projet_categorie '.
75 jpm 134
							'WHERE gpc_libelle = "#0" ';
170 mathias 135
				break;
136
			default :
137
				$message = 'Commande '.$cmd.'inconnue!';
138
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
139
    			trigger_error($e, E_USER_ERROR);
140
		}
141
		return parent::consulter($requete, $parametres, $instancier);
142
	}
143
}
144
 
145
/* +--Fin du code ----------------------------------------------------------------------------------------+
146
*
10 jpm 147
* $Log$
170 mathias 148
*
149
* +-- Fin du code ----------------------------------------------------------------------------------------+
150
*/
10 jpm 151
?>