PHP Class Horde_Form_Variable, horde

Author: Robert E. Coyle ([email protected])
ファイルを表示 Open project: horde/horde Class Usage Examples

Public Properties

Property Type Description
$_action Horde_Form_Action A {@link Horde_Form_Action} instance.
$_arrayVal boolean Whether this is an array variable.
$_autofilled boolean TODO
$_defValue mixed The default value.
$_disabled boolean Whether this variable is disabled.
$_hidden boolean Whether this is a hidden variable.
$_options array TODO
$description string A long description of the variable's purpose, special instructions, etc.
$form Horde_Form The form instance this variable is assigned to.
$help string The variable help text.
$humanName string A short description of this variable's purpose.
$readonly boolean Whether this is a readonly variable.
$required boolean Whether this is a required variable.
$type Horde_Form_Type A {@link Horde_Form_Type} instance.
$varName string The internally used name.

Public Methods

Method Description
Horde_Form_Variable ( string $humanName, string $varName, Horde_Form_Type &$type, boolean $required, boolean $readonly = false, string $description = null ) Variable constructor.
disable ( ) Disables this variable.
getDefault ( ) : mixed Returns this variable's default value.
getDescription ( ) : string Returns this variable's long description.
getHelp ( ) : string Returns the help text of this variable.
getHumanName ( ) : string Return the short description of this variable.
getInfo ( Variables &$vars, mixed &$info ) : mixed Processes the submitted value of this variable according to the rules of the variable type.
getOption ( string $option ) : mixed Returns a variable option's value.
getType ( ) : Horde_Form_Type Returns this variable's type.
getTypeName ( ) : string Returns the name of this variable's type.
getValue ( Variables &$vars, integer $index = null ) : mixed Returns the submitted or default value of this variable.
getValues ( ) : array Returns the possible values of this variable.
getVarName ( ) : string Returns the internally used variable name.
hasAction ( ) : boolean Returns whether this variable has an attached action.
hasDescription ( ) : boolean Returns whether this variable has a long description.
hasHelp ( ) : boolean Returns whether this variable has some help text assigned.
hide ( ) Makes this a hidden variable.
isArrayVal ( ) : boolean Returns whether this is an array variable.
isDisabled ( ) : boolean Returns whether this variable is disabled.
isHidden ( ) : boolean Returns whether this is a hidden variable.
isReadonly ( ) : boolean Returns whether this is a readonly variable.
isRequired ( ) : boolean Returns whether this is a required variable.
isUpload ( ) : boolean Returns whether this variable is to upload a file.
setAction ( Horde_Form_Action $action ) Assigns an action to this variable.
setDefault ( mixed $value ) Sets a default value for this variable.
setFormOb ( Horde_Form &$form ) Assign this variable to the specified form.
setHelp ( string $help ) Assigns a help text to this variable.
setOption ( string $option, mixed $val ) Sets a variable option.
validate ( Variables &$vars, string &$message ) : boolean Validates this variable.
wasChanged ( Variables &$vars ) : boolean Returns whether this variable if it had the "trackchange" option set has actually been changed.

Method Details

Horde_Form_Variable() public method

Variable constructor.
public Horde_Form_Variable ( string $humanName, string $varName, Horde_Form_Type &$type, boolean $required, boolean $readonly = false, string $description = null )
$humanName string A short description of the variable's purpose.
$varName string The internally used name.
$type Horde_Form_Type A {@link Horde_Form_Type} instance.
$required boolean Whether this is a required variable.
$readonly boolean Whether this is a readonly variable.
$description string A long description of the variable's purpose, special instructions, etc.

disable() public method

Disables this variable.
public disable ( )

getDefault() public method

Returns this variable's default value.
public getDefault ( ) : mixed
return mixed This variable's default value.

getDescription() public method

Returns this variable's long description.
public getDescription ( ) : string
return string This variable's long description.

getHelp() public method

Returns the help text of this variable.
public getHelp ( ) : string
return string This variable's help text.

getHumanName() public method

Return the short description of this variable.
public getHumanName ( ) : string
return string A short description

getInfo() public method

Processes the submitted value of this variable according to the rules of the variable type.
public getInfo ( Variables &$vars, mixed &$info ) : mixed
$vars Variables The {@link Variables} instance of the submitted form.
$info mixed A variable passed by reference that will be assigned the processed value of the submitted variable value.
return mixed Depending on the variable type.

getOption() public method

Returns a variable option's value.
public getOption ( string $option ) : mixed
$option string The option name.
return mixed The option's value.

getType() public method

Returns this variable's type.
public getType ( ) : Horde_Form_Type
return Horde_Form_Type This variable's {@link Horde_Form_Type} instance.

