PHP Класс Prado\Web\UI\WebControls\TImageButton

TImageButton creates an image button on the page. It is used to submit data to a page. You can create either a submit button or a command button. A command button has a command name (specified by the {@link setCommandName CommandName} property) and and a command parameter (specified by {@link setCommandParameter CommandParameter} property) associated with the button. This allows you to create multiple TLinkButton components on a Web page and programmatically determine which one is clicked with what parameter. You can provide an event handler for {@link onCommand OnCommand} event to programmatically control the actions performed when the command button is clicked. In the event handler, you can determine the {@link setCommandName CommandName} property value and the {@link setCommandParameter CommandParameter} property value through the {@link TCommandParameter::getName Name} and {@link TCommandParameter::getParameter Parameter} properties of the event parameter which is of type {@link \Prado\Web\UI\TCommandEventParameter}. A submit button does not have a command name associated with the button and clicking on it simply posts the Web page back to the server. By default, a TImageButton control is a submit button. You can provide an event handler for the {@link onClick OnClick} event to programmatically control the actions performed when the submit button is clicked. The coordinates of the clicking point can be obtained from the {@link onClick OnClick} event parameter, which is of type {@link TImageClickEventParameter}. Clicking on button can trigger form validation, if {@link setCausesValidation CausesValidation} is true. And the validation may be restricted within a certain group of validator controls by setting {@link setValidationGroup ValidationGroup} property. If validation is successful, the data will be post back to the same page. TImageButton displays the {@link setText Text} property as the hint text to the displayed image.
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends TImage, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\Web\UI\IPostBackEventHandler, implements Prado\Web\UI\IButtonControl
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
getCausesValidation ( ) : boolean
getCommandName ( ) : string
getCommandParameter ( ) : string
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getEnableClientScript ( ) : boolean
getIsDefaultButton ( ) : boolean
getText ( ) : string
getValidationGroup ( ) : string
loadPostData ( $key, $values ) : boolean This method checks if the TImageButton is clicked and loads the coordinates of the clicking position.
onClick ( $param ) This method is invoked when the button is clicked.
onCommand ( $param ) This method is invoked when the button is clicked.
onPreRender ( $param ) Registers the image button to receive postback data during postback.
raisePostBackEvent ( $param ) Raises the postback event.
raisePostDataChangedEvent ( ) A dummy implementation for the \Prado\Web\UI\IPostBackDataHandler interface.
renderContents ( $writer ) Renders the body content enclosed between the control tag.
setCausesValidation ( $value )
setCommandName ( $value )
setCommandParameter ( $value )
setEnableClientScript ( $value )
setIsDefaultButton ( $value )
setText ( $value )
setValidationGroup ( $value )

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

Метод Описание
addAttributesToRender ( $writer ) Adds attribute name-value pairs to renderer.
canCauseValidation ( ) : boolean
getClientClassName ( ) : string Gets the name of the javascript class responsible for performing postback for this control.
getPostBackOptions ( ) : array Returns postback specifications for the button.
getTagName ( ) : string
needPostBackScript ( ) : boolean
renderClientControlScript ( $writer ) Renders the client-script code.

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

addAttributesToRender() защищенный метод

This overrides the parent implementation with additional button specific attributes.
protected addAttributesToRender ( $writer )

canCauseValidation() защищенный метод

protected canCauseValidation ( ) : boolean
Результат boolean whether to perform validation if the button is clicked

getCausesValidation() публичный метод

public getCausesValidation ( ) : boolean
Результат boolean whether postback event trigger by this button will cause input validation, default is true

getClientClassName() защищенный метод

This method overrides the parent implementation.
protected getClientClassName ( ) : string
Результат string the javascript class name

getCommandName() публичный метод

public getCommandName ( ) : string
Результат string the command name associated with the {@link onCommand OnCommand} event.

getCommandParameter() публичный метод

public getCommandParameter ( ) : string
Результат string the parameter associated with the {@link onCommand OnCommand} event

getDataChanged() публичный метод

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
Результат boolean whether postback has caused the control data change. False if the page is not in postback mode.

getEnableClientScript() публичный метод

public getEnableClientScript ( ) : boolean
Результат boolean whether to render javascript.

getIsDefaultButton() публичный метод

public getIsDefaultButton ( ) : boolean
Результат boolean true if this button is registered as a default button for a panel.

getPostBackOptions() защищенный метод

This method is used by framework and control developers.
protected getPostBackOptions ( ) : array
Результат array parameters about how the button defines its postback behavior.

getTagName() защищенный метод

protected getTagName ( ) : string
Результат string tag name of the button

getText() публичный метод

public getText ( ) : string
Результат string caption of the button

getValidationGroup() публичный метод

public getValidationGroup ( ) : string
Результат string the group of validators which the button causes validation upon postback

loadPostData() публичный метод

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
Результат boolean whether the data of the component has been changed

needPostBackScript() защищенный метод

protected needPostBackScript ( ) : boolean
Результат boolean whether the button needs javascript to do postback

onClick() публичный метод

The method raises 'OnClick' event to fire up the event handlers. If you override this method, be sure to call the parent implementation so that the event handler can be invoked.
public onClick ( $param )

onCommand() публичный метод

The method raises 'OnCommand' event to fire up the event handlers. If you override this method, be sure to call the parent implementation so that the event handlers can be invoked.
public onCommand ( $param )

onPreRender() публичный метод

This is necessary because an image button, when postback, does not have direct mapping between post data and the image button name. This method overrides the parent implementation and is invoked before render.
public onPreRender ( $param )

raisePostBackEvent() публичный метод

This method is required by {@link IPostBackEventHandler} interface. If {@link getCausesValidation CausesValidation} is true, it will invoke the page's {@link TPage::validate validate} method first. It will raise {@link onClick OnClick} and {@link onCommand OnCommand} events. This method is mainly used by framework and control developers.
public raisePostBackEvent ( $param )

raisePostDataChangedEvent() публичный метод

A dummy implementation for the \Prado\Web\UI\IPostBackDataHandler interface.

renderClientControlScript() защищенный метод

Renders the client-script code.
protected renderClientControlScript ( $writer )

renderContents() публичный метод

This overrides the parent implementation with nothing to be rendered.
public renderContents ( $writer )

setCausesValidation() публичный метод

public setCausesValidation ( $value )

setCommandName() публичный метод

public setCommandName ( $value )

setCommandParameter() публичный метод

public setCommandParameter ( $value )

setEnableClientScript() публичный метод

public setEnableClientScript ( $value )

setIsDefaultButton() публичный метод

public setIsDefaultButton ( $value )

setText() публичный метод

public setText ( $value )

setValidationGroup() публичный метод

public setValidationGroup ( $value )