19,7 → 19,7 |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: bazar.fonct.formulaire.php,v 1.18 2006-03-01 16:01:46 florian Exp $ |
// CVS : $Id: bazar.fonct.formulaire.php,v 1.19 2006-03-02 20:36:52 florian Exp $ |
/** |
* Formulaire |
* |
31,7 → 31,7 |
//Autres auteurs : |
*@author Aleandre GRANIER <alexandre@tela-botanica.org> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.18 $ $Date: 2006-03-01 16:01:46 $ |
*@version $Revision: 1.19 $ $Date: 2006-03-02 20:36:52 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
62,14 → 62,14 |
} |
$option=array('style'=>'width: '.$limite1.'px;'); |
require_once 'HTML/QuickForm/select.php'; |
$select= new HTML_QuickForm_select('liste'.$id_liste, constant($label), $select, $option); |
$select= new HTML_QuickForm_select('liste'.$id_liste, $label, $select, $option); |
$select->setSize($limite2); |
$select->setMultiple(0); |
$select->setSelected($defaut); |
$formtemplate->addElement($select) ; |
if (isset($obligatoire)and($obligatoire==1)) { |
$formtemplate->addRule('liste'.$id_liste, BAZ_CHOISIR_OBLIGATOIRE.' '.constant($label) , 'nonzero', '', 'client') ; |
$formtemplate->addRule('liste'.$id_liste, constant($label.'_REQUIS'), 'required', '', 'client') ;} |
$formtemplate->addRule('liste'.$id_liste, BAZ_CHOISIR_OBLIGATOIRE.' '.$label , 'nonzero', '', 'client') ; |
$formtemplate->addRule('liste'.$id_liste, $label.' obligatoire', 'required', '', 'client') ;} |
} |
|
|
95,7 → 95,7 |
$i=0; |
if (isset($defaut)) $tab=split(', ', $defaut); |
while ($ligne = $resultat->fetchRow()) { |
if ($i==0) $labelchkbox=constant($label) ; else $labelchkbox=' ' ; |
if ($i==0) $labelchkbox=$label ; else $labelchkbox=' ' ; |
$checkbox[$i]= & HTML_Quickform::createElement('checkbox', $ligne[1], $labelchkbox, $ligne[2], |
array ('style'=>'display:inline;margin-left:2px;')) ; |
foreach ($tab as $val) { |
103,9 → 103,9 |
} |
$i++; |
} |
$formtemplate->addGroup($checkbox, 'checkbox'.$id_liste, constant($label), '<br />'."\n"); |
$formtemplate->addGroup($checkbox, 'checkbox'.$id_liste, $label, '<br />'."\n"); |
if (isset($obligatoire)and($obligatoire==1)) { |
$formtemplate->addGroupRule('checkbox'.$id_liste, constant($label.'_REQUIS'), 'required', null, 1, 'client'); |
$formtemplate->addGroupRule('checkbox'.$id_liste, $label.' obligatoire', 'required', null, 1, 'client'); |
} |
} |
|
129,7 → 129,7 |
'format' => 'd m Y', |
'addEmptyOption' => true, |
); |
$formtemplate->addElement('date', $nom_bdd, constant($label), $optiondate) ; |
$formtemplate->addElement('date', $nom_bdd, $label, $optiondate) ; |
//gestion des valeurs par défaut (date du jour) |
if (isset($defaut)) $formtemplate->setDefaults(array($nom_bdd => $defaut)); |
else { |
137,7 → 137,7 |
$formtemplate->setDefaults($defauts); |
} |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;} |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;} |
} |
|
/** listedatefin() - Ajoute un élément de type date sous forme de liste au formulaire pour designer une date de fin |
171,13 → 171,13 |
*/ |
function texte(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
$option=array('size'=>$limite1,'maxlength'=>$limite2); |
$formtemplate->addElement('text', $nom_bdd, constant($label), $option) ; |
$formtemplate->addElement('text', $nom_bdd, $label, $option) ; |
//gestion des valeurs par défaut |
$defauts=array($nom_bdd=>$defaut); |
$formtemplate->setDefaults($defauts); |
$formtemplate->applyFilter($nom_bdd, 'addslashes') ; |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;} |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;} |
} |
|
|
194,7 → 194,7 |
* @return void |
*/ |
function textelong(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
$formtexte= new HTML_QuickForm_textarea($nom_bdd, constant($label), array('style'=>'white-space: normal;')); |
$formtexte= new HTML_QuickForm_textarea($nom_bdd, $label, array('style'=>'white-space: normal;')); |
$formtexte->setCols($limite1); |
$formtexte->setRows($limite2); |
$formtemplate->addElement($formtexte) ; |
203,7 → 203,7 |
$formtemplate->setDefaults($defauts); |
$formtemplate->applyFilter($nom_bdd, 'addslashes') ; |
//gestion du champs obligatoire |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, constant($label.'_REQUIS'), 'required', '', 'client') ;} |
if (isset($obligatoire)and($obligatoire==1)) {$formtemplate->addRule($nom_bdd, $label.' obligatoire', 'required', '', 'client') ;} |
} |
|
/** url() - Ajoute un élément de type url internet au formulaire |
269,7 → 269,7 |
* @return void |
*/ |
function image(&$formtemplate, $nom_bdd , $label, $limite1, $limite2, $defaut, $source, $obligatoire) { |
$html.='<tr>'."\n".'<td colspan="2">'."\n".'<h4>'.$label.'</h4>'."\n".'</td>'."\n".'</tr>'."\n"; |
$html ='<tr>'."\n".'<td colspan="2">'."\n".'<h4>'.$label.'</h4>'."\n".'</td>'."\n".'</tr>'."\n"; |
$formtemplate->addElement('html', $html) ; |
$formtemplate->addElement('file', 'image'.$nom_bdd, BAZ_IMAGE) ; |
//TODO: controler si c'est une image |
303,6 → 303,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.18 2006/03/01 16:01:46 florian |
* correction bug déclaration variable $html |
* |
* Revision 1.17 2006/01/30 10:27:03 florian |
* - ajout des entrées de formulaire fichier, url, et image |
* - correction bug d'affichage du mode de saisie |