FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Widget Class Reference
Inheritance diagram for Widget:
Thing Char Check Date File Grid Group Number Options

Public Member Functions

 __construct ($config=null)
 
 update ($config)
 Update the widget configuration. More...
 
 clientConfig ()
 Public configuration. More...
 
 caption ($id=null)
 
 hint ($id=null)
 
 meta ($key, $default=null)
 Get a meta data value. More...
 
 convert ($value)
 Convert a value from user format to standard, internal format. More...
 
 clientConvert ($value)
 Convert a value from client format to standard, internal format. More...
 
 dataConvert ($value)
 Convert an internal value before it is stored in the request data. More...
 
 format ($value)
 Format a value from standard, internal format to user format. More...
 
 clientFormat ($value)
 Format a value from standard, internal format to client format. More...
 
 formatTag ($value)
 Format a tag value. More...
 
 purge ($value)
 Purge a value. More...
 
 expect ($action)
 Note if an action is expected. More...
 
 execute ($id)
 Execute an action on this widget. More...
 
 nothing ($value)
 Check if a value is empty. More...
 
 check ($value)
 Check a value. More...
 
- Public Member Functions inherited from Thing
 propertyExists ($property)
 Check if a property exists (public or published). More...
 
 constants ($prefix=null)
 Return all constants. More...
 
 get ($key)
 Get one or more properties. More...
 
 set ($key, $value=null)
 Set one or more properties. More...
 
 __get ($key)
 
 __set ($key, $value)
 

Data Fields

const CHILD_ID_SEPARATOR = '__'
 
const CAPTION = 'caption'
 
const DEFAULT_VALUE = 'defaultValue'
 
const DISPLAY = 'display'
 Display type (see DISPLAY_* constants). More...
 
const HELP = 'help'
 Help string (translated). More...
 
const HINT = 'hint'
 Hint string (translated). More...
 
const META = 'meta'
 Meta data (array). More...
 
const PARAMS = 'params'
 Extra parameters for async calls (prefix the key with a '@' to point to the value of another. More...
 
const RIGHT = 'right'
 Optional different right with respect to the controller. If the user has the right, then (s)he. More...
 
const TRAILER = 'trailer'
 Trailer string (translated). More...
 
const TAGS = 'tags'
 Extra tags for help, hint, and trailer. More...
 
const WIDGET_HELP = 'widgetHelp'
 General widget help (translated). More...
 
const CLASS_NAME = 'className'
 
const MIN = 'min'
 Minimum value. More...
 
const MAX = 'max'
 Maximum value. More...
 
const REQUIRED = 'required'
 True for required. Set to self::VALID_FUNC to let the validation function handle this. Use. More...
 
const VALID_FUNC = 'validFunc'
 Specific validation function (called with value and index; returns true if OK). More...
 
const WIDGETS = 'widgets'
 Optional child widgets (key = name, value = widget object). More...
 
const SECURITY_CHECKS_IGNORE = 'securityChecksIgnore'
 Security checks to ignore (array with checks to ignore, true =. More...
 
const DISPLAY_HIDDEN = 'h'
 Do not show (only hidden) More...
 
const DISPLAY_MINIMAL = 'm'
 Show only value (without input element(s)). More...
 
const DISPLAY_READABLE = 'r'
 Show input element(s), but read-only. More...
 
const DISPLAY_WRITEABLE = 'w'
 Show editable input element(s). More...
 
const EVENT_ACTION_PREFIX = 'controller:widget:action:'
 
 $defaultValue = null
 
 $help = null
 
 $min = null
 
 $max = null
 
 $required = null
 
 $trailer = null
 
 $widgetHelp = null
 
 $validFunc = null
 
 $parent = null
 Optional parent widget. More...
 
 $indexes = []
 
- Data Fields inherited from Thing
const HIDDEN = 0
 Property is hidden. More...
 
const READABLE = 1
 Property is readable. More...
 
const WRITEABLE = 2
 Property is writeable. More...
 
const READWRITE = 3
 Property is readable and writeable. More...
 

Protected Member Functions

 init ()
 
 config ($key, $default=null)
 Get single configuration value. More...
 
 purgeBase ($value)
 Purge function that will be called first. More...
 
 executeChild ($id)
 Execute an action on a child widget. More...
 
 indexId ($id, $join=false)
 Add indexes to an ID (with wildcards). More...
 
 checkMin ($value)
 
 checkMax ($value)
 
 checkRequired ($value)
 Required check. More...
 
 checkValidFunc ($value)
 
 actionHelp ()
 
 setController ($value)
 
 getDisplay ()
 
 getFred ()
 
 getId ()
 
 getParams ()
 
 getReadable ()
 
 getRight ()
 
 getTags ()
 
 getWidgets ()
 
 getWriteable ()
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). More...
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 alias ($alias, $property, $object=null)
 Define an alias for a property (of another object). More...
 
 configure ($config)
 Configure the object. More...
 
 _set ($key, $value)
 Default setter if no specific setter is defined, and the property is also not published (writeable). More...
 

Protected Attributes

 $_controller = null
 
 $_id = null
 
 $_widgets = null
 Optional child widgets. More...
 
 $_securityChecksIgnore = []
 Security checks to ignore. More...
 
 $_config = []
 Widget configuration (see constants). More...
 
 $_display = null
 
 $_meta = []
 
 $_params = []
 
 $_right = null
 
 $_tags = null
 
 $_executing = false
 Executing an direct action on the widget. More...
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 
 $_aliases = []
 Alias properties (key = alias, value = [object,property]). More...
 

Detailed Description

Definition at line 7 of file Widget.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $config = null)

