PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TDatePicker

TDatePicker class.

TDatePicker displays a text box for date input purpose. When the text box receives focus, a calendar will pop up and users can pick up from it a date that will be automatically entered into the text box. The format of the date string displayed in the text box is determined by the DateFormat property. Valid formats are the combination of the following tokens,

Character Format Pattern (en-US)
-----------------------------------------
d          day digit
dd         padded day digit e.g. 01, 02
M          month digit
MM         padded month digit
MMMM       localized month name, e.g. March, April
yy         2 digit year
yyyy       4 digit year
-----------------------------------------

TDatePicker has four Mode to show the date picker popup.
# Basic -- Only shows a text input, focusing on the input shows the date picker. This way you can access the popup using only the keyboard. Note that because of this, TAB-bing through this control will automatically select the current date if no previous date was selected. If you close the popup (eg. pressing the ESC key) you'll need to un-focus and re-focus the control again for the popup to reappear. # Clickable -- Only shows a text input, clicking on the input shows the date picker. This mode solves the two small problems of the Basic mode. It was first introduced in Prado 3.2. # Button -- Shows a button next to the text input, clicking on the button shows the date, button text can be by the ButtonText property # ImageButton -- Shows an image next to the text input, clicking on the image shows the date picker, image source can be change through the ButtonImageUrl property.

The CssClass property can be used to override the css class name for the date picker panel. CalendarStyle property sets the packages styles available. E.g. default.

The InputMode property can be set to "TextBox" or "DropDownList" with default as "TextBox". 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.

TComponent
Extended by TApplicationComponent
Extended by TControl implements IRenderable, IBindable
Extended by TWebControl implements IStyleable
Extended by TTextBox implements IPostBackDataHandler, IValidatable, IDataRenderer
Extended by TDatePicker

Direct known subclasses

TActiveDatePicker
Package: System\Web\UI\WebControls
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Author: Carl G. Mathisen <carlgmathisen@gmail.com>
Since: 3.0
Located at Web/UI/WebControls/TDatePicker.php
Methods summary
public
# setAutoPostBack( boolean $value )

AutoPostBack is not supported.

AutoPostBack is not supported.

Parameters

$value
boolean
the value indicating if postback automatically

Overrides

TTextBox::setAutoPostBack()
public string
# getDateFormat( )

Returns

string
the format of the date string
public
# setDateFormat( string $value )

Sets the format of the date string.

Sets the format of the date string.

Parameters

$value
string
the format of the date string
public boolean
# getShowCalendar( )

Returns

boolean
whether the calendar window should pop up when the control receives focus
public
# setShowCalendar( boolean $value )

Sets whether to pop up the calendar window when the control receives focus

Sets whether to pop up the calendar window when the control receives focus

Parameters

$value
boolean
whether to show the calendar window
public string
# getCulture( )

Gets the current culture.

Gets the current culture.

Returns

string
current culture, e.g. en_AU.
public
# setCulture( string $value )

Sets the culture/language for the date picker.

Sets the culture/language for the date picker.

Parameters

$value
string
a culture string, e.g. en_AU.
public
# setInputMode( TDatePickerInputMode $value )

Parameters

$value
TDatePickerInputMode
input method of date values
public TDatePickerInputMode
# getInputMode( )

Returns

TDatePickerInputMode
input method of date values. Defaults to TDatePickerInputMode::TextBox.
public
# setMode( TDatePickerMode $value )

Parameters

$value
TDatePickerMode
calendar UI mode
public TDatePickerMode
# getMode( )

Returns

TDatePickerMode
current calendar UI mode.
public
# setButtonImageUrl( string $value )

Parameters

$value
string
the image url for "Image" UI mode.
public string
# getButtonImageUrl( )

Returns

string
the image url for "Image" UI mode.
public
# setCalendarStyle( string $value )

Parameters

$value
string
set the calendar style
public string
# getCalendarStyle( )

Returns

string
current calendar style
public
# setFirstDayOfWeek( integer $value )

Set the first day of week, with 0 as Sunday, 1 as Monday, etc.

Set the first day of week, with 0 as Sunday, 1 as Monday, etc.

Parameters

$value
integer
0 for Sunday, 1 for Monday, 2 for Tuesday, etc.
public integer
# getFirstDayOfWeek( )

Returns

integer
first day of the week
public string
# getButtonText( )

Returns

