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 ProjetCategorie
|
|
|
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 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 : */
|
|
|
49 |
const GPC_ID = 'PROJETCATEGORIE_ID';
|
|
|
50 |
const GPC_ID_MAX = 'PROJETCATEGORIE_ID_MAX';
|
|
|
51 |
|
|
|
52 |
/*** Attributs : */
|
|
|
53 |
private $id_categorie;
|
|
|
54 |
private $libelle;
|
|
|
55 |
|
|
|
56 |
/*** Aggregations : */
|
|
|
57 |
|
|
|
58 |
/*** Constructeur : */
|
|
|
59 |
public function __construct($cmd = null, $parametres = null)
|
|
|
60 |
{
|
|
|
61 |
$this->dao_table_nom = 'gestion_projet_categorie';
|
|
|
62 |
$this->dao_correspondance = array(
|
|
|
63 |
'gpc_id_categorie' => 'id_categorie',
|
|
|
64 |
'gpc_libelle' => 'libelle');
|
|
|
65 |
|
|
|
66 |
// Si l'on veut remplir l'objet à la création on lance la requete correspondante
|
|
|
67 |
if (!is_null($cmd)) {
|
|
|
68 |
$this->consulter($cmd, $parametres, true);
|
|
|
69 |
}
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
/*** Accesseurs : */
|
|
|
73 |
// Id Categorie
|
|
|
74 |
public function getIdCategorie()
|
|
|
75 |
{
|
|
|
76 |
return $this->id_categorie;
|
|
|
77 |
}
|
|
|
78 |
public function setIdCategorie( $ic )
|
|
|
79 |
{
|
|
|
80 |
$this->id_categorie = $ic;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
// Libelle
|
|
|
84 |
public function getLibelle()
|
|
|
85 |
{
|
|
|
86 |
return $this->libelle;
|
|
|
87 |
}
|
|
|
88 |
public function setLibelle( $l )
|
|
|
89 |
{
|
|
|
90 |
$this->libelle = $l;
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
/*** Méthodes : */
|
|
|
94 |
|
|
|
95 |
/**
|
|
|
96 |
* Consulter la table gestion_projet_categorie.
|
|
|
97 |
* @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.
|
|
|
98 |
*/
|
|
|
99 |
public function consulter($cmd = '', $parametres = array(), $instancier = false)
|
|
|
100 |
{
|
|
|
101 |
if (!is_array($parametres)) {
|
|
|
102 |
$parametres[0] = $parametres;
|
|
|
103 |
}
|
|
|
104 |
switch ($cmd) {
|
|
|
105 |
case ProjetCategorie::GPC_ID:
|
|
|
106 |
$requete = 'SELECT * '.
|
|
|
107 |
'FROM gestion_projet_categorie '.
|
|
|
108 |
'WHERE gpc_id_categorie = '.$parametres[0].' ';
|
|
|
109 |
break;
|
|
|
110 |
case ProjetCategorie::GPC_ID_MAX:
|
|
|
111 |
$requete = 'SELECT MAX(gpc_id_categorie) '.
|
|
|
112 |
'FROM gestion_projet_categorie ';
|
|
|
113 |
break;
|
|
|
114 |
default :
|
|
|
115 |
$message = 'Commande '.$cmd.'inconnue!';
|
|
|
116 |
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
|
|
|
117 |
trigger_error($e, E_USER_ERROR);
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
$resultat = $GLOBALS['db']->query($requete);
|
|
|
121 |
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
|
|
|
122 |
$tab_resultat = array();
|
|
|
123 |
while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
124 |
$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
$resultat_nbre = count($tab_resultat);
|
|
|
128 |
if ($resultat_nbre > 1) {
|
|
|
129 |
return $tab_resultat;
|
|
|
130 |
} else if ($resultat_nbre == 1) {
|
|
|
131 |
return $tab_resultat[0];
|
|
|
132 |
} else if ($resultat_nbre == 0) {
|
|
|
133 |
return false;
|
|
|
134 |
}
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
/** Afficher l'objet ProjetCategorie */
|
|
|
138 |
function afficherProjetCategorie()
|
|
|
139 |
{
|
|
|
140 |
echo '<pre>'.print_r($this, true).'</pre>';
|
|
|
141 |
}
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
145 |
*
|
|
|
146 |
* $Log$
|
|
|
147 |
*
|
|
|
148 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
149 |
*/
|
|
|
150 |
?>
|