System.Web.UI.WebControls
[ class tree: System.Web.UI.WebControls ] [ index: System.Web.UI.WebControls ] [ all elements ]

Class: TDatePicker

Source Location: /Web/UI/WebControls/TDatePicker.php

Class Overview

TComponent
   |
   --TControl
      |
      --TWebControl
         |
         --TTextBox
            |
            --TDatePicker

TDatePicker class

Class Details

[line 101]
TDatePicker class

TDatePicker wraps the DHTML Calendar javascript developed by dynarch.com http://www.dynarch.com/projects/calendar/.

TDatePicker displays a text box for date(time) input purpose. When the text box receives focus, a calendar will pop up and users can pick up from it a date(time) that will be automatically entered into the text box. By default, the calendar will only show dates. If the ShowTime property is set to true, the calendar will also show time that can be selected by users. 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,

WARNING: Languages other than EN may not work.

  1. %a abbreviated weekday name
  2. %A full weekday name
  3. %b abbreviated month name
  4. %B full month name
  5. %C century number
  6. %d the day of the month ( 00 .. 31 )
  7. %e the day of the month ( 0 .. 31 )
  8. %H hour ( 00 .. 23 )
  9. %I hour ( 01 .. 12 )
  10. %j day of the year ( 000 .. 366 )
  11. %k hour ( 0 .. 23 )
  12. %l hour ( 1 .. 12 )
  13. %m month ( 01 .. 12 )
  14. %M minute ( 00 .. 59 )
  15. %n a newline character
  16. %p ”°PM”± or ”°AM”±
  17. %P ”°pm”± or ”°am”±
  18. %S second ( 00 .. 59 )
  19. %s number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC)
  20. %t a tab character
  21. %U, %W, %V the week number
  22. %u the day of the week ( 1 .. 7, 1 = MON )
  23. %w the day of the week ( 0 .. 6, 0 = SUN )
  24. %y year without the century ( 00 .. 99 )
  25. %Y year including the century ( ex. 1979 )
  26. %% a literal % character
For example, the format "%m/%d/%y" will show the date Dec. 31, 2004 as "12/31/04". In case you do not want to show calendar at all, set the ShowCalendar property to false.

Note, you can set the ReadOnly property to true so that users cannot update the content in the textbox directly. The content can still be changed by picking up date from the calendar, though. Set Enabled to false to totally forbid editting the text box.

Note, to use this component, you have to copy the directory "<framework>/js/datepicker" to the "js" directory which should be under the directory containing the entry script file.

Namespace: System.Web.UI.WebControls

Properties

  • DateFormat, string, default="%m/%d/%Y", kept in viewstate
    Gets or sets the format that the date should be displayed
  • ShowCalendar, boolean, default=true, kept in viewstate
    Gets or sets whether the calendar window should pop up when the control receives focus.
  • ShowTime, boolean, default=false, kept in viewstate
    Gets or sets whether the calendar window will allow selection of time.
Compatibility
  • The calendar javascript is supported by Internet Explorer 5.0+ for Windows,
Mozilla, Netscape 7.x, Mozilla FireFox (any platform), Other Gecko-based browsers (any platform) Konqueror 3.2+ for Linux and Apple Safari for Macintosh Opera 7+ (any platform)




version:  v1.0, last update on 2004/08/13 21:44:52
author:  Qiang Xue <qiang.xue@gmail.com>


[ Top ]

Variables

Constants

Methods


Inherited Variables

Inherited Methods

Class: TTextBox

