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_categorie.class.php';
38
//fichier langues
39
include_once CHEMIN_LANGUES.'gtt_langue_fr.inc.php';
40
include_once CHEMIN_CONTROLEUR.'gtt_controleur_admin_categorie.php';
41
 
42
//inclusion des paquets de la librairie pear
43
include_once 'HTML/QuickForm.php';
44
 
45
 
46
/**
47
*fonction affichant le menu administration des categorie
48
*option ajout de categorie
49
*/
50
 
51
function afficherMenuAjouterCategorie()
52
{
53
 
54
 $id="AJOUTER_CATEGORIE";
55
 $assoc1=array ('class' =>$id);
56
 
57
 $form=new HTML_QuickForm('gestion_categorie', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_CATEGORIE,'',$assoc1);
58
 $squelette =& $form->defaultRenderer();
59
 $squelette->setFormTemplate("\n<form{attributes}>\n<ul>{content}\n</ul></form>");
60
 $squelette->setElementTemplate('<li>'."\n".'{label}'."\n".'{element}'."\n".
61
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
62
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
63
                                    '</li>'."\n");
64
 $squelette->setGroupElementTemplate('{label}{element}','groupe');
65
 $squelette->setRequiredNoteTemplate("\n".'<li>'.'<p>'."\n".'<span class="symbole_obligatoire">*</span> {requiredNote}'."\n".'</p>'.'</li>'."\n");
66
 $squelette->setHeaderTemplate("\n".'<li><h2>'."\n".'{header}'."\n".'</h2></li>'."\n");
67
 
68
 
69
 //creation et ajout des elements
70
  $form->addElement('html','<fieldset>');
71
  $form->addElement('header', 'entete', GESTION_AJOUTER_CATEGORIE_L);
72
 
73
  //creation des Messages d'erreur
74
 
75
  $form->setRequiredNote('='.GTT_CHAMPS_OBLIGATOIRE);
76
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
77
 
78
 
79
  //ligne nom categorie
80
  $size=30;
81
  $assoc=array('class' =>$id, 'size'=>$size);
82
  $ligneNomCat=   &HTML_QuickForm::createElement('text', 'champ_nom_cat',GESTION_LIBELLE_L.': ',$assoc);
83
  $form->addElement($ligneNomCat);
84
 
85
 
86
  //ligne bouton validation
87
  $size=5;
88
  $assoc=array('class' =>$id, 'size'=>$size);
89
  $boutonC=   &HTML_QuickForm::createElement('submit', 'champ_valider_cat',GTT_L_G_VALIDER,$assoc);
90
  $form->addElement($boutonC);
91
 
92
 
93
  //ajout de regles
94
  $form->applyFilter('champ_nom_cat', 'trim');
95
 
96
  $form->addRule('champ_nom_cat',GTT_ERREUR_NOM, 'required','','client');
97
  $form->addRule('champ_nom_cat',GTT_ERREUR_NOM, 'alphanumeric','','client');
98
  $form->addElement('html','</fieldset>');
99
  return $form;
100
}
101
 
102
 
103
/**fonction affichant le menu
104
*supression d'une categorie
105
*/
106
 
107
function afficherMenuSupressionCategorie()
108
{
109
 $id="SUPPRIMER_CATEGORIE";
110
 $assoc1=array ('class' =>$id);
111
 
112
 $form=new HTML_QuickForm('gestion_categorie2', 'post',$GLOBALS['urlBase'].GESTION_ADMIN_CATEGORIE,'',$assoc1);
113
 
114
 //creation et ajout des elements
115
 
116
  $form->addElement('header', 'entete', GESTION_SUPPRIMER_CATEGORIE_L);
117
  $form->setJsWarnings(GTT_DONNEES_INCORRECTES, GTT_DONNEES_A_CORRIGER);
118
   //creation des elements
119
 
120
   $assoc=array('class' =>$id);
121
 
122
   $ligne[0]=&HTML_QuickForm::createElement('select', 'champ_cat_supprimer',GESTION_CATEGORIE_L." : ",'',$assoc);
123
   $ligne[0]->load($result) ;
124
   $c="SELECT * FROM ".GEST_CATEGORIE."";
125
 
126
   $ligne[0]->loadQuery($GLOBALS['dsn'],$c,GEST_CHAMPS_LIBELLE_CATEGORIE,GEST_CHAMPS_ID_CATEGORIE);
127
 
128
   $ligne[1]=&HTML_QuickForm::createElement('submit', 'btn_supprimer_cat',GTT_L_G_SUPPRIMER,$assoc);
129
 
130
   //ajout
131
   $form->addGroup($ligne,'groupe',"",'&nbsp',false);
132
 
133
 
134
   //ajout des regles de groupe
135
   $form->registerRule('verifContientProjet','function','verifContientProjet');
136
   $regle['champ_cat_supprimer'][]=array(GTT_IMPOSSIBLE_SUPPR_CAT,'verifContientProjet','','client');
137
   $form->addGroupRule('groupe', $regle);
138
   return $form;
139
}
140
?>