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)
 
 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 ()
 Execute an action on this widget. More...
 
 nothing ($value)
 Check if a value is empty. More...
 
 check ($value, $index=null)
 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 PARAMS = 'params'
 Extra parameters (prefix the key with a '@' to point to the value of another widget). 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...
 
- 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...
 
 checkMin ($value, $index=null)
 
 checkMax ($value, $index=null)
 
 checkRequired ($value, $index=null)
 Required check. More...
 
 checkValidFunc ($value, $index=null)
 
 actionHelp ()
 
 setController ($value)
 
 getDisplay ()
 
 getFred ()
 
 getId ()
 
 getParams ()
 
 getReadable ()
 
 getRight ()
 
 getTags ()
 
 getWidgets ()
 
 getWriteable ()
 
 _get ($key)
 
- Protected Member Functions inherited from Thing
 publish ($property, $visibility=self::READABLE)
 Publish a property (or hide it again). More...
 
 configure ($config)
 Configure the object. More...
 
 _get ($key)
 Default getter if no specific setter is defined, and the property is also not published (readable). 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
 
 $_params = null
 
 $_right = null
 
 $_tags = null
 
- Protected Attributes inherited from Thing
 $_published = []
 Published properties (key = name of property, value = visibility). More...
 

Detailed Description

Definition at line 7 of file Widget.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $config = null)

Definition at line 64 of file Widget.php.

Member Function Documentation

◆ _get()

_get (   $key)
protected

Definition at line 394 of file Widget.php.

◆ actionHelp()

actionHelp ( )
protected

Definition at line 289 of file Widget.php.

◆ caption()

caption (   $id = null)

Definition at line 123 of file Widget.php.

◆ check()

check (   $value,
  $index = null 
)

Check a value.

Parameters
mixed$valueValue in standard, internal format.
int$indexIndex for mutual children.
Returns
string Error code (empty = OK).

Definition at line 281 of file Widget.php.

◆ checkMax()

checkMax (   $value,
  $index = null 
)
protected

Definition at line 248 of file Widget.php.

◆ checkMin()

checkMin (   $value,
  $index = null 
)
protected

Definition at line 244 of file Widget.php.

◆ checkRequired()

checkRequired (   $value,
  $index = null 
)
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 260 of file Widget.php.

◆ checkValidFunc()

checkValidFunc (   $value,
  $index = null 
)
protected

Definition at line 272 of file Widget.php.

◆ clientConfig()

clientConfig ( )

Public configuration.

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

Definition at line 100 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.

Definition at line 148 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.

Definition at line 172 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 93 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.

Definition at line 140 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.

Definition at line 156 of file Widget.php.

◆ execute()

execute ( )

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.

Definition at line 224 of file Widget.php.

◆ executeChild()

executeChild (   $id)
protected

Execute an action on a child widget.

The widget must determine the child from the ID. E.g. for a list the ID could be [list,5,name] (name of the 5th record on the list). The 'name' child widget will be called then (with 5 as the index).

Parameters
array$idComplete compound ID, including the ID of this parent.

Definition at line 215 of file Widget.php.

◆ expect()

expect (   $action)

Note if an action is expected.

Parameters
string$action

Definition at line 206 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.

Definition at line 164 of file Widget.php.

◆ formatTag()

formatTag (   $value)

Format a tag value.

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

Definition at line 180 of file Widget.php.

◆ getDisplay()

getDisplay ( )
protected

Definition at line 305 of file Widget.php.

◆ getFred()

getFred ( )
protected

Definition at line 318 of file Widget.php.

◆ getId()

getId ( )
protected

Definition at line 322 of file Widget.php.

◆ getParams()

getParams ( )
protected

Definition at line 339 of file Widget.php.

◆ getReadable()

getReadable ( )
protected

Definition at line 358 of file Widget.php.

◆ getRight()

getRight ( )
protected

Definition at line 362 of file Widget.php.

◆ getTags()

getTags ( )
protected

Definition at line 368 of file Widget.php.

◆ getWidgets()

getWidgets ( )
protected

Definition at line 379 of file Widget.php.

◆ getWriteable()

getWriteable ( )
protected

Definition at line 390 of file Widget.php.

◆ hint()

hint (   $id = null)

Definition at line 128 of file Widget.php.

◆ init()

init ( )
protected

Definition at line 70 of file Widget.php.

◆ nothing()

nothing (   $value)

Check if a value is empty.

Parameters
mixed$value
Returns
bool True when empty.

Definition at line 240 of file Widget.php.

◆ purge()

purge (   $value)

Purge a value.

Parameters
mixed$valueRaw value.
Returns
string Purged value.

Definition at line 196 of file Widget.php.

◆ purgeBase()

purgeBase (   $value)
protected

Purge function that will be called first.

Parameters
mixed$valueRaw value.
Returns
string Purged value.

Definition at line 188 of file Widget.php.

◆ setController()

setController (   $value)
protected

Definition at line 300 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 83 of file Widget.php.

Field Documentation

◆ $_config

$_config = []
protected

Widget configuration (see constants).

Definition at line 58 of file Widget.php.

◆ $_controller

$_controller = null
protected

Definition at line 54 of file Widget.php.

◆ $_display

$_display = null
protected

Definition at line 59 of file Widget.php.

◆ $_id

$_id = null
protected

Definition at line 55 of file Widget.php.

◆ $_params

$_params = null
protected

Definition at line 60 of file Widget.php.

◆ $_right

$_right = null
protected

Definition at line 61 of file Widget.php.

◆ $_securityChecksIgnore

$_securityChecksIgnore = []
protected

Security checks to ignore.

Definition at line 57 of file Widget.php.

◆ $_tags

$_tags = null
protected

Definition at line 62 of file Widget.php.

◆ $_widgets

$_widgets = null
protected

Optional child widgets.

Definition at line 56 of file Widget.php.

◆ $defaultValue

$defaultValue = null

Definition at line 43 of file Widget.php.

◆ $help

$help = null

Definition at line 44 of file Widget.php.

◆ $max

$max = null

Definition at line 46 of file Widget.php.

◆ $min

$min = null

Definition at line 45 of file Widget.php.

◆ $parent

$parent = null

Optional parent widget.

Definition at line 52 of file Widget.php.

◆ $required

$required = null

Definition at line 47 of file Widget.php.

◆ $trailer

$trailer = null

Definition at line 48 of file Widget.php.

◆ $validFunc

$validFunc = null

Definition at line 50 of file Widget.php.

◆ $widgetHelp

$widgetHelp = null

Definition at line 49 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 23 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 36 of file Widget.php.

◆ DISPLAY_MINIMAL

const DISPLAY_MINIMAL = 'm'

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

Definition at line 37 of file Widget.php.

◆ DISPLAY_READABLE

const DISPLAY_READABLE = 'r'

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

Definition at line 38 of file Widget.php.

◆ DISPLAY_WRITEABLE

const DISPLAY_WRITEABLE = 'w'

Show editable input element(s).

Definition at line 39 of file Widget.php.

◆ EVENT_ACTION_PREFIX

const EVENT_ACTION_PREFIX = 'controller:widget:action:'

Definition at line 41 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 27 of file Widget.php.

◆ MIN

const MIN = 'min'

Minimum value.

Definition at line 26 of file Widget.php.

◆ PARAMS

const PARAMS = 'params'

Extra parameters (prefix the key with a '@' to point to the value of another widget).

Definition at line 17 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 28 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 18 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 32 of file Widget.php.

◆ TAGS

const TAGS = 'tags'

Extra tags for help, hint, and trailer.

Definition at line 21 of file Widget.php.

◆ TRAILER

const TRAILER = 'trailer'

Trailer string (translated).

Definition at line 20 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 30 of file Widget.php.

◆ WIDGET_HELP

const WIDGET_HELP = 'widgetHelp'

General widget help (translated).

Definition at line 22 of file Widget.php.

◆ WIDGETS

const WIDGETS = 'widgets'

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

Definition at line 31 of file Widget.php.


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