TTextBox::allowBody()
Overrides parent implementation to disable body addition.
TTextBox::getAttributesToRender()
Returns the attributes to be rendered.
TTextBox::getColumns()
TTextBox::getMaxLength()
TTextBox::getRows()
TTextBox::getText()
TTextBox::getTextMode()
TTextBox::getValidationPropertyValue()
Returns the value of the property that needs validation.
TTextBox::isAutoPostBack()
TTextBox::isAutoTrim()
TTextBox::isEncodeText()
TTextBox::isReadOnly()
TTextBox::isWrap()
TTextBox::loadPostData()
Loads user input data.
TTextBox::onTextChanged()
This method is invoked when the value of the Text property changes between posts to the server.
TTextBox::raisePostDataChangedEvent()
Raises postdata changed event.
TTextBox::render()
Renders the text box
TTextBox::setAutoPostBack()
Sets the value indicating if postback automatically.
TTextBox::setAutoTrim()
Sets the value indicating if the input text should be trimmed spaces
TTextBox::setColumns()
Sets the display width of the text box in characters.
TTextBox::setEncodeText()
Sets the value indicating whether the text should be HTML encoded before rendering
TTextBox::setMaxLength()
Sets the maximum number of characters allowed in the text box.
TTextBox::setReadOnly()
TTextBox::setRows()
Sets the number of rows displayed in a multiline text box.
TTextBox::setText()
Sets the text content of the TTextBox component.
TTextBox::setTextMode()
Sets the behavior mode (SingleLine, MultiLine, or Password) of the TTextBox component.
TTextBox::setWrap()
Sets the value indicating whether the text content wraps within a multiline text box.

Class: TWebControl

TWebControl::appendJavascriptEvent()
Append a javascript statement to a particular attribute, e.g. "onclick".
TWebControl::getAccessKey()
TWebControl::getAttributesToRender()
This overrides the parent implementation by rendering more TWebControl-specific attributes.
TWebControl::getBackColor()
TWebControl::getBorderColor()
TWebControl::getBorderStyle()
TWebControl::getBorderWidth()
TWebControl::getCssClass()
TWebControl::getForeColor()
TWebControl::getHeight()
TWebControl::getJavascriptEvents()
Get the list of all the javascript statements.
TWebControl::getStyle()
TWebControl::getTabIndex()
TWebControl::getToolTip()
TWebControl::getWidth()
TWebControl::isEnabled()
TWebControl::parseStyle()
Parses a CSS style string into an array representation.
TWebControl::removeJavascriptEvent()
Remove all or a particular javascript statements.
TWebControl::setAccessKey()
Sets the access key of the control.
TWebControl::setBackColor()
Sets the background color of the control
TWebControl::setBorderColor()
Sets the border color of the control
TWebControl::setBorderStyle()
Sets the border style of the control
TWebControl::setBorderWidth()
Sets the border width of the control
TWebControl::setCssClass()
Sets the CSS class name of the control
TWebControl::setEnabled()
Enables or disables a control.
TWebControl::setForeColor()
Sets the foreground color of the control
TWebControl::setHeight()
Sets the height of the control
TWebControl::setStyle()
Sets the CSS style of the control.
TWebControl::setTabIndex()
Sets the tab index of the control.
TWebControl::setToolTip()
Sets the tooltip of the control.
TWebControl::setWidth()
Sets the width of the control

Class: TControl

