PHP Class Prado\Web\UI\ActiveControls\TCallbackClientScript

The TCallbackClientScript class provides corresponding methods that can be executed on the client-side (i.e. the browser client that is viewing the page) during a callback response. The available methods includes setting/clicking input elements, changing Css styles, hiding/showing elements, and adding visual effects to elements on the page. The client-side methods can be access through the CallbackClient property available in TPage. For example, to hide "$myTextBox" element during callback response, do $this->getPage()->getCallbackClient()->hide($myTextBox); To call a specific jQuery method on an element, use the {@link jQuery} method: simple example: focus a textbox $this->getCallbackClient()->jQuery($myTextBox, 'focus'); complex example: resize a textbox using an animation $this->getCallbackClient()->jQuery($myTextBox, 'animate', array( array( 'width' => '+=100', 'height' => '+=50' ), array('duration' => 1000) )); To call a jQueryUI effect on an element, use the {@link juiEffect} method: simple example: focus a textbox $this->getCallbackClient()->juiEffect($myTextBox, 'highlight'); In order to use the jQueryUI effects, the jqueryui script must be registered: $this->getPage()->getClientScript()->registerPradoScript('jqueryui');
Since: 3.1
Inheritance: extends Prado\TApplicationComponent
Exibir arquivo Open project: pradosoft/prado

Public Methods

Method Description
__construct ( ) Constructor.
addCssClass ( $element, $cssClass ) Add a Css class name to the element.
appear ( $element, $options = [] ) Alias of fadeIn()
appendContent ( $element, $content ) Append a HTML fragement to the element.
appendScriptBlock ( $content ) Appends a block of inline javascript enclosed in a boundary.
blind ( $element, $options = [] ) Visual Effect: Blind.
blindDown ( $element, $options = [] ) Alias of blind(), presets the direction to 'down'
blindUp ( $element, $options = [] ) Alias of blind(), presets the direction to 'up'
callClientFunction ( $function, $params = [] ) Executes a client-side statement.
check ( $checkbox, $checked = true ) Client script to check or uncheck a checkbox or radio button.
click ( $control ) Client script to click on an element. This client-side function is unpredictable.
drop ( $element, $options = [] ) Visual Effect: Drop out.
dropOut ( $element, $options = [] ) Alias of drop()
evaluateScript ( $writer ) Evaluate a block of javascript enclosed in a boundary.
fade ( $element, $options = [] ) Alias of fadeOut()
fadeIn ( $element, $options = [] ) Visual Effect: Gradually make the element appear.
fadeOut ( $element, $options = [] ) Visual Effect: Gradually fade the element.
fadeTo ( $element, $value, $duration = 500 ) Set the opacity on a html element or control.
focus ( $element ) Focus on a particular element.
fold ( $element, $options = [] ) Visual Effect: Fold.
getClientFunctionsToExecute ( ) : array
grow ( $element, $options = [] ) Alias of size()
hide ( $element ) Hides an element by changing its CSS display style to "none".
highlight ( $element, $options = [] ) Visual Effect: High light the element for about 2 seconds.
insertContentAfter ( $element, $content ) Insert a HTML fragement after the element.
insertContentBefore ( $element, $content ) Insert a HTML fragement in before the element.
jQuery ( $element, $method, $params = [] ) Executes a jQuery client-side method over an element.
juiEffect ( $element, $effect, $options = [] ) Add a jQuery-ui effect the element.
prependContent ( $element, $content ) Prepend a HTML fragement to the element.
puff ( $element, $options = [] ) Visual Effect: Gradually grow and fade the element.
pulsate ( $element, $options = [] ) Visual Effect: Pulsate.
raiseClientEvent ( $control, $eventName ) Raise the client side event (given by $eventName) on a particular element.
remove ( $element ) Removes an element from the HTML page.
removeCssClass ( $element, $cssClass ) Remove a Css class name from the element.
replaceContent ( $element, $content, $self = true ) Replace the content of an element with new content contained in writer.
scale ( $element, $options = [] ) Visual Effect: Scale the element.
scrollTo ( $element, $options = [] ) Scroll the top of the browser viewing area to the location of the element.
select ( $control, $method = 'Value', $value = null, $type = null ) Client script to select/clear/check a drop down list, check box list, or radio button list.
setAttribute ( $control, $name, $value ) Sets the attribute of a particular control.
setListItems ( $control, $items ) Sets the options of a select input element.
setOpacity ( $element, $value ) Alias of fadeTo()
setStyle ( $element, $styles ) Sets the style of element. The style must be a key-value array where the key is the style property and the value is the style value.
setValue ( $input, $text ) Client script to set the value of a particular input element.
shake ( $element, $options = [] ) Visual Effect: Shake the element.
show ( $element ) Shows an element by changing its CSS display style as empty.
shrink ( $element, $options = [] ) Alias of scale()
size ( $element, $options = [] ) Visual Effect: Gradually make an element grow to a predetermined size.
slideDown ( $element, $options = [] ) Visual Effect: Slide down.
slideUp ( $element, $options = [] ) Visual Effect: Slide up.
squish ( $element, $options = [] ) Alias of scale()
switchOff ( $element, $options = [] ) Alias of scale()
toggle ( $element, $effect = null, $options = [] ) Toggles the visibility of the element.
update ( $element, $content ) Update the element's innerHTML with new content.
visualEffect ( $type, $element, $options = [] ) Add a visual effect the element.

