From 1afc913c386bba8e6072c278b0eb4fd9818ab310 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 25 Apr 2006 01:27:04 +0000 Subject: Undo previous checkin (which goes int 3.0 branch and will be merged back). --- framework/Web/UI/WebControls/TDatePicker.php | 45 +++++----------------------- 1 file changed, 8 insertions(+), 37 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 02386515..c6a2345b 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -245,16 +245,17 @@ class TDatePicker extends TTextBox /** * @return integer current selected date from the date picker as timestamp. */ - public function getTimeStamp() + public function getDate() { - return $this->getTimeStampFromText(); + $date = $this->getDateFromText(); + return $date[0]; } /** * Sets the date for the date picker using timestamp. * @param integer time stamp for the date picker */ - public function setTimeStamp($value) + public function setDate($value) { $date = TPropertyValue::ensureInteger($value); $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', @@ -262,34 +263,6 @@ class TDatePicker extends TTextBox $this->setText($formatter->format($date)); } - /** - * @return string the date string. - */ - public function getDate() - { - return $this->getText(); - } - - /** - * @param string date string - */ - public function setDate($value) - { - $this->setText($value); - } - - /** - * Returns the value to be validated. - * This methid is required by IValidatable interface. - * @return integer the value of the property to be validated. - */ - public function getValidationPropertyValue() - { - if($this->getText() === '') - return ''; - return $this->getTimeStamp(); - } - /** * Publish the date picker Css asset files. */ @@ -423,7 +396,6 @@ class TDatePicker extends TTextBox $date = $this->getLocalizedCalendarInfo(); $options['MonthNames'] = TJavaScript::encode($date->getMonthNames(),false); - $options['AbbreviatedMonthNames'] = TJavaScript::encode($date->getAbbreviatedMonthNames(),false); $options['ShortWeekDayNames'] = TJavaScript::encode($date->getAbbreviatedDayNames(),false); return $options; @@ -467,8 +439,7 @@ class TDatePicker extends TTextBox $writer->addAttribute('class', $class); $writer->renderBeginTag('span'); - $date = @getdate($this->getTimeStampFromText()); - + $date = $this->getDateFromText(); $this->renderCalendarSelections($writer, $date); //render a hidden input field @@ -510,9 +481,9 @@ class TDatePicker extends TTextBox /** * Gets the date from the text input using TSimpleDateFormatter - * @return integer current selected date timestamp + * @return array current selected date */ - protected function getTimeStampFromText() + protected function getDateFromText() { $pattern = $this->getDateFormat(); $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern); @@ -588,7 +559,7 @@ class TDatePicker extends TTextBox case 'MMM': case 'MM': return $info->getAbbreviatedMonthNames(); case 'M': - $array = array(); for($i=1;$i<=12;$i++) $array[$i-1] = $i; + $array = array(); for($i=1;$i<=12;$i++) $array[$i] = $i; return $array; default : return $info->getMonthNames(); } -- cgit v1.2.3