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
/*@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
include_once CHEMIN_CLASSES_METIER.'gtt_statut.class.php';
38
//fichier langues
39
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
40
//inclusion des paquets de la librairie pear
41
include_once 'HTML/QuickForm.php';
42
 
43
/**
44
*fonction affichant le menu afficher menu ajout statut
45
*/
46
 
47
function afficherMenuAjouterStatut()
48
{
49
  $id="AJOUTER_STATUT";
50
  $assoc1=array ('class' =>$id);
51
 
52
  $form=new HTML_QuickForm('statut', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_STATUT,'',$assoc1);
53
 
54
  //creation des templates pour la mise en forme
55
   $squelette =& $form->defaultRenderer();
56
   $squelette->setFormTemplate("\n<form{attributes}>\n<ul>{content}\n</ul></form>");
57
   $squelette->setElementTemplate('<li>'."\n".'{label}'."\n".'{element}'."\n".
58
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
59
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
60
                                    '</li>'."\n");
61
  $squelette->setGroupElementTemplate('{label}{element}','groupe');
62
  $squelette->setRequiredNoteTemplate("\n".'<li>'.'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'.'</li>'."\n");
63
 
64
 //creation et ajout des elements
65
 
66
  $form->addElement('header', 'entete', GESTION_AJOUTER_STATUT_L);
67
 
68
  //creation des Messages d'erreur
69
 
70
  $form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE);
71
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
72
 
73
 
74
  //ligne libelle statut
75
  $size=30;
76
  $assoc=array('class' =>$id, 'size'=>$size);
77
  $ligneNomStatut =  &HTML_QuickForm::createElement('text', 'champ_nom_statut',GESTION_LIBELLE_L.': ',$assoc);
78
  $form->addElement($ligneNomStatut);
79
 
80
 
81
  //ligne bouton validation
82
  $size=5;
83
  $assoc=array('class' =>$id, 'size'=>$size);
84
  $boutonS=   &HTML_QuickForm::createElement('submit', 'champ_valider_statut',GTT_L_G_VALIDER,$assoc);
85
  $form->addElement($boutonS);
86
 
87
  //ajout de regles
88
  $form->applyFilter('champ_nom_statut', 'trim');
89
 
90
 
91
  $form->addRule('champ_nom_statut',GTT_ERREUR_NOM, 'required','','client');
92
  $form->addRule('champ_nom_statut',GTT_ERREUR_NOM, 'alphanumeric','','client');
93
  return $form;
94
}
95
 
96
/**
97
*fonction affichant le menu supression d'un statut
98
*/
99
function afficherMenuSupressionstatut()
100
{
101
 $id="SUPPRIMER_STATUT";
102
 $assoc1=array ('class' =>$id);
103
 
104
 $form=new HTML_QuickForm('gestion_categorie2', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_STATUT,'',$assoc1);
105
 
106
 //creation et ajout des elements
107
 
108
  $form->addElement('header', 'entete', GESTION_SUPPRIMER_STATUT_L);
109
 
110
   //creation des elements
111
 
112
   $assoc=array('class' =>$id);
113
 
114
   $ligne[0]=&HTML_QuickForm::createElement('select', 'champ_statut_supprimer',GTT_L_FU_STATUT." : ",'',$assoc);
115
   $ligne[0]->load($result) ;
116
   $c="SELECT * FROM ".GEST_STATUT."";
117
 
118
   $ligne[0]->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_STATUT,GEST_CHAMPS_ID_STATUT);
119
 
120
   $ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_statut',GTT_L_G_SUPPRIMER,$assoc);
121
 
122
   //ajout
123
   $form->addGroup($ligne,'groupe',"",'&nbsp',false);
124
 
125
   //ajout des regles de groupe
126
   $form->registerRule('verifStatutUtilise','function','verifStatutUtilise');
127
   $regle['champ_statut_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_STATUT,'verifStatutUtilise','','client');
128
   $form->addGroupRule('groupe', $regle);
129
   return $form;
130
}
131
?>