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 45)

P4A_Object
   |
   --P4A_Widget
      |
      --P4A_Field
Variable Summary
 string $align
 integer $allow_null
 array $buttons
 data_source $data
 data_field $data_field
 data_field $data_member
 string $formatted
 string $format_name
 integer $null_message
 string $type
 boolean $upload
 string $_error
Method Summary
 P4A_Field P4A_Field (string $name, [string $add_default_data_field = TRUE])
 void allowNull ([string $message = NULL])
 void cleanNewValue ()
 string composeLabel ()
 string composeStringValue ()
 void enableUpload ([ $enable = true])
 string format (string $value)
 string getAsCheckbox ()
 void getAsColor ()
 void getAsDate ()
 string getAsFile ()
 string getAsHidden ()
 string getAsImage ()
 string getAsLabel ()
 string getAsPassword ()
 string getAsRadio ()
 string getAsRichTextarea ()
 string getAsSelect ()
 string getAsString ()
 string getAsText ()
 string getAsTextarea ()
 string getEncryptionType ()
 void getError ()
 string getLabel ()
 integer getMaxThumbnailSize ()
 string getNewValue ([integer $index = null])
 string getRichTextareaToolbar ( $index)
 string getSQLNewValue ()
 string getSQLValue ()
 string getStringValue ()
 void getTooltip ()
 string getType ()
 string getUnformattedNewValue ([integer $index = null])
 mixed getValue ()
 boolean isFormattable ()
 boolean isFormatted ()
 boolean isNullAllowed ()
 void isUploadEnabled ()
 void noAllowNull ()
 void setAlign (string $align)
 void setDataField (DATA_FIELD &$data_field)
 void setEncryptionType ( $type)
 void setError ([string $error = ''])
 void setFormat (string $formatter_name, string $format_name)
 void setFormatted ([ $value = true])
 void setLabel (string $value)
 void setMaxThumbnailSize (integer $size)
 void setMultivalueSeparator ( $string)
 void setNewValue (mixed $new_value)
 void setRichTextareaTheme ( $theme)
 void setRichTextareaToolbar (integer $index, string $buttons)
 void setSource (data_source &$data_source)
 void setSourceDescriptionField (string $name)
 void setSourceValueField (string $name)
 void setTooltip ( $text)
 void setType (strings $type, [strings $multivalue_separator = NULL])
 void setUploadSubpath ([string $subpath = NULL])
 void setValue (mixed $value)
 string unformat (string $value)
 void unsetFormat ()
 void unsetFormatted ()
Variables
string $align = 'left' (line 123)

Field align.

  • access: private
integer $allow_null = false (line 109)

Defines if a SELECT has "none selected" record.

  • access: private
array $buttons = NULL (line 52)

Buttons collection.

  • access: private
data_source $data = NULL (line 59)

Data source for the field.

  • access: private
string $data_description_field = NULL (line 87)

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

  • access: private
data_field $data_field = NULL (line 66)

Data source for the field.

  • access: private
data_field $data_member = NULL (line 73)

Will be used for future implementations.

  • access: private
string $data_value_field = NULL (line 80)

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

  • access: private
string $encryption_type = 'md5' (line 158)

Type of encryption to use for password fields

  • access: private
string $formatted = true (line 130)

Tells if the fields content is formatted or not.

  • access: private
string $formatter_name = NULL (line 137)

The formatter class name for the data field.

  • access: private
string $format_name = NULL (line 144)

The format name for the data field.

  • access: private
integer $max_thumbnail_size = 100 (line 102)

Max size in pixels for image thumbnail.

  • access: private
string $multivalue_separator = '' (line 194)

The multivalue separator

  • access: public
integer $null_message = NULL (line 116)

Defines the message for "none selected" record for select.

  • access: private
string $rich_textarea_theme = 'Default' (line 173)

rich textarea theme/toolbar (advanced|simple)

  • access: private
array $rich_textarea_toolbars = array() (line 180)

buttons for rich textarea toolbars

  • access: private
string $type = 'text' (line 95)

Field type.

  • see: set_type()
  • access: private
boolean $upload = false (line 166)

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: private
string $upload_subpath = NULL (line 151)

Path under P4A_UPLOADS_PATH where uploads happens.

  • access: private
string $_error = NULL (line 187)

The error message

  • access: private

Inherited Variables

Inherited from P4A_Widget

P4A_Widget::$actions
P4A_Widget::$enabled
P4A_Widget::$label
P4A_Widget::$map_actions
P4A_Widget::$properties
P4A_Widget::$style
P4A_Widget::$template_name
P4A_Widget::$use_template
P4A_Widget::$value
P4A_Widget::$visible
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 P4A_Field (line 203)

