From 371a6798f342d1e7912919adbd3aadbc0659948c Mon Sep 17 00:00:00 2001 From: dtportnoy69 Date: Wed, 5 Sep 2007 16:43:48 +0000 Subject: [PATCH] added year range control for date dropdowns git-svn-id: https://seedframework.svn.sourceforge.net/svnroot/seedframework/trunk@507 e74265ba-5712-0410-b544-ed03b9d7f503 --- view/lib/form.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/view/lib/form.php b/view/lib/form.php index d5eb355..026d123 100644 --- a/view/lib/form.php +++ b/view/lib/form.php @@ -1038,8 +1038,15 @@ function generate_control() { */ class DateFormControl extends FormControl { + var $year_min = 0; + var $year_max = 0; + function generate_control() { $discard = assign($this->params['discard']); + + $this->year_min = assign($this->params['year_min'],0); + $this->year_max = assign($this->params['year_max'],0); + $hide = false; if (!intval($this->value)) { @@ -1089,11 +1096,20 @@ function generate_control() { } - function year_options($date) { + function year_options($date, $range = array()) { + + if($this->year_min == '0') { + $this->year_min = 1900; + } + + if($this->year_max == '0') { + $this->year_max = 2020; + } + if ($date) { - return make_number_options(1900, 2020, $date->get_year()); + return make_number_options($this->year_min, $this->year_max, $date->get_year()); } else { - return make_number_options(1900, 2020, ''); + return make_number_options($this->year_min, $this->year_max, ''); } }