PHP Class Prado\Web\UI\TClientScriptManager

TClientScriptManager manages javascript and CSS stylesheets for a page.
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends Prado\TApplicationComponent
Afficher le fichier Open project: pradosoft/prado

Méthodes publiques

Méthode Description
__construct ( TPage $owner ) Constructor.
flushScriptFiles ( $writer, $control = null ) Flushes all pending script registrations
getCallbackReference ( Prado\Web\UI\ActiveControls\ICallbackEventHandler $callbackHandler, $options = null ) : string Returns javascript statement that create a new callback request object.
getHiddenFields ( )
getPradoPackages ( )
getPradoScriptAssetPath ( $script = 'prado' ) : string
getPradoScriptAssetUrl ( $script = 'prado' ) : string
getPradoScripts ( )
getRequiresHead ( ) : boolean
getScriptUrls ( ) : array Returns the URLs of all script files referenced on the page
getStyleSheetCodes ( ) : array Returns all the stylesheet code snippets referenced on the page
getStyleSheetUrls ( ) : array Returns the URLs of all stylesheet files referenced on the page
hasBeginScripts ( ) : boolean
hasEndScripts ( ) : boolean
isBeginScriptRegistered ( $key ) : boolean
isEndScriptRegistered ( $key ) : boolean
isHeadScriptFileRegistered ( $key ) : boolean
isHeadScriptRegistered ( $key ) : boolean
isHiddenFieldRegistered ( $key ) : boolean
isScriptFileRegistered ( $key ) : boolean
isStyleSheetFileRegistered ( $key ) : boolean
isStyleSheetRegistered ( $key ) : boolean
markScriptFileAsRendered ( $url )
registerBeginScript ( $key, $script ) Registers a javascript script block at the beginning of the form
registerCallbackControl ( $class, $options ) Registers callback javascript for a control.
registerDefaultButton ( $panel, $button ) Register a default button to panel. When the $panel is in focus and the 'enter' key is pressed, the $button will be clicked.
registerEndScript ( $key, $script ) Registers a javascript script block at the end of the form
registerFocusControl ( $target ) Registers the control to receive default focus.
registerHeadScript ( $key, $script ) Registers a javascript block in the page head.
registerHeadScriptFile ( $key, $url ) Registers a javascript file in the page head
registerHiddenField ( $name, $value ) Registers a hidden field to be rendered in the form.
registerPostBackControl ( $class, $options ) Registers postback javascript for a control. A null class parameter will prevent the javascript code registration.
registerPradoScript ( $name ) Registers Prado javascript by library name. See "Web/Javascripts/packages.php" for library names.
registerPradoStyle ( $name ) Registers Prado style by library name. See "Web/Javascripts/packages.php" for library names.
registerScriptFile ( $key, $url ) Registers a javascript file to be rendered within the form
registerStyleSheet ( $key, $css, $media = '' ) Registers a CSS block to be rendered in the page head
registerStyleSheetFile ( $key, $url, $media = '' ) Registers a CSS file to be rendered in the page head
renderAllPendingScriptFiles ( $writer )
renderBeginScripts ( $writer )
renderBeginScriptsCallback ( $writer )
renderEndScripts ( $writer )
renderEndScriptsCallback ( $writer )
renderHeadScriptFiles ( $writer )
renderHeadScripts ( $writer )
renderHiddenFieldsBegin ( $writer )
renderHiddenFieldsEnd ( $writer )
renderScriptFilesBegin ( $writer )
renderScriptFilesEnd ( $writer )
renderStyleSheetFiles ( $writer )
renderStyleSheets ( $writer )

Méthodes protégées

Méthode Description
checkIfNotInRender ( ) Checks whether page rendering has not begun yet
getDefaultButtonOptions ( $panelID, $buttonID ) : array
getPackagePathUrl ( $base ) : array
getRenderedScriptFiles ( )
getScriptPackageFolder ( $script ) : array
getStylePackageFolder ( $script ) : array
registerPradoScriptInternal ( $name ) Registers a Prado javascript library to be loaded.
registerPradoStyleInternal ( $name ) Registers a Prado style library to be loaded.
renderHiddenFieldsInt ( $writer, $initial )
renderScriptFiles ( $writer, array $scripts )

