Subversion Repositories Applications.bazar

Rev

Rev 53 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 53 Rev 54
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
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                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: bazar.fonct.formulaire.php,v 1.8 2005-11-18 16:03:23 florian Exp $
22
// CVS : $Id: bazar.fonct.formulaire.php,v 1.9 2005-11-24 16:17:13 florian Exp $
23
/**
23
/**
24
* Formulaire
24
* Formulaire
25
*
25
*
26
* Les fonctions de mise en page des formulaire
26
* Les fonctions de mise en page des formulaire
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
30
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aleandre GRANIER <alexandre@tela-botanica.org>
32
*@author        Aleandre GRANIER <alexandre@tela-botanica.org>
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.8 $ $Date: 2005-11-18 16:03:23 $
34
*@version       $Revision: 1.9 $ $Date: 2005-11-24 16:17:13 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
Line 75... Line 75...
75
		$formtemplate->addRule($nom_bdd, BAZ_CHOISIR_OBLIGATOIRE.' '.constant($label) , 'nonzero', '', 'client') ;
75
		$formtemplate->addRule($nom_bdd, BAZ_CHOISIR_OBLIGATOIRE.' '.constant($label) , 'nonzero', '', 'client') ;
76
		$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;}
76
		$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;}
77
}
77
}
Line -... Line 78...
-
 
78
 
-
 
79
 
-
 
80
/** checkbox() - Ajoute un élément de type checkbox au formulaire
-
 
81
*
-
 
82
* @param    mixed   L'objet QuickForm du formulaire
-
 
83
* @param    string  nom du champs dans la table bazar_fiche dans la base de donnée
-
 
84
* @param    string  label à afficher dans le formulaire
-
 
85
* @param    string  première restriction de la taille des champs du formulaire
-
 
86
* @param    string  deuxième restriction de la taille des champs du formulaire
-
 
87
* @param    string  valeur par défaut du formulaire
-
 
88
* @param    string  table source pour les valeurs de la liste
-
 
89
* @param    string  ce champs est il obligatoire? (required)
-
 
90
* @return   void
-
 
91
*/
-
 
92
function checkbox(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
-
 
93
	$requete = 'SELECT * FROM '.$source;
-
 
94
	$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
-
 
95
	if (DB::isError ($resultat)) {
-
 
96
		die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
-
 
97
	}
-
 
98
	require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/advcheckbox.php' ;
-
 
99
	$i=0;
-
 
100
	while ($ligne = $resultat->fetchRow()) {
-
 
101
		//$chkbox[$ligne[0]] = $ligne[1] ;
-
 
102
		if ($i==0) $labelchkbox=constant($label) ; else $labelchkbox='&nbsp;' ;
-
 
103
		$checkbox[]= & HTML_Quickform::createElement('checkbox', $ligne[0], $labelchkbox, $ligne[1], array ('style'=>'display:inline;margin-left:2px;')) ;		
-
 
104
		$i++;
-
 
105
	}
-
 
106
	//if (isset($obligatoire)and($obligatoire==1)) {
-
 
107
	//$formtemplate->addRule($nom_bdd.'$i', BAZ_CHOISIR_OBLIGATOIRE.' '.constant($label) , 'nonzero', '', 'client') ;
-
 
108
	//$formtemplate->addRule($nom_bdd.'$i', constant($label.'_REQUIS'), 'required', '', 'client') ;
-
 
109
	//}
-
 
110
	$formtemplate->addGroup($checkbox, $nom_bdd, constant($label), '<br />'."\n");
-
 
111
}
78
 
112
 
79
 
113
 
80
/** listedatedeb() - Ajoute un élément de type date sous forme de liste au formulaire pour designer une date de début
114
/** listedatedeb() - Ajoute un élément de type date sous forme de liste au formulaire pour designer une date de début
81
*
115
*
82
* @param    mixed   L'objet QuickForm du formulaire
116
* @param    mixed   L'objet QuickForm du formulaire
Line 151... Line 185...
151
* @param    string  table source pour les valeurs du texte (inutile)
185
* @param    string  table source pour les valeurs du texte (inutile)
152
* @param    string  ce champs est il obligatoire? (required)
186
* @param    string  ce champs est il obligatoire? (required)
153
* @return   void
187
* @return   void
154
*/
188
*/
155
function textelong(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
189
function textelong(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
156
	$formtexte= new HTML_QuickForm_textarea($nom_bdd, constant($label));
190
	$formtexte= new HTML_QuickForm_textarea($nom_bdd, constant($label), array('style'=>'white-space: normal;'));
157
	$formtexte->setCols($limite1);
191
	$formtexte->setCols($limite1);
158
	$formtexte->setRows($limite2);
192
	$formtexte->setRows($limite2);
159
	$formtexte->setWrap('HARD');
-
 
160
	$formtemplate->addElement($formtexte) ;
193
	$formtemplate->addElement($formtexte) ;
161
	//gestion des valeurs par défaut
194
	//gestion des valeurs par défaut
162
	$defauts=array($nom_bdd=>$defaut);
195
	$defauts=array($nom_bdd=>$defaut);
163
	$formtemplate->setDefaults($defauts);
196
	$formtemplate->setDefaults($defauts);
164
	$formtemplate->applyFilter($nom_bdd, 'addslashes') ;
197
	$formtemplate->applyFilter($nom_bdd, 'addslashes') ;
Line 179... Line 212...
179
* @param    string  ce champs est il obligatoire? (required) (pas utilisé)
212
* @param    string  ce champs est il obligatoire? (required) (pas utilisé)
180
* @return   void
213
* @return   void
181
*/
214
*/
182
function labelhtml(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
215
function labelhtml(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
183
	require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/html.php';
216
	require_once PAP_CHEMIN_RACINE.'api/pear/HTML/QuickForm/html.php';
184
	$formhtml= new HTML_QuickForm_html(constant($label));
217
	$formhtml= new HTML_QuickForm_html('<li>'.constant($label).'</li>'."\n");
185
	$formtemplate->addElement($formhtml) ;
218
	$formtemplate->addElement($formhtml) ;
186
}
219
}
Line 187... Line 220...
187
 
220
 
188
/* +--Fin du code ----------------------------------------------------------------------------------------+
221
/* +--Fin du code ----------------------------------------------------------------------------------------+
189
*
222
*
-
 
223
* $Log: not supported by cvs2svn $
-
 
224
* Revision 1.8  2005/11/18 16:03:23  florian
-
 
225
* correction bug html entites
190
* $Log: not supported by cvs2svn $
226
*
191
* Revision 1.7  2005/11/07 17:51:06  florian
227
* Revision 1.7  2005/11/07 17:51:06  florian
192
* correction bug liste
228
* correction bug liste
193
*
229
*
194
* Revision 1.6  2005/11/07 17:30:36  florian
230
* Revision 1.6  2005/11/07 17:30:36  florian