class FormDisplay

Form management class, displays and processes forms

Methods

__construct(ConfigFile $cf)

Constructor

getConfigFile()

Returns {@link ConfigFile} associated with this instance

void
registerForm(string $formName, array $form, int $serverId = null)

Registers form in form manager

boolean
process(bool $allowPartialSave = true, bool $checkFormSubmit = true)

Processes forms, returns true on successful save

string
getDisplay(bool $tabbedForm = false, bool $showRestoreDefault = false, bool $showButtons = true, string $formAction = null, array|null $hiddenFields = null)

Outputs HTML for forms

string|null
displayErrors()

Displays errors

void
fixErrors()

Reverts erroneous fields to their default values

boolean
save(array|string $forms, bool $allowPartialSave = true)

Validates and saves form data to session

boolean
hasErrors()

Tells whether form validation failed

string
getDocLink(string $path)

Returns link to documentation

Details

at line 97
__construct(ConfigFile $cf)

Constructor

Parameters

ConfigFile $cf Config file instance

at line 117
ConfigFile getConfigFile()

Returns {@link ConfigFile} associated with this instance

Return Value

ConfigFile

at line 131
void registerForm(string $formName, array $form, int $serverId = null)

Registers form in form manager

Parameters

string $formName Form name
array $form Form data
int $serverId 0 if new server, validation; >= 1 if editing a server

Return Value

void

at line 158
boolean process(bool $allowPartialSave = true, bool $checkFormSubmit = true)

Processes forms, returns true on successful save

Parameters

bool $allowPartialSave allows for partial form saving on failed validation
bool $checkFormSubmit whether check for $_POST['submit_save']

Return Value

boolean whether processing was successful

at line 293
string getDisplay(bool $tabbedForm = false, bool $showRestoreDefault = false, bool $showButtons = true, string $formAction = null, array|null $hiddenFields = null)

Outputs HTML for forms

Parameters

bool $tabbedForm if true, use a form with tabs
bool $showRestoreDefault whether show "restore default" button besides the input field
bool $showButtons whether show submit and reset button
string $formAction action attribute for the form
array|null $hiddenFields array of form hidden fields (key: field name)

Return Value

string HTML for forms

at line 522
string|null displayErrors()

Displays errors

Return Value

string|null HTML for errors

at line 548
void fixErrors()

Reverts erroneous fields to their default values

Return Value

void

at line 604
boolean save(array|string $forms, bool $allowPartialSave = true)

Validates and saves form data to session

Parameters

array|string $forms array of form names
bool $allowPartialSave allows for partial form saving on failed validation

Return Value

boolean true on success (no errors and all saved)

at line 769
boolean hasErrors()

Tells whether form validation failed

Return Value

boolean

Returns link to documentation

Parameters

string $path Path to documentation

Return Value

string