Method Details

__construct() public méthode

Constructor.
public __construct ( TPage $owner )
$owner TPage

checkIfNotInRender() protected méthode

Checks whether page rendering has not begun yet
protected checkIfNotInRender ( )

flushScriptFiles() public méthode

Flushes all pending script registrations
public flushScriptFiles ( $writer, $control = null )

getCallbackReference() public méthode

Returns javascript statement that create a new callback request object.
public getCallbackReference ( Prado\Web\UI\ActiveControls\ICallbackEventHandler $callbackHandler, $options = null ) : string
$callbackHandler Prado\Web\UI\ActiveControls\ICallbackEventHandler
Résultat string javascript statement that creates a new callback request.

getDefaultButtonOptions() protected méthode

protected getDefaultButtonOptions ( $panelID, $buttonID ) : array
Résultat array default button options.

getHiddenFields() public méthode

public getHiddenFields ( )

getPackagePathUrl() protected méthode

protected getPackagePathUrl ( $base ) : array
Résultat array tuple($path,$url).

getPradoPackages() public static méthode

public static getPradoPackages ( )

getPradoScriptAssetPath() public méthode

public getPradoScriptAssetPath ( $script = 'prado' ) : string
Résultat string Prado javascript library base asset path in local filesystem.

getPradoScriptAssetUrl() public méthode

public getPradoScriptAssetUrl ( $script = 'prado' ) : string
Résultat string Prado javascript library base asset url.

getPradoScripts() public static méthode

public static getPradoScripts ( )

getRenderedScriptFiles() protected méthode

protected getRenderedScriptFiles ( )

getRequiresHead() public méthode

Since: 3.1.1
public getRequiresHead ( ) : boolean
Résultat boolean whether THead is required in order to render CSS and js within head

getScriptPackageFolder() protected méthode

protected getScriptPackageFolder ( $script ) : array
Résultat array tuple($basepath,$subpath).

getScriptUrls() public méthode

Returns the URLs of all script files referenced on the page
public getScriptUrls ( ) : array
Résultat array Combined list of all script urls used in the page

getStylePackageFolder() protected méthode

protected getStylePackageFolder ( $script ) : array
Résultat array tuple($basepath,$subpath).

getStyleSheetCodes() public méthode

Returns all the stylesheet code snippets referenced on the page
public getStyleSheetCodes ( ) : array
Résultat array List of all stylesheet snippets used in the page

getStyleSheetUrls() public méthode

Returns the URLs of all stylesheet files referenced on the page
public getStyleSheetUrls ( ) : array
Résultat array List of all stylesheet urls used in the page

hasBeginScripts() public méthode

public hasBeginScripts ( ) : boolean
Résultat boolean true if any begin scripts are registered.

hasEndScripts() public méthode

public hasEndScripts ( ) : boolean
Résultat boolean true if any end scripts are registered.

isBeginScriptRegistered() public méthode

public isBeginScriptRegistered ( $key ) : boolean
Résultat boolean whether there is a beginning javascript block registered with the specified key

isEndScriptRegistered() public méthode

public isEndScriptRegistered ( $key ) : boolean
Résultat boolean whether there is an ending javascript block registered with the specified key

isHeadScriptFileRegistered() public méthode

public isHeadScriptFileRegistered ( $key ) : boolean
Résultat boolean whether there is a head javascript file registered with the specified key

isHeadScriptRegistered() public méthode

public isHeadScriptRegistered ( $key ) : boolean
Résultat boolean whether there is a head javascript block registered with the specified key

isHiddenFieldRegistered() public méthode

public isHiddenFieldRegistered ( $key ) : boolean
Résultat boolean whether there is a hidden field registered with the specified key

isScriptFileRegistered() public méthode

public isScriptFileRegistered ( $key ) : boolean
Résultat boolean whether there is a javascript file registered with the specified key

isStyleSheetFileRegistered() public méthode

