Module development: Difference between revisions

m
Line 183: Line 183:
* class="'''button'''" on HTML fields with type ''input type="submit"''.
* class="'''button'''" on HTML fields with type ''input type="submit"''.


== Utiliser le sélecteur de date de Dolibarr ==
== Use the Dolibarr date selector ==
{{ToTranslate}}
If you want to use the Dolibarr date selector (with its calendar popup) into your pages, use the following line:
 
Si vous le désirez, vous pouvez profiter du sélecteur de date dans des écrans Dolibarr. Pour cela, utilisez la ligne suivante:
  $form=new Form($db);
  $form=new Form($db);
  $form->select_date('','mykey',0,0,0,"myform");
  $form->select_date('','mykey',0,0,0,"myform");
La chaine mykey identifie la zone date. Il faut y mettre une valeur différente s'il y a plusieurs zones.
The string mykey will identify the date selector in the form. You must use different values if you use several date selectors in same page.
La chaine myform est le nom de la zone FORM (dans form name="myform" de la page HTML).
The string myform is the name of the FORM in which the selector is included (value found in the form name="myform" in HTML page).
L'affichage d'un sélecteur de date doit donc être intégrée dans une zone FORM Html.
This means a date selector must be included necessarily into an html FORM.


Pour récupérer la valeur, à l'issu du POST, la commande est:
To get value after the POST of your form, the command is:
<pre>
<pre>
$datefacture = dolibarr_mktime(12, 0 , 0, $_POST['mykeymonth'], $_POST['mykeyday'], $_POST['mykeyyear']);
$mydate = dol_mktime(12, 0 , 0, $_POST['mykeymonth'], $_POST['mykeyday'], $_POST['mykeyyear']);
print strftime('%A %d %B %Y', $datefacture);
print strftime('%A %d %B %Y', $mydate);
</pre>
</pre>