PHP Class PMA\libraries\config\FormDisplay

Exibir arquivo Open project: phpmyadmin/phpmyadmin Class Usage Examples

Public Methods

Method Description
__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

Private Methods

Method Description
_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

Method Details

__construct() public method

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

displayErrors() public method

Displays errors
public displayErrors ( ) : string
return string HTML for errors

fixErrors() public method

Reverts erroneous fields to their default values
public fixErrors ( ) : void
return void

getConfigFile() public method

Returns {@link ConfigFile} associated with this instance
public getConfigFile ( ) : PMA\libraries\config\ConfigFile
return PMA\libraries\config\ConfigFile

getDisplay() public method

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)
return string HTML for forms

hasErrors() public method

Tells whether form validation failed
public hasErrors ( ) : boolean
return boolean

process() public method

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']
return boolean whether processing was successful

registerForm() public method

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
return void

save() public method

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
return boolean true on success (no errors and all saved)