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
/*@package gtt_general
25
//Auteur original :
26
*@author        Dorian Bannier <dbannier@aol.com>
27
//Autres auteurs :
28
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
29
*@copyright     Copyright (C) 2003 Tela-Botanica
30
@version        $Date: 2004/07/06
31
*/
32
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
// |                                            INCLUSION DE FICHIERS                                       |
35
// +------------------------------------------------------------------------------------------------------+
36
 
37
 
38
include_once CHEMIN_CLASSES_METIER.'gtt_projet.class.php';
39
include_once CHEMIN_CLASSES_METIER.'gtt_categorie.class.php';
40
//fichier langues
41
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
42
//inclusion des paquets de la librairie pear
43
include_once 'HTML/QuickForm.php';
44
 
45
/**
46
*fonction affichant le menu d'ajout d'un projet
47
*/
48
 
49
function afficherMenuAjouterProjet()
50
{
51
 
52
  $id="AJOUTER_PROJET";
53
  $assoc1=array ('class' =>$id);
54
 
55
  $form=new HTML_QuickForm('gestion_projet', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_PROJET,'',$assoc1);
56
   $squelette =& $form->defaultRenderer();
57
 $squelette->setFormTemplate("\n<form{attributes}>\n<ul>{content}\n</ul></form>");
58
 $squelette->setElementTemplate('<li>'."\n".'{label}'."\n".'{element}'."\n".
59
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
60
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
61
                                    '</li>'."\n");
62
 $squelette->setGroupElementTemplate('{label}{element}','groupe');
63
 $squelette->setRequiredNoteTemplate("\n".'<li>'.'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'.'</li>'."\n");
64
 $squelette->setHeaderTemplate("\n".'<li><h2>'."\n".'{header}'."\n".'</h2></li>'."\n");
65
 
66
 //creation et ajout des elements
67
 
68
  $form->addElement('header', 'entete', GESTION_AJOUTER_PROJET_L);
69
 
70
  //creation des Messages d'erreur
71
 
72
  $form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE);
73
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
74
 
75
 
76
  //ligne nom du projet
77
  $size=30;
78
  $assoc=array('class' =>$id, 'size'=>$size);
79
  $ligneNomProjet=   &HTML_QuickForm::createElement('text', 'champ_nom_projet',GESTION_NOM_L."   : ",$assoc);
80
  $form->addElement($ligneNomProjet);
81
 
82
  //ligne categorie du projet
83
 
84
   $assoc=array('class' =>$id);
85
   $cat=&HTML_QuickForm::createElement('select', 'champ_categorie_projet',GESTION_CATEGORIE_L."   : ",'',$assoc);
86
   $cat->load($result) ;
87
   $c="SELECT * FROM ".GEST_CATEGORIE."";
88
 
89
   $cat->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_CATEGORIE,GEST_CHAMPS_ID_CATEGORIE);
90
   $form->addElement($cat);
91
 
92
   //ligne date debut prevue
93
   $assoc=array('class'=>$id);
94
   //definition des date sde debut et de fin
95
   $min=date('Y')-5;
96
   $max=date('Y')+5;
97
   $option=array('language'=>'fr','minYear'=>$min, 'maxYear'=>$max);
98
 
99
   $dateDeb=&HTML_QuickForm::createElement('date','champ_date_deb_projet',GESTION_DATE_DEB_PROJET_L.' : ',$option,$assoc);
100
   $valDef=date("d,M,Y");
101
   $dateDeb->setValue($valDef);
102
   $form->addElement($dateDeb);
103
 
104
 
105
   //champ duree prevue du projet compte en jours
106
    $size=3;
107
    $assoc=array('class'=>$id,'size'=>$size);
108
    $dureePrev=&HTML_QuickForm::createElement('text','champ_duree_prev_projet',GESTION_DUREE_PROJET_L.':',$assoc);
109
    $form->addElement($dureePrev);
110
 
111
 
112
 
113
  //etat d'avancement du projet
114
   $size=1;
115
    $assoc=array('class'=>$id,'size'=>$size);
116
    $valeur=array();
117
    for ($i = 0; $i <= 100; $i++) {
118
     array_push($valeur,$i);
119
    }
120
 
121
    $avancement=&HTML_QuickForm::createElement('select','champ_avancement_projet',GESTION_AVANCEMENT_PROJET_L.':',$valeur,$assoc);
122
    $form->addElement($avancement);
123
 
124
 
125
 
126
   //champ description du projet
127
   $row=4;
128
   $col=30;
129
   $id="CHAMP_DESC_AJOUTER_PROJET";
130
   $assoc=array('class '=>$id ,'rows'=>$row , 'cols'=>$col, 'wrap'=>"physical");
131
 
132
   $description=&HTML_QuickForm::createElement('textarea','champ_description',GESTION_DESCRIPTION_L.' : ',$assoc);
133
 
134
   $form->addElement($description);
135
 
136
   //champ valider
137
   $size=5;
138
  $assoc=array('class' =>$id, 'size'=>$size);
139
  $boutonP=   &HTML_QuickForm::createElement('submit', 'champ_valider_projet',GTT_L_G_VALIDER,$assoc);
140
  $form->addElement($boutonP);
141
 
142
    //ajout de regles
143
  $form->applyFilter('champ_nom_projet', 'trim');
144
 
145
  $form->addRule('champ_nom_projet',GTT_ERREUR_NOM, 'required','','client');
146
  $form->addRule('champ_nom_projet',GTT_ERREUR_NOM, 'alphanumeric','','client');
147
 
148
   return $form;
149
}
150
 
151
 
152
  /**supression d'un projet
153
  *on ne peut supprimer que les projets n'ayant pas de taches
154
  */
155
 function afficherMenuSupprimerProjet()
156
  {
157
     $id="SUPPRIMER_PROJET";
158
     $assoc1=array ('class' =>$id);
159
 
160
    $form=new HTML_QuickForm('gestion_projet2', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_PROJET,'',$assoc1);
161
 
162
 //creation et ajout des elements
163
  $form->addElement('header', 'entete', GESTION_SUPPRIMER_PROJET_L);
164
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
165
  //creation des elements
166
 
167
   $assoc=array('class' =>$id);
168
 
169
   $ligne[0]=&HTML_QuickForm::createElement('select', 'champ_proj_supprimer',GESTION_PROJET_L." : ",'',$assoc);
170
   $ligne[0]->load($result) ;
171
   $p="SELECT * FROM ".GEST_PROJET."";
172
 
173
   $ligne[0]->loadQuery($GLOBALS['dsn'],$p,GEST_CHAMPS_NOM_PROJET,GEST_CHAMPS_ID_PROJET);
174
 
175
   $ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_projet',GTT_L_G_SUPPRIMER,$assoc);
176
 
177
   //ajout
178
   $form->addGroup($ligne,'groupe',"",'&nbsp',false);
179
 
180
   //ajout des regles de groupe interdisant la supression
181
   //au cas ou le projet contient des taches
182
 
183
   $form->registerRule('verifContientTache','function','verifContientTache');
184
   $regle['champ_proj_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_PROJ,'verifContientTache','','client');
185
   $form->addGroupRule('groupe', $regle);
186
   return $form;
187
  }
188
 
189
?>