TControl::__construct()
Constructor.
TControl::addBody()
Appends an object into the body collection of this control.
TControl::addParsedObject()
Adds the object parsed in template as a body of the component.
TControl::allowBody()
Determines whether the control can add the object as a body.
TControl::clearViewState()
Clears viewstate
TControl::findBodyControl()
TControl::getAttribute()
TControl::getAttributes()
Returns the attribute list object.
TControl::getAttributesToRender()
Returns attributes to be rendered.
TControl::getBodies()
TControl::getClientID()
Returns the client ID of the component.
TControl::getContainer()
Returns the container of this component.
TControl::getSkinName()
TControl::getTagName()
TControl::getViewState()
Returns a viewstate value.
TControl::initSkin()
Initializes a skin for the control. If a skin name is provided then that skin will be loaded.
TControl::isViewStateEnabled()
TControl::isVisible()
This method checks whether a control is visible.
TControl::loadViewState()
Loads viewstate into this component and its children.
TControl::onBubbleEvent()
This method responds to a bubbled event.
TControl::onInit()
This method is invoked when the control enters 'Init' stage.
TControl::onInitRecursive()
Calls onInit of this control and its children recursively.
TControl::onLoad()
This method is invoked when the control enters 'Load' stage.
TControl::onLoadRecursive()
Calls onLoad of this control and its children recursively.
TControl::onPreRender()
This method is invoked when the control enters 'PreRender' stage.
TControl::onPreRenderRecursive()
Calls onPreRender of this control and its children recursively.
TControl::onUnload()
This method is invoked when the control enters 'Unload' stage.
TControl::onUnloadRecursive()
Calls onUnload of this control and its children recursively.
TControl::raiseBubbleEvent()
Invokes the parent's onBubbleEvent method.
TControl::removeBodies()
Removes all body content.
TControl::render()
Renders this control.
TControl::renderAttributes()
Renders the attributes.
TControl::renderBody()
Renders the body content.
TControl::saveViewState()
Returns the viewstate of this component and its children.
TControl::setAttribute()
Sets an attribute.
TControl::setContainer()
Sets the container of this component
TControl::setEnableViewState()
TControl::setSkinName()
Sets the skin to use for this control
TControl::setTagName()
Sets the tag name.
TControl::setViewState()
Sets a viewstate value.
TControl::setVisible()
TControl::synchronizeControl()
This method should only be used by framework developer.

Class: TComponent

TComponent::__construct()
Constructor.
TComponent::addChild()
Adds a child component.
TComponent::addParsedObject()
Handles a component or string met in template.
TComponent::attachEventHandler()
Attaches a handler function to an event.
TComponent::bindProperty()
Sets up the binding between a property and an expression.
TComponent::canGetProperty()
Determines whether a property can be read.
TComponent::canSetProperty()
Determines whether a property can be written.
TComponent::createComponent()
Creates a child component.
TComponent::dataBind()
Performs the databinding for this component.
TComponent::evaluateExpression()
Evaluates a PHP expression.
TComponent::evaluateStatements()
Evaluates a list of PHP statements.
TComponent::findObject()
Finds an object by its ID path.
TComponent::getApplication()
TComponent::getChild()
TComponent::getChildren()
TComponent::getDefinition()
Returns or builds a component definition.
TComponent::getGlobalization()
Returns the Globalization instance for the application.
TComponent::getID()
TComponent::getModule()
Returns the module object that contains the component or the page containing the component.
TComponent::getPage()
TComponent::getParent()
TComponent::getPropertyInitValue()
Gets the initial value of a property.
TComponent::getPropertyType()
Returns the type of a property
TComponent::getRequest()
Returns the request object associated with application.
TComponent::getServiceManager()
Returns the service manager for this application.
TComponent::getSession()
Returns the session object associated with the application.
TComponent::getSessionState()
Returns a session variable.
TComponent::getUniqueID()
Returns the unique ID of the component.
TComponent::getUser()
Returns the user object associated with the application.
TComponent::hasChildren()
TComponent::hasEvent()
Determines whether an event is defined.
TComponent::hasProperty()
Determines whether a property is defined.
TComponent::initProperties()
Initializes the property values.
TComponent::instantiateTemplate()
Parses a template string and instantiates the content.
TComponent::onDataBinding()
This method is invoked when dataBind is invoked for the component.
TComponent::raiseEvent()
Invokes all attached event handler functions for a particular event.
TComponent::removeChild()
Removes a child component.
TComponent::removeChildren()
Removes all child components.
TComponent::setAttribute()
Sets an attribute.
TComponent::setDefinition()
Sets a component definition.
TComponent::setID()
Sets a component ID.
TComponent::setParent()
Sets the parent of this component.
TComponent::setPropertyInitValue()
Sets the initial value of a property.
TComponent::setRoot()
Sets the root component in the component hierarchy.
TComponent::setSessionState()
Sets a session variable.
TComponent::unbindProperty()
Breaks the binding between a property and an expression.
TComponent::__get()
Returns a property value by name or a child component by ID.
TComponent::__set()
Sets value of a component property.

