LSYii_ClientScript

Extends\CClientScript

package

Default

Methods

Add a file to a given package

addFileToPackage( $sPackageName, $sType, $sFileName)
var

string name of the package

string css/js

string name of the file to add

Arguments

$sPackageName

$sType

$sFileName

This function will analyze the url of a file (css/js) to register It will check if it can be published via the asset manager and if so will retrieve its path

analyzeUrl( $sUrl): array

Arguments

$sUrl

Response

array

Convert one package to baseUrl Overwrite the package definition using a base url instead of a base path The package must have a devBaseUrl, else it will remain unchanged (for core/external package); so third party package are not concerned

convertDevBaseUrl(string $package)

Arguments

$package

string

cssFicoreScripts is protected on CClientScript. It can be useful to access it for debugin purpose

getCoreScripts(): array

Response

array

cssFiles is protected on CClientScript. It can be useful to access it for debugin purpose

getCssFiles(): array

Response

array

getFontPackages

getFontPackages(): array

Response

array

Return a list of all the recursive dependencies of a packages eg: If a package A depends on B, and B depends on C, getRecursiveDependencies('A') will return {B,C}

getRecursiveDependencies(string $sPackageName)

Arguments

$sPackageName

string

getScriptFiles

getScriptFiles()

Check if a file is in a given package

IsFileInPackage( $sPackageName, $sType, $sFileName): boolean
var

string name of the package

string css/js

string name of the file to remove

Arguments

$sPackageName

$sType

$sFileName

Response

boolean

recordCachingAction

recordCachingAction( $context, $method, $params)

Arguments

$context

$method

$params

registerCssFile

registerCssFile( $url, $media = '')

Arguments

$url

$media

The method will first check if a devbaseUrl parameter is provided, so when debug mode is on, it doens't use the asset manager

registerPackage(string $name): void|static

Arguments

$name

string

Response

void|static

Registers a script package that is listed in {@link packages}.

registerPackageScriptOnPosition(string $name, $position): static
see \renderCoreScript
Throws
\CException

Arguments

$name

string

the name of the script package.

$position

Response

static

the CClientScript object itself (to support method chaining, available since version 1.1.5).

In LimeSurvey, if debug mode is OFF we use the asset manager (so participants never needs to update their webbrowser cache).

registerScriptFile(string $url,string $position = null,array $htmlOptions = array()): void|static

If debug mode is ON, we don't use the asset manager, so developpers just have to refresh their browser cache to reload the new scripts. To make developer life easier, if they want to register a single script file, they can use App()->getClientScript()->registerScriptFile({url to script file}) if the file exist in local file system and debug mode is off, it will find the path to the file, and it will publish it via the asset manager

Arguments

$url

string

$position

string

$htmlOptions

array

Response

void|static

Remove a file from a given package

removeFileFromPackage( $sPackageName, $sType, $sFileName)
var

string name of the package

string css/js

string name of the file to remove

Arguments

$sPackageName

$sType

$sFileName

Renders the registered scripts.

render(string &$output)

This method is called in \CController::render when it finishes rendering content. CClientScript thus gets a chance to insert script tags at head and body sections in the HTML output.

Arguments

$output

string

the existing output that needs to be inserted with script tags

Inserts the scripts at the beginning of the body section.

renderBodyBegin(string &$output)

This is overwriting the core method and is exactly the same except the marked parts

Arguments

$output

string

the output to be inserted with scripts.

Inserts the scripts at the end of the body section.

renderBodyEnd(string &$output)

This is overwriting the core method and is exactly the same except the marked parts

Arguments

$output

string

the output to be inserted with scripts.

Renders the specified core javascript library.

renderCoreScripts()

Inserts the scripts in the head section.

renderHead(string &$output)

Arguments

$output

string

the output to be inserted with scripts.

Remove a package from coreScript.

unregisterPackage( $sName)

It can be useful when mixing backend/frontend rendering (see: template editor)

var

of the package to remove

Arguments

$sName

unregisterScriptFile

unregisterScriptFile( $sName)

Arguments

$sName

Constants

POS_POSTSCRIPT

POS_POSTSCRIPT

POS_PREBEGIN

POS_PREBEGIN