abstract class BaseControl extends Component implements IControl

Base class that implements the basic functionality common to form controls.

Properties

static string $idMask
string $caption
mixed $value
Html read-only $control
Html read-only $label
bool $disabled
string $htmlId
bool $omitted
bool $required
Form read-only $form
string read-only $htmlName
Html read-only $controlPrototype
Html read-only $labelPrototype
array read-only $errors

Methods

__construct($caption = NULL)

No description

void
attached($form)

This method will be called when the component becomes attached to Form.

getForm($need = TRUE)

Returns form.

void
loadHttpData()

Loads HTTP data.

mixed
getHttpData($type, $htmlTail = NULL)

Loads HTTP data.

string
getHtmlName()

Returns HTML name of control.

void
setValue($value)

Sets control's value.

mixed
getValue()

Returns control's value.

bool
isFilled()

Is control filled?

setDefaultValue($value)

Sets control's default value.

setDisabled($value = TRUE)

Disables or enables control.

bool
isDisabled()

Is control disabled?

setOmitted($value = TRUE)

Sets whether control value is excluded from $form->getValues() result.

bool
isOmitted()

Is control value excluded from $form->getValues() result?

Html|string
getControl()

Generates control's HTML element.

Html|string
getLabel($caption = NULL)

Generates label's HTML element.

Html
getControlPrototype()

Returns control's HTML element template.

Html
getLabelPrototype()

Returns label's HTML element template.

setHtmlId($id)

Changes control's HTML id.

string
getHtmlId()

Returns control's HTML id.

setHtmlAttribute($name, $value = TRUE)

Changes control's HTML attribute.

setAttribute($name, $value = TRUE)

Alias for setHtmlAttribute()

setTranslator(ITranslator $translator = NULL)

Sets translate adapter.

ITranslator|null
getTranslator()

Returns translate adapter.

string
translate($value, $count = NULL)

Returns translated string.

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

Adds a validation rule.

addCondition($validator, $value = NULL)

Adds a validation condition a returns new branch.

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

Adds a validation condition based on another control a returns new branch.

getRules()

No description

setRequired($value = TRUE)

Makes control mandatory.

bool
isRequired()

Is control mandatory?

void
validate()

Performs the server side validation.

void
addError($message)

Adds error message to the list.

string
getError()

Returns errors corresponding to control.

array
getErrors()

Returns errors corresponding to control.

bool
hasErrors()

No description

void
cleanErrors()

No description

static 
exportRules($rules) deprecated

No description

setOption($key, $value)

Sets user-specific option.

mixed
getOption($key, $default = NULL)

Returns user-specific option.

array
getOptions()

Returns user-specific options.

Details

at line 71
__construct($caption = NULL)

No description

Parameters

$caption

at line 88
protected void attached($form)

This method will be called when the component becomes attached to Form.

Parameters

$form

Return Value

void

at line 101
Form getForm($need = TRUE)

Returns form.

Parameters

$need

Return Value

Form

at line 111
void loadHttpData()

Loads HTTP data.

Return Value

void

at line 121
mixed getHttpData($type, $htmlTail = NULL)

Loads HTTP data.

Parameters

$type
$htmlTail

Return Value

mixed

at line 131
string getHtmlName()

Returns HTML name of control.

Return Value

string

at line 145
void setValue($value)

internal  
 

Sets control's value.

Parameters

$value

Return Value

void

at line 156
mixed getValue()

Returns control's value.

Return Value

mixed

at line 166
bool isFilled()

Is control filled?

Return Value

bool

at line 177
BaseControl setDefaultValue($value)

Sets control's default value.

Parameters

$value

Return Value

BaseControl

at line 192
BaseControl setDisabled($value = TRUE)

Disables or enables control.

Parameters

$value

Return Value

BaseControl

at line 206
bool isDisabled()

Is control disabled?

Return Value

bool

at line 217
BaseControl setOmitted($value = TRUE)

Sets whether control value is excluded from $form->getValues() result.

Parameters

$value

Return Value

BaseControl

at line 228
bool isOmitted()

Is control value excluded from $form->getValues() result?

Return Value

bool

at line 241
Html|string getControl()

Generates control's HTML element.

Return Value

Html|string

at line 260
Html|string getLabel($caption = NULL)

Generates label's HTML element.

Parameters

$caption

Return Value

Html|string

at line 273
Html getControlPrototype()

Returns control's HTML element template.

Return Value

Html

at line 283
Html getLabelPrototype()

Returns label's HTML element template.

Return Value

Html

at line 294
BaseControl setHtmlId($id)

Changes control's HTML id.

Parameters

$id

Return Value

BaseControl

at line 305
string getHtmlId()

Returns control's HTML id.

Return Value

string

at line 320
BaseControl setHtmlAttribute($name, $value = TRUE)

Changes control's HTML attribute.

Parameters

$name
$value

Return Value

BaseControl

at line 332
BaseControl setAttribute($name, $value = TRUE)

Alias for setHtmlAttribute()

Parameters

$name
$value

Return Value

BaseControl

at line 346
BaseControl setTranslator(ITranslator $translator = NULL)

Sets translate adapter.

Parameters

ITranslator $translator

Return Value

BaseControl

at line 357
ITranslator|null getTranslator()

Returns translate adapter.

Return Value

ITranslator|null

at line 372
string translate($value, $count = NULL)

Returns translated string.

Parameters

$value
$count

Return Value

string

at line 396
BaseControl addRule($validator, $message = NULL, $arg = NULL)

Adds a validation rule.

Parameters

$validator
$message
$arg

Return Value

BaseControl

at line 409
Rules addCondition($validator, $value = NULL)

Adds a validation condition a returns new branch.

Parameters

$validator
$value

Return Value

Rules

new branch

at line 422
Rules addConditionOn(IControl $control, $validator, $value = NULL)

Adds a validation condition based on another control a returns new branch.

Parameters

IControl $control
$validator
$value

Return Value

Rules

new branch

at line 431
Rules getRules()

No description

Return Value

Rules

at line 442
BaseControl setRequired($value = TRUE)

Makes control mandatory.

Parameters

$value

Return Value

BaseControl

at line 453
bool isRequired()

Is control mandatory?

Return Value

bool

at line 463
void validate()

Performs the server side validation.

Return Value

void

at line 478
void addError($message)

Adds error message to the list.

Parameters

$message

Return Value

void

at line 488
string getError()

Returns errors corresponding to control.

Return Value

string

at line 498
array getErrors()

Returns errors corresponding to control.

Return Value

array

at line 507
bool hasErrors()

No description

Return Value

bool

at line 516
void cleanErrors()

No description

Return Value

void

at line 523
static protected exportRules($rules) deprecated

deprecated

No description

Parameters

$rules

at line 537
BaseControl setOption($key, $value)

Sets user-specific option.

Parameters

$key
$value

Return Value

BaseControl

at line 552
mixed getOption($key, $default = NULL)

Returns user-specific option.

Parameters

$key
$default

Return Value

mixed

at line 562
array getOptions()

Returns user-specific options.

Return Value

array