Class P4A_Field

Description

A fields is a GUI element that shows its value, and this value can be changed.

Located in /p4a/objects/widgets/field.php (line 41)

P4A_Object
   |
   --P4A_Widget
      |
      --P4A_Field
Variable Summary
Method Summary
 P4A_Field __construct (string $name, [string $add_default_data_field = true])
 P4A_Field addValidator ( $validator, [boolean $break_chain_on_failure = false])
 P4A_Field allowNull ([string|boolean $message = null])
 string composeLabel ()
 string composeStringValue ()
 P4A_Field enableUpload ([boolean $enable = true])
 mixed format (mixed $value, [string $type = null], [integer $num_of_decimals = null])
 string getAsCheckbox ()
 string getAsDate ()
 string getAsFile ()
 string getAsHidden ()
 string getAsImage ()
 string getAsLabel ()
 string getAsMulticheckbox ()
 string getAsMultiselect ()
 string getAsPassword ()
 string getAsRadio ()
 string getAsRichTextarea ()
 string getAsSelect ()
 string getAsString ()
 string getAsText ()
 string getAsTextarea ()
 string getEncryptionType ()
 string getError ()
 string getInputMask ()
 string getLabel ()
 integer getMaxThumbnailSize ()
 string getNewValue ([integer $index = null])
 string getNormalizedNewValue ([integer $index = null])
 string getSQLNewValue ()
 string getSQLValue ()
 string getTooltip ()
 string getType ()
 string getUploadSubpath ()
 mixed getValue ()
 array getYearRange ()
 boolean isFormattable ()
 P4A_Field isFormatted ([boolean $enable_formatting = null])
 boolean isNullAllowed ()
 boolean isUploadEnabled ()
 boolean|array isValid ()
 mixed normalize (mixed $value, [string $type = null])
 void removeValidator ( $validator_class)
 P4A_Field setAlign (string $align)
 P4A_Field setEncryptionType (string $type)
 P4A_Field setError ([string $error = ''])
 P4A_Mask setInputMask ([string $mask = null])
 P4A_Field setLabel (string $value)
 P4A_Field setMaxThumbnailSize ([integer $size = null])
 P4A_Field setMultivalueSeparator (string $string)
 P4A_Field setNewValue (mixed $new_value)
 P4A_Field setSourceValueField (string $name)
 P4A_Field setTooltip (string $text)
 P4A_Field setType (unknown_type $type, [unknown_type $multivalue_separator = null])
 P4A_Field setUploadSubpath ([string $subpath = null])
 P4A_Field setValue (mixed $value)
 P4A_Field setYearRange (integer $start_year, integer $end_year)
Variables
string $align = 'left' (line 97)

Field alignment

  • access: protected
boolean $allow_null = false (line 85)

Defines if a SELECT has "none selected" record

  • access: protected
P4A_Collection $buttons = null (line 46)
  • access: public
P4A_Data_Source $data = null (line 51)
  • access: public
string $data_description_field = null (line 68)

The data source member that contains the descriptions for this field

  • access: protected
P4A_Data_Field $data_field = null (line 56)
  • access: public
string $data_value_field = null (line 62)

The data source member that contains the values for this field.

  • access: protected
string $encryption_type = 'md5' (line 109)

Type of encryption to use for password fields

  • access: protected
boolean $formatted = true (line 103)

Tells if the fields content is formatted or not

  • access: protected
string $input_mask = null (line 147)
  • access: protected
integer $max_thumbnail_size = 100 (line 79)

Max size in pixels for image thumbnail

  • access: protected
string $multivalue_separator = '' (line 132)
  • access: protected
string $null_message = null (line 91)

Defines the message for "none selected" record for select

  • access: protected
string $rich_textarea_theme = 'Default' (line 121)
  • access: protected
string $type = 'text' (line 73)
  • access: protected
boolean $upload = false (line 116)

Is upload enabled on rich text area? This is disabled by default for security reasons, enable it only after a well done permission check.

  • access: protected
string $_error = null (line 127)

The error message

  • access: protected
Zend_Validate $_validator_chain = null (line 137)
  • access: protected
string $_year_range = null (line 142)
  • access: protected

Inherited Variables

Inherited from P4A_Widget

P4A_Widget::$actions
P4A_Widget::$enabled
P4A_Widget::$label
P4A_Widget::$properties
P4A_Widget::$style
P4A_Widget::$template_name
P4A_Widget::$use_template
P4A_Widget::$visible
P4A_Widget::$_css_classes
P4A_Widget::$_temp_vars
P4A_Widget::$_tpl_vars

Inherited from P4A_Object

P4A_Object::$_helpers
P4A_Object::$_id
P4A_Object::$_map_actions
P4A_Object::$_name
P4A_Object::$_objects
P4A_Object::$_parent_id
Methods
Constructor __construct (line 153)
  • access: public
