Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Commit

Permalink
added year range control for date dropdowns
Browse files Browse the repository at this point in the history
git-svn-id: https://seedframework.svn.sourceforge.net/svnroot/seedframework/trunk@507 e74265ba-5712-0410-b544-ed03b9d7f503
  • Loading branch information
dtportnoy69 committed Sep 5, 2007
1 parent a4cfd06 commit 371a679
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions view/lib/form.php
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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, '');
}

}
Expand Down

0 comments on commit 371a679

Please sign in to comment.