Definition at line 69 of file Widget.php.

Member Function Documentation

◆ _get()

_get (   $key)
protected

Default getter if no specific setter is defined, and the property is also not published (readable).

Parameters
string$keyName of the property.
Returns
mixed Value.

Reimplemented from Thing.

Definition at line 443 of file Widget.php.

◆ actionHelp()

actionHelp ( )
protected

Definition at line 322 of file Widget.php.

◆ caption()

caption (   $id = null)

Definition at line 133 of file Widget.php.

◆ check()

check (   $value)

Check a value.

Parameters
mixed$valueValue in standard, internal format.
Returns
string Error code (empty = OK).

Definition at line 314 of file Widget.php.

◆ checkMax()

checkMax (   $value)
protected

Reimplemented in Char, Grid, and Options.

Definition at line 282 of file Widget.php.

◆ checkMin()

checkMin (   $value)
protected

Reimplemented in Char, Grid, and Options.

Definition at line 278 of file Widget.php.

◆ checkRequired()

checkRequired (   $value)
protected

Required check.

This check will only be called when the value is empty. If the required parameter has the value self::VALID_FUNC, then the checkValidFunc() function will be used to determine whether the value is correct (allowed empty). If the required parameter is an array, the first entry is seen as an reference to another widget (e.g. 'List__*__Name' - where the asterisk will be replaced with the current index). Its value will then be used for an comparison with an operator (2nd entry) and a value (3rd entry). If this comparison returns true, the value is required.

Definition at line 294 of file Widget.php.

◆ checkValidFunc()

checkValidFunc (   $value)
protected

Definition at line 306 of file Widget.php.

◆ clientConfig()

clientConfig ( )

Public configuration.

Returns
array Public configuration for this widget in key => value pairs.

Reimplemented in Table, File, Char, Options, Phone, DateTime, Lookup, Grid, Number, Email, Group, and Time.

Definition at line 105 of file Widget.php.

◆ clientConvert()

clientConvert (   $value)

Convert a value from client format to standard, internal format.

Parameters
mixed$valueValue in client format.
Returns
mixed Value in standard, internal format.

Reimplemented in Table, Group, and Check.

Definition at line 169 of file Widget.php.

◆ clientFormat()

clientFormat (   $value)

Format a value from standard, internal format to client format.

Parameters
mixed$valueValue in standard, internal format.
Returns
mixed Value in client format.

Reimplemented in Table.

Definition at line 193 of file Widget.php.

◆ config()

config (   $key,
  $default = null 
)
protected

Get single configuration value.

Parameters
string$keyKey.
mixed$defaultDefault value.
Returns
mixed Value.

Definition at line 98 of file Widget.php.

◆ convert()

convert (   $value)

Convert a value from user format to standard, internal format.

Parameters
mixed$valueValue in user format.
Returns
mixed Value in standard, internal format.

Reimplemented in Table, Number, Grid, Group, Time, Date, and Check.

Definition at line 161 of file Widget.php.

◆ dataConvert()

dataConvert (   $value)

Convert an internal value before it is stored in the request data.

Parameters
mixed$valueValue in internal format.
Returns
mixed Value in request data format.

Reimplemented in Group, and DateTime.

Definition at line 177 of file Widget.php.

◆ execute()

execute (   $id)

Execute an action on this widget.

