PHP Класс PMA\libraries\config\FormDisplay

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( PMA\libraries\config\ConfigFile $cf ) Constructor
displayErrors ( ) : string Displays errors
fixErrors ( ) : void Reverts erroneous fields to their default values
getConfigFile ( ) : PMA\libraries\config\ConfigFile Returns {@link ConfigFile} associated with this instance
getDisplay ( boolean $tabbed_form = false, boolean $show_restore_default = false, boolean $show_buttons = true, string $form_action = null, array $hidden_fields = null ) : string Outputs HTML for forms
getDocLink ( string $path ) : string Returns link to documentation
hasErrors ( ) : boolean Tells whether form validation failed
process ( boolean $allow_partial_save = true, boolean $check_form_submit = true ) : boolean Processes forms, returns true on successful save
registerForm ( string $form_name, array $form, integer $server_id = null ) : void Registers form in form manager
save ( array | string $forms, boolean $allow_partial_save = true ) : boolean Validates and saves form data to session

Приватные методы

Метод Описание
_displayFieldInput ( PMA\libraries\config\Form $form, string $field, string $system_path, string $work_path, string $translated_path, boolean $show_restore_default, boolean | null $userprefs_allow, array &$js_default ) : string Prepares data for input field display and outputs HTML code
_displayForms ( boolean $show_restore_default, array &$js_default, array &$js, boolean $show_buttons ) : string Outputs HTML for the forms under the menu tab
_fillPostArrayParameters ( array $post_values, string $key ) : void Copy items of an array to $_POST variable
_getOptName ( string $path ) : string Changes path so it can be used in URLs
_loadUserprefsInfo ( ) : void Fills out {@link userprefs_keys} and {@link userprefs_disallow}
_setComments ( string $system_path, array &$opts ) : void Sets field comments and warnings based on current environment
_validate ( ) : void Runs validation for all registered forms
_validateSelect ( &$value, array $allowed ) : boolean Validates select field and casts $value to correct type

Описание методов

__construct() публичный Метод

Constructor
public __construct ( PMA\libraries\config\ConfigFile $cf )
$cf PMA\libraries\config\ConfigFile Config file instance

displayErrors() публичный Метод

Displays errors
public displayErrors ( ) : string
Результат string HTML for errors

fixErrors() публичный Метод

Reverts erroneous fields to their default values
public fixErrors ( ) : void
Результат void

getConfigFile() публичный Метод

Returns {@link ConfigFile} associated with this instance
public getConfigFile ( ) : PMA\libraries\config\ConfigFile
Результат PMA\libraries\config\ConfigFile

getDisplay() публичный Метод

Outputs HTML for forms
public getDisplay ( boolean $tabbed_form = false, boolean $show_restore_default = false, boolean $show_buttons = true, string $form_action = null, array $hidden_fields = null ) : string
$tabbed_form boolean if true, use a form with tabs
$show_restore_default boolean whether show "restore default" button besides the input field
$show_buttons boolean whether show submit and reset button
$form_action string action attribute for the form
$hidden_fields array array of form hidden fields (key: field name)
Результат string HTML for forms

hasErrors() публичный Метод

Tells whether form validation failed
public hasErrors ( ) : boolean
Результат boolean

process() публичный Метод

Processes forms, returns true on successful save
public process ( boolean $allow_partial_save = true, boolean $check_form_submit = true ) : boolean
$allow_partial_save boolean allows for partial form saving on failed validation
$check_form_submit boolean whether check for $_POST['submit_save']
Результат boolean whether processing was successful

registerForm() публичный Метод

Registers form in form manager
public registerForm ( string $form_name, array $form, integer $server_id = null ) : void
$form_name string Form name
$form array Form data
$server_id integer 0 if new server, validation; >= 1 if editing a server
Результат void

save() публичный Метод

Validates and saves form data to session
public save ( array | string $forms, boolean $allow_partial_save = true ) : boolean
$forms array | string array of form names
$allow_partial_save boolean allows for partial form saving on failed validation
Результат boolean true on success (no errors and all saved)