Permettre au theme d'offrir un mode de selection des date different

This commit is contained in:
Laurent Destailleur 2005-10-31 03:06:16 +00:00
parent cb1ada00d0
commit 8da5f2a8da

View File

@ -1345,12 +1345,9 @@ class Form
*/ */
function select_date($set_time='', $prefix='re', $h = 0, $m = 0, $empty=0) function select_date($set_time='', $prefix='re', $h = 0, $m = 0, $empty=0)
{ {
global $langs; global $conf,$langs;
if (! $set_time && $empty == 0) if (! $set_time && $empty == 0) $set_time = time();
{
$set_time = time();
}
$strmonth[1] = $langs->trans("January"); $strmonth[1] = $langs->trans("January");
$strmonth[2] = $langs->trans("February"); $strmonth[2] = $langs->trans("February");
@ -1391,6 +1388,27 @@ class Form
$smin = ''; $smin = '';
} }
$conf->use_popup_date=0; // Mettre 1 pour avoir date en popup (experimental)
/*
* Affiche date en popup
*/
if ($conf->use_javascript && $conf->use_popup_date)
{
$timearray=getDate($set_time);
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="11" maxlength="11" value="'.$formated_date.'"> <button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons" onClick="showDP(\''.DOL_URL_ROOT.'/theme/'.$conf->theme.'/\',\''.$prefix.'\',\''.$conf->format_date_short.'\');">'.img_object($langs->trans("SelectDate"),'calendar').'</button>';
print '<input type="hidden" name="'.$prefix.'day" value="'.$timearray['mday'].'">'."\n";
print '<input type="hidden" name="'.$prefix.'month" value="'.$timearray['mon'].'">'."\n";
print '<input type="hidden" name="'.$prefix.'year" value="'.$timearray['year'].'">'."\n";
}
/*
* Affiche date en select
*/
if (! $conf->use_javascript || ! $conf->use_popup_date)
{
// Jour // Jour
print '<select class="flat" name="'.$prefix.'day">'; print '<select class="flat" name="'.$prefix.'day">';
@ -1464,7 +1482,11 @@ class Form
} }
print "</select>\n"; print "</select>\n";
} }
}
/*
* Affiche heure en select
*/
if ($h) if ($h)
{ {
print '<select class="flat" name="'.$prefix.'hour">'; print '<select class="flat" name="'.$prefix.'hour">';
@ -1511,6 +1533,7 @@ class Form
} }
} }
} }
/** /**