Subversion Repositories Applications.gtt

Rev

Rev 64 | Rev 87 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64 Rev 82
1
<?php
1
<?php
2
// +------------------------------------------------------------------------------------------------------+
2
// +------------------------------------------------------------------------------------------------------+
3
// | PHP version 5.1.1                                                                                    |
3
// | PHP version 5.1.1                                                                                    |
4
// +------------------------------------------------------------------------------------------------------+
4
// +------------------------------------------------------------------------------------------------------+
5
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
5
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// +------------------------------------------------------------------------------------------------------+
6
// +------------------------------------------------------------------------------------------------------+
7
// | This file is part of eFlore.                                                                         |
7
// | This file is part of eFlore.                                                                         |
8
// |                                                                                                      |
8
// |                                                                                                      |
9
// | Foobar is free software; you can redistribute it and/or modify                                       |
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                                 |
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                                    |
11
// | the Free Software Foundation; either version 2 of the License, or                                    |
12
// | (at your option) any later version.                                                                  |
12
// | (at your option) any later version.                                                                  |
13
// |                                                                                                      |
13
// |                                                                                                      |
14
// | Foobar is distributed in the hope that it will be useful,                                            |
14
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
16
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | GNU General Public License for more details.                                                         |
17
// | GNU General Public License for more details.                                                         |
18
// |                                                                                                      |
18
// |                                                                                                      |
19
// | You should have received a copy of the GNU General Public License                                    |
19
// | You should have received a copy of the GNU General Public License                                    |
20
// | along with Foobar; if not, write to the Free Software                                                |
20
// | along with Foobar; if not, write to the Free Software                                                |
21
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// +------------------------------------------------------------------------------------------------------+
22
// +------------------------------------------------------------------------------------------------------+
23
// CVS : $Id$
23
// CVS : $Id$
24
/**
24
/**
25
* Classe AbsenceMotif
25
* Classe AbsenceMotif
26
*
26
*
27
* Description
27
* Description
28
*
28
*
29
*@package eFlore
29
*@package eFlore
30
*@subpackage modele
30
*@subpackage modele
31
//Auteur original :
31
//Auteur original :
32
*@version 3
32
*@version 3
33
*@author        Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
33
*@author        Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@version 4
35
*@version 4
36
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
36
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
37
*@author        aucun
37
*@author        aucun
38
*@copyright     Tela-Botanica 2000-2006
38
*@copyright     Tela-Botanica 2000-2006
39
*@version       $Revision$ $Date$
39
*@version       $Revision$ $Date$
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
*/
41
*/
42
 
42
 
