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_FN_GENERIQUE_AFFICHAGE;
include_once CHEMIN_MENU.'gtt_menu_admin_motif_absence.php';
/**
*fonction traitantg l'ajout des motifs dans la base de donnees
*/
function traiterAjoutermotif()
{
if (isset($_POST["champ_valider_motif"]))
{
$i=&Motif::nextId();
$tableau=array(GEST_CHAMPS_ID_MOTIF =>$i,
GEST_CHAMPS_LIBELLE_MOTIF=>$_POST["champ_nom_motif"],
GEST_CHAMPS_TYPE_RTT=>0);
if (isset($_POST["champ_rtt"]))
{
$tableau[GEST_CHAMPS_TYPE_RTT]=1;
}
$mot=new Motif($i);
$mot->ConstruireMotif($tableau);
$j =$mot->enregistrerMotif();
}
$_POST["champ_valider_motif"]='dejaValider';
$_POST["champ_nom_motif"]='';
}
/**
*fonction traitant la supression des motifs d'absence
*/
function traiterSupprimerMotif()
{
if (isset($_POST["btn_supprimer_motif"]))
{
$identifiant=$_POST["champ_motif_supprimer"];
$g=&Motif::motifUtilise($identifiant);
if ($g!=1)
{
$j=&Motif::supprimerMotif($identifiant);
}else $j=0;
if ($j==0)
{
echo "echec supression";
}
}
$_POST["btn_supprimer_motif"]='dejaValider';
$_POST["champ_motif_supprimer"]='';
}
/**
*fonction verifiant si le motif d'absence est en cours d'utilisation
*la suppression sera interdite dans ce cas afin de maintenir la cohérence de
*de la base de donnees
*/
function verifMotifUtilise()
{
$identifiant=$_POST["champ_motif_supprimer"];
$verif=&Motif::motifUtilise($identifiant);
if ($verif==1)return false;
else return true;
}
/**
*fonction traitant le menu admin motif absence
*/
function traiterAdminMotif()
{
$text=creerEntetePage(GESTION_ADMIN_MOTIF_L);
//cas de l'ajout
$form=afficherMenuAjouterMotif();
if (isset($_POST["champ_valider_motif"]) and $_POST["champ_valider_motif"]!='dejaValider' and $form->validate())
{
$form->process('traiterAjouterMotif');
$m=afficherMenuAjouterMotif();
$text.=$m->ToHTml();
}else
{
$text.=$form->ToHtml();
}
//cas supression
$forms=afficherMenuSupressionMotif();
if (isset($_POST["btn_supprimer_motif"]) and $_POST["btn_supprimer_motif"]!='dejaValider' and $forms->validate())
{
$forms->process('traiterSupprimerMotif');
$m=afficherMenuSupressionMotif();
$text.=$m->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;
}
?>