summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDatePicker.php
diff options
context:
space:
mode:
authorxue <>2006-04-25 01:27:04 +0000
committerxue <>2006-04-25 01:27:04 +0000
commit1afc913c386bba8e6072c278b0eb4fd9818ab310 (patch)
tree40cc63eb41f47e0ac392c692619640dca57cd262 /framework/Web/UI/WebControls/TDatePicker.php
parentfd019bf034ef4dbedfc305c77fed0dbd83a732c4 (diff)
Undo previous checkin (which goes int 3.0 branch and will be merged back).
Diffstat (limited to 'framework/Web/UI/WebControls/TDatePicker.php')
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php45
1 files changed, 8 insertions, 37 deletions
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',
@@ -263,34 +264,6 @@ class TDatePicker extends TTextBox
}
/**
- * @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.
*/
public function onPreRender($param)
@@ -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();
}