getTypeName() public method

Returns the name of this variable's type.
public getTypeName ( ) : string
return string This variable's {@link Horde_Form_Type} name.

getValue() public method

If an action is attached to this variable, the value will get passed to the action object.
public getValue ( Variables &$vars, integer $index = null ) : mixed
$vars Variables The {@link Variables} instance of the submitted form.
$index integer If the variable is an array variable, this specifies the array element to return.
return mixed The variable or element value.

getValues() public method

Returns the possible values of this variable.
public getValues ( ) : array
return array The possible values of this variable or null.

getVarName() public method

Returns the internally used variable name.
public getVarName ( ) : string
return string This variable's internal name.

hasAction() public method

Returns whether this variable has an attached action.
public hasAction ( ) : boolean
return boolean True if this variable has an attached action.

hasDescription() public method

Returns whether this variable has a long description.
public hasDescription ( ) : boolean
return boolean True if this variable has a long description.

hasHelp() public method

Returns whether this variable has some help text assigned.
public hasHelp ( ) : boolean
return boolean True if this variable has a help text.

hide() public method

Makes this a hidden variable.
public hide ( )

isArrayVal() public method

Returns whether this is an array variable.
public isArrayVal ( ) : boolean
return boolean True if this an array variable.

isDisabled() public method

Returns whether this variable is disabled.
public isDisabled ( ) : boolean
return boolean True if this variable is disabled.

isHidden() public method

Returns whether this is a hidden variable.
public isHidden ( ) : boolean
return boolean True if this a hidden variable.

isReadonly() public method

Returns whether this is a readonly variable.
public isReadonly ( ) : boolean
return boolean True if this a readonly variable.

isRequired() public method

Returns whether this is a required variable.
public isRequired ( ) : boolean
return boolean True if this is a required variable.

isUpload() public method

Returns whether this variable is to upload a file.
public isUpload ( ) : boolean
return boolean True if variable is to upload a file.

setAction() public method

Example: $v = $form->addVariable('My Variable', 'var1', 'text', false); $v->setAction(Horde_Form_Action::factory('submit'));
public setAction ( Horde_Form_Action $action )
$action Horde_Form_Action A {@link Horde_Form_Action} instance.

setDefault() public method

Sets a default value for this variable.
public setDefault ( mixed $value )
$value mixed A variable value.

setFormOb() public method

Assign this variable to the specified form.
public setFormOb ( Horde_Form &$form )
$form Horde_Form The form instance to assign this variable to.

setHelp() public method

Assigns a help text to this variable.
public setHelp ( string $help )
$help string The variable help text.

setOption() public method

Sets a variable option.
public setOption ( string $option, mixed $val )
$option string The option name.
$val mixed The option's value.

validate() public method

Validates this variable.
public validate ( Variables &$vars, string &$message ) : boolean
$vars Variables The {@link Variables} instance of the submitted form.
$message string A variable passed by reference that will be assigned a descriptive error message if validation failed.
return boolean True if the variable validated.

wasChanged() public method

Returns whether this variable if it had the "trackchange" option set has actually been changed.
public wasChanged ( Variables &$vars ) : boolean
$vars Variables The {@link Variables} instance of the submitted form.
return boolean Null if this variable doesn't have the "trackchange" option set or the form wasn't submitted yet. A boolean indicating whether the variable was changed otherwise.

Property Details

$_action public_oe property

A {@link Horde_Form_Action} instance.
public Horde_Form_Action $_action
return Horde_Form_Action

$_arrayVal public_oe property

Whether this is an array variable.
public bool $_arrayVal
return boolean

$_autofilled public_oe property

TODO
public bool $_autofilled
return boolean

$_defValue public_oe property

The default value.
public mixed $_defValue
return mixed

$_disabled public_oe property

Whether this variable is disabled.
public bool $_disabled
return boolean

$_hidden public_oe property

Whether this is a hidden variable.
public bool $_hidden
return boolean

$_options public_oe property

TODO
public array $_options
return array

$description public_oe property

A long description of the variable's purpose, special instructions, etc.
public string $description
return string

$form public_oe property

The form instance this variable is assigned to.
public Horde_Form $form
return Horde_Form

$help public_oe property

The variable help text.
public string $help
return string

$humanName public_oe property

A short description of this variable's purpose.
public string $humanName
return string

$readonly public_oe property

Whether this is a readonly variable.
public bool $readonly
return boolean

$required public_oe property

Whether this is a required variable.
public bool $required
return boolean

$type public_oe property

A {@link Horde_Form_Type} instance.
public Horde_Form_Type $type
return Horde_Form_Type

$varName public_oe property

The internally used name.
public string $varName
return string