formelements
[ class tree: formelements ] [ index: formelements ] [ all elements ]

Class: JsDateTime

Source Location: /HtmlForm.FormElement.JsDateTime.class.php

Class Overview

FormElement
   |
   --InputText
      |
      --JsDateTime

Wraps a standard text-input adapted and expanded to work as a date-time-picker.


Author(s):

  • Sebastian Schlapkohl

Version:

  • 1.0

Constants

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: InputText

InputText::__construct()
Hidden constructor.
InputText::doRender()
Compiles and returns the html-fragment for the element.
InputText::get()
Factory method for InputText, returns new instance.
InputText::getValue()
Returns the current value of the element.
InputText::printMaxLength()
Compiles and returns the html-maxlength-attribute for the element.
InputText::printReadonly()
Compiles and returns the html-readonly-attribute for the element.
InputText::printSize()
Compiles and returns the html-size-attribute for the element.
InputText::refill()
Tries to refill the element-value from existing data.
InputText::setMaxLength()
Sets the maximum amount of characters that can be inserted into the input.
InputText::setReadonly()
Sets that the element should be read-only.
InputText::setSize()
Sets the amount of characters the input should hold horizontally.
InputText::setText()
Sets the text to start with.
InputText::validate()
Starts the validation-process for the element.

Class: FormElement

FormElement::__construct()
General abstract, hidden formelement constructor.
FormElement::addCssClasses()
Adds one or many css-classes to the element's class-attribute.
FormElement::addElement()
Adds a subelement to the element.
FormElement::determineRefiller()
Returns the supposed source of refill values.
FormElement::doRender()
Returns the compiled html-code for the element.
FormElement::getId()
Return the element's html-id.
FormElement::getLabel()
Return the element's label text.
FormElement::getMasterElement()
Return the currently connected owner element for the element.
FormElement::getMasterForm()
Returns the currently connected owner form for the element.
FormElement::getName()
Return the element's html-name.
FormElement::getSubElements()
Return all owned elements of this element.
FormElement::getTitle()
Return the element's html-title.
FormElement::getValidator()
Return the currently connected validator for the element.
FormElement::getValue()
Returns the value of the element if there is any.
FormElement::getValueSet()
Returns the compiled valueset for this element including the elements owned by this one.
FormElement::insertElementAfter()
Searches the subelements of the element if present and inserts a given element after the first found one.
FormElement::isValid()
Answers if the element is in a valid state at the moment.
FormElement::needsUtf8Safety()
Answers if the element needs to be treated with precautions according to possible utf-8 values.
FormElement::printCssClasses()
Compiles the html-class-attribute-string of the element.
FormElement::printDisabled()
Compiles the html-disabled-attribute-string of the element.
FormElement::printId()
Compiles the html-id-attribute-string of the element.
FormElement::printJavascriptEventHandler()
Compiles html-javascript-eventhandler-string of the element.
FormElement::printJavascriptValidationCode()
Grabs the compiled JS-validation-code for the element from its validator, if present and returns the code as a string.
FormElement::printMessages()
Returns a string of all aggregated error messages of the element.
FormElement::printName()
Compiles the html-name-string of the element.
FormElement::printNameArray()
Comiles the html-name-string of the element, if the element is part of a group of values.
FormElement::printTabIndex()
Calculates current ongoing tabindex of the form, refreshes it and returns the proper value for the element.
FormElement::printTitle()
Compiles the html-title-string of the element.
FormElement::printWrapperClasses()
Compiles a string of all classes for the tag-wrapper for the element's html-code.
FormElement::setCssClasses()
Sets the html-class-attribute for the element.
FormElement::setDisabled()
Set the element disabled.
FormElement::setId()
Sets the html-id for this element.
FormElement::setJavascriptEventHandler()
Sets a javascript-handler for the element.
FormElement::setLabel()
Inserts a label for the element.
FormElement::setMasterElement()
Sets the owning element for an element.
FormElement::setMasterForm()
Sets the owning form for an element and by doing so inserts the element into the logical structure of the form.
FormElement::setTitle()
Sets the html-title for this element.
FormElement::setUsable()
Set the element usables or disabled based on an expression.
FormElement::setValidator()
Sets a validator for a value-bearing element.
FormElement::validate()
Starts validation for the element and all subelements according to the rules laid out in the element's validator.

Class Details

[line 59]
Wraps a standard text-input adapted and expanded to work as a date-time-picker.

This element is an example of how to write expanded, special elements, with behaviour not originally found in html. JsDateTime take a normal InputText, expands from it and adds a calendar-button to the mix, which opens a javascript-powered date-time-picker with own images. The picked date and/or time will the be inserted into tht textfield as an ordinary string.
This element shows several principles:

  • elements and widgets are not bound by html alone
  • inclusion of external assets like javscripts and images by setting a packagepath in the form and adding the assets to the package

The javascript-date-time-picker can be configured via parameters using the according setters. These are the parameters and their defaults:

