Subversion Repositories Applications.gtt

Rev

Go to most recent revision | Details | 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_FN_GENERIQUE_AFFICHAGE;
37
include_once CHEMIN_MENU.'gtt_menu_admin_motif_absence.php';
38
 
39
/**
40
*fonction traitantg l'ajout des motifs dans la base de donnees
41
*/
42
function traiterAjoutermotif()
43
{
44
if (isset($_POST["champ_valider_motif"]))
45
{
46
  $i=&Motif::nextId();
47
 
48
  $tableau=array(GEST_CHAMPS_ID_MOTIF =>$i,
49
                 GEST_CHAMPS_LIBELLE_MOTIF=>$_POST["champ_nom_motif"],
50
                 GEST_CHAMPS_TYPE_RTT=>0);
51
  if (isset($_POST["champ_rtt"]))
52
   {
53
       $tableau[GEST_CHAMPS_TYPE_RTT]=1;
54
   }
55
 
56
  $mot=new Motif($i);
57
  $mot->ConstruireMotif($tableau);
58
  $j =$mot->enregistrerMotif();
59
 }
60
 $_POST["champ_valider_motif"]='dejaValider';
61
 $_POST["champ_nom_motif"]='';
62
 
63
}
64
 
65
 /**
66
 *fonction traitant la supression des motifs d'absence
67
 */
68
 
69
 function traiterSupprimerMotif()
70
 {
71
   if (isset($_POST["btn_supprimer_motif"]))
72
  {
73
    $identifiant=$_POST["champ_motif_supprimer"];
74
    $g=&Motif::motifUtilise($identifiant);
75
    if ($g!=1)
76
    {
77
    $j=&Motif::supprimerMotif($identifiant);
78
    }else $j=0;
79
    if ($j==0)
80
    {
81
    echo "echec supression";
82
    }
83
  }
84
  $_POST["btn_supprimer_motif"]='dejaValider';
85
  $_POST["champ_motif_supprimer"]='';
86
 }
87
 
88
   /**
89
   *fonction verifiant si le motif d'absence est en cours d'utilisation
90
   *la suppression sera interdite dans ce cas afin de maintenir la cohérence de
91
   *de la base de donnees
92
   */
93
 
94
   function verifMotifUtilise()
95
   {
96
     $identifiant=$_POST["champ_motif_supprimer"];
97
     $verif=&Motif::motifUtilise($identifiant);
98
     if ($verif==1)return false;
99
    else return true;
100
 
101
   }
102
 
103
/**
104
*fonction traitant le menu admin motif absence
105
*/
106
 
107
function traiterAdminMotif()
108
{
109
  $text=creerEntetePage(GESTION_ADMIN_MOTIF_L);
110
  //cas de l'ajout
111
  $form=afficherMenuAjouterMotif();
112
  if (isset($_POST["champ_valider_motif"]) and $_POST["champ_valider_motif"]!='dejaValider' and $form->validate())
113
   {
114
        $form->process('traiterAjouterMotif');
115
	$m=afficherMenuAjouterMotif();
116
	$text.=$m->ToHTml();
117
   }else
118
   {
119
	$text.=$form->ToHtml();
120
   }
121
 
122
   //cas supression
123
   $forms=afficherMenuSupressionMotif();
124
   if (isset($_POST["btn_supprimer_motif"]) and $_POST["btn_supprimer_motif"]!='dejaValider' and  $forms->validate())
125
   {
126
        $forms->process('traiterSupprimerMotif');
127
	$m=afficherMenuSupressionMotif();
128
	$text.=$m->ToHTml();
129
   }else{
130
       $text.=$forms->ToHtml();
131
   }
132
   //affichage des options d'administration
133
 
134
    $formp=creerFormulaireOptionAdmin();
135
    $text.=$formp->ToHtml();
136
 
137
      //affichage des options disponibles pour l'utilisateur courant
138
    $text.=afficherOptionAplication($GLOBALS['idCurrentUser']);
139
 
140
 
141
   return $text;
142
}
143
?>