Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 83 → Rev 82

/trunk/bibliotheque/metier/TravailTache.class.php
New file
0,0 → 1,184
<?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 TravailTache
*
* 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 TravailTache : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
* classe métier
*/
class TravailTache extends aGttSql {
/*** Constantes : */
const GTT_ID = 'TRAVAILTACHE_ID';
const GTT_ID_MAX_UTILISATEUR = 'TRAVAILTACHE_ID_MAX_UTILISATEUR';
const GTT_ID_MAX_TACHE = 'TRAVAILTACHE_ID_MAX_TACHE';
const GTT_ID_MAX_DATE_TRAVAIL = 'TRAVAILTACHE_ID_MAX_DATE_TRAVAIL';
 
/*** Attributs : */
private $id_utilisateur;
private $id_tache;
private $id_date_travail;
private $duree;
 
/*** Aggregations : */
 
/*** Constructeur : */
public function __construct($cmd = null, $parametres = null)
{
$this->dao_table_nom = 'gestion_travail_tache';
$this->dao_correspondance = array(
'gtt_id_utilisateur' => 'id_utilisateur',
'gtt_id_tache' => 'id_tache',
'gtt_id_date_travail' => 'id_date_travail',
'gtt_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 Tache
public function getIdTache()
{
return $this->id_tache;
}
public function setIdTache( $it )
{
$this->id_tache = $it;
}
 
// Id Date Travail
public function getIdDateTravail()
{
return $this->id_date_travail;
}
public function setIdDateTravail( $idt )
{
$this->id_date_travail = $idt;
}
 
// Duree
public function getDuree()
{
return $this->duree;
}
public function setDuree( $d )
{
$this->duree = $d;
}
 
/*** Méthodes : */
 
/**
* Consulter la table gestion_travail_tache.
* @return mixed un tableau d'objets TravailTache s'il y en a plusieurs, l'objet TravailTache s'il y en a 1 seul sinon false.
*/
public function consulter($cmd = '', $parametres = array(), $instancier = false)
{
if (!is_array($parametres)) {
$parametres[0] = $parametres;
}
switch ($cmd) {
case TravailTache::GTT_ID:
$requete = 'SELECT * '.
'FROM gestion_travail_tache '.
'WHERE gtt_id_utilisateur = '.$parametres[0].' AND gtt_id_tache = '.$parametres[1].' AND gtt_id_date_travail = '.$parametres[2].' ';
break;
case TravailTache::GTT_ID_MAX_UTILISATEUR:
$requete = 'SELECT MAX(gtt_id_utilisateur) '.
'FROM gestion_travail_tache ';
break;
case TravailTache::GTT_ID_MAX_TACHE:
$requete = 'SELECT MAX(gtt_id_tache) '.
'FROM gestion_travail_tache ';
break;
case TravailTache::GTT_ID_MAX_DATE_TRAVAIL:
$requete = 'SELECT MAX(gtt_id_date_travail) '.
'FROM gestion_travail_tache ';
break;
default :
$message = 'Commande '.$cmd.'inconnue!';
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
trigger_error($e, E_USER_ERROR);
}
 
$resultat = $GLOBALS['db']->query($requete);
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
$tab_resultat = array();
while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
}
 
$resultat_nbre = count($tab_resultat);
if ($resultat_nbre > 1) {
return $tab_resultat;
} else if ($resultat_nbre == 1) {
return $tab_resultat[0];
} else if ($resultat_nbre == 0) {
return false;
}
}
 
/** Afficher l'objet TravailTache */
function afficherTravailTache()
{
echo '<pre>'.print_r($this, true).'</pre>';
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/trunk/bibliotheque/metier/ProjetTache.class.php
New file
0,0 → 1,228
<?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 ProjetTache
*
* 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 ProjetTache : est à la fois le DAO et le conteneur de la table gestion_utilisateur.
* classe métier
*/
class ProjetTache extends aGttSql {
/*** Constantes : */
const GPT_ID = 'PROJETTACHE_ID';
const GPT_ID_MAX = 'PROJETTACHE_ID_MAX';
const GPT_PROJET = 'PROJETTACHE_ID_PROJET';
/*** Attributs : */
private $id_tache;
private $ce_tache_precedente;
private $ce_projet;
private $libelle;
private $description;
private $date_debut;
private $duree_prevue;
private $avancement;
 
/*** Aggregations : */
 
/*** Constructeur : */
public function __construct($cmd = null, $parametres = null)
{
$this->dao_table_nom = 'gestion_projet_tache';
$this->dao_correspondance = array(
'gpt_id_tache' => 'id_tache',
'gpt_ce_tache_precedente' => 'ce_tache_precedente',
'gpt_ce_projet' => 'ce_projet',
'gpt_libelle' => 'libelle',
'gpt_description' => 'description',
'gpt_date_debut' => 'date_debut',
'gpt_duree_prevue' => 'duree_prevue',
'gpt_avancement' => 'avancement');
 
// 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 Tache
public function getIdTache()
{
return $this->id_tache;
}
public function setIdTache( $it )
{
$this->id_tache = $it;
}
 
// Ce Tache Precedente
public function getCeTachePrecedente()
{
return $this->ce_tache_precedente;
}
public function setCeTachePrecedente( $ctp )
{
$this->ce_tache_precedente = $ctp;
}
 
// Ce Projet
public function getCeProjet()
{
return $this->ce_projet;
}
public function setCeProjet( $cp )
{
$this->ce_projet = $cp;
}
 
// Libelle
public function getLibelle()
{
return $this->libelle;
}
public function setLibelle( $l )
{
$this->libelle = $l;
}
 
// Description
public function getDescription()
{
return $this->description;
}
public function setDescription( $d )
{
$this->description = $d;
}
 
// Date Debut
public function getDateDebut()
{
return $this->date_debut;
}
public function setDateDebut( $dd )
{
$this->date_debut = $dd;
}
 
// Duree Prevue
public function getDureePrevue()
{
return $this->duree_prevue;
}
public function setDureePrevue( $dp )
{
$this->duree_prevue = $dp;
}
 
// Avancement
public function getAvancement()
{
return $this->avancement;
}
public function setAvancement( $a )
{
$this->avancement = $a;
}
 
/*** Méthodes : */
 
/**
* Consulter la table gestion_projet_tache.
* @return mixed un tableau d'objets ProjetTache s'il y en a plusieurs, l'objet ProjetTache s'il y en a 1 seul sinon false.
*/
public function consulter($cmd = '', $parametres = array(), $instancier = false)
{
if (!is_array($parametres)) {
$parametres[0] = $parametres;
}
switch ($cmd) {
case ProjetTache::GPT_ID:
$requete = 'SELECT * '.
'FROM gestion_projet_tache '.
'WHERE gpt_id_tache = '.$parametres[0].' ';
break;
case ProjetTache::GPT_ID_MAX:
$requete = 'SELECT MAX(gpt_id_tache) '.
'FROM gestion_projet_tache ';
break;
case ProjetTache::GPT_PROJET:
$requete = 'SELECT gpt_ce_projet '.
'FROM gestion_projet_tache '.
'WHERE gpt_ce_projet = '.$parametres[0];
break;
default :
$message = 'Commande '.$cmd.'inconnue!';
$e = GestionnaireErreur::formaterMessageErreur(__FILE__, __LINE__, $message);
trigger_error($e, E_USER_ERROR);
}
 
$resultat = $GLOBALS['db']->query($requete);
(DB::isError($resultat)) ? die (GestionnaireErreur::retournerErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ;
$tab_resultat = array();
while ($donnees =& $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$tab_resultat[] = $this->basculerEnregistrementObjet($donnees, $instancier);
}
 
$resultat_nbre = count($tab_resultat);
if ($resultat_nbre > 1) {
return $tab_resultat;
} else if ($resultat_nbre == 1) {
return $tab_resultat[0];
} else if ($resultat_nbre == 0) {
return false;
}
}
 
/** Afficher l'objet ProjetTache */
function afficherProjetTache()
{
echo '<pre>'.print_r($this, true).'</pre>';
}
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>