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 TravailProjet
|
|
|
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 |
/**
|
104 |
jpm |
44 |
* class TravailProjet : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
|
|
|
45 |
* classe métier
|
10 |
jpm |
46 |
*/
|
|
|
47 |
class TravailProjet extends aGttSql {
|
|
|
48 |
/*** Constantes : */
|
11 |
jpm |
49 |
const GTP_ID = 'TRAVAILPROJET_ID';
|
|
|
50 |
const GTP_ID_UTILISATEUR_DATE_DEB_FIN = 'TRAVAILPROJET_ID_UTILISATEUR_DATE';
|
10 |
jpm |
51 |
const GTP_ID_MAX_UTILISATEUR = 'TRAVAILPROJET_ID_MAX_UTILISATEUR';
|
|
|
52 |
const GTP_ID_MAX_PROJET = 'TRAVAILPROJET_ID_MAX_PROJET';
|
|
|
53 |
const GTP_ID_MAX_DATE_TRAVAIL = 'TRAVAILPROJET_ID_MAX_DATE_TRAVAIL';
|
71 |
jpm |
54 |
const GTP_PROJET = 'TRAVAILPROJET_ID_PROJET';
|
95 |
jpm |
55 |
const GTP_UTILISATEUR = 'TRAVAILPROJET_ID_UTILISATEUR';
|
71 |
jpm |
56 |
|
10 |
jpm |
57 |
/*** Attributs : */
|
|
|
58 |
private $id_utilisateur;
|
|
|
59 |
private $id_projet;
|
|
|
60 |
private $id_date_travail;
|
|
|
61 |
private $duree;
|
12 |
jpm |
62 |
|
10 |
jpm |
63 |
/*** Aggregations : */
|
|
|
64 |
|
|
|
65 |
/*** Constructeur : */
|
|
|
66 |
public function __construct($cmd = null, $parametres = null)
|
|
|
67 |
{
|
|
|
68 |
$this->dao_table_nom = 'gestion_travail_projet';
|
|
|
69 |
$this->dao_correspondance = array(
|
|
|
70 |
'gtp_id_utilisateur' => 'id_utilisateur',
|
|
|
71 |
'gtp_id_projet' => 'id_projet',
|
|
|
72 |
'gtp_id_date_travail' => 'id_date_travail',
|
|
|
73 |
'gtp_duree' => 'duree');
|
12 |
jpm |
74 |
|
104 |
jpm |
75 |
// Si l'on veut remplir l'objet à la création on lance la requete correspondante
|
10 |
jpm |
76 |
if (!is_null($cmd)) {
|
|
|
77 |
$this->consulter($cmd, $parametres, true);
|
|
|
78 |
}
|
|
|
79 |
}
|
12 |
jpm |
80 |
|
10 |
jpm |
81 |
/*** Accesseurs : */
|
|
|
82 |
// Id Utilisateur
|
|
|
83 |
public function getIdUtilisateur()
|
|
|
84 |
{
|
|
|
85 |
return $this->id_utilisateur;
|
|
|
86 |
}
|
|
|
87 |
public function setIdUtilisateur( $iu )
|
|
|
88 |
{
|
|
|
89 |
$this->id_utilisateur = $iu;
|
|
|
90 |
}
|
12 |
jpm |
91 |
|
10 |
jpm |
92 |
// Id Projet
|
|
|
93 |
public function getIdProjet()
|
|
|
94 |
{
|
|
|
95 |
return $this->id_projet;
|
|
|
96 |
}
|
|
|
97 |
public function setIdProjet( $ip )
|
|
|
98 |
{
|
|
|
99 |
$this->id_projet = $ip;
|
|
|
100 |
}
|
12 |
jpm |
101 |
|
10 |
jpm |
102 |
// Id Date Travail
|
|
|
103 |
public function getIdDateTravail()
|
|
|
104 |
{
|
|
|
105 |
return $this->id_date_travail;
|
|
|
106 |
}
|
|
|
107 |
public function setIdDateTravail( $idt )
|
|
|
108 |
{
|
|
|
109 |
$this->id_date_travail = $idt;
|
|
|
110 |
}
|
12 |
jpm |
111 |
|
10 |
jpm |
112 |
// Duree
|
|
|
113 |
public function getDuree()
|
|
|
114 |
{
|
|
|
115 |
return $this->duree;
|
|
|
116 |
}
|
|
|
117 |
public function setDuree( $d )
|
|
|
118 |
{
|
|
|
119 |
$this->duree = $d;
|
|
|
120 |
}
|
12 |
jpm |
121 |
|
104 |
jpm |
122 |
/*** Méthodes : */
|
10 |
jpm |
123 |
|
|
|
124 |
/**
|
|
|
125 |
* Consulter la table gestion_travail_projet.
|
|
|
126 |
* @return mixed un tableau d'objets TravailProjet s'il y en a plusieurs, l'objet TravailProjet s'il y en a 1 seul sinon false.
|
|
|
127 |
*/
|
|
|
128 |
public function consulter($cmd = '', $parametres = array(), $instancier = false)
|
|
|
129 |
{
|
|
|
130 |
switch ($cmd) {
|
|
|
131 |
case TravailProjet::GTP_ID:
|
|
|
132 |
$requete = 'SELECT * '.
|
|
|
133 |
'FROM gestion_travail_projet '.
|
90 |
jpm |
134 |
'WHERE gtp_id_utilisateur = #0 '.
|
|
|
135 |
' AND gtp_id_projet = #1 '.
|
|
|
136 |
' AND gtp_id_date_travail = "#2" ';
|
10 |
jpm |
137 |
break;
|
11 |
jpm |
138 |
case TravailProjet::GTP_ID_UTILISATEUR_DATE_DEB_FIN:
|
|
|
139 |
$requete = 'SELECT * '.
|
|
|
140 |
'FROM gestion_travail_projet '.
|
90 |
jpm |
141 |
'WHERE gtp_id_utilisateur = #0 '.
|
|
|
142 |
' AND gtp_id_date_travail >= "#1" '.
|
|
|
143 |
' AND gtp_id_date_travail <= "#2" ';
|
11 |
jpm |
144 |
break;
|
10 |
jpm |
145 |
case TravailProjet::GTP_ID_MAX_UTILISATEUR:
|
|
|
146 |
$requete = 'SELECT MAX(gtp_id_utilisateur) '.
|
|
|
147 |
'FROM gestion_travail_projet ';
|
|
|
148 |
break;
|
|
|
149 |
case TravailProjet::GTP_ID_MAX_PROJET:
|
|
|
150 |
$requete = 'SELECT MAX(gtp_id_projet) '.
|
|
|
151 |
'FROM gestion_travail_projet ';
|
|
|
152 |
break;
|
|
|
153 |
case TravailProjet::GTP_ID_MAX_DATE_TRAVAIL:
|
|
|
154 |
$requete = 'SELECT MAX(gtp_id_date_travail) '.
|
|
|
155 |
'FROM gestion_travail_projet ';
|
11 |
jpm |
156 |
break;
|
71 |
jpm |
157 |
case TravailProjet::GTP_PROJET:
|
|
|
158 |
$requete = 'SELECT gtp_id_projet '.
|
|
|
159 |
'FROM gestion_travail_projet '.
|
90 |
jpm |
160 |
'WHERE gtp_id_projet = #0 ';
|
71 |
jpm |
161 |
break;
|
95 |
jpm |
162 |
case TravailProjet::GTP_UTILISATEUR:
|
|
|
163 |
$requete = 'SELECT gtp_id_utilisateur '.
|
|
|
164 |
'FROM gestion_travail_projet '.
|
|
|
165 |
'WHERE gtp_id_utilisateur = #0 ';
|
|
|
166 |
break;
|
10 |
jpm |
167 |
default :
|
11 |
jpm |
168 |
$message = 'Commande '.$cmd.' inconnue!';
|
10 |
jpm |
169 |
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
|
|
|
170 |
trigger_error($e, E_USER_ERROR);
|
|
|
171 |
}
|
90 |
jpm |
172 |
return parent::consulter($requete, $parametres, $instancier);
|
10 |
jpm |
173 |
}
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
177 |
*
|
|
|
178 |
* $Log$
|
|
|
179 |
*
|
|
|
180 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
181 |
*/
|
|
|
182 |
?>
|