| 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.13 2006-01-13 14:12:51 florian Exp $
|
22 |
// CVS : $Id: bazar.fonct.formulaire.php,v 1.14 2006-01-19 17:42:11 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.13 $ $Date: 2006-01-13 14:12:51 $
|
34 |
*@version $Revision: 1.14 $ $Date: 2006-01-19 17:42:11 $
|
| 35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
| 36 |
*/
|
36 |
*/
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| Line 50... |
Line 50... |
| 50 |
* @param string table source pour les valeurs de la liste
|
50 |
* @param string table source pour les valeurs de la liste
|
| 51 |
* @param string ce champs est il obligatoire? (required)
|
51 |
* @param string ce champs est il obligatoire? (required)
|
| 52 |
* @return void
|
52 |
* @return void
|
| 53 |
*/
|
53 |
*/
|
| 54 |
function liste(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
|
54 |
function liste(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
|
| 55 |
//TODO: trouver la variable générique papyrus pour les langues
|
- |
|
| 56 |
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="fr-FR"';
|
55 |
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
|
| 57 |
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
|
56 |
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
|
| 58 |
if (DB::isError ($resultat)) {
|
57 |
if (DB::isError ($resultat)) {
|
| 59 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
58 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
| 60 |
}
|
59 |
}
|
| 61 |
while ($ligne = $resultat->fetchRow()) {
|
60 |
while ($ligne = $resultat->fetchRow()) {
|
| Line 66... |
Line 65... |
| 66 |
$select= new HTML_QuickForm_select('liste'.$id_liste, constant($label), $select, $option);
|
65 |
$select= new HTML_QuickForm_select('liste'.$id_liste, constant($label), $select, $option);
|
| 67 |
$select->setSize($limite2);
|
66 |
$select->setSize($limite2);
|
| 68 |
$select->setMultiple(0);
|
67 |
$select->setMultiple(0);
|
| 69 |
$select->setSelected($defaut);
|
68 |
$select->setSelected($defaut);
|
| 70 |
$formtemplate->addElement($select) ;
|
69 |
$formtemplate->addElement($select) ;
|
| 71 |
|
- |
|
| 72 |
if (isset($obligatoire)and($obligatoire==1)) {
|
70 |
if (isset($obligatoire)and($obligatoire==1)) {
|
| 73 |
$formtemplate->addRule('liste'.$id_liste, BAZ_CHOISIR_OBLIGATOIRE.' '.constant($label) , 'nonzero', '', 'client') ;
|
71 |
$formtemplate->addRule('liste'.$id_liste, BAZ_CHOISIR_OBLIGATOIRE.' '.constant($label) , 'nonzero', '', 'client') ;
|
| 74 |
$formtemplate->addRule('liste'.$id_liste, constant($label.'_REQUIS'), 'required', '', 'client') ;}
|
72 |
$formtemplate->addRule('liste'.$id_liste, constant($label.'_REQUIS'), 'required', '', 'client') ;}
|
| 75 |
}
|
73 |
}
|
| Line 86... |
Line 84... |
| 86 |
* @param string table source pour les valeurs de la liste
|
84 |
* @param string table source pour les valeurs de la liste
|
| 87 |
* @param string ce champs est il obligatoire? (required)
|
85 |
* @param string ce champs est il obligatoire? (required)
|
| 88 |
* @return void
|
86 |
* @return void
|
| 89 |
*/
|
87 |
*/
|
| 90 |
function checkbox(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
|
88 |
function checkbox(&$formtemplate, $id_liste , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
|
| 91 |
//TODO: trouver la variable générique papyrus pour les langues
|
- |
|
| 92 |
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="fr-FR"';
|
89 |
$requete = 'SELECT * FROM bazar_liste_valeurs WHERE blv_ce_liste='.$id_liste.' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
|
| 93 |
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
|
90 |
$resultat = & $GLOBALS['_BAZAR_']['db'] -> query($requete) ;
|
| 94 |
if (DB::isError ($resultat)) {
|
91 |
if (DB::isError ($resultat)) {
|
| 95 |
die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
|
92 |
die ($GLOBALS['_BAZAR_']['db']->getMessage().$GLOBALS['_BAZAR_']['db']->getDebugInfo()) ;
|
| 96 |
}
|
93 |
}
|
| 97 |
|
- |
|
| 98 |
require_once 'HTML/QuickForm/advcheckbox.php' ;
|
94 |
require_once 'HTML/QuickForm/checkbox.php' ;
|
| 99 |
$i=0;
|
95 |
$i=0;
|
| - |
|
96 |
if (isset($defaut)) $tab=split(', ', $defaut);
|
| 100 |
while ($ligne = $resultat->fetchRow()) {
|
97 |
while ($ligne = $resultat->fetchRow()) {
|
| 101 |
if ($i==0) $labelchkbox=constant($label) ; else $labelchkbox=' ' ;
|
98 |
if ($i==0) $labelchkbox=constant($label) ; else $labelchkbox=' ' ;
|
| 102 |
$checkbox[]= & HTML_Quickform::createElement('checkbox', $ligne[1], $labelchkbox, $ligne[2],
|
99 |
$checkbox[$i]= & HTML_Quickform::createElement('checkbox', $ligne[1], $labelchkbox, $ligne[2],
|
| 103 |
array ('style'=>'display:inline;margin-left:2px;')) ;
|
100 |
array ('style'=>'display:inline;margin-left:2px;')) ;
|
| - |
|
101 |
foreach ($tab as $val) {
|
| - |
|
102 |
if ($ligne[1]==$val) $checkbox[$i]->setChecked(1);
|
| - |
|
103 |
}
|
| 104 |
$i++;
|
104 |
$i++;
|
| 105 |
}
|
105 |
}
|
| 106 |
|
- |
|
| 107 |
$formtemplate->addGroup($checkbox, 'checkbox'.$id_liste, constant($label), '<br />'."\n");
|
106 |
$formtemplate->addGroup($checkbox, 'checkbox'.$id_liste, constant($label), '<br />'."\n");
|
| - |
|
107 |
if (isset($obligatoire)and($obligatoire==1)) {
|
| - |
|
108 |
//TODO: marches pas...
|
| - |
|
109 |
$formtemplate->addGroupRule('checkbox'.$id_liste, constant($label.'_REQUIS'), 'required', null, 1, 'client');
|
| - |
|
110 |
}
|
| 108 |
}
|
111 |
}
|
| Line 109... |
Line 112... |
| 109 |
|
112 |
|
| 110 |
|
113 |
|
| Line 121... |
Line 124... |
| 121 |
* @return void
|
124 |
* @return void
|
| 122 |
*/
|
125 |
*/
|
| 123 |
function listedatedeb(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
|
126 |
function listedatedeb(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) {
|
| 124 |
$optiondate=array('language' => BAZ_LANGUE_PAR_DEFAUT,'minYear' => date('Y'),'maxYear'=> (date('Y')+10), 'format' => 'd m Y');
|
127 |
$optiondate=array('language' => BAZ_LANGUE_PAR_DEFAUT,'minYear' => date('Y'),'maxYear'=> (date('Y')+10), 'format' => 'd m Y');
|
| 125 |
$formtemplate->addElement('date', $nom_bdd, constant($label), $optiondate) ;
|
128 |
$formtemplate->addElement('date', $nom_bdd, constant($label), $optiondate) ;
|
| 126 |
//gestion des valeurs par défaut (date du jour)
|
129 |
//gestion des valeurs par défaut (date du jour)
|
| - |
|
130 |
if (isset($defaut)) $formtemplate->setDefaults(array($nom_bdd => $defaut));
|
| - |
|
131 |
else {
|
| 127 |
$defauts=array($nom_bdd => array ('d'=>date('d'), 'm'=>date('m'), 'Y'=>date('Y')));
|
132 |
$defauts=array($nom_bdd => array ('d'=>date('d'), 'm'=>date('m'), 'Y'=>date('Y')));
|
| 128 |
$formtemplate->setDefaults($defauts);
|
133 |
$formtemplate->setDefaults($defauts);
|
| - |
|
134 |
}
|
| 129 |
//gestion du champs obligatoire
|
135 |
//gestion du champs obligatoire
|
| 130 |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;}
|
136 |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;}
|
| 131 |
}
|
137 |
}
|
| Line 132... |
Line 138... |
| 132 |
|
138 |
|
| Line 216... |
Line 222... |
| 216 |
}
|
222 |
}
|
| Line 217... |
Line 223... |
| 217 |
|
223 |
|
| 218 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
224 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 219 |
*
|
225 |
*
|
| - |
|
226 |
* $Log: not supported by cvs2svn $
|
| - |
|
227 |
* Revision 1.13 2006/01/13 14:12:51 florian
|
| - |
|
228 |
* utilisation des temlates dans la table bazar_nature
|
| 220 |
* $Log: not supported by cvs2svn $
|
229 |
*
|
| 221 |
* Revision 1.12 2006/01/05 16:28:24 alexandre_tb
|
230 |
* Revision 1.12 2006/01/05 16:28:24 alexandre_tb
|
| 222 |
* prise en chage des checkbox, reste la mise à jour à gérer
|
231 |
* prise en chage des checkbox, reste la mise à jour à gérer
|
| 223 |
*
|
232 |
*
|
| 224 |
* Revision 1.11 2006/01/02 13:24:07 alexandre_tb
|
233 |
* Revision 1.11 2006/01/02 13:24:07 alexandre_tb
|