Security checks are executed before. All input and output is handled through the request component. An action can only trust the values from the data array. An action must check if the widget is writeable for actions that perform 'write like' behaviour.

Parameters
array$idSub widget ID.

Definition at line 244 of file Widget.php.

◆ executeChild()

executeChild (   $id)
protected

Execute an action on a child widget.

Parameters
array$idChild ID (everything after the parent ID).

Reimplemented in Group, and Grid.

Definition at line 234 of file Widget.php.

◆ expect()

expect (   $action)

Note if an action is expected.

Parameters
string$action

Definition at line 227 of file Widget.php.

◆ format()

format (   $value)

Format a value from standard, internal format to user format.

Parameters
mixed$valueValue in standard, internal format.
Returns
mixed Value in user format.

Reimplemented in Table, Group, Time, Date, Check, and Color.

Definition at line 185 of file Widget.php.

◆ formatTag()

formatTag (   $value)

Format a tag value.

Parameters
mixed$valueValue in standard, internal format.
Returns
mixed Value in user format.

Reimplemented in Char.

Definition at line 201 of file Widget.php.

◆ getDisplay()

getDisplay ( )
protected

Definition at line 338 of file Widget.php.

◆ getFred()

getFred ( )
protected

Definition at line 351 of file Widget.php.

◆ getId()

getId ( )
protected

Definition at line 355 of file Widget.php.

◆ getParams()

getParams ( )
protected

Reimplemented in Char.

Definition at line 372 of file Widget.php.

◆ getReadable()

getReadable ( )
protected

Definition at line 407 of file Widget.php.

◆ getRight()

getRight ( )
protected

Definition at line 411 of file Widget.php.

◆ getTags()

getTags ( )
protected

Definition at line 417 of file Widget.php.

◆ getWidgets()

getWidgets ( )
protected

Definition at line 428 of file Widget.php.

◆ getWriteable()

getWriteable ( )
protected

Definition at line 439 of file Widget.php.

◆ hint()

hint (   $id = null)

Definition at line 138 of file Widget.php.

◆ indexId()

indexId (   $id,
  $join = false 
)
protected

Add indexes to an ID (with wildcards).