Class constructor.

Istances the widget, sets name and initializes its value.

  • access: private
P4A_Field P4A_Field (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.
allowNull (line 1110)

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

  • access: public
void allowNull ([string $message = NULL])
  • string $message: The message for "none selected"
cleanNewValue (line 758)

Resets the "new_value".

  • access: public
void cleanNewValue ()
composeLabel (line 1532)

Gets the HTML rendered field's label.

  • access: public
string composeLabel ()
composeStringProperties (line 1553)

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

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

  • access: public
string composeStringProperties ()

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

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

  • access: public
string composeStringValue ()
enableUpload (line 1595)
void enableUpload ([ $enable = true])
  • $enable
fileDeleteOnClick (line 1291)

Action handler for file deletetion.

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

Action handler for file download.

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

Action handler for file preview (only images).

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

Format the given value using the current formatting options.

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

  • access: private
string format (string $value)
  • string $value: The value to be formatted.
getAsCheckbox (line 1195)

Returns the HTML rendered field as checkbox.

  • access: public
string getAsCheckbox ()
getAsColor (line 1486)
void getAsColor ()
getAsDate (line 835)
void getAsDate ()
getAsFile (line 1224)

Returns the HTML rendered field as file upload.

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

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

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

Returns the HTML rendered field as image upload.

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

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

  • access: public
string getAsLabel ()
getAsMulticheckbox (line 1066)
void getAsMulticheckbox ()
getAsMultiselect (line 1019)
void getAsMultiselect ()
getAsPassword (line 866)

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 1140)

Returns the HTML rendered field as radio buttons group.

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

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

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

Returns the HTML rendered field as combo box.

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

Returns the HTML rendered field.

  • access: public
string getAsString ()

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

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

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

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

  • access: public
string getAsTextarea ()
getAutoMaxlength (line 763)
void getAutoMaxlength ()
getEncryptionType (line 630)

Returns the encryption type (for password fields)

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

Returns the error message.

  • access: public
void getError ()
getLabel (line 1522)

Returns the label for the field.

  • access: public
string getLabel ()

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

Returns the maximum size for image thumbnails.

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

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.
getRichTextareaTheme (line 1619)

DOESN'T WORK WITH FCK

  • access: public
string getRichTextareaTheme ()
getRichTextareaToolbar (line 1639)
  • access: public
string getRichTextareaToolbar ( $index)
  • $index
getRichTextareaToolbars (line 1649)

returns all toolbars buttons

  • access: public
array getRichTextareaToolbars ()
getSourceDescriptionField (line 609)

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

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

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

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

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

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

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

  • access: public
string getSQLValue ()
getStringValue (line 351)

Return the field's value always as string.

If the value is an array, it will be encoded in {value1, value2}

  • access: public
string getStringValue ()
getTooltip (line 320)
void getTooltip ()
getType (line 619)

Returns the field's type.

  • access: public
string getType ()
getUnformattedNewValue (line 443)

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

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

Return the subpath for upload..

  • access: public
void getUploadSubpath ()
getValue (line 330)

Returns the value for the field.

  • access: public
mixed getValue ()

Redefinition of:
P4A_Widget::getValue()
Retuns the value of the widget.
isFormattable (line 639)

Returns true if the field is text or textarea.

  • access: public
boolean isFormattable ()
isFormatted (line 657)

Returns true if a formatting format for the field has been set.

  • access: public
boolean isFormatted ()
isNullAllowed (line 1130)

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

  • access: public
boolean isNullAllowed ()
isUploadEnabled (line 1600)
void isUploadEnabled ()
noAllowNull (line 1120)

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

  • access: public
void noAllowNull ()
setAlign (line 1542)

Sets the alignment property for the field.

  • access: public
void setAlign (string $align)
  • string $align: The align property.
setDataField (line 234)

Sets a data field as current data_field.

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

  • access: public
void setDataField (DATA_FIELD &$data_field)
  • DATA_FIELD &$data_field: The new data field
setDefaultVisualizationProperties (line 258)

Sets the default visualization property for the field.

  • access: private
void setDefaultVisualizationProperties ()
setEncryptionType (line 511)

Set type of encryption to use for password fields (md5|none)

  • access: public
void setEncryptionType ( $type)
  • $type
setError (line 301)

Sets the error message.

  • access: public
void setError ([string $error = ''])
  • string $error: Error.
setFormat (line 688)

Sets the field formatter and format.

This also turns formatting on.
Eg: set_format('numbers', 'decimal')

  • access: public
void setFormat (string $formatter_name, string $format_name)
  • string $formatter_name: The formatter name.
  • string $format_name: The format name.
