Subversion Repositories Applications.gtt

Rev

Rev 104 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 104 Rev 170
Line 1... Line 1...
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 Absence
25
* Classe Absence
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 Absence : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
44
* class Absence : 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 Absence extends aGttSql {
47
class Absence extends aGttSql {
48
	/*** Constantes : */
48
	/*** Constantes : */
49
	const GA_ID = 'ABSENCE_ID';
49
	const GA_ID = 'ABSENCE_ID';
50
	const GA_ID_ABSENCE_MOTIF = 'ABSENCE_ID_ABSENCE_MOTIF';
50
	const GA_ID_ABSENCE_MOTIF = 'ABSENCE_ID_ABSENCE_MOTIF';
51
	const GA_ID_UTILISATEUR = 'ABSENCE_ID_UTILISATEUR';
51
	const GA_ID_UTILISATEUR = 'ABSENCE_ID_UTILISATEUR';
52
	const GA_ID_UTILISATEUR_DATE_DEB_FIN = 'ABSENCE_ID_UTILISATEUR_DATE_DEB_FIN';
52
	const GA_ID_UTILISATEUR_DATE_DEB_FIN = 'ABSENCE_ID_UTILISATEUR_DATE_DEB_FIN';
53
	const GA_ID_MAX_UTILISATEUR = 'ABSENCE_ID_MAX_UTILISATEUR';
53
	const GA_ID_MAX_UTILISATEUR = 'ABSENCE_ID_MAX_UTILISATEUR';
54
	const GA_ID_MAX_ABSENCE_MOTIF = 'ABSENCE_ID_MAX_ABSENCE_MOTIF';
54
	const GA_ID_MAX_ABSENCE_MOTIF = 'ABSENCE_ID_MAX_ABSENCE_MOTIF';
55
	const GA_ID_MAX_DATE_ABSENCE = 'ABSENCE_ID_MAX_DATE_ABSENCE';
55
	const GA_ID_MAX_DATE_ABSENCE = 'ABSENCE_ID_MAX_DATE_ABSENCE';
56
 
56
 
57
	/*** Attributs : */
57
	/*** Attributs : */
58
	private $id_utilisateur;
58
	private $id_utilisateur;
59
	private $id_absence_motif;
59
	private $id_absence_motif;
60
	private $id_date_absence;
60
	private $id_date_absence;
61
	private $duree;
61
	private $duree;
62
 
62
 
63
	/*** Aggregations : */
63
	/*** Aggregations : */
64
 
64
 
65
	/*** Constructeur : */
65
	/*** Constructeur : */
66
	public function __construct($cmd = null, $parametres = null)
66
	public function __construct($cmd = null, $parametres = null)
67
	{
67
	{
68
		$this->dao_table_nom = 'gestion_absence';
68
		$this->dao_table_nom = GTT_BDD_PREFIXE . 'gestion_absence';
69
		$this->dao_correspondance = array(
69
		$this->dao_correspondance = array(
70
			'ga_id_utilisateur'	=> 'id_utilisateur',
70
			'ga_id_utilisateur'	=> 'id_utilisateur',
71
			'ga_id_absence_motif'	=> 'id_absence_motif',
71
			'ga_id_absence_motif'	=> 'id_absence_motif',
72
			'ga_id_date_absence'	=> 'id_date_absence',
72
			'ga_id_date_absence'	=> 'id_date_absence',
73
			'ga_duree'	=> 'duree');
73
			'ga_duree'	=> 'duree');
74
 
74
 
75
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
75
		// Si l'on veut remplir l'objet à la création on lance la requete correspondante
76
		if (!is_null($cmd)) {
76
		if (!is_null($cmd)) {
77
			$this->consulter($cmd, $parametres, true);
77
			$this->consulter($cmd, $parametres, true);
78
		}
78
		}
79
	}
79
	}
80
 
80
 
81
	/*** Accesseurs : */
81
	/*** Accesseurs : */
82
	// Id Utilisateur
82
	// Id Utilisateur
83
	public function getIdUtilisateur()
83
	public function getIdUtilisateur()
84
	{
84
	{
85
		return $this->id_utilisateur;
85
		return $this->id_utilisateur;
86
	}
86
	}
87
	public function setIdUtilisateur( $iu )
87
	public function setIdUtilisateur( $iu )
88
	{
88
	{
89
		$this->id_utilisateur = $iu;
89
		$this->id_utilisateur = $iu;
90
	}
90
	}
91
 
91
 
92
	// Id Absence Motif
92
	// Id Absence Motif
93
	public function getIdAbsenceMotif()
93
	public function getIdAbsenceMotif()
94
	{
94
	{
95
		return $this->id_absence_motif;
95
		return $this->id_absence_motif;
96
	}
96
	}
97
	public function setIdAbsenceMotif( $iam )
97
	public function setIdAbsenceMotif( $iam )
98
	{
98
	{
99
		$this->id_absence_motif = $iam;
99
		$this->id_absence_motif = $iam;
100
	}
100
	}
101
 
101
 
102
	// Id Date Absence
102
	// Id Date Absence
103
	public function getIdDateAbsence()
103
	public function getIdDateAbsence()
104
	{
104
	{
105
		return $this->id_date_absence;
105
		return $this->id_date_absence;
106
	}
106
	}
107
	public function setIdDateAbsence( $ida )
107
	public function setIdDateAbsence( $ida )
108
	{
108
	{
109
		$this->id_date_absence = $ida;
109
		$this->id_date_absence = $ida;
110
	}
110
	}
111
 
111
 
112
	// Duree
112
	// Duree
113
	public function getDuree()
113
	public function getDuree()
114
	{
114
	{
115
		return $this->duree;
115
		return $this->duree;
116
	}
116
	}
117
	public function setDuree( $d )
117
	public function setDuree( $d )
118
	{
118
	{
119
		$this->duree = $d;
119
		$this->duree = $d;
120
	}
120
	}
121
 
121
 
122
	/*** Méthodes : */
122
	/*** Méthodes : */
123
 
123
 
124
	/**
124
	/**
125
	* Consulter la table gestion_absence.
125
	* Consulter la table gestion_absence.
126
	* @return mixed un tableau d'objets Absence s'il y en a plusieurs, l'objet Absence s'il y en a 1 seul sinon false.
126
	* @return mixed un tableau d'objets Absence s'il y en a plusieurs, l'objet Absence s'il y en a 1 seul sinon false.
127
	*/
127
	*/
128
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
128
	public function consulter($cmd = '', $parametres = array(), $instancier = false)
129
	{
129
	{
130
		switch ($cmd) {
130
		switch ($cmd) {
131
			case Absence::GA_ID:
131
			case Absence::GA_ID:
132
				$requete = 	'SELECT * '.
132
				$requete = 	'SELECT * '.
133
							'FROM gestion_absence '.
133
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '.
134
							'WHERE ga_id_utilisateur = #0 '.
134
							'WHERE ga_id_utilisateur = #0 '.
135
							'	AND ga_id_absence_motif = #1 '.
135
							'	AND ga_id_absence_motif = #1 '.
136
							'	AND ga_id_date_absence = #2 ';
136
							'	AND ga_id_date_absence = #2 ';
137
				break;
137
				break;
138
			case Absence::GA_ID_ABSENCE_MOTIF:
138
			case Absence::GA_ID_ABSENCE_MOTIF:
139
				$requete = 	'SELECT * '.
139
				$requete = 	'SELECT * '.
140
							'FROM gestion_absence '.
140
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '.
141
							'WHERE ga_id_absence_motif = #0 ';
141
							'WHERE ga_id_absence_motif = #0 ';
142
				break;
142
				break;
143
			case Absence::GA_ID_UTILISATEUR:
143
			case Absence::GA_ID_UTILISATEUR:
144
				$requete = 	'SELECT * '.
144
				$requete = 	'SELECT * '.
145
							'FROM gestion_absence '.
145
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '.
146
							'WHERE ga_id_utilisateur = #0 ';
146
							'WHERE ga_id_utilisateur = #0 ';
147
				break;
147
				break;
148
			case Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN:
148
			case Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN:
149
				$requete = 	'SELECT * '.
149
				$requete = 	'SELECT * '.
150
							'FROM gestion_absence '.
150
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '.
151
							'WHERE ga_id_utilisateur = #0 '.
151
							'WHERE ga_id_utilisateur = #0 '.
152
							'	AND ga_id_date_absence >= "#1" '.
152
							'	AND ga_id_date_absence >= "#1" '.
153
							'	AND ga_id_date_absence <= "#2" ';
153
							'	AND ga_id_date_absence <= "#2" ';
154
				break;
154
				break;
155
			case Absence::GA_ID_MAX_UTILISATEUR:
155
			case Absence::GA_ID_MAX_UTILISATEUR:
156
				$requete =	'SELECT MAX(ga_id_utilisateur) '.
156
				$requete =	'SELECT MAX(ga_id_utilisateur) '.
157
							'FROM gestion_absence ';
157
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence ';
158
				break;
158
				break;
159
			case Absence::GA_ID_MAX_ABSENCE_MOTIF:
159
			case Absence::GA_ID_MAX_ABSENCE_MOTIF:
160
				$requete =	'SELECT MAX(ga_id_absence_motif) '.
160
				$requete =	'SELECT MAX(ga_id_absence_motif) '.
161
							'FROM gestion_absence ';
161
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence ';
162
				break;
162
				break;
163
			case Absence::GA_ID_MAX_DATE_ABSENCE:
163
			case Absence::GA_ID_MAX_DATE_ABSENCE:
164
				$requete =	'SELECT MAX(ga_id_date_absence) '.
164
				$requete =	'SELECT MAX(ga_id_date_absence) '.
165
							'FROM gestion_absence ';
165
							'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence ';
166
				break;
166
				break;
167
			default :
167
			default :
168
				$message = 'Commande '.$cmd.'inconnue!';
168
				$message = 'Commande '.$cmd.'inconnue!';
169
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
169
				$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
170
    			trigger_error($e, E_USER_ERROR);
170
    			trigger_error($e, E_USER_ERROR);
171
		}
171
		}
172
		return parent::consulter($requete, $parametres, $instancier);
172
		return parent::consulter($requete, $parametres, $instancier);
173
	}
173
	}
174
}
174
}
175
 
175
 
176
/* +--Fin du code ----------------------------------------------------------------------------------------+
176
/* +--Fin du code ----------------------------------------------------------------------------------------+
177
*
177
*
178
* $Log$
178
* $Log$
179
*
179
*
180
* +-- Fin du code ----------------------------------------------------------------------------------------+
180
* +-- Fin du code ----------------------------------------------------------------------------------------+
181
*/
181
*/
182
?>
182
?>
183
183