From 8d9364f64440f4c0c625f2447f4658d4d821731e Mon Sep 17 00:00:00 2001 From: carlgmathisen <> Date: Sun, 2 Nov 2008 23:56:37 +0000 Subject: Issue #29 --- framework/Web/UI/WebControls/TDatePicker.php | 44 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 6b7e96a9..916902cd 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -59,6 +59,10 @@ Prado::using('System.Web.UI.WebControls.TTextBox'); * In DropDownList mode, in addition to the popup date picker, three * drop down list (day, month and year) are presented to select the date . * + * The PositionMode property can be set to "Top" or "Bottom" with default + * as "Bottom". It specifies the position of the calendar popup, relative to the + * input field. + * * @author Wei Zhuo * @version $Id$ * @package System.Web.UI.WebControls @@ -263,6 +267,22 @@ class TDatePicker extends TTextBox { return $this->getViewState('UpToYear', intval(@date('Y'))+10); } + + /** + * @param TDatePickerPositionMode calendar UI position + */ + public function setPositionMode($value) + { + $this->setViewState('PositionMode', TPropertyValue::ensureEnum($value, 'TDatePickerPositionMode'), TDatePickerPositionMode::Bottom); + } + + /** + * @return TDatePickerPositionMode current calendar UI position. + */ + public function getPositionMode() + { + return $this->getViewState('PositionMode', TDatePickerPositionMode::Bottom); + } /** * @return integer current selected date from the date picker as timestamp, NULL if timestamp is not set previously. @@ -505,6 +525,7 @@ class TDatePicker extends TTextBox $options['UpToYear'] = $this->getUpToYear(); if($this->getMode()!==TDatePickerMode::Basic) $options['Trigger'] = $this->getDatePickerButtonID(); + $options['PositionMode'] = $this->getPositionMode(); $options = array_merge($options, $this->getCulturalOptions()); if(!is_null($this->_clientScript)) @@ -853,8 +874,8 @@ class TDatePicker extends TTextBox * * The OnDateChanged event is raise when the date picker's date * is changed. - * The formatted date according to {@link TDatePicker::getDateFormat DateFormat} is sent - * as parameter to this event + * The formatted date according to {@link TDatePicker::getDateFormat DateFormat} is sent + * as parameter to this event * * @author Wei Zhuo * @version $Id$ @@ -923,3 +944,20 @@ class TDatePickerMode extends TEnumerable const ImageButton='ImageButton'; } +/** + * TDatePickerPositionMode class. + * TDatePickerPositionMode defines the positions available for the calendar popup, relative to the corresponding input. + * + * The following enumerable values are defined: + * - Top: the date picker is placed above the input field + * - Bottom: the date picker is placed below the input field + * + * @author Carl G. Mathisen + * @package System.Web.UI.WebControls + * @since 3.1.4 + */ +class TDatePickerPositionMode extends TEnumerable +{ + const Top='Top'; + const Bottom='Bottom'; +} \ No newline at end of file -- cgit v1.2.3