PHP Класс SimpleForm, simpletest

Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( SimpleTag $tag, SimplePage $page ) Starts with no held controls/widgets.
addWidget ( SimpleWidget $tag ) Adds a tag contents to the form.
attachLabelBySelector ( SelectorInterface $selector, $label ) Used by the page object to set widgets labels to external label tags.
getAction ( ) : SimpleUrl Absolute URL of the target.
getId ( ) : string ID field of form for unique identification.
getMethod ( ) : string Accessor for method of form submission.
getValue ( SelectorInterface $selector ) : string/array Extracts current value from form.
hasImage ( SelectorInterface $selector ) : boolean Test to see if a form has an image control.
hasSubmit ( SelectorInterface $selector ) : boolean Test to see if a form has a submit button.
setDefaultTarget ( string $frame ) Sets the frame target within a frameset.
setField ( SelectorInterface $selector, string $value, $position = false ) : boolean Sets a widget value within the form.
submit ( $additional = false ) : hash Simply submits the form without the submit button value.
submitButton ( SelectorInterface $selector, hash $additional = false ) : SimpleEncoding Gets the submit values for a selected button.
submitImage ( SelectorInterface $selector, integer $x, integer $y, hash $additional = false ) : SimpleEncoding Gets the submit values for an image.

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

Метод Описание
addCheckbox ( SimpleCheckboxTag $tag ) Adds a checkbox, making it a group on a repeated name.
addRadioButton ( SimpleRadioButtonTag $tag ) Adds a radio button, building a group if necessary.
createAction ( string $action, $page ) : SimpleUrl Combined action attribute with current location to get an absolute form target.
encode ( ) : SimpleFormEncoding Creates the encoding for the current values in the form.
setEncodingClass ( SimpleTag $tag ) : string Creates the request packet to be sent by the form.
setWidget ( SimpleWidget $tag ) Sets the widget into the form, grouping radio buttons if any.

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

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

Starts with no held controls/widgets.
public __construct ( SimpleTag $tag, SimplePage $page )
$tag SimpleTag Form tag to read.
$page SimplePage Holding page.

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

Adds a checkbox, making it a group on a repeated name.
protected addCheckbox ( SimpleCheckboxTag $tag )
$tag SimpleCheckboxTag Incoming form control.

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

Adds a radio button, building a group if necessary.
protected addRadioButton ( SimpleRadioButtonTag $tag )
$tag SimpleRadioButtonTag Incoming form control.

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

Adds a tag contents to the form.
public addWidget ( SimpleWidget $tag )
$tag SimpleWidget Input tag to add.

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

Used by the page object to set widgets labels to external label tags.
public attachLabelBySelector ( SelectorInterface $selector, $label )
$selector SelectorInterface Criteria to apply.

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

Combined action attribute with current location to get an absolute form target.
protected createAction ( string $action, $page ) : SimpleUrl
$action string Action attribute from form tag.
$page Page location.
Результат SimpleUrl Absolute form target.

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

Creates the encoding for the current values in the form.
protected encode ( ) : SimpleFormEncoding
Результат SimpleFormEncoding Request to submit.

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

Absolute URL of the target.
public getAction ( ) : SimpleUrl
Результат SimpleUrl URL target.

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

ID field of form for unique identification.
public getId ( ) : string
Результат string Unique tag ID.

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

Accessor for method of form submission.
public getMethod ( ) : string
Результат string Either get or post.

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

Extracts current value from form.
public getValue ( SelectorInterface $selector ) : string/array
$selector SelectorInterface Criteria to apply.
Результат string/array

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

Test to see if a form has an image control.
public hasImage ( SelectorInterface $selector ) : boolean
$selector SelectorInterface Criteria to apply.
Результат boolean True if present.

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

Test to see if a form has a submit button.
public hasSubmit ( SelectorInterface $selector ) : boolean
$selector SelectorInterface Criteria to apply.
Результат boolean True if present.

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

Sets the frame target within a frameset.
public setDefaultTarget ( string $frame )
$frame string Name of frame.

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

Creates the request packet to be sent by the form.
protected setEncodingClass ( SimpleTag $tag ) : string
$tag SimpleTag Form tag to read.
Результат string Packet class.

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

Sets a widget value within the form.
public setField ( SelectorInterface $selector, string $value, $position = false ) : boolean
$selector SelectorInterface Criteria to apply.
$value string Value to input into the widget.
Результат boolean True if value is legal, false otherwise. If the field is not present, nothing will be set.

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

Sets the widget into the form, grouping radio buttons if any.
protected setWidget ( SimpleWidget $tag )
$tag SimpleWidget Incoming form control.

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

Used when there is only one button or it is unimportant.
public submit ( $additional = false ) : hash
Результат hash Submitted values.

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

Gets the submit values for a selected button.
public submitButton ( SelectorInterface $selector, hash $additional = false ) : SimpleEncoding
$selector SelectorInterface Criteria to apply.
$additional hash Additional data for the form.
Результат SimpleEncoding Submitted values or false if there is no such button in the form.

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

Gets the submit values for an image.
public submitImage ( SelectorInterface $selector, integer $x, integer $y, hash $additional = false ) : SimpleEncoding
$selector SelectorInterface Criteria to apply.
$x integer X-coordinate of click.
$y integer Y-coordinate of click.
$additional hash Additional data for the form.
Результат SimpleEncoding Submitted values or false if there is no such button in the form.