From 90b3f22cba8ad85ef2eb38c158fa2da46d798cf8 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 8 Sep 2006 19:31:03 +0000 Subject: merge from 3.0 branch till 1397. --- framework/Web/UI/WebControls/TDatePicker.php | 29 +++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'framework/Web/UI/WebControls/TDatePicker.php') diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 73a69abc..86d119ac 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -6,7 +6,7 @@ * @link http://www.pradosoft.com/ * @copyright Copyright © 2005 PradoSoft * @license http://www.pradosoft.com/license/ - * @version $Revision: $ $Date: $ + * @version $Id$ * @package System.Web.UI.WebControls */ @@ -60,7 +60,7 @@ Prado::using('System.Web.UI.WebControls.TTextBox'); * drop down list (day, month and year) are presented to select the date . * * @author Wei Zhuo - * @version $Revision: $ $Date: $ + * @version $Id$ * @package System.Web.UI.WebControls * @since 3.0 */ @@ -600,7 +600,7 @@ class TDatePicker extends TTextBox */ protected function renderCalendarDayOptions($writer, $selected=null) { - $days = array(); for($i=1;$i<=31;$i++) $days[$i] = $i; + $days = $this->getDropDownDayOptions(); $writer->addAttribute('id', $this->getClientID().'_day'); $writer->addAttribute('name', $this->getUniqueID().'$day'); $writer->addAttribute('class', 'datepicker_day_options'); @@ -611,6 +611,22 @@ class TDatePicker extends TTextBox $writer->renderEndTag(); } + /** + * @return array list of day options for a drop down list. + */ + protected function getDropDownDayOptions() + { + $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', + $this->getDateFormat()); + $days = array(); + $requiresPadding = $formatter->getDayPattern() === 'dd'; + for($i=1;$i<=31;$i++) + { + $days[$i] = $requiresPadding ? str_pad($i, 2, '0', STR_PAD_LEFT) : $i; + } + return $days; + } + /** * Renders the month drop down list options. * @param THtmlWriter the writer used for the rendering purpose @@ -618,7 +634,6 @@ class TDatePicker extends TTextBox */ protected function renderCalendarMonthOptions($writer, $selected=null) { - $info = $this->getLocalizedCalendarInfo(); $writer->addAttribute('id', $this->getClientID().'_month'); $writer->addAttribute('name', $this->getUniqueID().'$month'); @@ -806,7 +821,7 @@ class TDatePicker extends TTextBox * is changed. * * @author Wei Zhuo - * @version $Revision: $ $Date: $ + * @version $Id$ * @package System.Web.UI.WebControls * @since 3.0.4 */ @@ -840,7 +855,7 @@ class TDatePickerClientScript extends TClientSideOptions * - DropDownList: dropdown lists are used to pick up date values * * @author Qiang Xue - * @version $Revision: $ $Date: $ + * @version $Id$ * @package System.Web.UI.WebControls * @since 3.0.4 */ @@ -861,7 +876,7 @@ class TDatePickerInputMode extends TEnumerable * - ImageButton: Shows an image next to the text input, clicking on the image shows the date picker, * * @author Qiang Xue - * @version $Revision: $ $Date: $ + * @version $Id$ * @package System.Web.UI.WebControls * @since 3.0.4 */ -- cgit v1.2.3