PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TClientScriptManager

TClientScriptManager class.

TClientScriptManager manages javascript and CSS stylesheets for a page.

TComponent
Extended by TApplicationComponent
Extended by TClientScriptManager
Package: System\Web\UI
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Author: Gabor Berczi <gabor.berczi@devworx.hu> (lazyload additions & progressive rendering)
Since: 3.0
Located at Web/UI/TClientScriptManager.php
Methods summary
public
# __construct( TPage $owner )

Constructor.

Constructor.

Parameters

$owner
TPage
page that owns this client script manager

Overrides

TComponent::__construct()
public boolean
# getRequiresHead( )

Returns

boolean
whether THead is required in order to render CSS and js within head

Since

3.1.1
public static
# getPradoPackages( )
public static
# getPradoScripts( )
public
# registerPradoScript( string $name )

Registers Prado javascript by library name. See "Web/Javascripts/packages.php" for library names.

Registers Prado javascript by library name. See "Web/Javascripts/packages.php" for library names.

Parameters

$name
string
script library name.
protected
# registerPradoScriptInternal( mixed $name )

Registers a Prado javascript library to be loaded.

Registers a Prado javascript library to be loaded.

public string
# getPradoScriptAssetUrl( )

Returns

string
Prado javascript library base asset url.
public array
# getScriptUrls( )

Returns the URLs of all script files referenced on the page

Returns the URLs of all script files referenced on the page

Returns

array
Combined list of all script urls used in the page
protected array
# getPackagePathUrl( string $base )

Parameters

$base
string
javascript package path.

Returns

array
tuple($path,$url).
public string
# getCallbackReference( ICallbackEventHandler $callbackHandler, array $options = null )

Returns javascript statement that create a new callback request object.

Returns javascript statement that create a new callback request object.

Parameters

$callbackHandler
ICallbackEventHandler
callback response handler
$options
array
additional callback options

Returns

string
javascript statement that creates a new callback request.
public
# registerCallbackControl( string $class, array $options )

Registers callback javascript for a control.

Registers callback javascript for a control.

Parameters

$class
string
javascript class responsible for the control being registered for callback
$options
array
callback options
public
# registerPostBackControl( string $class, array $options )

Registers postback javascript for a control. A null class parameter will prevent the javascript code registration.

Registers postback javascript for a control. A null class parameter will prevent the javascript code registration.

Parameters

$class
string
javascript class responsible for the control being registered for postback
$options
array
postback options
public
# registerDefaultButton( TControl|string $panel, TControl|string $button )

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

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

Parameters

$panel
TControl|string
panel (or its unique ID) to register the default button action
$button
TControl|string
button (or its unique ID) to trigger a postback
protected array
# getDefaultButtonOptions( string $panelID, string $buttonID )

Parameters

$panelID
string
the unique ID of the container control
$buttonID
string
the unique ID of the button control

Returns

array
default button options.
public
# registerFocusControl( string $target )

Registers the control to receive default focus.

Registers the control to receive default focus.

Parameters

$target
string
the client ID of the control to receive default focus
public
# registerStyleSheetFile( string $key, string $url, string $media = '' )

Registers a CSS file to be rendered in the page head

Registers a CSS file to be rendered in the page head

The CSS files in themes are registered in OnPreRenderComplete onPreRenderComplete if you want to override CSS styles in themes you need to register it after this event is completed.

Example:

<?php
class BasePage extends TPage {
  public function onPreRenderComplete($param) {
    parent::onPreRenderComplete($param);
    $url = 'path/to/your/stylesheet.css';
    $this->Page->ClientScript->registerStyleSheetFile($url, $url);
  }
}

Parameters

$key
string
a unique key identifying the file
$url
string
URL to the CSS file
$media
string
media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types.
public
# registerStyleSheet( string $key, string $css, mixed $media = '' )

Registers a CSS block to be rendered in the page head

Registers a CSS block to be rendered in the page head

Parameters

$key
string
a unique key identifying the CSS block
$css
string
CSS block
$media
public array
# getStyleSheetUrls( )

Returns the URLs of all stylesheet files referenced on the page

