Subversion Repositories Applications.gtt

Rev

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_categorie.php';
38
/**
39
*fonction traitant l'ajout d'une categorie
40
*/
41
function ajouterCategorie()
42
{
43
    if (isset($_POST["champ_valider_cat"]))
44
    {
45
	$i=&Categorie::nextId();
46
	$c=new Categorie($i);
47
	$c->setLibelleCategorie($_POST["champ_nom_cat"]);
48
	$j= $c->enregistrerNewCategorie();
49
	if ($j!=1) echo "echec";
50
 
51
    }
52
    $_POST["champ_valider_cat"]='dejaValider';
53
    $_POST["champ_nom_cat"]='';
54
 
55
}
56
/**
57
*fonction effectuant la suppression d'une categorie
58
*/
59
function traiterSupprimerCategorie()
60
{
61
 if (isset($_POST["btn_supprimer_cat"]))
62
  {
63
    $identifiant=$_POST["champ_cat_supprimer"];
64
    //verification si la categorie ne contient pas de projets
65
    $verif=&Categorie::contientProjet($identifiant);
66
 
67
    if($verif!=1)
68
    {
69
    $b=&Categorie::supprimerCategorie($identifiant);
70
    }else $b=0;
71
    if ($b==0)
72
    {
73
	echo "echec supression";
74
    }
75
  }
76
  $_POST["champ_cat_supprimer"]='';
77
  $_POST["btn_supprimer_cat"]='essai';
78
}
79
/**fonction traitant toutesles actions du menu admin categorie
80
*/
81
function traiterAdminCategorie()
82
{
83
   $text=creerEntetePage(GESTION_ADMIN_CATEGORIE_L);
84
   //cas de l'ajout
85
   $form=afficherMenuAjouterCategorie();
86
 
87
   if (isset($_POST["champ_valider_cat"]) and $_POST["champ_valider_cat"]!='dejaValider' and $form->validate())
88
   {
89
       $form->process('ajouterCategorie');
90
       $t=afficherMenuAjouterCategorie();
91
       $text.=$t->ToHTml();
92
 
93
   }else
94
   {
95
	$text.=$form->ToHtml();
96
   }
97
   //cas supression
98
       $forms=afficherMenuSupressionCategorie();
99
       if (isset($_POST["btn_supprimer_cat"]) and $_POST["btn_supprimer_cat"]!='essai' and  $forms->validate())
100
   {
101
       $forms->process('traiterSupprimerCategorie');
102
       $j=afficherMenuSupressionCategorie();
103
       $text.=$j->ToHtml();
104
 
105
   }else
106
   {
107
       $text.=$forms->ToHtml();
108
   }
109
 
110
   //affichage des options d'administration
111
 
112
    $formp=creerFormulaireOptionAdmin();
113
    $text.=$formp->ToHtml();
114
     //affichage des options disponibles pour l'utilisateur courant
115
    $text.=afficherOptionAplication($GLOBALS['idCurrentUser']);
116
 
117
 
118
 return $text;
119
}
120
/**
121
*fonction verifiant si la categorie ne contient pas de
122
projets
123
*/
124
function verifContientProjet()
125
{
126
    $identifiant=$_POST["champ_cat_supprimer"];
127
    $verif=&Categorie::contientProjet($identifiant);
128
    if ($verif==1)return false;
129
    else return true;
130
 
131
}
132
 
133
?>