public isStyleSheetFileRegistered ( $key ) : boolean
Résultat boolean whether there is a CSS file registered with the specified key

isStyleSheetRegistered() public méthode

public isStyleSheetRegistered ( $key ) : boolean
Résultat boolean whether there is a CSS block registered with the specified key

markScriptFileAsRendered() public méthode

public markScriptFileAsRendered ( $url )

registerBeginScript() public méthode

Registers a javascript script block at the beginning of the form
public registerBeginScript ( $key, $script )

registerCallbackControl() public méthode

Registers callback javascript for a control.
public registerCallbackControl ( $class, $options )

registerDefaultButton() public méthode

Register a default button to panel. When the $panel is in focus and the 'enter' key is pressed, the $button will be clicked.
public registerDefaultButton ( $panel, $button )

registerEndScript() public méthode

Registers a javascript script block at the end of the form
public registerEndScript ( $key, $script )

registerFocusControl() public méthode

Registers the control to receive default focus.
public registerFocusControl ( $target )

registerHeadScript() public méthode

Registers a javascript block in the page head.
public registerHeadScript ( $key, $script )

registerHeadScriptFile() public méthode

Registers a javascript file in the page head
public registerHeadScriptFile ( $key, $url )

registerHiddenField() public méthode

Registers a hidden field to be rendered in the form.
public registerHiddenField ( $name, $value )

registerPostBackControl() public méthode

Registers postback javascript for a control. A null class parameter will prevent the javascript code registration.
public registerPostBackControl ( $class, $options )

registerPradoScript() public méthode

Registers Prado javascript by library name. See "Web/Javascripts/packages.php" for library names.
public registerPradoScript ( $name )

registerPradoScriptInternal() protected méthode

Registers a Prado javascript library to be loaded.
protected registerPradoScriptInternal ( $name )

registerPradoStyle() public méthode

Registers Prado style by library name. See "Web/Javascripts/packages.php" for library names.
public registerPradoStyle ( $name )

registerPradoStyleInternal() protected méthode

Registers a Prado style library to be loaded.
protected registerPradoStyleInternal ( $name )

registerScriptFile() public méthode

Registers a javascript file to be rendered within the form
public registerScriptFile ( $key, $url )

registerStyleSheet() public méthode

Registers a CSS block to be rendered in the page head
public registerStyleSheet ( $key, $css, $media = '' )

registerStyleSheetFile() public méthode

The CSS files in themes are registered in {@link OnPreRenderComplete onPreRenderComplete} if you want to override CSS styles in themes you need to register it after this event is completed. Example: Page->ClientScript->registerStyleSheetFile($url, $url); } }
public registerStyleSheetFile ( $key, $url, $media = '' )

renderAllPendingScriptFiles() public méthode

public renderAllPendingScriptFiles ( $writer )

renderBeginScripts() public méthode

public renderBeginScripts ( $writer )

renderBeginScriptsCallback() public méthode

public renderBeginScriptsCallback ( $writer )

renderEndScripts() public méthode

public renderEndScripts ( $writer )

renderEndScriptsCallback() public méthode

public renderEndScriptsCallback ( $writer )

renderHeadScriptFiles() public méthode

public renderHeadScriptFiles ( $writer )

renderHeadScripts() public méthode

public renderHeadScripts ( $writer )

renderHiddenFieldsBegin() public méthode

public renderHiddenFieldsBegin ( $writer )

renderHiddenFieldsEnd() public méthode

public renderHiddenFieldsEnd ( $writer )

renderHiddenFieldsInt() protected méthode

protected renderHiddenFieldsInt ( $writer, $initial )

renderScriptFiles() protected méthode

protected renderScriptFiles ( $writer, array $scripts )
$scripts array

renderScriptFilesBegin() public méthode

public renderScriptFilesBegin ( $writer )

renderScriptFilesEnd() public méthode

public renderScriptFilesEnd ( $writer )

renderStyleSheetFiles() public méthode

public renderStyleSheetFiles ( $writer )

renderStyleSheets() public méthode

public renderStyleSheets ( $writer )