From a2c7d35ea49a03672ddebb45dc1add6e1f756dd1 Mon Sep 17 00:00:00 2001 From: Mike Ho Date: Mon, 18 Jul 2011 08:05:30 -0700 Subject: [PATCH] Modified year selections on date pickers to be current time / year dependent --- .../_core/qform/QDateTimePickerBase.class.php | 22 +++++++++++++++---- .../qcodo/qform/QDateTimePicker.class.php | 5 +++-- www/assets/php/_core/calendar.php | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/includes/qcodo/_core/qform/QDateTimePickerBase.class.php b/includes/qcodo/_core/qform/QDateTimePickerBase.class.php index 56a2497c..e7503cd9 100644 --- a/includes/qcodo/_core/qform/QDateTimePickerBase.class.php +++ b/includes/qcodo/_core/qform/QDateTimePickerBase.class.php @@ -4,13 +4,19 @@ class QDateTimePickerBase extends QControl { // Private Member Variables /////////////////////////// + // DEFAULTS + // These are set at the bottom of this script + public static $DefaultMinimumYear; + public static $DefaultMaximumYear; + // MISC protected $dttDateTime = null; protected $strDateTimePickerType = QDateTimePickerType::Date; protected $strDateTimePickerFormat = QDateTimePickerFormat::MonthDayYear; - protected $intMinimumYear = 1970; - protected $intMaximumYear = 2015; + // If these stay null, then it will use the $DefaultMinimumYear and $DefaultMaximumYear static variables on QDateTimePicker + protected $intMinimumYear = null; + protected $intMaximumYear = null; protected $intSelectedMonth = null; protected $intSelectedDay = null; @@ -191,12 +197,17 @@ protected function GetControlHtml() { } } $strDayListbox .= ''; - + + // Figure Out Min and Max Years + $intMinimumYear = (is_null($this->intMinimumYear)) ? QDateTimePicker::$DefaultMinimumYear : $this->intMinimumYear; + $intMaximumYear = (is_null($this->intMaximumYear)) ? QDateTimePicker::$DefaultMaximumYear : $this->intMaximumYear; + // Year $strYearListbox = sprintf('