Protected Methods

Method Description
replace ( $element, $content, $self ) Replace the content of an element with new content. The new content can be a string or a TControl component. If the content parameter is a TControl component, its rendered method will be called and its contents will be used for replacement.

Private Methods

Method Description
getRenderedContentBoundary ( $control ) : string Renders the control and return the content boundary from TCallbackResponseWriter. This method should only be used by framework component developers. The render() method is defered to be called in the TActivePageAdapter class.
getResponseContentBoundary ( $html ) : string
getSelectionControlIsListType ( $control )
getSelectionControlType ( $control )

Method Details

__construct() public method

Constructor.
public __construct ( )

addCssClass() public method

Add a Css class name to the element.
public addCssClass ( $element, $cssClass )

appear() public method

Alias of fadeIn()
Deprecation: since 3.4
public appear ( $element, $options = [] )

appendContent() public method

Append a HTML fragement to the element.
public appendContent ( $element, $content )

appendScriptBlock() public method

Similar to to evaluateScript(), but functions declared in the inline block will be available to page elements.
public appendScriptBlock ( $content )

blind() public method

This effect needs jQueryUI.
public blind ( $element, $options = [] )

blindDown() public method

Alias of blind(), presets the direction to 'down'
Deprecation: since 3.4
public blindDown ( $element, $options = [] )

blindUp() public method

Alias of blind(), presets the direction to 'up'
Deprecation: since 3.4
public blindUp ( $element, $options = [] )

callClientFunction() public method

Executes a client-side statement.
public callClientFunction ( $function, $params = [] )

check() public method

Client script to check or uncheck a checkbox or radio button.
public check ( $checkbox, $checked = true )

click() public method

Client script to click on an element. This client-side function is unpredictable.
public click ( $control )

drop() public method

This effect needs jQueryUI.
public drop ( $element, $options = [] )

dropOut() public method

Alias of drop()
Deprecation: since 3.4
public dropOut ( $element, $options = [] )

evaluateScript() public method

Evaluate a block of javascript enclosed in a boundary.
public evaluateScript ( $writer )

fade() public method

Alias of fadeOut()
Deprecation: since 3.4
public fade ( $element, $options = [] )

fadeIn() public method

This effect doesn't need jQueryUI.
public fadeIn ( $element, $options = [] )

fadeOut() public method

This effect doesn't need jQueryUI.
public fadeOut ( $element, $options = [] )

fadeTo() public method

This effect doesn't need jQueryUI.
public fadeTo ( $element, $value, $duration = 500 )

focus() public method

Focus on a particular element.
public focus ( $element )

fold() public method

This effect needs jQueryUI.
public fold ( $element, $options = [] )

getClientFunctionsToExecute() public method

public getClientFunctionsToExecute ( ) : array
return array list of client function to be executed during callback response.

grow() public method

Alias of size()
Deprecation: since 3.4
public grow ( $element, $options = [] )

hide() public method

Hides an element by changing its CSS display style to "none".
public hide ( $element )

highlight() public method

This effect needs jQueryUI.
public highlight ( $element, $options = [] )

insertContentAfter() public method

Insert a HTML fragement after the element.
public insertContentAfter ( $element, $content )

insertContentBefore() public method

Insert a HTML fragement in before the element.
public insertContentBefore ( $element, $content )

jQuery() public method

Executes a jQuery client-side method over an element.
public jQuery ( $element, $method, $params = [] )

juiEffect() public method

This method needs jQueryUI.
public juiEffect ( $element, $effect, $options = [] )

prependContent() public method

Prepend a HTML fragement to the element.
public prependContent ( $element, $content )

puff() public method

This effect needs jQueryUI.
public puff ( $element, $options = [] )

pulsate() public method

This effect needs jQueryUI.
public pulsate ( $element, $options = [] )

raiseClientEvent() public method

Raise the client side event (given by $eventName) on a particular element.
public raiseClientEvent ( $control, $eventName )

remove() public method

Removes an element from the HTML page.
public remove ( $element )

removeCssClass() public method

Remove a Css class name from the element.
public removeCssClass ( $element, $cssClass )

replace() protected method

Replace the content of an element with new content. The new content can be a string or a TControl component. If the content parameter is a TControl component, its rendered method will be called and its contents will be used for replacement.
See also: insertAbout
See also: insertBelow
See also: insertBefore
See also: insertAfter
protected replace ( $element, $content, $self )

replaceContent() public method

Replace the content of an element with new content contained in writer.
public replaceContent ( $element, $content, $self = true )

scale() public method

This effect needs jQueryUI.
public scale ( $element, $options = [] )

scrollTo() public method

Scroll the top of the browser viewing area to the location of the element.
public scrollTo ( $element, $options = [] )

select() public method

The second parameter determines the selection method. Valid methods are - Value, select or check by value - Values, select or check by a list of values - Index, select or check by index (zero based index) - Indices, select or check by a list of index (zero based index) - Clear, clears or selections or checks in the list - All, select all - Invert, invert the selection.
public select ( $control, $method = 'Value', $value = null, $type = null )

setAttribute() public method

Sets the attribute of a particular control.
public setAttribute ( $control, $name, $value )

setListItems() public method

Sets the options of a select input element.
public setListItems ( $control, $items )

setOpacity() public method

Alias of fadeTo()
Deprecation: since 3.4
public setOpacity ( $element, $value )

setStyle() public method

Sets the style of element. The style must be a key-value array where the key is the style property and the value is the style value.
public setStyle ( $element, $styles )

setValue() public method

Client script to set the value of a particular input element.
public setValue ( $input, $text )

shake() public method

This effect needs jQueryUI.
public shake ( $element, $options = [] )

show() public method

Shows an element by changing its CSS display style as empty.
public show ( $element )

shrink() public method

Alias of scale()
Deprecation: since 3.4
public shrink ( $element, $options = [] )

size() public method

This effect needs jQueryUI.
public size ( $element, $options = [] )

slideDown() public method

This effect doesn't need jQueryUI.
public slideDown ( $element, $options = [] )

slideUp() public method

This effect doesn't need jQueryUI.
public slideUp ( $element, $options = [] )

squish() public method

Alias of scale()
Deprecation: since 3.4
public squish ( $element, $options = [] )

switchOff() public method

Alias of scale()
Deprecation: since 3.4
public switchOff ( $element, $options = [] )

toggle() public method

Toggles the visibility of the element.
public toggle ( $element, $effect = null, $options = [] )

update() public method

Update the element's innerHTML with new content.
public update ( $element, $content )

visualEffect() public method

Add a visual effect the element.
public visualEffect ( $type, $element, $options = [] )