Subversion Repositories Applications.gtt

Rev

Rev 15 | Go to most recent revision | Details | 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 : */
49
	const GAM_ID = 'ABSENCEMOTIF_ID';
50
	const GAM_ID_MAX = 'ABSENCEMOTIF_ID_MAX';
51
 
52
	/*** Attributs : */
53
	private $id_absence_motif;
54
	private $libelle;
55
	private $mark_rtt;
56
	private $nbre_heure;
57
 
58
	/*** Aggregations : */
59
 
60
	/*** Constructeur : */
61
	public function __construct($cmd = null, $parametres = null)
62
	{
63
		$this->dao_table_nom = 'gestion_absence_motif';
64
		$this->dao_correspondance = array(
65
			'gam_id_absence_motif'	=> 'id_absence_motif',
66
			'gam_libelle'	=> 'libelle',
67
			'gam_mark_rtt'	=> 'mark_rtt',
68
			'gam_nbre_heure'	=> 'nbre_heure');
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 : */
77
	// Id Absence Motif
78
	public function getIdAbsenceMotif()
79
	{
80
		return $this->id_absence_motif;
81
	}
82
	public function setIdAbsenceMotif( $iam )
83
	{
84
		$this->id_absence_motif = $iam;
85
	}
86
 
87
	// Libelle
88
	public function getLibelle()
89
	{
90
		return $this->libelle;
91
	}
92
	public function setLibelle( $l )
93
	{
94
		$this->libelle = $l;
95
	}
96
 
97
	// Mark Rtt
98
	public function getMarkRtt()
99
	{
100
		return $this->mark_rtt;
101
	}
102
	public function setMarkRtt( $mr )
103
	{
104
		$this->mark_rtt = $mr;
105
	}
106
 
107
	// Nbre Heure
108
	public function getNbreHeure()
109
	{
110
		return $this->nbre_heure;
111
	}
112
	public function setNbreHeure( $nh )
113
	{
114
		$this->nbre_heure = $nh;
115
	}
116
 
117
	/*** Méthodes : */
118
 
119
	/**
120
	* Consulter la table gestion_absence_motif.
121
	* @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.
122
	*/
123
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
124
	{
125
		switch ($cmd) {
126
			case AbsenceMotif::GAM_ID:
127
				$requete = 	'SELECT * '.
128
							'FROM gestion_absence_motif '.
129
							'WHERE gam_id_absence_motif = '.$parametres[0].' ';
130
				break;
131
			case AbsenceMotif::GAM_ID_MAX:
132
				$requete =	'SELECT MAX(gam_id_absence_motif) '.
133
							'FROM gestion_absence_motif ';
134
				break;
135
			default :
136
				$message = 'Commande '.$cmd.'inconnue!';
137
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
138
    			trigger_error($e, E_USER_ERROR);
139
		}
140
 
141
		$resultat = $GLOBALS['db']->query($requete);
142
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
143
		$tab_resultat = array();
144
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
145
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
146
		}
147
 
148
		$resultat_nbre = count($tab_resultat);
149
		if ($resultat_nbre > 1) {
150
			return $tab_resultat;
151
		} else if ($resultat_nbre == 1) {
152
			return $tab_resultat[0];
153
		} else if ($resultat_nbre == 0) {
154
			return false;
155
		}
156
	}
157
 
158
	/** Afficher l'objet AbsenceMotif */
159
	function afficherAbsenceMotif()
160
	{
161
		echo '<pre>'.print_r($this, true).'</pre>';
162
	}
163
}
164
 
165
/* +--Fin du code ----------------------------------------------------------------------------------------+
166
*
167
* $Log$
168
*
169
* +-- Fin du code ----------------------------------------------------------------------------------------+
170
*/
171
?>