PHP 클래스 PKPTemplateManager, pkp-lib

상속: extends Smarty
파일 보기 프로젝트 열기: pkp/pkp-lib 1 사용 예제들

공개 메소드들

메소드 설명
__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