Parameters
string$idBase ID (with wildcards).
bool$joinSet to true to return a string again (otherwise array with sub ID's).
Returns
array|string

Definition at line 263 of file Widget.php.

◆ init()

init ( )
protected

Reimplemented in Table, DateTime, and Sorter.

Definition at line 75 of file Widget.php.

◆ meta()

meta (   $key,
  $default = null 
)

Get a meta data value.

Parameters
string$keyKey.
mixed$defaultDefault value.
Returns
mixed Value.

Definition at line 153 of file Widget.php.

◆ nothing()

nothing (   $value)

Check if a value is empty.

Parameters
mixed$value
Returns
bool True when empty.

Definition at line 274 of file Widget.php.

◆ purge()

purge (   $value)

Purge a value.

Parameters
mixed$valueRaw value.
Returns
string Purged value.

Definition at line 217 of file Widget.php.

◆ purgeBase()

purgeBase (   $value)
protected

Purge function that will be called first.

Parameters
mixed$valueRaw value.
Returns
string Purged value.

Reimplemented in File, Group, Char, Options, and Grid.

Definition at line 209 of file Widget.php.

◆ setController()

setController (   $value)
protected

Definition at line 333 of file Widget.php.

◆ update()

update (   $config)

Update the widget configuration.

Parameters
array$configNew configuration (key-value pairs). Old values, which are not in the new configuration, are preserved.

Definition at line 88 of file Widget.php.

Field Documentation

◆ $_config

$_config = []
protected

Widget configuration (see constants).

Definition at line 61 of file Widget.php.

◆ $_controller

$_controller = null
protected

Definition at line 57 of file Widget.php.

◆ $_display

$_display = null
protected

Definition at line 62 of file Widget.php.

◆ $_executing

$_executing = false
protected

Executing an direct action on the widget.

Definition at line 67 of file Widget.php.

◆ $_id

$_id = null
protected

Definition at line 58 of file Widget.php.

◆ $_meta

$_meta = []
protected

Definition at line 63 of file Widget.php.

◆ $_params

$_params = []
protected

Definition at line 64 of file Widget.php.

◆ $_right

$_right = null
protected

Definition at line 65 of file Widget.php.

◆ $_securityChecksIgnore

$_securityChecksIgnore = []
protected

Security checks to ignore.

Definition at line 60 of file Widget.php.

◆ $_tags

$_tags = null
protected

Definition at line 66 of file Widget.php.

◆ $_widgets

$_widgets = null
protected

Optional child widgets.

Definition at line 59 of file Widget.php.

◆ $defaultValue

$defaultValue = null

Definition at line 45 of file Widget.php.

◆ $help

$help = null

Definition at line 46 of file Widget.php.

◆ $indexes

$indexes = []

Definition at line 55 of file Widget.php.

◆ $max

$max = null

Definition at line 48 of file Widget.php.

◆ $min

$min = null

Definition at line 47 of file Widget.php.

◆ $parent

$parent = null

Optional parent widget.

Definition at line 54 of file Widget.php.

◆ $required

$required = null

Definition at line 49 of file Widget.php.

◆ $trailer

$trailer = null

Definition at line 50 of file Widget.php.

◆ $validFunc

$validFunc = null

Definition at line 52 of file Widget.php.

◆ $widgetHelp

$widgetHelp = null

Definition at line 51 of file Widget.php.

◆ CAPTION

const CAPTION = 'caption'

Definition at line 12 of file Widget.php.

◆ CHILD_ID_SEPARATOR

const CHILD_ID_SEPARATOR = '__'

Definition at line 9 of file Widget.php.

◆ CLASS_NAME

const CLASS_NAME = 'className'

Definition at line 25 of file Widget.php.

◆ DEFAULT_VALUE

const DEFAULT_VALUE = 'defaultValue'

Definition at line 13 of file Widget.php.

◆ DISPLAY

const DISPLAY = 'display'

Display type (see DISPLAY_* constants).

Definition at line 14 of file Widget.php.

◆ DISPLAY_HIDDEN

const DISPLAY_HIDDEN = 'h'

Do not show (only hidden)

Definition at line 38 of file Widget.php.

◆ DISPLAY_MINIMAL

const DISPLAY_MINIMAL = 'm'

Show only value (without input element(s)).

Definition at line 39 of file Widget.php.

◆ DISPLAY_READABLE

const DISPLAY_READABLE = 'r'

Show input element(s), but read-only.

Definition at line 40 of file Widget.php.

◆ DISPLAY_WRITEABLE

const DISPLAY_WRITEABLE = 'w'

Show editable input element(s).

Definition at line 41 of file Widget.php.

◆ EVENT_ACTION_PREFIX

const EVENT_ACTION_PREFIX = 'controller:widget:action:'

Definition at line 43 of file Widget.php.

◆ HELP

const HELP = 'help'

Help string (translated).

Definition at line 15 of file Widget.php.

◆ HINT

const HINT = 'hint'

Hint string (translated).

Definition at line 16 of file Widget.php.

◆ MAX

const MAX = 'max'

Maximum value.

Definition at line 29 of file Widget.php.

◆ META

const META = 'meta'

Meta data (array).

Definition at line 17 of file Widget.php.

◆ MIN

const MIN = 'min'

Minimum value.

Definition at line 28 of file Widget.php.

◆ PARAMS

const PARAMS = 'params'

Extra parameters for async calls (prefix the key with a '@' to point to the value of another.

Definition at line 18 of file Widget.php.

◆ REQUIRED

const REQUIRED = 'required'

True for required. Set to self::VALID_FUNC to let the validation function handle this. Use.

Definition at line 30 of file Widget.php.

◆ RIGHT

const RIGHT = 'right'

Optional different right with respect to the controller. If the user has the right, then (s)he.

Definition at line 20 of file Widget.php.

◆ SECURITY_CHECKS_IGNORE

const SECURITY_CHECKS_IGNORE = 'securityChecksIgnore'

Security checks to ignore (array with checks to ignore, true =.

Definition at line 34 of file Widget.php.

◆ TAGS

const TAGS = 'tags'

Extra tags for help, hint, and trailer.

Definition at line 23 of file Widget.php.

◆ TRAILER

const TRAILER = 'trailer'

Trailer string (translated).

Definition at line 22 of file Widget.php.

◆ VALID_FUNC

const VALID_FUNC = 'validFunc'

Specific validation function (called with value and index; returns true if OK).

Definition at line 32 of file Widget.php.

◆ WIDGET_HELP

const WIDGET_HELP = 'widgetHelp'

General widget help (translated).

Definition at line 24 of file Widget.php.

◆ WIDGETS

const WIDGETS = 'widgets'

Optional child widgets (key = name, value = widget object).

Definition at line 33 of file Widget.php.


The documentation for this class was generated from the following file: