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