Returns the URLs of all stylesheet files referenced on the page

Returns

array
List of all stylesheet urls used in the page
public array
# getStyleSheetCodes( )

Returns all the stylesheet code snippets referenced on the page

Returns all the stylesheet code snippets referenced on the page

Returns

array
List of all stylesheet snippets used in the page
public
# registerHeadScriptFile( string $key, string $url )

Registers a javascript file in the page head

Registers a javascript file in the page head

Parameters

$key
string
a unique key identifying the file
$url
string
URL to the javascript file
public
# registerHeadScript( string $key, string $script )

Registers a javascript block in the page head.

Registers a javascript block in the page head.

Parameters

$key
string
a unique key identifying the script block
$script
string
javascript block
public
# registerScriptFile( string $key, string $url )

Registers a javascript file to be rendered within the form

Registers a javascript file to be rendered within the form

Parameters

$key
string
a unique key identifying the file
$url
string
URL to the javascript file to be rendered
public
# registerBeginScript( string $key, string $script )

Registers a javascript script block at the beginning of the form

Registers a javascript script block at the beginning of the form

Parameters

$key
string
a unique key identifying the script block
$script
string
javascript block
public
# registerEndScript( string $key, string $script )

Registers a javascript script block at the end of the form

Registers a javascript script block at the end of the form

Parameters

$key
string
a unique key identifying the script block
$script
string
javascript block
public
# registerHiddenField( string $name, string|array $value )

Registers a hidden field to be rendered in the form.

Registers a hidden field to be rendered in the form.

Parameters

$name
string
a unique key identifying the hidden field
$value
string|array
hidden field value, if the value is an array, every element in the array will be rendered as a hidden field value.
public boolean
# isStyleSheetFileRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a CSS file registered with the specified key
public boolean
# isStyleSheetRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a CSS block registered with the specified key
public boolean
# isHeadScriptFileRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a head javascript file registered with the specified key
public boolean
# isHeadScriptRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a head javascript block registered with the specified key
public boolean
# isScriptFileRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a javascript file registered with the specified key
public boolean
# isBeginScriptRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a beginning javascript block registered with the specified key
public boolean
# isEndScriptRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is an ending javascript block registered with the specified key
public boolean
# hasEndScripts( )

Returns

boolean
true if any end scripts are registered.
public boolean
# hasBeginScripts( )

Returns

boolean
true if any begin scripts are registered.
public boolean
# isHiddenFieldRegistered( string $key )

Parameters

$key
string
a unique key

Returns

boolean
whether there is a hidden field registered with the specified key
public
# renderStyleSheetFiles( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderStyleSheets( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderHeadScriptFiles( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderHeadScripts( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderScriptFilesBegin( mixed $writer )
public
# renderScriptFilesEnd( mixed $writer )
public
# markScriptFileAsRendered( mixed $url )
protected
# renderScriptFiles( mixed $writer, array $scripts )
protected
# getRenderedScriptFiles( )
public
# renderAllPendingScriptFiles( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderBeginScripts( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderEndScripts( THtmlWriter $writer )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
public
# renderHiddenFieldsBegin( mixed $writer )
public
# renderHiddenFieldsEnd( mixed $writer )
public
# flushScriptFiles( THtmlWriter $writer, TControl $control = null )

Flushes all pending script registrations

Flushes all pending script registrations

Parameters

$writer
THtmlWriter
writer for the rendering purpose
$control
TControl
the control forcing the flush (used only in error messages)
protected
# renderHiddenFieldsInt( THtmlWriter $writer, mixed $initial )

Parameters

$writer
THtmlWriter
writer for the rendering purpose
$initial
public
# getHiddenFields( )
protected
# checkIfNotInRender( )

Checks whether page rendering has not begun yet

Checks whether page rendering has not begun yet

Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string SCRIPT_PATH 'Web/Javascripts/source'
#

directory containing Prado javascript files

directory containing Prado javascript files

string PACKAGES_FILE 'Web/Javascripts/packages.php'
#

file containing javascript packages and their cross dependencies

file containing javascript packages and their cross dependencies

Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO