PHP Класс Horde_Core_Form, horde

The Horde_Core_Form:: package provides form rendering, validation, and other functionality for the Horde Application Framework. Copyright 2001-2007 Robert E. Coyle Copyright 2001-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Автор: Robert E. Coyle ([email protected])
Автор: Chuck Hagenbuch ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_autofilled
$_currentSection
$_errors
$_help
$_hiddenVariables
$_name
$_open_section
$_sections
$_submitted
$_title
$_useFormToken
$_variables
$_vars

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

Метод Описание
__construct ( $vars, $title = '', $name = null )
add ( $varName, $type, $humanName, $required, $readonly = false, $description = null, $params = [] )
addHidden ( $varName, $type, $required, $params = [] ) TODO
addVariable ( $humanName, $varName, $type, $required, $readonly = false, $description = null, $params = [] ) TODO
clearError ( $var )
clearValidation ( )
execute ( )
getError ( $var )
getHiddenVariables ( )
getInfo ( array &$info ) Fetch the field values of the submitted form.
getName ( )
getOpenSection ( )
getRenderer ( array $params = [] ) : object Get the renderer for this form, either a custom renderer or the standard one.
getSectionDesc ( $section )
getSectionExpandedState ( $section, $boolean = false )
getSectionImage ( $section )
getSections ( )
getTitle ( )
getType ( $type, $params = [] )
getVariables ( $flat = true, $withHidden = false )
getVars ( )
hasHelp ( )
insertVariableBefore ( $before, $humanName, $varName, $type, $required, $readonly = false, $description = null, $params = [] ) TODO
isSubmitted ( ) : boolean Determines if this form has been submitted or not. If the class var _submitted is null then it will check for the presence of the formname in the form variables.
isValid ( )
onSubmit ( ) Checks if there is anything to do on the submission of the form by looping through each variable's onSubmit() function.
preserve ( Horde_Core_Form $form ) Preserve the variables/values from another Horde_Core_Form object.
removeVariable ( Horde_Core_Form_Variable | string &$var ) : boolean Removes a variable from the form.
setError ( $var, $message )
setOpenSection ( $section )
setSection ( $section = '', $desc = '', $image = '', $expanded = true )
setSubmitted ( boolean $state = true ) Explicitly sets the state of the form submit.
setTitle ( $title )
setVars ( $vars )
useToken ( boolean $token = null ) : boolean Sets or gets whether the form should be verified by tokens.
validate ( $canAutoFill = false ) : boolean Does the action of validating the form, checking if it really has been submitted by calling isSubmitted() and if true does any onSubmit() calls for var types in the form. The _submitted var is then rechecked.

Защищенные методы

Метод Описание
_getInfoFromVariables ( array $variables, array &$info ) Fetch the field values from a given array of variables.

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

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

public __construct ( $vars, $title = '', $name = null )

_getInfoFromVariables() защищенный Метод

Fetch the field values from a given array of variables.
protected _getInfoFromVariables ( array $variables, array &$info )
$variables array An array of Horde_Core_Form_Variable objects to fetch from.
$info array The array to be filled with the submitted field values.

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

public add ( $varName, $type, $humanName, $required, $readonly = false, $description = null, $params = [] )

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

TODO
public addHidden ( $varName, $type, $required, $params = [] )

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

TODO
public addVariable ( $humanName, $varName, $type, $required, $readonly = false, $description = null, $params = [] )

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

public clearError ( $var )

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

public clearValidation ( )

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

public execute ( )

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

public getError ( $var )

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

public getHiddenVariables ( )

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

Fetch the field values of the submitted form.
public getInfo ( array &$info )
$info array Array to be filled with the submitted field values.

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

public getName ( )

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

public getOpenSection ( )

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

To use a custom form renderer, your form class needs to override this function: function getRenderer() { return new CustomFormRenderer(); } ... where CustomFormRenderer is the classname of the custom renderer class, which should extend Horde_Core_Form_Renderer.
public getRenderer ( array $params = [] ) : object
$params array A hash of renderer-specific parameters.
Результат object Horde_Core_Form_Renderer The form renderer.

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

public getSectionDesc ( $section )

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

public getSectionExpandedState ( $section, $boolean = false )

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

public getSectionImage ( $section )

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

public getSections ( )

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

public getTitle ( )

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

public getType ( $type, $params = [] )

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

public getVariables ( $flat = true, $withHidden = false )

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

public getVars ( )

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

public hasHelp ( )

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

TODO
public insertVariableBefore ( $before, $humanName, $varName, $type, $required, $readonly = false, $description = null, $params = [] )

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

Other events can explicitly set the _submitted variable to false to indicate a form submit but not for actual posting of data (eg. onChange events to update the display of fields).
public isSubmitted ( ) : boolean
Результат boolean True or false indicating if the form has been submitted.

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

public isValid ( )

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

Checks if there is anything to do on the submission of the form by looping through each variable's onSubmit() function.
public onSubmit ( )

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

Preserve the variables/values from another Horde_Core_Form object.
public preserve ( Horde_Core_Form $form )
$form Horde_Core_Form

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

As only variables can be passed by reference, you need to call this method this way if want to pass a variable name: $form->removeVariable($var = 'varname');
public removeVariable ( Horde_Core_Form_Variable | string &$var ) : boolean
$var Horde_Core_Form_Variable | string Either the variable's name or the variable to remove from the form.
Результат boolean True if the variable was found (and deleted).

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

public setError ( $var, $message )

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

public setOpenSection ( $section )

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

public setSection ( $section = '', $desc = '', $image = '', $expanded = true )

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

An event can override the automatic determination of the submit state in the isSubmitted() function.
public setSubmitted ( boolean $state = true )
$state boolean Whether to set the state of the form as being submitted.

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

public setTitle ( $title )

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

public setVars ( $vars )

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

Tokens are used to verify that a form is only submitted once.
public useToken ( boolean $token = null ) : boolean
$token boolean If specified, sets whether to use form tokens.
Результат boolean Whether form tokens are being used.

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

Does the action of validating the form, checking if it really has been submitted by calling isSubmitted() and if true does any onSubmit() calls for var types in the form. The _submitted var is then rechecked.
public validate ( $canAutoFill = false ) : boolean
Результат boolean True if the form is valid.

Описание свойств

$_autofilled защищенное свойство

protected $_autofilled

$_currentSection защищенное свойство

protected $_currentSection

$_errors защищенное свойство

protected $_errors

$_help защищенное свойство

protected $_help

$_hiddenVariables защищенное свойство

protected $_hiddenVariables

$_name защищенное свойство

protected $_name

$_open_section защищенное свойство

protected $_open_section

$_sections защищенное свойство

protected $_sections

$_submitted защищенное свойство

protected $_submitted

$_title защищенное свойство

protected $_title

$_useFormToken защищенное свойство

protected $_useFormToken

$_variables защищенное свойство

protected $_variables

$_vars защищенное свойство

protected $_vars