FORMfields


FORMfields.fields.TimeField

Class TimeField

FormField
|
+--TimeField

public class TimeField
extends FormField

TimeField a field for 12 hour time.

Since:
FORMfields v1.0

Field Summary
mixed

$amPm

The AM/PM field.

mixed

$dateFormat

The date format used when displaying the time to the user.

mixed

$endTimeString

The latest time permitted in the form of a time string defined by PHP's strtotime() function.

mixed

$hour

The hour field.

mixed

$min

The minute field.

mixed

$startTimeString

The earliest time permitted in the form of a time string defined by PHP's strtotime() function.

Fields inherited from FORMfields.fields.FormField
autoPropagate, data, disableEnterHandler, displayValuesOnNewLine, editable, enabled, endingString, enterTabHandler, enterTabs, error, extraHtml, fieldBelowLabel, formError, help, hidden, htmlify, id, isData, label, labelForId, multiValues, name, required, subFieldDisplayValueSeparator, subFieldSeparator, subFieldValueSeparator, subFields, subFieldsCannotBeEmpty, trimWhitespace, validators, value, valueIsHtml
Constructor Summary

TimeField(string name, string label, int required, mixed startTimeString, mixed endTimeString, string the)

Creates a new TimeField.

__construct(string name, string label, int required, mixed startTimeString, mixed endTimeString, string the)

Creates a new TimeField.

Method Summary
void

get24Hour()

Returns the 24 hour value of this field's time value.

void

getCurrentTime()

Sets this field's value to the current time.

string

getDisplayValue()

Returns the date formatted by the dateFormat.

string

getEditableFieldTag()

Returns the HTML used to display the input portion of this field.

int

getUnixTimestamp()

Returns the time as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

string

getValue()

Returns the value of this form field in the form "HH:MM:00".

boolean

isValid()

Checks for field errors detected by this field, including a check for blank.

void

setTime(array date)

Sets this field's value according to the date array returned by PHP's getdate() function.

void

setToCurrentTime()

Sets this field's value to the current time.

void

setValue(string value)

Sets the value of this form field.

Methods inherited from FORMfields.fields.FormField
addFieldValidator, addSubField, checkForBlank, clearValue, disable, formatRequestParameter, formatText, getButtonClicked, getData, getDbValue, getDisableFieldJs, getDisableJs, getDisableLabelJs, getDisplayFieldTag, getDisplayHtmlValue, getDisplayLabelTag, getDisplayValue, getEditable, getEditableFieldTag, getEditableLabelTag, getEnabled, getError, getExtraHtml, getFieldTag, getFormError, getHelp, getHelpTag, getHidden, getHiddenFieldTag, getId, getIsData, getIsHidden, getLabel, getLabelHtml, getLabelTag, getName, getOrNull, getParameter, getRawDbValue, getRequired, getValue, isBlank, isEmpty, isValid, setAutoPropagate, setData, setDbValue, setDisplayValuesOnNewLine, setEditable, setEnabled, setEndingString, setError, setExtraHtml, setFieldBelowLabel, setFormError, setHelp, setHidden, setHtmlify, setId, setIsData, setIsHidden, setLabel, setName, setRequired, setTrimWhitespace, setValue, setValueIsHtml, validate

Field Detail

amPm

public mixed $amPm = null

The AM/PM field.

Since:
FORMfields v1.0

dateFormat

public mixed $dateFormat = "g:i A"

The date format used when displaying the time to the user. See PHP's date function for all the supported formats.

Since:
FORMfields v3.0

endTimeString

public mixed $endTimeString = null

The latest time permitted in the form of a time string defined by PHP's strtotime() function. For example, "6:00 PM".

Since:
FORMfields v3.0

hour

public mixed $hour = null

The hour field.

Since:
FORMfields v1.0

min

public mixed $min = null

The minute field.

Since:
FORMfields v1.0

startTimeString

public mixed $startTimeString = null

The earliest time permitted in the form of a time string defined by PHP's strtotime() function. For example, "8:53 AM".

Since:
FORMfields v3.0

Constructor Detail

TimeField

public TimeField(string name, string label, int required, mixed startTimeString, mixed endTimeString, string the)

Creates a new TimeField.

Parameters:
name - the name of the form field. This value must not be a SQL reserved word and should follow all the standard variable naming conventions in PHP.
label - this form field's label. The label is the printable text that is typically displayed on the left side of the field.
required - Sets whether the field must be filled in and whether it looks like it must be filled in: FORM_FIELD_REQUIRED, FORM_FIELD_NOT_REQUIRED, FORM_FIELD_LOOKS_REQUIRED or FORM_FIELD_REQUIRED_NO_LOOK
the - earliest time permitted in the form a time string define by PHP's strtotime() function. For example, "8:53 AM".
the - latest time permitted in the form a time string define by PHP's strtotime() function. For example, "6:00 PM".
See Also:
FORM_FIELD_REQUIRED
FORM_FIELD_NOT_REQUIRED
FORM_FIELD_LOOKS_REQUIRED
FORM_FIELD_REQUIRED_NO_LOOK
Since:
FORMfields v1.0
Deprecated:
deprecated as this constructor syntax is not expected in PHP 5 - will be removed once PHP 5 becomes a minimum requirement for FORMfields

Method Detail

get24Hour

public void get24Hour()

Returns the 24 hour value of this field's time value.

Since:
FORMfields v2.0

getCurrentTime

public void getCurrentTime()

Sets this field's value to the current time.

Since:
FORMfields v2.0
Depcrecated:
use setToCurrentTime() instead. Will be removed in the next release of FORMfields.

getDisplayValue

public string getDisplayValue()

Returns the date formatted by the dateFormat.

Returns:
the date formatted by the dateFormat.
Since:
FORMfields v2.0

getEditableFieldTag

public string getEditableFieldTag()

Returns the HTML used to display the input portion of this field.

Returns:
the HTML used to display the input portion of this field
Since:
FORMfields v1.0

getUnixTimestamp

public int getUnixTimestamp()

Returns the time as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). The date in the timestamp is equal to the current date.

Returns:
the time as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
Since:
FORMfields v3.0

getValue

public string getValue()

Returns the value of this form field in the form "HH:MM:00".

Returns:
the value of this form field
Since:
FORMfields v1.0

isValid

public boolean isValid()

Checks for field errors detected by this field, including a check for blank. This method ensures that the time is in the valid time range, if a range was specified. If an error is detected, the setError() method is called to set the appropriate error message.

Returns:
true if there is an error or false otherwise
Since:
FORMfields v1.0

setTime

public void setTime(array date)

Sets this field's value according to the date array returned by PHP's getdate() function.

Parameters:
date - the date array returned by PHP's getdate() function
Since:
FORMfields v2.0

setToCurrentTime

public void setToCurrentTime()

Sets this field's value to the current time.

Since:
FORMfields v3.0

setValue

public void setValue(string value)

Sets the value of this form field.

Parameters:
value - a time in the form of HH:MM, hh:MM PM, HH:MM:SS or single hour digit
Since:
FORMfields v1.0

FORMfields