P4A_Field __construct (string $name, [string $add_default_data_field = true])
  • string $name: Mnemonic identifier for the object.
  • string $add_default_data_field: If it's false the widget doesn't instance a default data_field. You must to set a data_field for the widget before call get_value, get_new_value or getAsstring.

Redefinition of:
P4A_Widget::__construct()
addValidator (line 1384)
  • access: public
P4A_Field addValidator ( $validator, [boolean $break_chain_on_failure = false])
  • Zend_Validate_Abstract $validator
  • boolean $break_chain_on_failure
allowNull (line 982)

Used ony for select, sets the select to allow a "none selected" record

  • access: public
P4A_Field allowNull ([string|boolean $message = null])
  • string|boolean $message: If false disable the feature, otherwise enable it
buildDeletePreviewDownloadButtons (line 1235)
  • access: protected
P4A_Field buildDeletePreviewDownloadButtons ()
composeLabel (line 1281)

Renders the label to HTML

  • access: protected
string composeLabel ()
composeStringProperties (line 1302)

Composes a string containing all the HTML properties of the widget.

Note: it will also contain the name and the value.

  • access: protected
string composeStringProperties ()

Redefinition of:
P4A_Widget::composeStringProperties()
Composes a string containing all the HTML properties of the widget.
composeStringValue (line 1319)

Returns the field's value differently if we are in an '<input value="' environment on in a '<tag>value</tag>' environment.

  • access: protected
string composeStringValue ()
enableUpload (line 1347)

Enables upload for rich_textarea fields

  • access: public
P4A_Field enableUpload ([boolean $enable = true])
  • boolean $enable
fileDeleteOnClick (line 1134)

Action handler for file deletetion

  • access: public
void fileDeleteOnClick ()
fileDownloadOnClick (line 1161)

Action handler for file download

  • access: public
void fileDownloadOnClick ()
filePreviewOnClick (line 1143)

Action handler for file preview (only images)

  • access: public
void filePreviewOnClick ()
format (line 582)

Format the given value using the current formatting options.

Empty values are not formatted.
If formatting is turned of it does nothing.

  • access: protected
mixed format (mixed $value, [string $type = null], [integer $num_of_decimals = null])
  • mixed $value
  • string $type
  • integer $num_of_decimals
getAsCheckbox (line 1058)

Returns the HTML rendered field as checkbox

  • access: public
string getAsCheckbox ()
getAsDate (line 684)
  • access: public
string getAsDate ()
getAsFile (line 1086)

Returns the HTML rendered field as file upload

  • access: public
string getAsFile ()
getAsHidden (line 791)

Returns the HTML rendered field as '<input type="hidden"'.

  • access: public
string getAsHidden ()
getAsImage (line 1189)

Returns the HTML rendered field as image upload

  • access: public
string getAsImage ()
getAsLabel (line 801)

Returns the HTML rendered field as '<div>$value</div>'.

  • access: public
string getAsLabel ()
getAsMulticheckbox (line 934)
  • access: public
string getAsMulticheckbox ()
getAsMultiselect (line 885)
  • access: public
string getAsMultiselect ()
getAsPassword (line 735)

Returns the HTML rendered field as '<input type="password"'.

We use P4A_PASSWORD_OBFUSCATOR for password value so the old password isn't sent over the net.

  • access: public
string getAsPassword ()
getAsRadio (line 1007)

Returns the HTML rendered field as radio buttons group

  • access: public
string getAsRadio ()
getAsRichTextarea (line 780)

Returns the HTML rendered field as '<input type="textarea"' with rich text editing features.

  • access: public
string getAsRichTextarea ()
getAsSelect (line 832)

Returns the HTML rendered field as combo box.

  • access: public
string getAsSelect ()
getAsString (line 619)

Returns the HTML rendered field.

  • access: public
string getAsString ()

Redefinition of:
P4A_Widget::getAsString()
Returns the HTML rendered widget.
getAsText (line 660)

Returns the HTML rendered field as '<input type="text"'.

  • access: public
string getAsText ()
getAsTextarea (line 757)

Returns the HTML rendered field as '<input type="textarea"'.

  • access: public
string getAsTextarea ()
getEncryptionType (line 539)

Returns the encryption type (for password fields)

  • access: public
string getEncryptionType ()
getError (line 238)

Returns the error message

  • access: public
string getError ()
getInputMask (line 1440)
  • access: public
string getInputMask ()
getLabel (line 1272)

Returns the label for the field

  • access: public
string getLabel ()

Redefinition of:
P4A_Widget::getLabel()
Returns the label for the widget
getMaxThumbnailSize (line 1227)

Returns the maximum size for image thumbnails.

  • access: public
integer getMaxThumbnailSize ()
getNewValue (line 321)