var SpanBorderColor = "#cdcdcd";//span border color
var SpanBgColor = "#cdcdcd";//span background color
var WeekChar=3;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
var DateSeparator="-";//Date Separator, you can change it to "-" if you want.
var ShowLongMonth=true;//Show long month name in Calendar header. example: "January".
var ShowMonthYear=true;//Show Month and Year in Calendar header.
var MonthYearColor="#cc0033";//Font Color of Month and Year in Calendar header.
var WeekHeadColor="#18861B";//Background Color in Week header.
var SundayColor="#C0F64F";//Background color of Sunday.
var SaturdayColor="#C0F64F";//Background color of Saturday.
var WeekDayColor="white";//Background color of weekdays.
var FontColor="blue";//color of font in Calendar day cell.
var TodayColor="#FFFF33";//Background color of today.
var SelDateColor="#8DD53C";//Backgrond color of selected date in textbox.
var YrSelColor="#cc0033";//color of font of Year selector.
var MthSelColor="#cc0033";//color of font of Month selector if "MonthSelector" is "arrow".
var ThemeBg="";//Background image of Calendar window.
var CalBgColor="";//Backgroud color of Calendar window.
var PrecedeZero=true;//Preceding zero [true|false]
var MondayFirstDay=false;//true:Use Monday as first day; false:Sunday as first day. [true|false] //added in version 1.7
var UseImageFiles = false;//Use image files with "arrows" and "close" button
var MonthName=["January", "February", "March", "April", "May", "June", "July","August", "September", "October", "November", "December"];
var WeekDayName1=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var WeekDayName2=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];




Tags:

author:  Sebastian Schlapkohl
version:  1.0


[ Top ]


Class Methods


static method get [line 113]

static JsDateTime get( String $name, [String $id = ''])

Factory method for JsDateTime, returns new instance.

Factories are used to make instant chaining possible.




Tags:

return:  new JsDateTime-instance
access:  public


Overrides InputText::get() (Factory method for InputText, returns new instance.)

Parameters:

String   $name   html-name for the element
String   $id   html-id for the element

[ Top ]

constructor __construct [line 90]

JsDateTime __construct( String $name, String $id)

Hidden constructor.

Get new instances with "get()" instead.




Tags:

access:  protected


Overrides InputText::__construct() (Hidden constructor.)

Parameters:

String   $name   html-name for the element
String   $id   html-id for the element

[ Top ]

method doRender [line 384]

String doRender( )

Compiles and returns the html-fragment for the element.



Tags:

return:  html-fragment for the element
access:  public


Overrides InputText::doRender() (Compiles and returns the html-fragment for the element.)

[ Top ]

method setAmPmTime [line 208]

JsDateTime setAmPmTime( )

Tells the picker to use american AMPM-time-format instead of iso-counting.



Tags:

return:  method owner
access:  public


[ Top ]

method setArrowSelection [line 184]

JsDateTime setArrowSelection( )

Tells the picker to use arrows for month-, year-selection and so forth, instead of selects.



Tags:

return:  method owner
access:  public


[ Top ]

method setDateFormat [line 160]

JsDateTime setDateFormat( String $dateFormat)

Set a date format to be used by the picker.

Default is the iso-format "yyyymmdd", feel free to change that.




Tags:

return:  method owner
access:  public


Parameters:

String   $dateFormat   the date format to use

[ Top ]

method setDropDownSelection [line 172]

JsDateTime setDropDownSelection( )

Tells the picker to use selects for month-, year-selection and so forth, instead of arrows.



Tags:

return:  method owner
access:  public


[ Top ]

method setIsoTime [line 220]

JsDateTime setIsoTime( )

Tells the picker to use 24h-iso-counting for the time.



Tags:

return:  method owner
access:  public


[ Top ]

method setJsConfig [line 130]

JsDateTime setJsConfig( $jsConfig)

Set a configuration object for the element.

There are always defaults for every parameter, so this set doesn't have to be complete necessarily.




Tags:

return:  method owner
access:  public


Parameters:

Array[String]   $jsConfig   set of configuration data to replace the current config for the element

[ Top ]

method setJsConfigVars [line 143]

JsDateTime setJsConfigVars( $jsConfigVars)

Set several configuration vars for the element.



Tags:

return:  method owner
access:  public


Parameters:

Array[String]   $jsConfigVars   set of configuration data to add to the current config for the element

[ Top ]

method setUpAsAmericanDate [line 261]

JsDateTime setUpAsAmericanDate( )

Configures the picker to offer the selection of a standard American date.

Date-parts will be separated by a forward slash here.




Tags:

return:  method owner
access:  public


[ Top ]

method setUpAsGermanDate [line 289]

JsDateTime setUpAsGermanDate( )

Configures the picker to offer the selection of a german date.

Date-parts will be separated by a point here.




Tags:

return:  method owner
access:  public


[ Top ]

method setUpAsIsoDate [line 275]

JsDateTime setUpAsIsoDate( )

Configures the picker to offer the selection of a standard iso-date.

Date-parts will be separated by a dash here.




Tags:

return:  method owner
access:  public


[ Top ]

method showSeconds [line 232]

JsDateTime showSeconds( )

Tells the picker to include seconds into the time selection.



Tags:

return:  method owner
access:  public


[ Top ]

method showTime [line 196]

JsDateTime showTime( )

Tells the picker to offer time selection as well.



Tags:

return:  method owner
access:  public


[ Top ]

method suppressJsInclude [line 248]

JsDateTime suppressJsInclude( )

Suppresses the javascript-include of the picker sources for this element.

If you got several pickers on a page you want to include those only with the first and not every time.




Tags:

return:  method owner
access:  public


[ Top ]


Class Constants

BUTTONCLASS =  'htmlform_jsdatetime_btn'

[line 71]

css-class for the calendar-button


[ Top ]

WRAPPERCLASS =  'htmlform_jsdatetime'

[line 65]

css-class for the wrapper around the whole element-html-structure


[ Top ]



Documentation generated on Fri, 18 Jul 2014 16:32:00 +0200 by phpDocumentor 1.4.3