string
text for the date picker button. Default is "...".
public
# setButtonText( string $value )

Parameters

$value
string
text for the date picker button
public
# setFromYear( integer $value )

Parameters

$value
integer
date picker starting year, default is 2000.
public integer
# getFromYear( )

Returns

integer
date picker starting year, default is -5 years
public
# setUpToYear( integer $value )

Parameters

$value
integer
date picker ending year, default +10 years
public integer
# getUpToYear( )

Returns

integer
date picker ending year, default +10 years
public
# setPositionMode( TDatePickerPositionMode $value )

Parameters

$value
TDatePickerPositionMode
calendar UI position
public TDatePickerPositionMode
# getPositionMode( )

Returns

TDatePickerPositionMode
current calendar UI position.
public integer
# getTimeStamp( )

Returns

integer
current selected date from the date picker as timestamp, NULL if timestamp is not set previously.
public
# setTimeStamp( float $value )

Sets the date for the date picker using timestamp.

Sets the date for the date picker using timestamp.

Parameters

$value
float
time stamp for the date picker
public integer
# getData( )

Returns the timestamp selected by the user. This method is required by IDataRenderer. It is the same as TDatePicker::getTimeStamp().

Returns the timestamp selected by the user. This method is required by IDataRenderer. It is the same as TDatePicker::getTimeStamp().

Returns

integer
the timestamp of the TDatePicker control.

Since

3.1.2

See

TDatePicker::getTimeStamp()

Overrides

TTextBox::getData()
public
# setData( integer $value )

Sets the timestamp represented by this control. This method is required by IDataRenderer. It is the same as TDatePicker::setTimeStamp().

Sets the timestamp represented by this control. This method is required by IDataRenderer. It is the same as TDatePicker::setTimeStamp().

Parameters

$value
integer
the timestamp of the TDatePicker control.

Since

3.1.2

See

TDatePicker::setTimeStamp()

Overrides

TTextBox::setData()
public string
# getDate( )

Returns

string
the date string.
public
# setDate( string $value )

Parameters

$value
string
date string
public TDatePickerClientScript
# getClientSide( )

Gets the TDatePickerClientScript to set the TDatePicker event handlers.

Gets the TDatePickerClientScript to set the TDatePicker event handlers.

The date picker on the client-side supports the following events. # OnDateChanged -- raised when the date is changed.

You can attach custom javascript code to each of these events

Returns

TDatePickerClientScript
javascript validator event options.
protected TDatePickerClientScript
# createClientScript( )

Returns

TDatePickerClientScript
javascript validator event options.
public integer
# getValidationPropertyValue( )

Returns the value to be validated. This methid is required by IValidatable interface.

Returns the value to be validated. This methid is required by IValidatable interface.

Returns

integer
the interger timestamp if valid, otherwise the original text.

Overrides

TTextBox::getValidationPropertyValue()
public
# onPreRender( TEventParameter $param )

Publish the date picker Css asset files.

Publish the date picker Css asset files.

Parameters

$param
TEventParameter
event parameter to be passed to the event handlers

Overrides

TWebControl::onPreRender()
public
# render( THtmlWriter $writer )

Renders body content. This method overrides parent implementation by adding additional date picker button if Mode is Button or ImageButton.

Renders body content. This method overrides parent implementation by adding additional date picker button if Mode is Button or ImageButton.

Parameters

$writer
THtmlWriter
writer

Overrides

TWebControl::render()
protected
# renderDatePickerButtons( mixed $writer )

Renders the date picker popup buttons.

Renders the date picker popup buttons.

public boolean
# loadPostData( string $key, array $values )

Loads user input data. Override parent implementation, when InputMode is DropDownList call getDateFromPostData to get date data. This method is primarly used by framework developers.

Loads user input data. Override parent implementation, when InputMode is DropDownList call getDateFromPostData to get date data. This method is primarly used by framework developers.

Parameters

$key
string
the key that can be used to retrieve data from the input data collection
$values
array
the input data collection

Returns

boolean
whether the data of the component has been changed

Overrides

TTextBox::loadPostData()
protected array
# getDateFromPostData( string $key, array $values )

Loads date from drop down list data.

Loads date from drop down list data.

Parameters

$key
string
the key that can be used to retrieve data from the input data collection
$values
array
the input data collection

Returns

array
the date selected
protected array
# getDatePickerOptions( )

Get javascript date picker options.