Returns the "new_value" for the field (with locale formatting).

  • access: public
string getNewValue ([integer $index = null])
  • integer $index: If the value is an array that we can return only one element.
getNormalizedNewValue (line 357)

Returns the "new_value" for the field (without locale formatting).

  • access: public
string getNormalizedNewValue ([integer $index = null])
  • integer $index: If the value is an array that we can return only one element.
getRichTextareaTheme (line 1374)
  • access: public
string getRichTextareaTheme ()
getSourceDescriptionField (line 522)

Returns the name of the data source member that keeps the field's description.

  • access: public
string getSourceDescriptionField ()
getSourceValueField (line 513)

Returns the name of the data source member that keeps the field's value.

  • access: public
string getSourceValueField ()
getSQLNewValue (line 347)

Returns the "new_value" for the field to make safe SQL query

  • access: public
string getSQLNewValue ()
getSQLValue (line 273)

Returns the "value" for the field to create safe SQL query

  • access: public
string getSQLValue ()
getTooltip (line 256)
  • access: public
string getTooltip ()
getType (line 530)
  • access: public
string getType ()
getUploadSubpath (line 1180)
  • access: public
string getUploadSubpath ()
getValue (line 264)
  • access: public
mixed getValue ()
getVisualizedDataType (line 195)
  • access: protected
void getVisualizedDataType ()
getYearRange (line 725)

Retrieve the range of years that can be selected with the datepicker

  • access: public
array getYearRange ()
isFormattable (line 547)

Returns true if the field is text, textarea, label or date

  • access: protected
boolean isFormattable ()
isFormatted (line 566)

Tells you if the field is formatted or not, also sets formatting on/off

  • access: public
P4A_Field isFormatted ([boolean $enable_formatting = null])
  • boolean $enable_formatting
isNullAllowed (line 998)

Used ony for select, returns if the select allows a "none selected" record

  • access: public
boolean isNullAllowed ()
isUploadEnabled (line 1356)
  • access: public
boolean isUploadEnabled ()
isValid (line 1409)

Validate the normalized new value.

Returns true if there are no validators or if validation passes, returns the array of error messages if validators fail.

  • access: public
boolean|array isValid ()
normalize (line 602)

Takes the formatted passed value and takes it back to its normalized form.

  • access: protected
mixed normalize (mixed $value, [string $type = null])
  • mixed $value
  • string $type
removeValidator (line 1394)
  • access: public
void removeValidator ( $validator_class)
  • $validator_class
setAlign (line 1291)

Sets the alignment property for the field.

  • access: public
P4A_Field setAlign (string $align)
  • string $align
setDataField (line 176)

Sets a data field as current data_field.

This changes default text alignment for integer, decimal, float, date, time to right.

  • access: public
P4A_Field setDataField (P4A_Data_Field $data_field)
setEncryptionType (line 431)

Set type of encryption to use for password fields

  • access: public
P4A_Field setEncryptionType (string $type)
  • string $type: (md5|none)
setError (line 227)

Sets the error message

  • access: public
P4A_Field setError ([string $error = ''])
  • string $error
setInputMask (line 1431)

Sets the input mask for the field (only if field type is "text").

The mask is used to guide users typing data in the right format. When using this feature users will be able to type only letters and numbers while the mask can contain special charset too.

  1.  $field->setInputMask("(aaa)-999-***");
