diff options
author | xue <> | 2006-09-04 19:15:47 +0000 |
---|---|---|
committer | xue <> | 2006-09-04 19:15:47 +0000 |
commit | 56fee292c37e162c03fab9eeadd6a8b9ab85c251 (patch) | |
tree | 923510b93c707868098ae4e5f404eb3766a59553 /framework/Web/UI/WebControls/TDatePicker.php | |
parent | b107cad91733d4a2a80f42cdbaab41a4f7b41c9d (diff) |
merge from 3.0 branch till 1387
Diffstat (limited to 'framework/Web/UI/WebControls/TDatePicker.php')
-rw-r--r-- | framework/Web/UI/WebControls/TDatePicker.php | 78 |
1 files changed, 63 insertions, 15 deletions
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php index 2a9340e5..73a69abc 100644 --- a/framework/Web/UI/WebControls/TDatePicker.php +++ b/framework/Web/UI/WebControls/TDatePicker.php @@ -131,30 +131,36 @@ class TDatePicker extends TTextBox $this->setViewState('Culture', $value, '');
}
+ /**
+ * @param TDatePickerInputMode input method of date values
+ */
public function setInputMode($value)
{
- $this->setViewState('InputMode', TPropertyValue::ensureEnum($value, 'TextBox', 'DropDownList'), 'TextBox');
+ $this->setViewState('InputMode', TPropertyValue::ensureEnum($value, 'TDatePickerInputMode'), TDatePickerInputMode::TextBox);
}
+ /**
+ * @return TDatePickerInputMode input method of date values. Defaults to TDatePickerInputMode::TextBox.
+ */
public function getInputMode()
{
- return $this->getViewState('InputMode', 'TextBox');
+ return $this->getViewState('InputMode', TDatePickerInputMode::TextBox);
}
/**
- * @param string calendar UI mode, "Basic", "Button" or "ImageButton"
+ * @param TDatePickerMode calendar UI mode
*/
public function setMode($value)
{
- $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'Basic', 'Button', 'ImageButton'), 'Basic');
+ $this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'TDatePickerMode'), TDatePickerMode::Basic);
}
/**
- * @return string current calendar UI mode.
+ * @return TDatePickerMode current calendar UI mode.
*/
public function getMode()
{
- return $this->getViewState('Mode', 'Basic');
+ return $this->getViewState('Mode', TDatePickerMode::Basic);
}
/**
* @param string the image url for "Image" UI mode.
@@ -340,12 +346,12 @@ class TDatePicker extends TTextBox /**
* Renders body content.
* This method overrides parent implementation by adding
- * additional date picker button if Mode is "Button" or "ImageButton".
+ * additional date picker button if Mode is Button or ImageButton.
* @param THtmlWriter writer
*/
public function render($writer)
{
- if($this->getInputMode() == 'TextBox')
+ if($this->getInputMode() == TDatePickerInputMode::TextBox)
{
parent::render($writer);
$this->renderDatePickerButtons($writer);
@@ -370,8 +376,8 @@ class TDatePicker extends TTextBox {
switch ($this->getMode())
{
- case 'Button': $this->renderButtonDatePicker($writer); break;
- case 'ImageButton' : $this->renderImageButtonDatePicker($writer); break;
+ case TDatePickerMode::Button: $this->renderButtonDatePicker($writer); break;
+ case TDatePickerMode::ImageButton : $this->renderImageButtonDatePicker($writer); break;
}
}
}
@@ -386,7 +392,7 @@ class TDatePicker extends TTextBox */
public function loadPostData($key,$values)
{
- if($this->getInputMode() == "TextBox")
+ if($this->getInputMode() == TDatePickerInputMode::TextBox)
return parent::loadPostData($key, $values);
$value = $this->getDateFromPostData($key, $values);
if(!$this->getReadOnly() && $this->getText()!==$value)
@@ -447,7 +453,7 @@ class TDatePicker extends TTextBox $options['ClassName'] = $cssClass;
$options['FromYear'] = $this->getFromYear();
$options['UpToYear'] = $this->getUpToYear();
- if($this->getMode()!=='Basic')
+ if($this->getMode()!==TDatePickerMode::Basic)
$options['Trigger'] = $this->getDatePickerButtonID();
$options = array_merge($options, $this->getCulturalOptions());
@@ -501,8 +507,8 @@ class TDatePicker extends TTextBox */
protected function renderDropDownListCalendar($writer)
{
- if($this->getMode() == 'Basic')
- $this->setMode('ImageButton');
+ if($this->getMode() == TDatePickerMode::Basic)
+ $this->setMode(TDatePickerMode::ImageButton);
parent::addAttributesToRender($writer);
$writer->removeAttribute('name');
$writer->removeAttribute('type');
@@ -824,4 +830,46 @@ class TDatePickerClientScript extends TClientSideOptions }
}
-?>
+
+/**
+ * TDatePickerInputMode class.
+ * TDatePickerInputMode defines the enumerable type for the possible datepicker input methods.
+ *
+ * The following enumerable values are defined:
+ * - TextBox: text boxes are used to input date values
+ * - DropDownList: dropdown lists are used to pick up date values
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDatePickerInputMode extends TEnumerable
+{
+ const TextBox='TextBox';
+ const DropDownList='DropDownList';
+}
+
+/**
+ * TDatePickerMode class.
+ * TDatePickerMode defines the enumerable type for the possible UI mode
+ * that a {@link TDatePicker} control can take.
+ *
+ * The following enumerable values are defined:
+ * - Basic: Only shows a text input, focusing on the input shows the date picker
+ * - Button: Shows a button next to the text input, clicking on the button shows the date, button text can be by the
+ * - ImageButton: Shows an image next to the text input, clicking on the image shows the date picker,
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TDatePickerMode extends TEnumerable
+{
+ const Basic='Basic';
+ const Button='Button';
+ const ImageButton='ImageButton';
+}
+
+?>
\ No newline at end of file |