Get javascript date picker options.

Returns

array
date picker client-side options
protected array
# getCulturalOptions( )

Get javascript localization options, e.g. month and weekday names.

Get javascript localization options, e.g. month and weekday names.

Returns

array
localization options.
protected string
# getCurrentCulture( )

Returns

string
the current culture, falls back to application if culture is not set.
protected DateTimeFormatInfo
# getLocalizedCalendarInfo( )

Returns

DateTimeFormatInfo
date time format information for the current culture.
protected
# renderDropDownListCalendar( mixed $writer )

Renders the drop down list date picker.

Renders the drop down list date picker.

protected
# hasDayPattern( )
protected
# renderCalendarSelections( THtmlWriter $writer, array $date )

Renders the calendar drop down list depending on the DateFormat pattern.

Renders the calendar drop down list depending on the DateFormat pattern.

Parameters

$writer
THtmlWriter
the Html writer to render the drop down lists.
$date
array
the current selected date
protected integer
# getTimeStampFromText( )

Gets the date from the text input using TSimpleDateFormatter

Gets the date from the text input using TSimpleDateFormatter

Returns

integer
current selected date timestamp
protected
# renderCalendarDayOptions( THtmlWriter $writer, mixed $selected = null )

Renders the day drop down list options.

Renders the day drop down list options.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose
$selected
mixed
selected day.
protected array
# getDropDownDayOptions( )

Returns

array
list of day options for a drop down list.
protected
# renderCalendarMonthOptions( THtmlWriter $writer, mixed $selected = null )

Renders the month drop down list options.

Renders the month drop down list options.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose
$selected
mixed
selected month.
protected array
# getLocalizedMonthNames( DateTimeFormatInfo $info )

Returns the localized month names that depends on the month format pattern. "MMMM" will return the month names, "MM" or "MMM" return abbr. month names and "M" return month digits.

Returns the localized month names that depends on the month format pattern. "MMMM" will return the month names, "MM" or "MMM" return abbr. month names and "M" return month digits.

Parameters

$info
DateTimeFormatInfo
localized date format information.

Returns

array
localized month names.
protected
# renderCalendarYearOptions( THtmlWriter $writer, mixed $selected = null )

Renders the year drop down list options.

Renders the year drop down list options.

Parameters

$writer
THtmlWriter
the writer used for the rendering purpose
$selected
mixed
selected year.
protected string
# getDatePickerButtonID( )

Gets the ID for the date picker trigger button.

Gets the ID for the date picker trigger button.

Returns

string
unique button ID
protected THtmlWriter
# renderButtonDatePicker( mixed $writer )

Adds an additional button such that when clicked it shows the date picker.

Adds an additional button such that when clicked it shows the date picker.

Returns

THtmlWriter
writer
protected THtmlWriter
# renderImageButtonDatePicker( mixed $writer )

Adds an additional image button such that when clicked it shows the date picker.

Adds an additional image button such that when clicked it shows the date picker.

Returns

THtmlWriter
writer
protected string
# getAssetUrl( string $file = '' )

Parameters

$file
string
date picker asset file in the self::SCRIPT_PATH directory.

Returns

string
date picker asset url.
protected string
# publishCalendarStyle( )

Publish the calendar style Css asset file.

Publish the calendar style Css asset file.

Returns

string
Css file url.
protected
# addAttributesToRender( THtmlWriter $writer )

Add the client id to the input textbox, and register the client scripts.

Add the client id to the input textbox, and register the client scripts.

Parameters

$writer
THtmlWriter
writer

Overrides

TTextBox::addAttributesToRender()
protected
# registerCalendarClientScriptPre( )

Registers the javascript code to initialize the date picker.

Registers the javascript code to initialize the date picker.

protected
# renderClientControlScript( mixed $writer )

Renders the javascript for textbox.

Renders the javascript for textbox.

Overrides

