New file |
0,0 → 1,182 |
<?php |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 5.1.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of eFlore. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id$ |
/** |
* Classe Absence |
* |
* Description |
* |
*@package eFlore |
*@subpackage modele |
//Auteur original : |
*@version 3 |
*@author Shaheen ABDOOL RAHEEM <shaheenar50@hotmail.com> |
//Autres auteurs : |
*@version 4 |
*@author Jean-Pascal MILCENT <jpm@clapas.org> |
*@author aucun |
*@copyright Tela-Botanica 2000-2006 |
*@version $Revision$ $Date$ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
/** |
* class Absence : est à la fois le DAO et le conteneur de la table gestion_utilisateur. |
* classe métier |
*/ |
class Absence extends aGttSql { |
/*** Constantes : */ |
const GA_ID = 'ABSENCE_ID'; |
const GA_ID_ABSENCE_MOTIF = 'ABSENCE_ID_ABSENCE_MOTIF'; |
const GA_ID_UTILISATEUR = 'ABSENCE_ID_UTILISATEUR'; |
const GA_ID_UTILISATEUR_DATE_DEB_FIN = 'ABSENCE_ID_UTILISATEUR_DATE_DEB_FIN'; |
const GA_ID_MAX_UTILISATEUR = 'ABSENCE_ID_MAX_UTILISATEUR'; |
const GA_ID_MAX_ABSENCE_MOTIF = 'ABSENCE_ID_MAX_ABSENCE_MOTIF'; |
const GA_ID_MAX_DATE_ABSENCE = 'ABSENCE_ID_MAX_DATE_ABSENCE'; |
|
/*** Attributs : */ |
private $id_utilisateur; |
private $id_absence_motif; |
private $id_date_absence; |
private $duree; |
|
/*** Aggregations : */ |
|
/*** Constructeur : */ |
public function __construct($cmd = null, $parametres = null) |
{ |
$this->dao_table_nom = GTT_BDD_PREFIXE . 'gestion_absence'; |
$this->dao_correspondance = array( |
'ga_id_utilisateur' => 'id_utilisateur', |
'ga_id_absence_motif' => 'id_absence_motif', |
'ga_id_date_absence' => 'id_date_absence', |
'ga_duree' => 'duree'); |
|
// Si l'on veut remplir l'objet à la création on lance la requete correspondante |
if (!is_null($cmd)) { |
$this->consulter($cmd, $parametres, true); |
} |
} |
|
/*** Accesseurs : */ |
// Id Utilisateur |
public function getIdUtilisateur() |
{ |
return $this->id_utilisateur; |
} |
public function setIdUtilisateur( $iu ) |
{ |
$this->id_utilisateur = $iu; |
} |
|
// Id Absence Motif |
public function getIdAbsenceMotif() |
{ |
return $this->id_absence_motif; |
} |
public function setIdAbsenceMotif( $iam ) |
{ |
$this->id_absence_motif = $iam; |
} |
|
// Id Date Absence |
public function getIdDateAbsence() |
{ |
return $this->id_date_absence; |
} |
public function setIdDateAbsence( $ida ) |
{ |
$this->id_date_absence = $ida; |
} |
|
// Duree |
public function getDuree() |
{ |
return $this->duree; |
} |
public function setDuree( $d ) |
{ |
$this->duree = $d; |
} |
|
/*** Méthodes : */ |
|
/** |
* Consulter la table gestion_absence. |
* @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. |
*/ |
public function consulter($cmd = '', $parametres = array(), $instancier = false) |
{ |
switch ($cmd) { |
case Absence::GA_ID: |
$requete = 'SELECT * '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '. |
'WHERE ga_id_utilisateur = #0 '. |
' AND ga_id_absence_motif = #1 '. |
' AND ga_id_date_absence = #2 '; |
break; |
case Absence::GA_ID_ABSENCE_MOTIF: |
$requete = 'SELECT * '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '. |
'WHERE ga_id_absence_motif = #0 '; |
break; |
case Absence::GA_ID_UTILISATEUR: |
$requete = 'SELECT * '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '. |
'WHERE ga_id_utilisateur = #0 '; |
break; |
case Absence::GA_ID_UTILISATEUR_DATE_DEB_FIN: |
$requete = 'SELECT * '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '. |
'WHERE ga_id_utilisateur = #0 '. |
' AND ga_id_date_absence >= "#1" '. |
' AND ga_id_date_absence <= "#2" '; |
break; |
case Absence::GA_ID_MAX_UTILISATEUR: |
$requete = 'SELECT MAX(ga_id_utilisateur) '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '; |
break; |
case Absence::GA_ID_MAX_ABSENCE_MOTIF: |
$requete = 'SELECT MAX(ga_id_absence_motif) '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '; |
break; |
case Absence::GA_ID_MAX_DATE_ABSENCE: |
$requete = 'SELECT MAX(ga_id_date_absence) '. |
'FROM ' . GTT_BDD_PREFIXE . 'gestion_absence '; |
break; |
default : |
$message = 'Commande '.$cmd.'inconnue!'; |
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message); |
trigger_error($e, E_USER_ERROR); |
} |
return parent::consulter($requete, $parametres, $instancier); |
} |
} |
|
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log$ |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |