Subversion Repositories Applications.gtt

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 jpm 1
<?php
2
 
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// |@author ABDOOL RAHEEM shaheen   shaheenar50@hotmail.com                                                 |
23
// |@version 3                                                                                            |
24
 
25
// +------------------------------------------------------------------------------------------------------+
26
/*
27
*fichier contenant le menu principal de l'application de gestion du temps de travail
28
*@package gtt_general
29
//Auteur original :
30
*@author        Dorian Bannier <dbannier@aol.com>
31
//Autres auteurs :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
*@copyright     Copyright (C) 2003 Tela-Botanica
34
*/
35
// +------------------------------------------------------------------------------------------------------+
36
include_once CHEMIN_MENU.'gtt_menu_admin_motif_absence.php';
37
 
38
/**
39
*fonction traitantg l'ajout des motifs dans la base de donnees
40
*/
41
function traiterAjoutermotif()
42
{
43
if (isset($_POST["champ_valider_motif"]))
44
{
45
  $i=&Motif::nextId();
46
 
47
  $tableau=array(GEST_CHAMPS_ID_MOTIF =>$i,
48
                 GEST_CHAMPS_LIBELLE_MOTIF=>$_POST["champ_nom_motif"],
49
                 GEST_CHAMPS_TYPE_RTT=>0);
50
  if (isset($_POST["champ_rtt"]))
51
   {
52
       $tableau[GEST_CHAMPS_TYPE_RTT]=1;
53
   }
54
 
55
  $mot=new Motif($i);
56
  $mot->ConstruireMotif($tableau);
57
  $j =$mot->enregistrerMotif();
58
 }
59
 $_POST["champ_valider_motif"]='dejaValider';
60
 $_POST["champ_nom_motif"]='';
61
 
62
}
63
 
64
 /**
65
 *fonction traitant la supression des motifs d'absence
66
 */
67
 
68
 function traiterSupprimerMotif()
69
 {
70
   if (isset($_POST["btn_supprimer_motif"]))
71
  {
72
    $identifiant=$_POST["champ_motif_supprimer"];
73
    $g=&Motif::motifUtilise($identifiant);
74
    if ($g!=1)
75
    {
76
    $j=&Motif::supprimerMotif($identifiant);
77
    }else $j=0;
78
    if ($j==0)
79
    {
80
    echo "echec supression";
81
    }
82
  }
83
  $_POST["btn_supprimer_motif"]='dejaValider';
84
  $_POST["champ_motif_supprimer"]='';
85
 }
86
 
87
   /**
88
   *fonction verifiant si le motif d'absence est en cours d'utilisation
89
   *la suppression sera interdite dans ce cas afin de maintenir la cohérence de
90
   *de la base de donnees
91
   */
92
 
93
   function verifMotifUtilise()
94
   {
95
     $identifiant=$_POST["champ_motif_supprimer"];
96
     $verif=&Motif::motifUtilise($identifiant);
97
     if ($verif==1)return false;
98
    else return true;
99
 
100
   }
101
 
102
/**
103
*fonction traitant le menu admin motif absence
104
*/
105
 
106
function traiterAdminMotif()
107
{
108
  $text=creerEntetePage(GESTION_ADMIN_MOTIF_L);
109
  //cas de l'ajout
110
  $form=afficherMenuAjouterMotif();
111
  if (isset($_POST["champ_valider_motif"]) and $_POST["champ_valider_motif"]!='dejaValider' and $form->validate())
112
   {
113
        $form->process('traiterAjouterMotif');
114
	$m=afficherMenuAjouterMotif();
115
	$text.=$m->ToHTml();
116
   }else
117
   {
118
	$text.=$form->ToHtml();
119
   }
120
 
121
   //cas supression
122
   $forms=afficherMenuSupressionMotif();
123
   if (isset($_POST["btn_supprimer_motif"]) and $_POST["btn_supprimer_motif"]!='dejaValider' and  $forms->validate())
124
   {
125
        $forms->process('traiterSupprimerMotif');
126
	$m=afficherMenuSupressionMotif();
127
	$text.=$m->ToHTml();
128
   }else{
129
       $text.=$forms->ToHtml();
130
   }
131
   //affichage des options d'administration
132
 
133
    $formp=creerFormulaireOptionAdmin();
134
    $text.=$formp->ToHtml();
135
 
136
      //affichage des options disponibles pour l'utilisateur courant
137
    $text.=afficherOptionAplication($GLOBALS['idCurrentUser']);
138
 
139
 
140
   return $text;
141
}
142
?>