dolibarr 21.0.0-alpha
FormSetup Class Reference

This class help you create setup render. More...

Public Member Functions

 __construct ($db, $outputLangs=null)
 Constructor.
 
 generateOutput ($editMode=false, $hideTitle=false)
 Generate the form (in read or edit mode depending on $editMode)
 
 generateTableOutput ($editMode=false, $hideTitle=false)
 generateTableOutput
 
 saveConfFromPost ($noMessageInUpdate=false)
 saveConfFromPost
 
 generateLineOutput ($item, $editMode=false)
 generateLineOutput
 
 addItemsFromParamsArray ($params)
 Method used to test module builder conversion to this form usage.
 
 addItemFromParams ($confKey, $params)
 From old Method was used to test module builder conversion to this form usage.
 
 exportItemsAsParamsArray ()
 Used to export param array for /core/actions_setmoduleoptions.inc.php template Method exists only for manage setup conversion.
 
 reloadConfs ()
 Reload for each item default conf note: this will override custom configuration.
 
 newItem ($confKey, $targetItemKey='', $insertAfterTarget=false)
 Create a new item The target is useful with hooks : that allow externals modules to add setup items on good place.
 
 sortingItems ()
 Sort items according to rank.
 
 getCurentItemMaxRank ($cache=true)
 getCurentItemMaxRank
 
 setItemMaxRank ($rank)
 set new max rank if needed
 
 getLineRank ($itemKey)
 get item position rank from item key
 
 itemSort (FormSetupItem $a, FormSetupItem $b)
 uasort callback function to Sort params items
 

Static Public Member Functions

static generateAttributesStringFromArray ($attributes)
 Generate an attributes string form an input array.
 

Detailed Description

This class help you create setup render.

Definition at line 22 of file html.formsetup.class.php.

Constructor & Destructor Documentation

◆ __construct()

FormSetup::__construct ( $db,
$outputLangs = null )

Constructor.

Parameters
DoliDB$dbDatabase handler
Translate$outputLangsif needed can use another lang

Definition at line 95 of file html.formsetup.class.php.

References newToken().

Member Function Documentation

◆ addItemFromParams()

FormSetup::addItemFromParams ( $confKey,
$params )

From old Method was used to test module builder conversion to this form usage.

Parameters
string$confKeythe conf name to store
array<string,null|int|float|string>$params an array of params from old modulBuilder params
Returns
bool

@scrutinizer ignore-deprecated

Definition at line 385 of file html.formsetup.class.php.

Referenced by addItemsFromParamsArray().

◆ addItemsFromParamsArray()

FormSetup::addItemsFromParamsArray ( $params)

Method used to test module builder conversion to this form usage.

Parameters
array<array<string,null|int|float|string>>$params an array of arrays of params from old modulBuilder params
Returns
boolean

Definition at line 365 of file html.formsetup.class.php.

References addItemFromParams().

◆ exportItemsAsParamsArray()

FormSetup::exportItemsAsParamsArray ( )

Used to export param array for /core/actions_setmoduleoptions.inc.php template Method exists only for manage setup conversion.

Returns
array<string,array{type:string,enabled:int<0,1>}> $arrayofparameters for /core/actions_setmoduleoptions.inc.php

Definition at line 427 of file html.formsetup.class.php.

◆ generateAttributesStringFromArray()

static FormSetup::generateAttributesStringFromArray ( $attributes)
static

Generate an attributes string form an input array.

Parameters
array<string,mixed|mixed[]|Object>$attributes an array of attributes keys and values,
Returns
string attribute string

Definition at line 122 of file html.formsetup.class.php.

References dol_escape_htmltag().

Referenced by generateOutput().

◆ generateLineOutput()

FormSetup::generateLineOutput ( $item,
$editMode = false )

generateLineOutput

Parameters
FormSetupItem$itemthe setup item
bool$editModeDisplay as edit mod
Returns
string the html output for an setup item

Definition at line 317 of file html.formsetup.class.php.

References setEventMessages().

Referenced by generateTableOutput().

◆ generateOutput()

FormSetup::generateOutput ( $editMode = false,
$hideTitle = false )

Generate the form (in read or edit mode depending on $editMode)

Parameters
bool$editModetrue will display output on edit mod
bool$hideTitleTrue to hide the first title line
Returns
string Html output

Definition at line 145 of file html.formsetup.class.php.

References dol_escape_htmltag(), generateAttributesStringFromArray(), generateTableOutput(), and setEventMessages().

◆ generateTableOutput()

FormSetup::generateTableOutput ( $editMode = false,
$hideTitle = false )

generateTableOutput

Parameters
bool$editModeTrue will display output on edit modECM
bool$hideTitleTrue to hide the first title line
Returns
string Html output

Definition at line 214 of file html.formsetup.class.php.

References generateLineOutput(), setEventMessages(), and sortingItems().

Referenced by generateOutput().

◆ getCurentItemMaxRank()

FormSetup::getCurentItemMaxRank ( $cache = true)

getCurentItemMaxRank

Parameters
bool$cacheTo use cache or not
Returns
int

Definition at line 520 of file html.formsetup.class.php.

Referenced by newItem().

◆ getLineRank()

FormSetup::getLineRank ( $itemKey)

get item position rank from item key

Parameters
string$itemKeythe item key
Returns
int rank on success and -1 on error

Definition at line 557 of file html.formsetup.class.php.

◆ itemSort()

FormSetup::itemSort ( FormSetupItem $a,
FormSetupItem $b )

uasort callback function to Sort params items

Parameters
FormSetupItem$aformSetup item
FormSetupItem$bformSetup item
Returns
int Return compare result

Definition at line 573 of file html.formsetup.class.php.

◆ newItem()

FormSetup::newItem ( $confKey,
$targetItemKey = '',
$insertAfterTarget = false )

Create a new item The target is useful with hooks : that allow externals modules to add setup items on good place.

Parameters
string$confKeythe conf key used in database
string$targetItemKeytarget item used to place the new item beside
bool$insertAfterTargetinsert before or after target item ?
Returns
FormSetupItem the new setup item created

Definition at line 468 of file html.formsetup.class.php.

References getCurentItemMaxRank(), and setItemMaxRank().

◆ reloadConfs()

FormSetup::reloadConfs ( )

Reload for each item default conf note: this will override custom configuration.

Returns
bool

Definition at line 446 of file html.formsetup.class.php.

◆ saveConfFromPost()

FormSetup::saveConfFromPost ( $noMessageInUpdate = false)

saveConfFromPost

Parameters
bool$noMessageInUpdatedisplay event message on errors and success
Returns
int|null Return -1 if KO, 1 if OK, null if no items

Definition at line 260 of file html.formsetup.class.php.

References setEventMessages().

◆ setItemMaxRank()

FormSetup::setItemMaxRank ( $rank)

set new max rank if needed

Parameters
int$rankthe item rank
Returns
int|void new max rank

Definition at line 545 of file html.formsetup.class.php.

Referenced by newItem().

◆ sortingItems()

FormSetup::sortingItems ( )

Sort items according to rank.

Returns
bool

Definition at line 508 of file html.formsetup.class.php.

Referenced by generateTableOutput().


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