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_projet.php';
38
 
39
 
40
 /**
41
 *fonction traitant l'ajout de projet
42
 */
43
 
44
 function traiterAjoutProjet()
45
 {
46
  if (isset($_POST["champ_valider_projet"]))
47
  {
48
     if(isset( $_POST["champ_date_deb_projet"]))
49
     {
50
     $tabDate=$_POST["champ_date_deb_projet"];
51
     $t='-';
52
     $dateNonFormate=$tabDate['Y'];
53
     $dateNonFormate.=$t;
54
     $dateNonFormate.=$tabDate['M'];
55
     $dateNonFormate.=$t;
56
     $dateNonFormate.=$tabDate['d'];
57
    }else $dateNonFormate=null;
58
 
59
     $tab=array(
60
         GEST_CHAMPS_NOM_PROJET=>$_POST["champ_nom_projet"],
61
	 GEST_CHAMPS_DESCRIPTION_PROJET=>$_POST["champ_description"],
62
	 GEST_CHAMPS_DATE_DEBUT_PROJET=>$dateNonFormate,
63
	 GEST_CHAMPS_DUREE_PREVUE_PROJET=>$_POST["champ_duree_prev_projet"],
64
	 GEST_CHAMPS_AVANCEMENT_PROJET=>$_POST["champ_avancement_projet"],
65
	 GEST_CHAMPS_ID_CATEGORIE=>$_POST["champ_categorie_projet"]);
66
 
67
     $i=&Projet::nextId();
68
     $proj=new Projet($i);
69
 
70
     $proj->construireProjet($tab);
71
     $k=$proj->enregistrerNewProjet();
72
 
73
  }
74
  $_POST["champ_valider_projet"]='dejaValider';
75
  $_POST["champ_nom_projet"]='';
76
 }
77
 /**
78
*fonction traitant la supression de projets
79
*la supression de projets entraine la suppression d'eventuelles
80
*taches faisant partie du projet
81
*/
82
 
83
function traiterSupprimerProjet()
84
{
85
   if(isset($_POST["btn_supprimer_projet"]))
86
   {
87
    $i=$_POST["champ_proj_supprimer"];
88
 
89
    $verif=&Projet::contientTache($i);
90
 
91
    if($verif!=1)
92
    {
93
    $b=&Projet::supprimerProjet($i);
94
    }else $b=0;
95
    if ($b==0)
96
    {
97
	echo "echec supression";
98
    }
99
 
100
   }
101
   $_POST["btn_supprimer_projet"]='dejaValider';
102
   $_POST["champ_proj_supprimer"]='';
103
}
104
 /**
105
*fonction verifiant si le projet contient des taches
106
*/
107
 
108
function verifContientTache()
109
{
110
    $i=$_POST["champ_proj_supprimer"];
111
    $verif=&Projet::contientTache($i);
112
    if ($verif==1)return false;
113
    else return true;
114
 
115
}
116
 
117
/**
118
*fonction traitant toutes les actions du menu admin projet
119
*/
120
function traiterAdminProjet()
121
{
122
$text=creerEntetePage(GESTION_ADMIN_PROJET_L);
123
//cas de l'ajout
124
$form=afficherMenuAjouterProjet();
125
if (isset($_POST["champ_valider_projet"])and $_POST["champ_valider_projet"]!='dejaValider'and $form->validate())
126
   {
127
       $form->process('traiterAjoutProjet');
128
       $t=afficherMenuAjouterProjet();
129
       $text.=$t->ToHTml();
130
   }else{
131
       $text.=$form->ToHtml();
132
   }
133
 
134
//cas de la suppression
135
  $forms=afficherMenuSupprimerProjet();
136
 if (isset($_POST["btn_supprimer_projet"]) and $_POST["btn_supprimer_projet"]!='dejaValider' and  $forms->validate())
137
   {
138
       $forms->process('traiterSupprimerProjet');
139
       $m=afficherMenuSupprimerProjet();
140
       $text.=$m->ToHtml();
141
   }else{
142
       $text.=$forms->ToHtml();
143
   }
144
 
145
   //affichage des options d'administration
146
 
147
    $formp=creerFormulaireOptionAdmin();
148
    $text.=$formp->ToHtml();
149
      //affichage des options disponibles pour l'utilisateur courant
150
    $text.=afficherOptionAplication($GLOBALS['idCurrentUser']);
151
 
152
 
153
 return $text;
154
}
155
?>