Class Variables

$langMap = array(
      //script-suffix => array(locale possiblities),
      'af' => array('af'),'br'=>array('pt_BR'),'ca'=>array('ca'),'cs-utf8'=>array('cs'),'da'=>array('da'),'de'=>array('de'),'du'=>array(),//DU?
'el'=>array('el'),'en'=>array('en'),'es'=>array('es'),'fi'=>array('fi'),'fr'=>array('fr'),'hr-utf8'=>array('hr'),'hu'=>array('hu'),'it'=>array('it'),'jp'=>array('ja'),'ko-utf8'=>array('ko'),'lt-utf8'=>array('lt'),'nl'=>array('nl'),'no'=>array('no'),'pl-utf8'=>array('pl'),'pt'=>array('pt'),'ro'=>array('ro'),'ru'=>array('ru'),'si'=>array('sl'),//Slovenian?
'sk'=>array(),//What is SK?
'sv'=>array('sv'),'tr'=>array('tr'),'zh'=>array('zh'),//new to 1.0
'al'=>array(),//AL?
'cn-utf8'=>array('zh_CN'),'big5-utf8'=>array('zh_TW','zh_HK'),'he-utf8'=>array('he'),'lv'=>array('lv'))

[line 112]

language js file to locale mappings.



access:  protected

Type:   array


[ Top ]



Class Methods


method allowBody [line 156]

boolean allowBody( mixed $object)

Overrides parent implementation to disable body addition.



access:  public


Overrides TTextBox::allowBody() (Overrides parent implementation to disable body addition.)

Parameters:

mixed   $object   the object to be added

[ Top ]

method getCulture [line 217]

string getCulture( )

Gets the current culture.



return:  current culture, e.g. en_AU.
access:  public


[ Top ]

method getDateFormat [line 164]

string getDateFormat( )



return:  the format of the date string
access:  public


[ Top ]

method getLanguageSuffix [line 288]

string getLanguageSuffix( string $culture)

Get the language prefix from the mappings.



return:  the js language file suffix
access:  protected


Parameters:

string   $culture   a culture identifier.

[ Top ]

method isShowCalendar [line 181]

boolean isShowCalendar( )



return:  whether the calendar window should pop up when the control receives focus
access:  public


[ Top ]

method isShowTime [line 198]

boolean isShowTime( )



return:  whether the calendar window should show time
access:  public


[ Top ]

method onPreRender [line 235]

void onPreRender( mixed $param)

Registers the script and style files



access:  public


Overrides TControl::onPreRender() (This method is invoked when the control enters 'PreRender' stage.)

[ Top ]

method render [line 262]

string render( )

Renders the datepicker



return:  the rendering result
access:  public


Overrides TTextBox::render() (Renders the text box)

[ Top ]

method setCulture [line 226]

void setCulture( string $value)

Sets the culture/language for the date picker.



access:  public


Parameters:

string   $value   a culture string, e.g. en_AU.

[ Top ]

method setDateFormat [line 173]

void setDateFormat( string $value)

Sets the format of the date string.



access:  public


Parameters:

string   $value   the format of the date string

[ Top ]

method setShowCalendar [line 190]

void setShowCalendar( boolean $value)

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



access:  public


Parameters:

boolean   $value   whether to show the calendar window

[ Top ]

method setShowTime [line 207]

void setShowTime( boolean $value)

Sets whether to show time on the calendar window



access:  public


Parameters:

boolean   $value   whether to show time on the calendar window

[ Top ]


Class Constants

JS_DATEPICKER = 'datepicker'

[line 106]

URL (either relative or absolute) of javascript file that contains functions for visual editting


[ Top ]



© 2004-2005 PRADO Software Group. All Rights Reserved.