|
dolibarr 24.0.0-beta
|
Class to manage fields. More...


Public Member Functions | |
| __construct ($db, $form=null) | |
| Constructor. | |
| getFieldClass ($type) | |
| Get field handler for the provided type. | |
| getAllFields () | |
| Get all fields handler available. | |
| clearErrors () | |
| clear errors | |
| errorsToString ($separator=', ') | |
| Method to output saved errors. | |
| clearFieldError ($fieldKey) | |
| clear validation message result for a field | |
| setFieldError ($fieldKey, $msg='') | |
| set validation error message a field | |
| getFieldError ($fieldKey) | |
| get field error message | |
| getFieldErrorIcon ($fieldValidationErrorMsg) | |
| get field error icon | |
| getAllFieldsInfos (&$object, &$extrafields=null, $mode='view', $nbColumn=2, $breakKeys=array(), $params=array()) | |
| Get list of fields infos for the provided mode into X columns. | |
| getAllObjectFieldsInfos (&$object, $mode='view', $params=array()) | |
| Get list of object fields infos. | |
| getAllExtraFieldsInfos (&$object, &$extrafields=null, $mode='view', $params=array()) | |
| Get list of extra fields infos. | |
| getFieldsInfos ($key, &$object, &$extrafields=null, $mode='view', $params=array()) | |
| Get list of fields infos for the provided mode into X columns. | |
| getFieldInfosFromObjectField (&$object, $key, $mode='view', $params=array()) | |
| Get field infos from object field infos. | |
| getFieldInfosFromExtraField (&$object, &$extrafields, $key, $mode='view', $params=array()) | |
| Get field infos from extra field infos. | |
| setCommonFieldInfos (&$fieldInfos, &$object, &$extrafields, $key, $mode='view', $enabled='1', $visibility='', $perms=null, $params=array()) | |
| Set common field infos. | |
| setFieldValuesFromPost (&$object, &$extrafields, $keyPrefix='', $keySuffix='', $mode='view', $params=array()) | |
| Set all values of the object (with extra field) from POST. | |
| setObjectFieldValuesFromPost (&$object, $keyPrefix='', $keySuffix='', $mode='view', $params=array()) | |
| Set all object values of the object from POST. | |
| setExtraFieldValuesFromPost (&$object, &$extrafields, $keyPrefix='', $keySuffix='', $mode='view', $params=array()) | |
| Set all extra field values of the object from POST. | |
| verifyPostFieldValue ($fieldInfos, $key, $keyPrefix='', $keySuffix='') | |
| Verify if the field value is valid. | |
| verifyFieldValue ($fieldInfos, $key, $value) | |
| Verify if the field value is valid. | |
| getPostFieldValue ($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='') | |
| Get field value from GET/POST. | |
| getPostSearchFieldValue ($fieldInfos, $key, $defaultValue=null, $keyPrefix='', $keySuffix='') | |
| Get search field value from GET/POST. | |
| printInputSearchField ($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='', $noNewButton=0) | |
| Return HTML string to put an input search field into a page. | |
| printInputField ($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='', $noNewButton=0) | |
| Return HTML string to put an input field into a page. | |
| printOutputField ($fieldInfos, $key, $value, $keyPrefix='', $keySuffix='', $moreCss='', $moreAttrib='') | |
| Return HTML string to show a field into a page. | |
| printSeparator ($key, &$object, $colspan=2, $display_type='card', $mode='view') | |
| Return HTML string to print separator field. | |
Class to manage fields.
Definition at line 42 of file fieldsmanager.class.php.
| FieldsManager::__construct | ( | $db, | |
| $form = null ) |
Constructor.
Reimplemented in WebPortalFieldsManager.
Definition at line 128 of file fieldsmanager.class.php.
References CommonField\setForm().
| FieldsManager::clearErrors | ( | ) |
clear errors
Definition at line 205 of file fieldsmanager.class.php.
Referenced by getPostFieldValue(), getPostSearchFieldValue(), printInputField(), printInputSearchField(), printOutputField(), verifyFieldValue(), and verifyPostFieldValue().
| FieldsManager::clearFieldError | ( | $fieldKey | ) |
clear validation message result for a field
| string | $fieldKey | Key of attribute to clear |
Definition at line 228 of file fieldsmanager.class.php.
Referenced by verifyFieldValue(), and verifyPostFieldValue().
| FieldsManager::errorsToString | ( | $separator = ', | |
| ' | ) |
Method to output saved errors.
| string | $separator | Separator between each error |
Definition at line 217 of file fieldsmanager.class.php.
Referenced by printInputField(), printInputSearchField(), and printOutputField().
| FieldsManager::getAllExtraFieldsInfos | ( | & | $object, |
| & | $extrafields = null, | ||
| $mode = 'view', | |||
| $params = array() ) |
Get list of extra fields infos.
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | ExtraFields handler |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 417 of file fieldsmanager.class.php.
References $object, and getFieldInfosFromExtraField().
Referenced by getAllFieldsInfos(), and setExtraFieldValuesFromPost().
| FieldsManager::getAllFields | ( | ) |
Get all fields handler available.
Definition at line 194 of file fieldsmanager.class.php.
| FieldsManager::getAllFieldsInfos | ( | & | $object, |
| & | $extrafields = null, | ||
| $mode = 'view', | |||
| $nbColumn = 2, | |||
| $breakKeys = array(), | |||
| $params = array() ) |
Get list of fields infos for the provided mode into X columns.
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | ExtraFields handler |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| int | $nbColumn | Split fields infos into X columns |
| array<int,string> | $breakKeys Key used for break on each column (ex: array(1 => 'total_ht', ...)) | |
| array<string,mixed> | $params Other params |
Definition at line 293 of file fieldsmanager.class.php.
References $object, dol_sort_array(), getAllExtraFieldsInfos(), getAllObjectFieldsInfos(), and getDolGlobalInt().
| FieldsManager::getAllObjectFieldsInfos | ( | & | $object, |
| $mode = 'view', | |||
| $params = array() ) |
Get list of object fields infos.
| CommonObject | $object | Object handler |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 381 of file fieldsmanager.class.php.
References $object, getDolGlobalInt(), and getFieldInfosFromObjectField().
Referenced by getAllFieldsInfos(), and setObjectFieldValuesFromPost().
| FieldsManager::getFieldClass | ( | $type | ) |
Get field handler for the provided type.
| string | $type | Field type |
Definition at line 145 of file fieldsmanager.class.php.
References dol_include_once().
Referenced by getPostFieldValue(), getPostSearchFieldValue(), printInputField(), printInputSearchField(), printOutputField(), verifyFieldValue(), and verifyPostFieldValue().
| FieldsManager::getFieldError | ( | $fieldKey | ) |
get field error message
| string | $fieldKey | Key of attribute |
Definition at line 257 of file fieldsmanager.class.php.
Referenced by printInputField().
| FieldsManager::getFieldErrorIcon | ( | $fieldValidationErrorMsg | ) |
get field error icon
| string | $fieldValidationErrorMsg | message to add in tooltip |
Definition at line 271 of file fieldsmanager.class.php.
References getFieldErrorIcon().
Referenced by getFieldErrorIcon(), and printInputField().
| FieldsManager::getFieldInfosFromExtraField | ( | & | $object, |
| & | $extrafields, | ||
| $key, | |||
| $mode = 'view', | |||
| $params = array() ) |
Get field infos from extra field infos.
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | Extrafields handler |
| string | $key | Field key |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 571 of file fieldsmanager.class.php.
References $object, and setCommonFieldInfos().
Referenced by getAllExtraFieldsInfos(), and getFieldsInfos().
| FieldsManager::getFieldInfosFromObjectField | ( | & | $object, |
| $key, | |||
| $mode = 'view', | |||
| $params = array() ) |
Get field infos from object field infos.
| CommonObject | $object | Object handler |
| string | $key | Field key |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 482 of file fieldsmanager.class.php.
References $object, and setCommonFieldInfos().
Referenced by getAllObjectFieldsInfos(), and getFieldsInfos().
| FieldsManager::getFieldsInfos | ( | $key, | |
| & | $object, | ||
| & | $extrafields = null, | ||
| $mode = 'view', | |||
| $params = array() ) |
Get list of fields infos for the provided mode into X columns.
| string | $key | Field key (begin by object_ for object or options_ for extrafields) |
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | ExtraFields handler |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 456 of file fieldsmanager.class.php.
References $object, getDolGlobalInt(), getFieldInfosFromExtraField(), and getFieldInfosFromObjectField().
| FieldsManager::getPostFieldValue | ( | $fieldInfos, | |
| $key, | |||
| $defaultValue = null, | |||
| $keyPrefix = '', | |||
| $keySuffix = '' ) |
Get field value from GET/POST.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of field |
| mixed | $defaultValue | Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
Definition at line 950 of file fieldsmanager.class.php.
References clearErrors(), and getFieldClass().
Referenced by setExtraFieldValuesFromPost(), and setObjectFieldValuesFromPost().
| FieldsManager::getPostSearchFieldValue | ( | $fieldInfos, | |
| $key, | |||
| $defaultValue = null, | |||
| $keyPrefix = '', | |||
| $keySuffix = '' ) |
Get search field value from GET/POST.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of field |
| mixed | $defaultValue | Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
Definition at line 989 of file fieldsmanager.class.php.
References clearErrors(), and getFieldClass().
| FieldsManager::printInputField | ( | $fieldInfos, | |
| $key, | |||
| $value, | |||
| $keyPrefix = '', | |||
| $keySuffix = '', | |||
| $moreCss = '', | |||
| $moreAttrib = '', | |||
| $noNewButton = 0 ) |
Return HTML string to put an input field into a page.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of attribute |
| mixed | $value | Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $moreCss | Value for css to define style/length of field. |
| string | $moreAttrib | To add more attributes on html input tag |
| int<0,1> | $noNewButton Force to not show the new button on field that are links to object |
Definition at line 1091 of file fieldsmanager.class.php.
References clearErrors(), errorsToString(), getFieldClass(), getFieldError(), getFieldErrorIcon(), and printOutputField().
| FieldsManager::printInputSearchField | ( | $fieldInfos, | |
| $key, | |||
| $value, | |||
| $keyPrefix = '', | |||
| $keySuffix = '', | |||
| $moreCss = '', | |||
| $moreAttrib = '', | |||
| $noNewButton = 0 ) |
Return HTML string to put an input search field into a page.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of attribute |
| mixed | $value | Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $moreCss | Value for css to define style/length of field. |
| string | $moreAttrib | To add more attributes on html input tag |
| int<0,1> | $noNewButton Force to not show the new button on field that are links to object |
Definition at line 1031 of file fieldsmanager.class.php.
References clearErrors(), errorsToString(), and getFieldClass().
| FieldsManager::printOutputField | ( | $fieldInfos, | |
| $key, | |||
| $value, | |||
| $keyPrefix = '', | |||
| $keySuffix = '', | |||
| $moreCss = '', | |||
| $moreAttrib = '' ) |
Return HTML string to show a field into a page.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of attribute |
| mixed | $value | Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $moreCss | Value for css to define style/length of field. |
| string | $moreAttrib | To add more attributes on html input tag |
Definition at line 1169 of file fieldsmanager.class.php.
References clearErrors(), errorsToString(), and getFieldClass().
Referenced by printInputField().
| FieldsManager::printSeparator | ( | $key, | |
| & | $object, | ||
| $colspan = 2, | |||
| $display_type = 'card', | |||
| $mode = 'view' ) |
Return HTML string to print separator field.
| string | $key | Key of attribute |
| object | $object | Object |
| int | $colspan | Value of colspan to use (it must include the first column with title) |
| string | $display_type | "card" for form display, "line" for document line display |
| string | $mode | Show output ('view') or input ('create' or 'edit') for field |
Definition at line 1221 of file fieldsmanager.class.php.
References $conf.
| FieldsManager::setCommonFieldInfos | ( | & | $fieldInfos, |
| & | $object, | ||
| & | $extrafields, | ||
| $key, | |||
| $mode = 'view', | |||
| $enabled = '1', | |||
| $visibility = '', | |||
| $perms = null, | |||
| $params = array() ) |
Set common field infos.
| FieldInfos | $fieldInfos | Field infos to set with common infos |
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | Extrafields handler |
| string | $key | Field key |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| string | $enabled | Condition when the field must be managed (Example: 1 or 'getDolGlobalInt("MY_SETUP_PARAM")' or 'isModEnabled("multicurrency")' ...) |
| string | $visibility | Condition when the field must be visible (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form (not create). 5=Visible on list and view form (not create/not update). 6=visible on list and update/view form (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) |
| string | $perms | Condition when the field must be editable |
| array<string,mixed> | $params Other params |
Definition at line 644 of file fieldsmanager.class.php.
References $object, dol_eval(), and getDolGlobalString().
Referenced by getFieldInfosFromExtraField(), and getFieldInfosFromObjectField().
| FieldsManager::setExtraFieldValuesFromPost | ( | & | $object, |
| & | $extrafields, | ||
| $keyPrefix = '', | |||
| $keySuffix = '', | |||
| $mode = 'view', | |||
| $params = array() ) |
Set all extra field values of the object from POST.
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | Extrafields handler |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 835 of file fieldsmanager.class.php.
References $object, getAllExtraFieldsInfos(), getPostFieldValue(), verifyFieldValue(), and verifyPostFieldValue().
Referenced by setFieldValuesFromPost().
| FieldsManager::setFieldError | ( | $fieldKey, | |
| $msg = '' ) |
set validation error message a field
| string | $fieldKey | Key of attribute |
| string | $msg | the field error message |
Definition at line 241 of file fieldsmanager.class.php.
Referenced by verifyFieldValue(), and verifyPostFieldValue().
| FieldsManager::setFieldValuesFromPost | ( | & | $object, |
| & | $extrafields, | ||
| $keyPrefix = '', | |||
| $keySuffix = '', | |||
| $mode = 'view', | |||
| $params = array() ) |
Set all values of the object (with extra field) from POST.
| CommonObject | $object | Object handler |
| ExtraFields | $extrafields | Extrafields handler |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 781 of file fieldsmanager.class.php.
References $object, setExtraFieldValuesFromPost(), and setObjectFieldValuesFromPost().
| FieldsManager::setObjectFieldValuesFromPost | ( | & | $object, |
| $keyPrefix = '', | |||
| $keySuffix = '', | |||
| $mode = 'view', | |||
| $params = array() ) |
Set all object values of the object from POST.
| CommonObject | $object | Object handler |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $mode | Get the fields infos for the provided mode ('create', 'edit', 'view', 'list') |
| array<string,mixed> | $params Other params |
Definition at line 799 of file fieldsmanager.class.php.
References $object, getAllObjectFieldsInfos(), getPostFieldValue(), verifyFieldValue(), and verifyPostFieldValue().
Referenced by setFieldValuesFromPost().
| FieldsManager::verifyFieldValue | ( | $fieldInfos, | |
| $key, | |||
| $value ) |
Verify if the field value is valid.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of field |
| mixed | $value | Value to check (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) |
Definition at line 909 of file fieldsmanager.class.php.
References clearErrors(), clearFieldError(), getDolGlobalInt(), getDolGlobalString(), getFieldClass(), and setFieldError().
Referenced by setExtraFieldValuesFromPost(), and setObjectFieldValuesFromPost().
| FieldsManager::verifyPostFieldValue | ( | $fieldInfos, | |
| $key, | |||
| $keyPrefix = '', | |||
| $keySuffix = '' ) |
Verify if the field value is valid.
| FieldInfos | $fieldInfos | Properties of the field |
| string | $key | Key of attribute |
| string | $keyPrefix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
| string | $keySuffix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
Definition at line 869 of file fieldsmanager.class.php.
References clearErrors(), clearFieldError(), getDolGlobalInt(), getDolGlobalString(), getFieldClass(), and setFieldError().
Referenced by setExtraFieldValuesFromPost(), and setObjectFieldValuesFromPost().