setFormatted (line 666)

Sets the field as formatted.

  • access: public
void setFormatted ([ $value = true])
  • $value
setLabel (line 1512)

Sets the label for the field.

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

void setLabel (string $value)
  • string $value: The string to set as label.

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

Sets the maximum size for image thumbnails.

  • access: public
void setMaxThumbnailSize (integer $size)
  • integer $size: Max size (width and height)
setMultivalueSeparator (line 1100)
void setMultivalueSeparator ( $string)
  • $string
setNewValue (line 368)

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

  • access: public
void setNewValue (mixed $new_value)
  • mixed $new_value: The new value for the field.
setRichTextareaTheme (line 1609)

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

  • access: public
void setRichTextareaTheme ( $theme)
  • $theme
setRichTextareaToolbar (line 1630)

sets buttons for every richtextarea toolbar

  • access: public
void setRichTextareaToolbar (integer $index, string $buttons)
  • integer $index: the toolbar index (1|2|3)
  • string $buttons: buttons in a comma separated list
setSource (line 529)

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
void setSource (data_source &$data_source)
  • data_source &$data_source: The data source.
setSourceDescriptionField (line 586)

Sets what data source member is the keeper of the field's description.

  • access: public
void setSourceDescriptionField (string $name)
  • string $name: The name of the data source member.
setSourceValueField (line 574)

Sets what data source member is the keeper of the field's value.

  • access: public
void setSourceValueField (string $name)
  • string $name: The name of the data source member.
setTooltip (line 315)
void setTooltip ( $text)
  • $text
setType (line 468)

Sets the field's type.

  • access: public
void setType (strings $type, [strings $multivalue_separator = NULL])
  • strings $type: The type (text|password|textarea|rich_textarea|date|hidden|label|select|radio|checkbox|multiselect|multicheckbox).
  • strings $multivalue_separator: The multivalue separator
setUploadSubpath (line 1346)

Sets the subpath of P4A_UPLOADS_PATH where the upload will happen.

  • access: public
void setUploadSubpath ([string $subpath = NULL])
  • string $subpath: The subdir (can be "test", "test/", "test/test", "test/test/test/")
setValue (line 291)

Sets the value for the field.

  • access: public
void setValue (mixed $value)
  • mixed $value: Value.

Redefinition of:
P4A_Widget::setValue()
Sets the value of the widget.
unformat (line 740)

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

string unformat (string $value)
  • string $value: The formatted value.
unsetFormat (line 699)

Removes formatting options and turns formatting off.

  • access: public
void unsetFormat ()
unsetFormatted (line 675)

Sets the field as not formatted.

  • access: public
void unsetFormatted ()
unsetMaxThumbnailSize (line 1471)

Removes the maximum size for image thumbnails.

  • access: public
void unsetMaxThumbnailSize ()
unsetUploadSubpath (line 1355)

Removes the subpath for upload.

  • access: public
void unsetUploadSubpath ()

Inherited Methods

Inherited From P4A_Widget

 P4A_Widget::addAction()
 P4A_Widget::addAjaxAction()
 P4A_Widget::addTempVar()
 P4A_Widget::changeEvent()
 P4A_Widget::clearTemplateVars()
 P4A_Widget::clearTempVars()
 P4A_Widget::composeStringActions()
 P4A_Widget::composeStringClassStyle()
 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::getHeight()
 P4A_Widget::getLabel()
 P4A_Widget::getProperty()
 P4A_Widget::getStyleProperty()
 P4A_Widget::getValue()
 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::p4a_widget()
 P4A_Widget::raise()
 P4A_Widget::redesign()
 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::setValue()
 P4A_Widget::setVisible()
 P4A_Widget::setWidth()
 P4A_Widget::unrequireConfirmation()
 P4A_Widget::unsetProperty()
 P4A_Widget::unsetStyleProperty()
 P4A_Widget::useTemplate()

Inherited From P4A_Object

 P4A_Object::actionHandler()
 P4A_Object::build()
 P4A_Object::destroy()
 P4A_Object::dropIntercept()
 P4A_Object::errorHandler()
 P4A_Object::getId()
 P4A_Object::getName()
 P4A_Object::getObjectType()
 P4A_Object::getParentID()
 P4A_Object::implementMethod()
 P4A_Object::intercept()
 P4A_Object::isActionTriggered()
 P4A_Object::p4a_object()
 P4A_Object::setName()
 P4A_Object::setParentID()
 P4A_Object::void()
 P4A_Object::_loadHelper()
 P4A_Object::__call()

Documentation generated on Mon, 07 Jan 2008 11:29:18 +0100 by phpDocumentor 1.4.0