Subversion Repositories Applications.gtt

Rev

Rev 15 | Rev 48 | 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 AbsenceMotif
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 AbsenceMotif : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
46
*/
47
class AbsenceMotif extends aGttSql {
48
	/*** Constantes : */
32 jpm 49
	const GAM_TOUS = 'ABSENCEMOTIF_TOUS';
10 jpm 50
	const GAM_ID = 'ABSENCEMOTIF_ID';
51
	const GAM_ID_MAX = 'ABSENCEMOTIF_ID_MAX';
32 jpm 52
 
10 jpm 53
	/*** Attributs : */
54
	private $id_absence_motif;
55
	private $libelle;
32 jpm 56
 
10 jpm 57
	/*** Aggregations : */
58
 
59
	/*** Constructeur : */
60
	public function __construct($cmd = null, $parametres = null)
61
	{
62
		$this->dao_table_nom = 'gestion_absence_motif';
63
		$this->dao_correspondance = array(
64
			'gam_id_absence_motif'	=> 'id_absence_motif',
15 jpm 65
			'gam_libelle'	=> 'libelle');
32 jpm 66
 
10 jpm 67
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
68
		if (!is_null($cmd)) {
69
			$this->consulter($cmd, $parametres, true);
70
		}
71
	}
32 jpm 72
 
10 jpm 73
	/*** Accesseurs : */
74
	// Id Absence Motif
75
	public function getIdAbsenceMotif()
76
	{
77
		return $this->id_absence_motif;
78
	}
79
	public function setIdAbsenceMotif( $iam )
80
	{
81
		$this->id_absence_motif = $iam;
82
	}
32 jpm 83
 
10 jpm 84
	// Libelle
85
	public function getLibelle()
86
	{
87
		return $this->libelle;
88
	}
89
	public function setLibelle( $l )
90
	{
91
		$this->libelle = $l;
92
	}
32 jpm 93
 
10 jpm 94
	/*** Méthodes : */
95
 
96
	/**
97
	* Consulter la table gestion_absence_motif.
98
	* @return mixed un tableau d'objets AbsenceMotif s'il y en a plusieurs, l'objet AbsenceMotif s'il y en a 1 seul sinon false.
99
	*/
100
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
101
	{
32 jpm 102
		switch ($cmd) {
103
			case AbsenceMotif::GAM_TOUS:
104
				$requete = 	'SELECT * '.
105
							'FROM gestion_absence_motif ';
106
				break;
10 jpm 107
			case AbsenceMotif::GAM_ID:
108
				$requete = 	'SELECT * '.
109
							'FROM gestion_absence_motif '.
110
							'WHERE gam_id_absence_motif = '.$parametres[0].' ';
111
				break;
112
			case AbsenceMotif::GAM_ID_MAX:
113
				$requete =	'SELECT MAX(gam_id_absence_motif) '.
114
							'FROM gestion_absence_motif ';
115
				break;
116
			default :
117
				$message = 'Commande '.$cmd.'inconnue!';
118
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
119
    			trigger_error($e, E_USER_ERROR);
120
		}
32 jpm 121
 
10 jpm 122
		$resultat = $GLOBALS['db']->query($requete);
123
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
124
		$tab_resultat = array();
125
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
126
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
127
		}
32 jpm 128
 
129
		$resultat_nbre = count($tab_resultat);
10 jpm 130
		if ($resultat_nbre > 1) {
131
			return $tab_resultat;
132
		} else if ($resultat_nbre == 1) {
133
			return $tab_resultat[0];
134
		} else if ($resultat_nbre == 0) {
135
			return false;
136
		}
137
	}
32 jpm 138
 
10 jpm 139
	/** Afficher l'objet AbsenceMotif */
140
	function afficherAbsenceMotif()
141
	{
142
		echo '<pre>'.print_r($this, true).'</pre>';
143
	}
144
}
145
 
146
/* +--Fin du code ----------------------------------------------------------------------------------------+
147
*
148
* $Log$
149
*
150
* +-- Fin du code ----------------------------------------------------------------------------------------+
151
*/
152
?>