Class NRules


List of validation & condition rules.

NObject
   |
   --NRules

Implements interfaces:

IteratorAggregate (internal interface)
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Forms/Rules.php (line 33)
Public Method Summary
NRules
NRules
addCondition (mixed $operation, [mixed $arg = NULL])
Adds a validation condition a returns new branch.
NRules
addConditionOn (IFormControl $control, mixed $operation, [mixed $arg = NULL])
Adds a validation condition on specified control a returns new branch.
NRules
addRule (mixed $operation, [string $message = NULL], [mixed $arg = NULL])
Adds a validation rule for the current control.
NRules
Adds a else statement.
NRules
Ends current validation condition.
ArrayIterator
Iterates over ruleset.
array
NRules
toggle (string $id, [bool $hide = TRUE])
Toggles HTML elememnt visibility.
bool
validate ([bool $onlyCheck = FALSE])
Validates against ruleset.
Methods Inherited From NObject
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Variable Summary
static array $defaultMessages array( )

line 39


Method Details

line 56

__construct

public NRules __construct (IFormControl $control)

Input
IFormControl $control
Output
NRules  

line 100

addCondition

public NRules addCondition (mixed $operation, [mixed $arg = NULL])

Adds a validation condition a returns new branch.

Input
mixed $operation condition type
mixed $arg optional condition arguments
Output
NRules new branch

line 114

addConditionOn

public NRules addConditionOn (IFormControl $control, mixed $operation, [mixed $arg = NULL])

Adds a validation condition on specified control a returns new branch.

Input
IFormControl $control form control
mixed $operation condition type
mixed $arg optional condition arguments
Output
NRules new branch

line 70

addRule

public NRules addRule (mixed $operation, [string $message = NULL], [mixed $arg = NULL])

Adds a validation rule for the current control.

Input
mixed $operation rule type
string $message message to display for invalid data
mixed $arg optional rule arguments
Output
NRules provides a fluent interface

line 135

elseCondition

public NRules elseCondition ()

Adds a else statement.

Output
NRules else branch

line 151

endCondition

public NRules endCondition ()

Ends current validation condition.

Output
NRules parent branch

line 210

getIterator

public ArrayIterator getIterator ()

Iterates over ruleset.

Implementation of:

IteratorAggregate::getIterator
Output
ArrayIterator  

line 220

getToggles

public array getToggles ()

Output
array  

line 164

toggle

public NRules toggle (string $id, [bool $hide = TRUE])

Toggles HTML elememnt visibility.

Input
string $id element id
bool $hide hide element?
Output
NRules provides a fluent interface

line 177

validate

public bool validate ([bool $onlyCheck = FALSE])

Validates against ruleset.

Input
bool $onlyCheck stop before first error?
Output
bool is valid?