Permettre au theme d'offrir un mode de selection des date different
This commit is contained in:
parent
cb1ada00d0
commit
8da5f2a8da
@ -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");
|
||||||
@ -1390,81 +1387,106 @@ class Form
|
|||||||
$shour = '';
|
$shour = '';
|
||||||
$smin = '';
|
$smin = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Jour
|
$conf->use_popup_date=0; // Mettre 1 pour avoir date en popup (experimental)
|
||||||
print '<select class="flat" name="'.$prefix.'day">';
|
|
||||||
|
/*
|
||||||
if ($empty || $set_time == -1)
|
* Affiche date en popup
|
||||||
|
*/
|
||||||
|
if ($conf->use_javascript && $conf->use_popup_date)
|
||||||
{
|
{
|
||||||
$sday = 0;
|
$timearray=getDate($set_time);
|
||||||
$smonth = 0;
|
$formated_date=dolibarr_print_date($set_time,$conf->format_date_short);
|
||||||
$syear = 0;
|
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>';
|
||||||
$shour = 0;
|
print '<input type="hidden" name="'.$prefix.'day" value="'.$timearray['mday'].'">'."\n";
|
||||||
$smin = 0;
|
print '<input type="hidden" name="'.$prefix.'month" value="'.$timearray['mon'].'">'."\n";
|
||||||
|
print '<input type="hidden" name="'.$prefix.'year" value="'.$timearray['year'].'">'."\n";
|
||||||
print '<option value="0" selected="true"> </option>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($day = 1 ; $day <= 31; $day++)
|
/*
|
||||||
|
* Affiche date en select
|
||||||
|
*/
|
||||||
|
if (! $conf->use_javascript || ! $conf->use_popup_date)
|
||||||
{
|
{
|
||||||
if ($day == $sday)
|
|
||||||
|
// Jour
|
||||||
|
print '<select class="flat" name="'.$prefix.'day">';
|
||||||
|
|
||||||
|
if ($empty || $set_time == -1)
|
||||||
{
|
{
|
||||||
print "<option value=\"$day\" selected=\"true\">$day";
|
$sday = 0;
|
||||||
|
$smonth = 0;
|
||||||
|
$syear = 0;
|
||||||
|
$shour = 0;
|
||||||
|
$smin = 0;
|
||||||
|
|
||||||
|
print '<option value="0" selected="true"> </option>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for ($day = 1 ; $day <= 31; $day++)
|
||||||
{
|
{
|
||||||
print "<option value=\"$day\">$day";
|
if ($day == $sday)
|
||||||
}
|
|
||||||
print "</option>";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</select>";
|
|
||||||
|
|
||||||
print '<select class="flat" name="'.$prefix.'month">';
|
|
||||||
if ($empty || $set_time == -1)
|
|
||||||
{
|
|
||||||
print '<option value="0" selected="true"> </option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mois
|
|
||||||
for ($month = 1 ; $month <= 12 ; $month++)
|
|
||||||
{
|
|
||||||
if ($month == $smonth)
|
|
||||||
{
|
|
||||||
print "<option value=\"$month\" selected=\"true\">" . $strmonth[$month];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<option value=\"$month\">" . $strmonth[$month];
|
|
||||||
}
|
|
||||||
print "</option>";
|
|
||||||
}
|
|
||||||
print "</select>";
|
|
||||||
|
|
||||||
// Année
|
|
||||||
if ($empty || $set_time == -1)
|
|
||||||
{
|
|
||||||
print '<input class="flat" type="text" size="3" maxlength="4" name="'.$prefix.'year">';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<select class="flat" name="'.$prefix.'year">';
|
|
||||||
|
|
||||||
for ($year = $syear - 3; $year < $syear + 5 ; $year++)
|
|
||||||
{
|
|
||||||
if ($year == $syear)
|
|
||||||
{
|
{
|
||||||
print "<option value=\"$year\" selected=\"true\">$year";
|
print "<option value=\"$day\" selected=\"true\">$day";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<option value=\"$year\">$year";
|
print "<option value=\"$day\">$day";
|
||||||
}
|
}
|
||||||
print "</option>";
|
print "</option>";
|
||||||
}
|
}
|
||||||
print "</select>\n";
|
|
||||||
|
print "</select>";
|
||||||
|
|
||||||
|
print '<select class="flat" name="'.$prefix.'month">';
|
||||||
|
if ($empty || $set_time == -1)
|
||||||
|
{
|
||||||
|
print '<option value="0" selected="true"> </option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mois
|
||||||
|
for ($month = 1 ; $month <= 12 ; $month++)
|
||||||
|
{
|
||||||
|
if ($month == $smonth)
|
||||||
|
{
|
||||||
|
print "<option value=\"$month\" selected=\"true\">" . $strmonth[$month];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<option value=\"$month\">" . $strmonth[$month];
|
||||||
|
}
|
||||||
|
print "</option>";
|
||||||
|
}
|
||||||
|
print "</select>";
|
||||||
|
|
||||||
|
// Année
|
||||||
|
if ($empty || $set_time == -1)
|
||||||
|
{
|
||||||
|
print '<input class="flat" type="text" size="3" maxlength="4" name="'.$prefix.'year">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<select class="flat" name="'.$prefix.'year">';
|
||||||
|
|
||||||
|
for ($year = $syear - 3; $year < $syear + 5 ; $year++)
|
||||||
|
{
|
||||||
|
if ($year == $syear)
|
||||||
|
{
|
||||||
|
print "<option value=\"$year\" selected=\"true\">$year";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<option value=\"$year\">$year";
|
||||||
|
}
|
||||||
|
print "</option>";
|
||||||
|
}
|
||||||
|
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
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user