43
/**
43
/**
44
* class AbsenceMotif : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
44
* class AbsenceMotif : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
45
* classe métier
45
* classe métier
46
*/
46
*/
47
class AbsenceMotif extends aGttSql {
47
class AbsenceMotif extends aGttSql {
48
	/*** Constantes : */
48
	/*** Constantes : */
49
	const GAM_TOUS = 'ABSENCEMOTIF_TOUS';
49
	const GAM_TOUS = 'ABSENCEMOTIF_TOUS';
50
	const GAM_ID = 'ABSENCEMOTIF_ID';
50
	const GAM_ID = 'ABSENCEMOTIF_ID';
51
	const GAM_ID_MAX = 'ABSENCEMOTIF_ID_MAX';
51
	const GAM_ID_MAX = 'ABSENCEMOTIF_ID_MAX';
52
	const GAM_LIBELLE = 'ABSENCEMOTIF_LIBELLE';
52
	const GAM_LIBELLE = 'ABSENCEMOTIF_LIBELLE';
53
 
53
 
54
	/*** Attributs : */
54
	/*** Attributs : */
55
	private $id_absence_motif;
55
	private $id_absence_motif;
56
	private $libelle;
56
	private $libelle;
-
 
57
	private $cp_diminuer;
-
 
58
	private $hs_augmenter;
-
 
59
	private $hs_diminuer;
57
 
60
	
58
	/*** Aggregations : */
61
	/*** Aggregations : */
59
 
62
 
60
	/*** Constructeur : */
63
	/*** Constructeur : */
61
	public function __construct($cmd = null, $parametres = null)
64
	public function __construct($cmd = null, $parametres = null)
62
	{
65
	{
63
		$this->dao_table_nom = 'gestion_absence_motif';
66
		$this->dao_table_nom = 'gestion_absence_motif';
64
		$this->dao_correspondance = array(
67
		$this->dao_correspondance = array(
65
			'gam_id_absence_motif'	=> 'id_absence_motif',
68
			'gam_id_absence_motif'	=> 'id_absence_motif',
66
			'gam_libelle'	=> 'libelle');
69
			'gam_libelle'	=> 'libelle',
-
 
70
			'gam_cp_diminuer'	=> 'cp_diminuer',
-
 
71
			'gam_hs_augmenter'	=> 'hs_augmenter',
-
 
72
			'gam_hs_diminuer'	=> 'hs_diminuer');
67
 
73
 
68
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
74
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
69
		if (!is_null($cmd)) {
75
		if (!is_null($cmd)) {
70
			$this->consulter($cmd, $parametres, true);
76
			$this->consulter($cmd, $parametres, true);
71
		}
77
		}
72
	}
78
	}
73
 
79
 
74
	/*** Accesseurs : */
80
	/*** Accesseurs : */
75
	// Id Absence Motif
81
	// Id Absence Motif
76
	public function getIdAbsenceMotif()
82
	public function getIdAbsenceMotif()
77
	{
83
	{
78
		return $this->id_absence_motif;
84
		return $this->id_absence_motif;
79
	}
85
	}
80
	public function setIdAbsenceMotif( $iam )
86
	public function setIdAbsenceMotif( $iam )
81
	{
87
	{
82
		$this->id_absence_motif = $iam;
88
		$this->id_absence_motif = $iam;
83
	}
89
	}
84
 
90
 
85
	// Libelle
91
	// Libelle
86
	public function getLibelle()
92
	public function getLibelle()
87
	{
93
	{
88
		return $this->libelle;
94
		return $this->libelle;
89
	}
95
	}
90
	public function setLibelle( $l )
96
	public function setLibelle( $l )
91
	{
97
	{
92
		$this->libelle = $l;
98
		$this->libelle = $l;
93
	}
99
	}
-
 
100
 
-
 
101
	// CP Diminuer
-
 
102
	public function getCpDiminuer()
-
 
103
	{
-
 
104
		return $this->cp_diminuer;
-
 
105
	}
-
 
106
	public function setCpDiminuer( $cd )
-
 
107
	{
-
 
108
		$this->cp_diminuer = $cd;
-
 
109
	}
-
 
110
 
-
 
111
	// HS Augmenter
-
 
112
	public function getHsAugmenter()
-
 
113
	{
-
 
114
		return $this->hs_augmenter;
-
 
115
	}
-
 
116
	public function setHsAugmenter( $ha )
-
 
117
	{
-
 
118
		$this->hs_augmenter = $ha;
-
 
119
	}
-
 
120
 
-
 
121
	// HS Diminuer
-
 
122
	public function getHsDiminuer()
-
 
123
	{
-
 
124
		return $this->hs_diminuer;
-
 
125
	}
-
 
126
	public function setHsDiminuer( $hd )
-
 
127
	{
-
 
128
		$this->hs_diminuer = $hd;
-
 
129
	}
94
 
130
 
95
	/*** Méthodes : */
131
	/*** Méthodes : */
96
 
132
 
97
	/**
133
	/**
98
	* Consulter la table gestion_absence_motif.
134
	* Consulter la table gestion_absence_motif.
99
	* @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.
135
	* @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.
100
	*/
136
	*/
101
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
137
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
102
	{
138
	{
103
		if (!is_array($parametres)) {
139
		if (!is_array($parametres)) {
104
			$parametres[0] = $parametres;
140
			$parametres[0] = $parametres;
105
		}
141
		}
106
		switch ($cmd) {
142
		switch ($cmd) {
107
			case AbsenceMotif::GAM_TOUS:
143
			case AbsenceMotif::GAM_TOUS:
108
				$requete = 	'SELECT * '.
144
				$requete = 	'SELECT * '.
109
							'FROM gestion_absence_motif ';
145
							'FROM gestion_absence_motif ';
110
				break;
146
				break;
111
			case AbsenceMotif::GAM_ID:
147
			case AbsenceMotif::GAM_ID:
112
				$requete = 	'SELECT * '.
148
				$requete = 	'SELECT * '.
113
							'FROM gestion_absence_motif '.
149
							'FROM gestion_absence_motif '.
114
							'WHERE gam_id_absence_motif = '.$parametres[0].' ';
150
							'WHERE gam_id_absence_motif = '.$parametres[0].' ';
115
				break;
151
				break;
116
			case AbsenceMotif::GAM_ID_MAX:
152
			case AbsenceMotif::GAM_ID_MAX:
117
				$requete =	'SELECT MAX(gam_id_absence_motif) as gam_id_absence_motif '.
153
				$requete =	'SELECT MAX(gam_id_absence_motif) as gam_id_absence_motif '.
118
							'FROM gestion_absence_motif ';
154
							'FROM gestion_absence_motif ';
119
				break;
155
				break;
120
			case AbsenceMotif::GAM_LIBELLE:
156
			case AbsenceMotif::GAM_LIBELLE:
121
				$requete =	'SELECT * '.
157
				$requete =	'SELECT * '.
122
							'FROM gestion_absence_motif '.
158
							'FROM gestion_absence_motif '.
123
							'WHERE gam_libelle = "'.$parametres[0].'" ';
159
							'WHERE gam_libelle = "'.$parametres[0].'" ';
124
				break;
160
				break;
125
			default :
161
			default :
126
				$message = 'Commande '.$cmd.'inconnue!';
162
				$message = 'Commande '.$cmd.'inconnue!';
127
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
163
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
128
    			trigger_error($e, E_USER_ERROR);
164
    			trigger_error($e, E_USER_ERROR);
129
		}
165
		}
130
 
166
 
131
		$resultat = $GLOBALS['db']->query($requete);
167
		$resultat = $GLOBALS['db']->query($requete);
132
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
168
		(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
133
		$tab_resultat = array();
169
		$tab_resultat = array();
134
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
170
		while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
135
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
171
			$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
136
		}
172
		}
137
 
173
 
138
		$resultat_nbre = count($tab_resultat);
174
		$resultat_nbre = count($tab_resultat);
139
		if ($resultat_nbre > 1) {
175
		if ($resultat_nbre > 1) {
140
			return $tab_resultat;
176
			return $tab_resultat;
141
		} else if ($resultat_nbre == 1) {
177
		} else if ($resultat_nbre == 1) {
142
			return $tab_resultat[0];
178
			return $tab_resultat[0];
143
		} else if ($resultat_nbre == 0) {
179
		} else if ($resultat_nbre == 0) {
144
			return false;
180
			return false;
145
		}
181
		}
146
	}
182
	}
147
 
183
 
148
	/** Afficher l'objet AbsenceMotif */
184
	/** Afficher l'objet AbsenceMotif */
149
	function afficherAbsenceMotif()
185
	function afficherAbsenceMotif()
150
	{
186
	{
151
		echo '<pre>'.print_r($this, true).'</pre>';
187
		echo '<pre>'.print_r($this, true).'</pre>';
152
	}
188
	}
153
}
189
}
154
 
190
 
155
/* +--Fin du code ----------------------------------------------------------------------------------------+
191
/* +--Fin du code ----------------------------------------------------------------------------------------+
156
*
192
*
157
* $Log$
193
* $Log$
158
*
194
*
159
* +-- Fin du code ----------------------------------------------------------------------------------------+
195
* +-- Fin du code ----------------------------------------------------------------------------------------+
160
*/
196
*/
161
?>
197
?>