class Rules extends Object implements IteratorAggregate

List of validation & condition rules.

Constants

internal VALIDATE_PREFIX

Properties

static array $defaultMessages

Methods

__construct(IControl $control)

No description

setRequired($value = TRUE)

Makes control mandatory.

bool
isRequired()

Is control mandatory?

addRule($validator, $message = NULL, $arg = NULL)

Adds a validation rule for the current control.

addCondition($validator, $arg = NULL)

Adds a validation condition and returns new branch.

addConditionOn(IControl $control, $validator, $arg = NULL)

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

elseCondition()

Adds a else statement.

endCondition()

Ends current validation condition.

toggle($id, $hide = TRUE)

Toggles HTML element visibility.

array
getToggles($actual = FALSE)

No description

array
getToggleStates($toggles = array(), $success = TRUE)

No description

bool
validate()

Validates against ruleset.

static bool
validateRule(Rule $rule)

Validates single rule.

getIterator()

Iterates over complete ruleset.

static 
formatMessage(Rule $rule, $withValue = TRUE)

No description

Details

at line 63
__construct(IControl $control)

No description

Parameters

IControl $control

at line 74
Rules setRequired($value = TRUE)

Makes control mandatory.

Parameters

$value

Return Value

Rules

at line 89
bool isRequired()

Is control mandatory?

Return Value

bool

at line 102
Rules addRule($validator, $message = NULL, $arg = NULL)

Adds a validation rule for the current control.

Parameters

$validator
$message
$arg

Return Value

Rules

at line 125
Rules addCondition($validator, $arg = NULL)

Adds a validation condition and returns new branch.

Parameters

$validator
$arg

Return Value

Rules

new branch

at line 138
Rules addConditionOn(IControl $control, $validator, $arg = NULL)

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

Parameters

IControl $control
$validator
$arg

Return Value

Rules

new branch

at line 157
Rules elseCondition()

Adds a else statement.

Return Value

Rules

else branch

at line 172
Rules endCondition()

Ends current validation condition.

Return Value

Rules

parent branch

at line 184
Rules toggle($id, $hide = TRUE)

Toggles HTML element visibility.

Parameters

$id
$hide

Return Value

Rules

at line 195
array getToggles($actual = FALSE)

No description

Parameters

$actual

Return Value

array

at line 205
array getToggleStates($toggles = array(), $success = TRUE)

internal  
 

No description

Parameters

$toggles
$success

Return Value

array

at line 224
bool validate()

Validates against ruleset.

Return Value

bool

at line 245
static bool validateRule(Rule $rule)

Validates single rule.

Parameters

Rule $rule

Return Value

bool

at line 260
ArrayIterator getIterator()

Iterates over complete ruleset.

Return Value

ArrayIterator

at line 300
static formatMessage(Rule $rule, $withValue = TRUE)

No description

Parameters

Rule $rule
$withValue