PHP Класс PKPTemplateManager, pkp-lib

Наследование: extends Smarty
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( $request ) Constructor.
_smarty_include ( $params ) Override the Smarty {include .
addHeader ( $name, $header, $args = [] ) Add a page-specific item to the .
addJavaScript ( $name, $script, $args = [] ) Register a script with the script handler
addStyleSheet ( $name, $style, $args = [] ) Register a stylesheet with the style handler
cacheLess ( $path, $styles ) : boolean Save LESS styles to a cached file
clearCssCache ( ) Clear all compiled CSS files
clearTemplateCache ( ) Clear template compile and cache directories.
compileLess ( $name, $lessFile, $args = [] ) : string Compile a LESS stylesheet
display ( $template, $sendContentType = null, $hookName = null, $display = true ) Display the template.
fetch ( $resource_name, $cache_id = null, $compile_id = null, $display = false )
fetchAjax ( $id, $url, $element = 'div' ) : JSONMessage Fetch content via AJAX and add it to the DOM, wrapped in a container element.
fetchJson ( $template, $status = true ) : JSONMessage Returns the template results as a JSON message.
flush ( )
getCachedLessFilePath ( $name ) Retrieve the file path for a cached LESS file
getCompileId ( $resourceName ) : string Calculate a compile ID for a resource.
getFBV ( ) : TemplateManager Return an instance of the Form Builder Vocabulary class.
getManager ( $request = null ) : TemplateManager Return an instance of the template manager.
getResourcesByContext ( $resources, $context ) : array Get resources assigned to a context
initialize ( ) Initialize the template manager.
registerJSLibrary ( ) Register all files required by the core JavaScript library
registerJSLibraryData ( ) Register JavaScript data used by the core JS library
setCacheability ( $cacheability = CACHEABILITY_PUBLIC ) Flag the page as cacheable (or not).
smartyAssign ( $value, $varName, $passThru = false ) Assign a value to a template variable.
smartyCSRF ( $params, $smarty ) : string Smarty usage: {csrf}
smartyCallHook ( $params, $smarty ) Call hooks from a template.
smartyCompare ( $a, $b, $strict = false, $invert = false ) Concatenate the parameters and return the result.
smartyConcat ( ) Concatenate the parameters and return the result.
smartyExplode ( $string, $separator ) Split the supplied string by the supplied separator.
smartyFlush ( $params, $smarty ) Flush the output buffer. This is useful in cases where Smarty templates are calling functions that take a while to execute so that they can display a progress indicator or a message stating that the operation may take a while.
smartyHelp ( $params, $smarty ) : string Smarty usage: {help file="someFile.md" section="someSection" textKey="some.text.key"}
smartyHtmlOptionsTranslate ( $params, $smarty ) Smarty usage: {html_options_translate .
smartyIterate ( $params, $content, $smarty, &$repeat ) Iterator function for looping through objects extending the ItemIterator class.
smartyLoadHeader ( $params, $smarty ) : string Smarty usage: {load_header context="frontent" headers=$headers}
smartyLoadScript ( $params, $smarty ) : string Smarty usage: {load_script context="backend" scripts=$scripts}
smartyLoadStylesheet ( $params, $smarty ) : string Smarty usage: {load_stylesheet context="frontend" stylesheets=$stylesheets}
smartyLoadUrlInDiv ( $params, $smarty ) : string Smarty usage: {load_url_in_div id="someHtmlId" url="http://the.url.to.be.loaded.into.the.grid"}
smartyLoadUrlInEl ( $params, $smarty ) : string Smarty usage: {load_url_in_el el="htmlElement" id="someHtmlId" url="http://the.url.to.be.loaded.into.the.grid"}
smartyNullLinkAction ( $params, $smarty ) : string Smarty usage: {null_link_action id="linkId" key="localization.key.name" image="imageClassName"}
smartyPageInfo ( $params, $smarty ) Display page information for a listing of items that has been divided onto multiple pages.
smartyPageLinks ( $params, $smarty ) Display page links for a listing of items that has been divided onto multiple pages.
smartyPluckFiles ( $params, $smarty ) : array Smarty usage: {pluck_files files=$availableFiles by="chapter" value=$chapterId}
smartyStrtotime ( $string ) Convert a string to a numeric time.
smartyToArray ( ) Convert the parameters of a function to an array.
smartyTranslate ( $params, $smarty ) : string Smarty usage: {translate key="localization.key.name" [paramName="paramValue" .
smartyUrl ( $parameters, $smarty ) Generate a URL into a PKPApp.

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

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

Initialize template engine and assign basic template variables.
public __construct ( $request )
$request PKPRequest

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

..} function to allow hooks to be called.
public _smarty_include ( $params )

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

Add a page-specific item to the .
public addHeader ( $name, $header, $args = [] )
$name string Unique name for the header
$header string The header to be included.
$args array Key/value array defining display details `priority` int The order in which to print this header. Default: STYLE_SEQUENCE_NORMAL `contexts` string|array Where the header should be loaded. Default: array('frontend')

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

Register a script with the script handler
public addJavaScript ( $name, $script, $args = [] )
$name string Unique name for the script
$script string The script to be included. Should be a URL or, if the `inline` argument is included, script data to be output.
$args array Key/value array defining display details `priority` int The order in which to print this script. Default: STYLE_SEQUENCE_NORMAL `contexts` string|array Where the script should be loaded. Default: array('frontend') `inline` bool Whether the $script value should be output directly as script data. Used to pass backend data to the scripts.

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

Register a stylesheet with the style handler
public addStyleSheet ( $name, $style, $args = [] )
$name string Unique name for the stylesheet
$style string The stylesheet to be included. Should be a URL or, if the `inline` argument is included, stylesheet data to be output.
$args array Key/value array defining display details `priority` int The order in which to print this stylesheet. Default: STYLE_SEQUENCE_NORMAL `contexts` string|array Where the stylesheet should be loaded. Default: array('frontend') `inline` bool Whether the $stylesheet value should be output directly as stylesheet data. Used to pass backend data to the scripts.

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

Save LESS styles to a cached file
public cacheLess ( $path, $styles ) : boolean
$path string File path to save the compiled styles
Результат boolean success/failure

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

Clear all compiled CSS files
public clearCssCache ( )

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

Clear template compile and cache directories.
public clearTemplateCache ( )

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

Compile a LESS stylesheet
public compileLess ( $name, $lessFile, $args = [] ) : string
$name string Unique name for this LESS stylesheet
$lessFile string Path to the LESS file to compile
$args array Optional arguments. SUpports: 'baseUrl': Base URL to use when rewriting URLs in the LESS file. 'addLess': Array of additional LESS files to parse before compiling
Результат string Compiled CSS styles

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

Display the template.
public display ( $template, $sendContentType = null, $hookName = null, $display = true )

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

См. также: Smarty::fetch()
public fetch ( $resource_name, $cache_id = null, $compile_id = null, $display = false )

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

Fetch content via AJAX and add it to the DOM, wrapped in a container element.
public fetchAjax ( $id, $url, $element = 'div' ) : JSONMessage
$id string ID to use for the generated container element.
$url string URL to fetch the contents from.
$element string Element to use for container.
Результат JSONMessage The JSON-encoded result.

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

Returns the template results as a JSON message.
public fetchJson ( $template, $status = true ) : JSONMessage
$template string
$status boolean
Результат JSONMessage JSON object

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

public flush ( )

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

Retrieve the file path for a cached LESS file
public getCachedLessFilePath ( $name )
$name string Unique name for the LESS file

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

Calculate a compile ID for a resource.
public getCompileId ( $resourceName ) : string
$resourceName string Resource name.
Результат string

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

Return an instance of the Form Builder Vocabulary class.
public getFBV ( ) : TemplateManager
Результат TemplateManager the template manager object

getManager() статический публичный метод

Return an instance of the template manager.
static public getManager ( $request = null ) : TemplateManager
$request PKPRequest
Результат TemplateManager the template manager object

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

A helper function which retrieves script, style and header assets assigned to a particular context.
public getResourcesByContext ( $resources, $context ) : array
$resources array Requested resources
$context string Requested context
Результат array Resources assigned to these contexts

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

Initialize the template manager.
public initialize ( )

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

Register all files required by the core JavaScript library
public registerJSLibrary ( )

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

This function registers script data that is required by the core JS library. This data is queued after jQuery but before the pkp-lib framework, allowing dynamic data to be passed to the framework. It is intended to be used for passing constants and locale strings, but plugins may also take advantage of a hook to include data required by their own scripts, when integrating with the pkp-lib framework.

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

Flag the page as cacheable (or not).
public setCacheability ( $cacheability = CACHEABILITY_PUBLIC )
$cacheability boolean optional

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

Assign a value to a template variable.
public smartyAssign ( $value, $varName, $passThru = false )

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

Custom Smarty function for inserting a CSRF token.
public smartyCSRF ( $params, $smarty ) : string
$params array associative array
$smarty Smarty
Результат string of HTML

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

Call hooks from a template.
public smartyCallHook ( $params, $smarty )

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

Concatenate the parameters and return the result.
public smartyCompare ( $a, $b, $strict = false, $invert = false )
$a mixed Parameter A
$strict boolean True iff a strict (===) compare should be used
$invert booelan True iff the output should be inverted

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

Concatenate the parameters and return the result.
public smartyConcat ( )

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

Split the supplied string by the supplied separator.
public smartyExplode ( $string, $separator )

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

Flush the output buffer. This is useful in cases where Smarty templates are calling functions that take a while to execute so that they can display a progress indicator or a message stating that the operation may take a while.
public smartyFlush ( $params, $smarty )

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

Custom Smarty function for displaying a context-sensitive help link.
public smartyHelp ( $params, $smarty ) : string
$smarty Smarty
Результат string the HTML for the generated link action

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

..} For parameter usage, see http://smarty.php.net/manual/en/language.function.html.options.php Identical to Smarty's "html_options" function except option values are translated from i18n keys.
public smartyHtmlOptionsTranslate ( $params, $smarty )
$params array
$smarty Smarty

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

Parameters: - from: Name of template variable containing iterator - item: Name of template variable to receive each item - key: (optional) Name of variable to receive index of current item
public smartyIterate ( $params, $content, $smarty, &$repeat )

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

Custom Smarty function for printing scripts attached to a context.
public smartyLoadHeader ( $params, $smarty ) : string
$params array associative array
$smarty Smarty
Результат string of HTML/Javascript

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

Custom Smarty function for printing scripts attached to a context.
public smartyLoadScript ( $params, $smarty ) : string
$params array associative array
$smarty Smarty
Результат string of HTML/Javascript

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

Custom Smarty function for printing stylesheets attached to a context.
public smartyLoadStylesheet ( $params, $smarty ) : string
$params array associative array
$smarty Smarty
Результат string of HTML/Javascript

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

Custom Smarty function for loading a URL via AJAX into a DIV. Convenience wrapper for smartyLoadUrlInEl.
public smartyLoadUrlInDiv ( $params, $smarty ) : string
$params array associative array
$smarty Smarty
Результат string of HTML/Javascript

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

Custom Smarty function for loading a URL via AJAX into any HTML element
public smartyLoadUrlInEl ( $params, $smarty ) : string
$params array associative array
$smarty Smarty
Результат string of HTML/Javascript

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

Custom Smarty function for displaying a null link action; these will typically be attached and handled in Javascript.
public smartyNullLinkAction ( $params, $smarty ) : string
$smarty Smarty
Результат string the HTML for the generated link action

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

Usage: {page_info from=$myIterator}
public smartyPageInfo ( $params, $smarty )

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

Custom Smarty function for plucking files from the array of $availableFiles related to a submission. Intended to be used on the frontend
public smartyPluckFiles ( $params, $smarty ) : array
$params array associative array
$smarty Smarty
Результат array of SubmissionFile objects

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

Convert a string to a numeric time.
public smartyStrtotime ( $string )

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

Convert the parameters of a function to an array.
public smartyToArray ( )

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

..]} Custom Smarty function for translating localization keys. Substitution works by replacing tokens like "{$foo}" with the value of the parameter named "foo" (if supplied).
public smartyTranslate ( $params, $smarty ) : string
$params array associative array, must contain "key" parameter for string to translate plus zero or more named parameters for substitution. Translation variables can be specified also as an optional associative array named "params".
$smarty Smarty
Результат string the localized string, including any parameter substitutions

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

Generate a URL into a PKPApp.
public smartyUrl ( $parameters, $smarty )
$smarty object Available parameters: - router: which router to use - context - page - component - op - path (array) - anchor - escape (default to true unless otherwise specified) - params: parameters to include in the URL if available as an array