Rev 2 | Blame | Last modification | View Log | RSS feed
<?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 contenant le menu principal de l'application de gestion du temps de travail
*@package gtt_general
//Auteur original :
*@author Dorian Bannier <dbannier@aol.com>
//Autres auteurs :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Copyright (C) 2003 Tela-Botanica
*/
// +------------------------------------------------------------------------------------------------------+
include_once CHEMIN_MENU.'gtt_menu_admin_categorie.php';
/**
*fonction traitant l'ajout d'une categorie
*/
function ajouterCategorie()
{
if (isset($_POST["champ_valider_cat"]))
{
$i=&Categorie::nextId();
$c=new Categorie($i);
$c->setLibelleCategorie($_POST["champ_nom_cat"]);
$j= $c->enregistrerNewCategorie();
if ($j!=1) echo "echec";
}
$_POST["champ_valider_cat"]='dejaValider';
$_POST["champ_nom_cat"]='';
}
/**
*fonction effectuant la suppression d'une categorie
*/
function traiterSupprimerCategorie()
{
if (isset($_POST["btn_supprimer_cat"]))
{
$identifiant=$_POST["champ_cat_supprimer"];
//verification si la categorie ne contient pas de projets
$verif=&Categorie::contientProjet($identifiant);
if($verif!=1)
{
$b=&Categorie::supprimerCategorie($identifiant);
}else $b=0;
if ($b==0)
{
echo "echec supression";
}
}
$_POST["champ_cat_supprimer"]='';
$_POST["btn_supprimer_cat"]='essai';
}
/**fonction traitant toutesles actions du menu admin categorie
*/
function traiterAdminCategorie()
{
$text=creerEntetePage(GESTION_ADMIN_CATEGORIE_L);
//cas de l'ajout
$form=afficherMenuAjouterCategorie();
if (isset($_POST["champ_valider_cat"]) and $_POST["champ_valider_cat"]!='dejaValider' and $form->validate())
{
$form->process('ajouterCategorie');
$t=afficherMenuAjouterCategorie();
$text.=$t->ToHTml();
}else
{
$text.=$form->ToHtml();
}
//cas supression
$forms=afficherMenuSupressionCategorie();
if (isset($_POST["btn_supprimer_cat"]) and $_POST["btn_supprimer_cat"]!='essai' and $forms->validate())
{
$forms->process('traiterSupprimerCategorie');
$j=afficherMenuSupressionCategorie();
$text.=$j->ToHtml();
}else
{
$text.=$forms->ToHtml();
}
//affichage des options d'administration
$formp=creerFormulaireOptionAdmin();
$text.=$formp->ToHtml();
//affichage des options disponibles pour l'utilisateur courant
$text.=afficherOptionAplication($GLOBALS['idCurrentUser']);
return $text;
}
/**
*fonction verifiant si la categorie ne contient pas de
projets
*/
function verifContientProjet()
{
$identifiant=$_POST["champ_cat_supprimer"];
$verif=&Categorie::contientProjet($identifiant);
if ($verif==1)return false;
else return true;
}
?>