TTextBox::renderClientControlScript()
Methods inherited from TTextBox
getAutoCompleteType(), getAutoPostBack(), getAutoTrim(), getCausesValidation(), getClientClassName(), getColumns(), getDataChanged(), getEnableClientScript(), getIsValid(), getMaxLength(), getPersistPassword(), getPostBackOptions(), getReadOnly(), getRows(), getSafeText(), getSafeTextParser(), getTagName(), getText(), getTextMode(), getValidationGroup(), getWrap(), onTextChanged(), raisePostDataChangedEvent(), renderBeginTag(), renderContents(), setAutoCompleteType(), setAutoTrim(), setCausesValidation(), setColumns(), setEnableClientScript(), setIsValid(), setMaxLength(), setPersistPassword(), setReadOnly(), setRows(), setText(), setTextMode(), setValidationGroup(), setWrap()
Methods inherited from TWebControl
clearStyle(), copyBaseAttributes(), createStyle(), getAccessKey(), getBackColor(), getBorderColor(), getBorderStyle(), getBorderWidth(), getCssClass(), getDecorator(), getDisplay(), getEnsureId(), getFont(), getForeColor(), getHasStyle(), getHeight(), getStyle(), getTabIndex(), getToolTip(), getWidth(), renderEndTag(), setAccessKey(), setBackColor(), setBorderColor(), setBorderStyle(), setBorderWidth(), setCssClass(), setDisplay(), setEnsureId(), setForeColor(), setHeight(), setStyle(), setTabIndex(), setToolTip(), setWidth()
Methods inherited from TControl
__construct(), __get(), addParsedObject(), addToPostDataLoader(), addedControl(), applyStyleSheetSkin(), autoBindProperty(), autoDataBindProperties(), bindProperty(), broadcastEvent(), bubbleEvent(), clearChildState(), clearControlState(), clearNamingContainer(), clearViewState(), convertUniqueIdToClientId(), createChildControls(), createControlCollection(), dataBind(), dataBindChildren(), dataBindProperties(), ensureChildControls(), findControl(), findControlsByID(), findControlsByType(), focus(), getAdapter(), getAllowChildControls(), getAttribute(), getAttributes(), getChildControlsCreated(), getClientID(), getControlStage(), getControlState(), getControls(), getCustomData(), getEnableTheming(), getEnableViewState(), getEnabled(), getHasAdapter(), getHasAttributes(), getHasChildInitialized(), getHasControls(), getHasInitialized(), getHasLoaded(), getHasLoadedPostData(), getHasPreRendered(), getID(), getIsSkinApplied(), getNamingContainer(), getPage(), getParent(), getRegisteredObject(), getSkinID(), getSourceTemplateControl(), getTemplateControl(), getUniqueID(), getViewState(), getVisible(), hasAttribute(), initRecursive(), isDescendentOf(), isObjectRegistered(), loadRecursive(), loadState(), loadStateRecursive(), onDataBinding(), onInit(), onLoad(), onUnload(), preRenderRecursive(), raiseBubbleEvent(), registerObject(), removeAttribute(), removedControl(), renderChildren(), renderControl(), saveState(), saveStateRecursive(), setAdapter(), setAttribute(), setChildControlsCreated(), setControlStage(), setControlState(), setCustomData(), setEnableTheming(), setEnableViewState(), setEnabled(), setID(), setPage(), setSkinID(), setTemplateControl(), setViewState(), setVisible(), trackViewState(), traverseChildControls(), unbindProperty(), unloadRecursive(), unregisterObject()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __isset(), __set(), __sleep(), __unset(), __wakeup(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string SCRIPT_PATH 'prado/datepicker'
#

Script path relative to the TClientScriptManager::SCRIPT_PATH

Script path relative to the TClientScriptManager::SCRIPT_PATH

Constants inherited from TTextBox
DEFAULT_COLUMNS, DEFAULT_ROWS
Constants inherited from TControl
AUTOMATIC_ID_PREFIX, CLIENT_ID_SEPARATOR, CS_CHILD_INITIALIZED, CS_CONSTRUCTED, CS_INITIALIZED, CS_LOADED, CS_PRERENDERED, CS_STATE_LOADED, ID_FORMAT, ID_SEPARATOR, IS_CHILD_CREATED, IS_CREATING_CHILD, IS_DISABLE_THEMING, IS_DISABLE_VIEWSTATE, IS_ID_SET, IS_SKIN_APPLIED, IS_STYLESHEET_APPLIED, RF_ADAPTER, RF_AUTO_BINDINGS, RF_CHILD_STATE, RF_CONTROLS, RF_CONTROLSTATE, RF_DATA_BINDINGS, RF_EVENTS, RF_NAMED_CONTROLS, RF_NAMED_CONTROLS_ID, RF_NAMED_OBJECTS, RF_SKIN_ID
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Properties inherited from TWebControl
$_decorator
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO