wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
FormUtil Class Reference

Public Member Functions

 FormUtil ($language=null)
 
 getInputControl ($name, $inputType, $value, $editable=true, $addEmptyValue=false)
 
 translateValue ($value, $inputType, $replaceBR=false, $nodeOid=null)
 

Static Public Member Functions

static getInputFieldDelimiter ()
 

Public Attributes

 $_language = null
 
 $_controlRenderer = null
 
 $_lists = array()
 

Private Member Functions

 getListMap ($description, $value=null, $nodeOid=null, $addEmptyValue=false)
 
 resolveByOid ($oid)
 

Detailed Description

FormUtil provides basic support for HTML forms. It's mainly for creating input controls from definition strings.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.FormUtil.php 1462 2014-02-04 23:52:27Z iherwig
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 35 of file class.FormUtil.php.

Member Function Documentation

FormUtil::FormUtil (   $language = null)

Constructor

Parameters
languageThe lanugage if FormUtil should be localization aware. Optional, default is Localization::getDefaultLanguage()

Definition at line 46 of file class.FormUtil.php.

References ObjectFactory\getInstance(), and WCMFException\throwEx().

+ Here is the call graph for this function:

static FormUtil::getInputFieldDelimiter ( )
static

Get the delimiter for HTML input control names to be used if a control name consists of different parts.

Returns
The delimitor
Note
If 'inputFieldNameDelimiter' is given in the configuration file (section 'htmlform') it will be taken (else it defaults to '-').

Definition at line 65 of file class.FormUtil.php.

References InifileParser\getInstance().

Referenced by DefaultControlRenderer\configure_fileex(), SaveController\executeKernel(), NodeUtil\getInputControlName(), and NodeUtil\getValueDefFromInputControlName().

+ Here is the call graph for this function:

FormUtil::getInputControl (   $name,
  $inputType,
  $value,
  $editable = true,
  $addEmptyValue = false 
)

Get a HTML input control for a given description.

Parameters
nameThe name of the control (HTML name attribute)
inputTypeThe description of the control as given in the input_type property of a value The description is of the form
type
or
type[attributes]#list
where list must be given for the types select, radio and checkbox
  • type: text|password|textarea|select|radio|checkbox|file|fileex(= file with delete checkbox)
  • attributes: a string of attributes for the input control as used in the HTML definition (e.g. 'cols="50" rows="4"')
  • list: one of the following:
    • fix:key1[val1]|key2[val2]|... or fix:$global_array_variable
    • db:key[val]|table
    • fkt:name|param1,param2,... global function
    • config:section
valueThe predefined value of the control (maybe comma separated list for list controls)
editableTrue/False if this is set false the function returns only the translated value (processed by translateValue()) [default: true]
addEmptyValueTrue/False if this is set true, an additional empty value is added to the input control (if not given no empty value will be added) [default: false]
Returns
The HTML control string or the translated value string depending in the editable parameter
See Also
DefaultControlRenderer::renderControl

Definition at line 94 of file class.FormUtil.php.

References SessionData\getInstance(), getListMap(), and translateValue().

+ Here is the call graph for this function:

FormUtil::getListMap (   $description,
  $value = null,
  $nodeOid = null,
  $addEmptyValue = false 
)
private

Get a list of key/value pairs defined by description.

Parameters
descriptionOne of the following strings:
  • fix:key1[val1]|key2[val2]|... or fix:$global_array_variable
  • db:key[val]|table
  • fkt:name|param1,param2,... global function
  • config:section
valueThe selected value (maybe null, default: null)
nodeOidOid of the node containing this value (for determining remote oids) [default: null]
addEmptyValueTrue/False if this is set true, an additional empty value is added to the input control (if not given no empty value will be added) [default: false]
Returns
An assoziative array containing the key/value pairs
Note
The method will try to translate values with Message::get(). Keys and values are encoded using htmlentities(string, ENT_QUOTES, 'UTF-8').

Definition at line 156 of file class.FormUtil.php.

References $GLOBALS, BUILDDEPTH_SINGLE, PersistenceFacade\composeOID(), PersistenceFacade\decomposeOID(), Message\get(), PersistenceFacade\getInstance(), InifileParser\getInstance(), Localization\getInstance(), PersistenceFacade\isValidOID(), resolveByOid(), and WCMFException\throwEx().

Referenced by getInputControl(), and translateValue().

+ Here is the call graph for this function:

FormUtil::resolveByOid (   $oid)
private

Resolves the DisplayValue of the given oid.

Parameters
String$oidThe oid of the requested object.
Returns
String The DisplayValue of $oid, or null if $oid is invalid.

Definition at line 328 of file class.FormUtil.php.

References BUILDDEPTH_SINGLE, PersistenceFacade\getInstance(), Localization\getInstance(), and PersistenceFacade\isValidOID().

Referenced by getListMap().

+ Here is the call graph for this function:

FormUtil::translateValue (   $value,
  $inputType,
  $replaceBR = false,
  $nodeOid = null 
)

Translate a value with use of it's assoziated input type e.g get the location string from a location id. (this is only done when the input type has a list definition).

Parameters
valueThe value to translate (maybe comma separated list for list controls)
inputTypeThe description of the control as given in the input_type property of a value (see CMS getInputControl())
replaceBRTrue/False wether to replace html line breaks with spaces or not [default:false]
nodeOidOid of the node containing this value (for determining remote oids) [default: null]
Returns
The translated value

Definition at line 361 of file class.FormUtil.php.

References getListMap(), and StringUtil\removeTrailingComma().

Referenced by getInputControl().

+ Here is the call graph for this function:

Member Data Documentation

FormUtil::$_language = null

Definition at line 37 of file class.FormUtil.php.

FormUtil::$_controlRenderer = null

Definition at line 38 of file class.FormUtil.php.

FormUtil::$_lists = array()

Definition at line 39 of file class.FormUtil.php.


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