The mask in the above sample means that user can type 3 alphabetic chars, 3 numeric chars and 3 alphanumerical chars. Only a/9/* are recognized, other chars will be used as the mask itself.

P4A_Mask setInputMask ([string $mask = null])
  • string $mask
setLabel (line 1262)

Sets the label for the field.

In rendering phase it will be added with ': '.

  • access: public
P4A_Field setLabel (string $value)
  • string $value

Redefinition of:
P4A_Widget::setLabel()
Sets the label for the widget.
setMaxThumbnailSize (line 1217)

Sets the maximum size for image thumbnails

  • access: public
P4A_Field setMaxThumbnailSize ([integer $size = null])
  • integer $size
setMultivalueSeparator (line 971)

Use this method when you're creating a multivalue field which rely on a single db field instead of an external table

P4A_Field setMultivalueSeparator (string $string)
  • string $string
setNewValue (line 283)

Examines the value passed by the web form and set the new value.

  • access: public
P4A_Field setNewValue (mixed $new_value)
  • mixed $new_value
setRichTextareaTheme (line 1365)

sets the rich textarea theme (Basic|Default|Full)

  • access: public
P4A_Field setRichTextareaTheme ( $theme)
  • $theme
setSource (line 450)

If we use fields like combo box we have to set a data source.

By default we'll take the data source primary key as value field and the first fiels (not pk) as description.

  • access: public
P4A_Field setSource (P4A_Data_Source $data_source)
setSourceDescriptionField (line 503)

When the field has a source, this is used to know which source's field keeps the description to be displayed by this field

  • access: public
P4A_Field setSourceDescriptionField (string $name)
  • string $name
setSourceValueField (line 492)

When the field has a source, this is used to know which source's field keeps the value to be used in this field

  • access: public
P4A_Field setSourceValueField (string $name)
  • string $name
setTooltip (line 247)
  • access: public
P4A_Field setTooltip (string $text)
  • string $text
setType (line 381)
  • access: public
P4A_Field setType (unknown_type $type, [unknown_type $multivalue_separator = null])
  • unknown_type $type: (text|password|textarea|rich_textarea|date|hidden|label|select|radio|checkbox|file|multiselect|multicheckbox)
  • unknown_type $multivalue_separator
setUploadSubpath (line 1171)

Sets the subpath of P4A_UPLOADS_PATH where the upload will happen

  • access: public
P4A_Field setUploadSubpath ([string $subpath = null])
  • string $subpath: The subdir (can be "test", "test/", "test/test", "test/test/test/")
setValue (line 216)
  • access: public
P4A_Field setValue (mixed $value)
  • mixed $value
setYearRange (line 715)

Sets the range of years that can be selected with the datepicker

  • access: public
P4A_Field setYearRange (integer $start_year, integer $end_year)
  • integer $start_year
  • integer $end_year

Inherited Methods

Inherited From P4A_Widget

 P4A_Widget::__construct()
 P4A_Widget::addAction()
 P4A_Widget::addAjaxAction()
 P4A_Widget::addCSSClass()
 P4A_Widget::addTempVar()
 P4A_Widget::changeEvent()
 P4A_Widget::clearTemplateVars()
 P4A_Widget::clearTempVars()
 P4A_Widget::composeStringActions()
 P4A_Widget::composeStringClass()
 P4A_Widget::composeStringProperties()
 P4A_Widget::composeStringStyle()
 P4A_Widget::disable()
 P4A_Widget::display()
 P4A_Widget::dropAction()
 P4A_Widget::dropTempVar()
 P4A_Widget::enable()
 P4A_Widget::fetchTemplate()
 P4A_Widget::getAccessKey()
 P4A_Widget::getAsString()
 P4A_Widget::getCSSClasses()
 P4A_Widget::getHeight()
 P4A_Widget::getLabel()
 P4A_Widget::getProperty()
 P4A_Widget::getStyleProperty()
 P4A_Widget::getWidth()
 P4A_Widget::isEnabled()
 P4A_Widget::isVisible()
 P4A_Widget::onBlur()
 P4A_Widget::onChange()
 P4A_Widget::onClick()
 P4A_Widget::onDblClick()
 P4A_Widget::onFocus()
 P4A_Widget::onKeyDown()
 P4A_Widget::onKeyPress()
 P4A_Widget::onKeyUp()
 P4A_Widget::onMouseDown()
 P4A_Widget::onMouseMove()
 P4A_Widget::onMouseOver()
 P4A_Widget::onMouseUp()
 P4A_Widget::onReturnPress()
 P4A_Widget::onSelect()
 P4A_Widget::redesign()
 P4A_Widget::removeCSSClass()
 P4A_Widget::requireConfirmation()
 P4A_Widget::setAccessKey()
 P4A_Widget::setBgcolor()
 P4A_Widget::setBgimage()
 P4A_Widget::setDefaultLabel()
 P4A_Widget::setFontColor()
 P4A_Widget::setFontWeight()
 P4A_Widget::setHeight()
 P4A_Widget::setInvisible()
 P4A_Widget::setLabel()
 P4A_Widget::setProperty()
 P4A_Widget::setStyleProperty()
 P4A_Widget::setVisible()
 P4A_Widget::setWidth()
 P4A_Widget::unrequireConfirmation()
 P4A_Widget::unsetProperty()
 P4A_Widget::unsetStyleProperty()
 P4A_Widget::useTemplate()

Inherited From P4A_Object

 P4A_Object::__construct()
 P4A_Object::actionHandler()
 P4A_Object::build()
 P4A_Object::destroy()
 P4A_Object::dropImplement()
 P4A_Object::dropMethod()
 P4A_Object::errorHandler()
 P4A_Object::getId()
 P4A_Object::getName()
 P4A_Object::getObjectType()
 P4A_Object::getParentID()
 P4A_Object::implement()
 P4A_Object::intercept()
 P4A_Object::isActionTriggered()
 P4A_Object::setName()
 P4A_Object::setParentID()
 P4A_Object::void()
 P4A_Object::_loadHelper()
 P4A_Object::__call()

Documentation generated on Tue, 02 Sep 2008 10:04:00 +0200 by phpDocumentor 1.4.2