mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:05:16 +01:00
Added ending date option
This commit is contained in:
parent
4b1282adcd
commit
003ef39d11
@ -126,23 +126,40 @@
|
||||
return $out;
|
||||
}
|
||||
|
||||
function getYears($name, $selected=0, $startYear=0)
|
||||
function getYears($name, $selected = 0, $startYear = 0, $endyear = 0)
|
||||
{
|
||||
|
||||
if(!$startYear) $startYear = date('Y');
|
||||
if (!$startYear)
|
||||
{
|
||||
$startYear = date('Y') - 2;
|
||||
}
|
||||
|
||||
if (!$endyear)
|
||||
{
|
||||
$endyear = date('Y') + 5;
|
||||
}
|
||||
|
||||
$out = '<select name="'.$name.'">'."\n";
|
||||
|
||||
$out .= '<option value=""';
|
||||
if($selected == 0 OR $selected == '') $out .= ' SELECTED';
|
||||
if ($selected == 0 OR $selected == '')
|
||||
{
|
||||
$out .= ' SELECTED';
|
||||
}
|
||||
$out .= '></option>'."\n";
|
||||
|
||||
for($i=$startYear - 1;$i<$startYear + 5;$i++)
|
||||
// We need to add some good error checking here.
|
||||
for ($i=$startYear;$i<$endyear; $i++)
|
||||
{
|
||||
$out .= '<option value="'.$i.'"';
|
||||
if($selected==$i) $out .= ' SELECTED';
|
||||
if ($selected==$i)
|
||||
{
|
||||
$out .= ' SELECTED';
|
||||
}
|
||||
$out .= '>'.$i.'</option>'."\n";
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user