New file |
0,0 → 1,174 |
<?php |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This library is free software; you can redistribute it and/or | |
// | modify it under the terms of the GNU Lesser General Public | |
// | License as published by the Free Software Foundation; either | |
// | version 2.1 of the License, or (at your option) any later version. | |
// | | |
// | This library 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 | |
// | Lesser General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU Lesser General Public | |
// | License along with $this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
|
// |@author ABDOOL RAHEEM shaheen shaheenar50@hotmail.com | |
// |@version 3 | |
|
//fichier langues |
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php'; |
//classe projet |
include_once CHEMIN_CLASSES_METIER.'gtt_projet.class.php'; |
|
class Tache |
{ |
var $_id_tache; |
var $_nom_tache; |
var $_description_tache; |
var $_date_debut_tache; |
var $_duree_prevue_tache; |
var $_duree_reelle_tache; |
var $_avancement_tache; |
|
//identifiant du projet auquel il appartient |
var $_projet; |
/*tableau des predecesseurs */ |
var $_tab_pred= array (); |
/*tableau des sucesseurs */ |
var $_tab_succ= array (); |
/** |
*constructeur |
*/ |
function Tache($id) |
{ |
$this->_id_tache=$id; |
} |
/** |
*fonction construisant une nouvelle tache |
*avec que les options obligatoires |
*@param : id : identifiant de la tache |
*@param : proj: identifiant du projet |
*@pâram : nom de la tache |
*/ |
function construireDefaultTache($proj,$nom) |
{ |
$this->_id_tache=&Tache::nextId(); |
$this->_projet=$proj; |
$this->_nom_tache=$nom; |
$p=&Projet::recupererProjet($proj); |
$this->_date_debut_tache=$p->getDateDeb(); |
$this->_duree_prevue_tache=$p->getDureePrevue(); |
|
} |
|
/** |
*enregistre une nouvelle tache par defaut |
*dasn la base de donnees |
*renvoie 1 si tache enregistree |
*0 si pas d'enregistrement |
*-1 si erreur |
*/ |
function enregistrerNewDefaultTache() |
{ |
$table =GEST_TACHES; |
//Verification si identifiant deja attribue |
|
$b=&Tache::nextId(); |
$this->_id_tache=$b; |
|
$champs = array( |
GEST_CHAMPS_ID_TACHE => $this->_id_tache, |
GEST_CHAMPS_ID_PROJET=>$this->_projet, |
GEST_CHAMPS_NOM_TACHE=> "$this->_nom_tache", |
GEST_CHAMPS_DATE_DEB_TACHE=> $this->_date_debut_tache, |
GEST_CHAMPS_DUREE_PREVUE_TACHE=>$this->_duree_prevue_tache); |
|
|
$resultat = $GLOBALS['db']->autoExecute($table, $champs, DB_AUTOQUERY_INSERT); |
|
if (DB::isError($resultat)) { |
die($resultat->getMessage()); |
} |
|
$j=$GLOBALS['db']->affectedRows(); |
switch ($j) |
{ |
case 1 : return 1; |
case 0 :return 0; |
default :return -1; |
} |
} |
|
/** |
*recupere l'identifiant de la tache par defaut |
*renvoie l'identifiant si aucune erreur |
*-1 si erreur |
*/ |
function recupererIdentifiantDefaultTache() |
{ |
$requete="SELECT ".GEST_CHAMPS_ID_TACHE. |
" FROM ".GEST_TACHES. |
" WHERE ".GEST_CHAMPS_NOM_TACHE." = \"".GESTION_NOM_TACHE_DEFAUT_L."\""; |
|
$resultat = $GLOBALS['db']->query($requete); |
|
(DB::isError($resultat)) ? |
die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '' ; |
|
$res = $resultat->fetchRow(DB_FETCHMODE_ORDERED); |
$j=$resultat->numRows(); |
if ($j==1) |
{ |
return $res[0]; |
}else return -1; |
} |
|
|
/** |
*supprime une tache de la base de donnees |
*@param $id_projet : supprime une tache a partir de l'identifiant |
*de la tache |
*/ |
function supprimerTache($id_tache) |
{ |
|
} |
|
|
|
|
/** |
* met a jour l'etat d'avancement d'une tache |
*/ |
|
function setAvancement($avanc) |
{ |
$this->avancement_tache=$avanc; |
} |
|
/** |
*recupere l'identifiant de la prochaine categorie |
*de la base de donnees |
*/ |
|
function nextId() |
{ |
$requete = 'SELECT MAX('.GEST_CHAMPS_ID_TACHE.') AS maxi FROM '.GEST_TACHES; |
$resultat = $GLOBALS['db']->query($requete); |
if (DB::isError($resultat) || $resultat->numRows() > 1) { |
return false; |
} |
|
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT); |
return $ligne->maxi + 1; |
} |
|
} |
?> |
Property changes: |
Added: svn:executable |