LimeSurvey API - Master branch

TemplateConfiguration extends TemplateConfig
in package

This is the model class for table "{{template_configuration}}".

NOTE: if you only need to access to the table, you don't need to call prepareTemplateRendering

The following are the available columns in table '{{template_configuration}}':

Tags
subpackage

Backend

Table of Contents

Properties

$aInstancesFromTemplateName  : array<string|int, mixed>
$aPreparedToRender  : array<string|int, mixed>
$bJustCreated  : mixed
$bUseMagicInherit  : mixed
$config  : SimpleXMLElement
$cssFramework  : object
$cssframework_css  : string
$cssframework_js  : string
$cssframework_name  : string
$files_css  : string
$files_js  : string
$files_print_css  : string
$filesPath  : string
$generalFilesPath  : mixed
$gsid  : int
$id  : int
$isStandard  : bool
$oMotherTemplate  : TemplateConfiguration
$oOptionAttributes  : mixed
$oOptions  : object
$oParentTemplate  : TemplateConfiguration
$options  : string
$options_page  : mixed
$packages_ltr  : string
$packages_rtl  : string
$packages_to_load  : string
$path  : string
$showpopups  : int
$sid  : int
$sPackageName  : string
$sPreviewImgTag  : string
$sTemplateName  : string
$sTemplateurl  : string
$template  : Template
$template_description  : mixed
$template_extends  : mixed
$template_name  : string
$template_type  : mixed
$uid  : int
$viewPath  : string
$aCssFrameworkReplacement  : array<string|int, mixed>
$apiVersion  : int
$depends  : array<string|int, string>
$hasConfigFile  : string
$iSurveyId  : int
$packages  : array<string|int, string>
$xmlFile  : string
$aFilesTo  : array<string|int, mixed>
$aFrameworkAssetsToReplace  : array<string|int, mixed>
$aReplacements  : array<string|int, mixed>
$bTemplateCheckResult  : bool
$Ofiles  : array<string|int, mixed>
$sTypeIcon  : string

Methods

__get()  : mixed
Proxy for the AR method to manage the inheritance If one of the field that can be inherited is set to "inherit", then it will return the value of its parent NOTE: this is recursive, if the parent field itself is set to inherit, then it will the value of the parent of the parent, etc
__toString()  : string
addFileReplacement()  : bool|void
Add a file replacement in the field `file_{css|js|print_css}` in table {{template_configuration}}, eg: {"replace": [ {original files to replace here...}, "css/template.css",]} In general, should be called from TemplateManifest, after adding a file replacement inside the manifest.
addOptionFromXMLToLiveTheme()  : void
Apply options from XML configuration for all missing template options
addOptionToLiveTheme()  : void
Add an option definition to the current theme.
attributeLabels()  : array<string|int, mixed>
checkAndcreateSurveyConfig()  : TemplateConfiguration
For a given survey, it checks if its theme have a all the needed configuration entries (survey + survey group).
checkTemplate()  : bool
Check if the template exists and is valid
convertOptionsToJson()  : string
Extracts option values from theme options node (XML) into a json key-value map.
defaultScope()  : mixed
formatToJsonArray()  : string
Convert the values to a json.
getAllDbTemplateFolders()  : array<string|int, mixed>|null
Returns an array of all unique template folders that are registered in the database
getApiVersion()  : int
get the template API version
getButtons()  : string
Displays survey theme action buttons
getClassAndAttributes()  : mixed
Core config and attributes
getDescription()  : mixed
Twig statements can be used in Theme description
getGlobalParent()  : TemplateConfiguration
Get the global template configuration with same name as $this.
getHasOptionPage()  : bool
Returns true if this theme or any mothertemplate has a TemplateConfiguration set
getInstance()  : TemplateConfiguration
Get an instance of a fitting TemplateConfiguration NOTE: for rendering prupose, you should never call this function directly, but rather Template::getInstance.
getInstanceFromSurveyGroup()  : TemplateConfiguration
Returns a TemplateConfiguration Object based on a surveygroup ID If no instance is existing, it will create one.
getInstanceFromSurveyId()  : TemplateConfiguration
Returns a TemplateConfiguration Object based on a surveyID If no instance is existing, it will create one.
getInstanceFromTemplateName()  : TemplateConfiguration
Gets an instance of a templateconfiguration by name
getOptionPage()  : mixed
getOptionPageAttributes()  : array<string|int, mixed>
getParentConfiguration()  : TemplateConfiguration
getPreview()  : array<string|int, mixed>|mixed|string|null
getshowpopups()  : mixed
Get showpopups value from config or template configuration
getTemplateAndMotherNames()  : string
getTemplateForAsset()  : TemplateConfiguration|bool
Find which template should be used to render a given view
getTemplateForFile()  : TemplateConfig
Get the template for a given file. It checks if a file exist in the current template or in one of its mother templates Can return a 302 redirect (this is not really a throw …
getTemplatesWithNoDb()  : array<string|int, TemplateConfiguration>
Returns an array with uninstalled and/or incompatible survey themes
getTemplateURL()  : string
Returns the complete URL path to a given template name
getThemeOptionsFromSurveyId()  : array<string|int, mixed>
Returns a Theme options array based on a surveyID
getTypeIcon()  : string
importManifest()  : bool
Create a new entry in {{templates}} and {{template_configuration}} table using the template manifest
isCompatible()  : bool|null
Checks if theme is compatible with the current limesurvey version
model()  : TemplateConfiguration
Returns the static model of the specified AR class.
prepareTemplateRendering()  : self
Prepare all the needed datas to render the temple If any problem (like template doesn't exist), it will load the default theme configuration NOTE 1: This function will create/update all the packages needed to render the template, which imply to do the same for all mother templates NOTE 2: So if you just want to access the TemplateConfiguration AR Object, you don't need to call it. Call it only before rendering anything related to the template.
relations()  : array<string|int, mixed>
removeFiles()  : mixed
Remove the css/js files defined in theme config, from any package (even the core ones) The file should have the exact same name as in the package (see: application/config/packages.php and application/config/vendor.php) eg: to remove awesome-bootstrap-checkbox.css, in the theme config file add <remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css</remove>
rename()  : mixed
Change the template name inside the configuration entries (called from template editor) NOTE: all tests (like template exist, etc) are done from template controller.
rules()  : array<string|int, mixed>
sanitizeImagePathsOnJson()  : mixed
Sanitizes the theme options making sure that paths are valid.
search()  : CActiveDataProvider
Retrieves a list of models based on the current search/filter conditions.
searchGrid()  : CActiveDataProvider
Retrieves a list of models based on the current search/filter conditions.
setBasics()  : mixed
Sets bUseMagicInherit sTemplate isStandard and path of the theme
setGlobalOption()  : void
Set a value on a given option at global setting level (survey level not affected).
setOption()  : void
Set option (unless if options is set to "inherit").
setOptionKeysToInherit()  : mixed
Set each option key value to 'inherit' instead of having only one 'inherit' value for options.
setToInherit()  : mixed
tableName()  : string
throwConsoleError()  : mixed
uninstall()  : bool|int
Uninstalls the selected surveytheme and deletes database entry and configuration
uninstallThemesRecursive()  : void
Uninstalls all surveythemes that are being extended from the supplied surveytheme name
validateTheme()  : bool
Checks if a theme is valid Can be extended with more checks in the future if needed
addMotherTemplatePackage()  : array<string|int, string>
loads the main theme template from the parent theme that it is extending, as a package. Ready to be registered
changeMotherConfiguration()  : array<string|int, mixed>
Change the mother template configuration depending on template settings
createTemplatePackage()  : mixed
Create a package for the asset manager.
getDependsPackages()  : array<string|int, string>
Get the depends package
getFilePath()  : string|false
Get the file path for a given template.
getFilesToLoad()  : array<string|int, mixed>
From a list of json files in db it will generate a PHP array ready to use by removeFileFromPackage()
getFrameworkAssetsReplacement()  : array<string|int, mixed>
Get the list of file replacement from Engine Framework
getFrameworkAssetsToReplace()  : array<string|int, mixed>
Get the list of file replacement from Engine Framework
getOfiles()  : bool|mixed
Get the json files (to load/replace/remove) from a theme, and checks if its correctly formated
getOptionKey()  : mixed
Search through the inheritence chain and find the inherited value for theme option
getTemplateConfigurationForAttribute()  : TemplateConfiguration
Get the closest template in the hierarchy that has the definition for $attribute
removeFileFromPackage()  : void
Proxy for Yii::app()->clientScript->removeFileFromPackage()
removeFilesFromPackage()  : mixed
Checks if some files are inside a package, and remove them.
setIsStandard()  : void
Check if this template is a standard template and save it in current model $this->isStandard
setMotherTemplates()  : mixed
Configure the mother template (and its mother templates) This is an object recursive call to TemplateConfiguration::prepareTemplateRendering()
setOptionInheritance()  : void
Loop through all theme options defined, trigger check for inheritance and write the new value back to the options object
setOptions()  : void
Decodes json string from the database field "options" and stores it inside $this->oOptions Also triggers inheritence checks
setThisTemplate()  : void
Set the default configuration values for the template, and use the motherTemplate value if needed
uninstallIncorectTheme()  : mixed
Uninstall a theme and, display error message, and redirect to theme list
getAttributeValue()  : mixed
Returns the value of the specified attribute ($attributeName) from the closest Template in the hierarchy.
getImageInfo()  : array<string|int, mixed>|null
Return image information
getRelatedTemplate()  : Template|null
Returns the related Template.
getRelativePath()  : string
replaceVariationFilesWithRtl()  : array<string|int, mixed>
When rtl language is chosen: if a css file in folder variations is in array cssFiles, then it will be replaced with the *-rtl version
setCssFramework()  : void

Properties

$aInstancesFromTemplateName

public static array<string|int, mixed> $aInstancesFromTemplateName

cache for method getInstanceFromTemplateName

$aPreparedToRender

public static array<string|int, mixed> $aPreparedToRender

cache for method prepareTemplateRendering

$config

public SimpleXMLElement $config

Will contain the config.xml

$cssFramework

public object $cssFramework

What framework css is used

$filesPath

public string $filesPath

Path of the tmeplate's files

$isStandard

public bool $isStandard

Is this template a core one?

$oParentTemplate

public TemplateConfiguration $oParentTemplate

The parent template name A template configuration, in the database, can inherit from another one. This used to manage the different configuration levels for a very same template: global, survey group, survey This is not related to motherTemplate (inheritance between two different templates)

$sPackageName

public string $sPackageName

Name of the asset package of this template

$sPreviewImgTag

public string $sPreviewImgTag

the template preview image tag for the template list

$sTemplateName

public string $sTemplateName = ''

The template name

$sTemplateurl

public string $sTemplateurl

Url to reach the framework

$viewPath

public string $viewPath

Path of the views files (twig template)

$aCssFrameworkReplacement

protected array<string|int, mixed> $aCssFrameworkReplacement

Css Framework Replacement

$apiVersion

protected int $apiVersion

Version of the LS API when created. Must be private : disallow update

$depends

protected array<string|int, string> $depends = array()

List of all dependencies (could be more that just the config.xml packages)

$hasConfigFile

protected string $hasConfigFile = ''

Does it has a config.xml file?

$iSurveyId

protected int $iSurveyId = ''

The current Survey Id. It can be void. It's use only to retrieve the current template of a given survey

$packages

protected array<string|int, string> $packages

Array of package dependencies defined in config.xml

$xmlFile

protected string $xmlFile

What xml config file does it use? (config/minimal)

$aFrameworkAssetsToReplace

private array<string|int, mixed> $aFrameworkAssetsToReplace

cache for the method getFrameworkAssetsToReplace()

$aReplacements

private array<string|int, mixed> $aReplacements

cache for the method getFrameworkAssetsReplacement

Methods

__get()

Proxy for the AR method to manage the inheritance If one of the field that can be inherited is set to "inherit", then it will return the value of its parent NOTE: this is recursive, if the parent field itself is set to inherit, then it will the value of the parent of the parent, etc

public __get(string $name) : mixed
Parameters
$name : string

the name of the attribute

__toString()

public __toString() : string
Tags
todo

document me

Return values
string

addFileReplacement()

Add a file replacement in the field `file_{css|js|print_css}` in table {{template_configuration}}, eg: {"replace": [ {original files to replace here...}, "css/template.css",]} In general, should be called from TemplateManifest, after adding a file replacement inside the manifest.

public addFileReplacement(string $sFile, string $sType) : bool|void
Parameters
$sFile : string

the file to replace

$sType : string

css|js

Tags
throws
Exception
Return values
bool|void

addOptionFromXMLToLiveTheme()

Apply options from XML configuration for all missing template options

public addOptionFromXMLToLiveTheme() : void

addOptionToLiveTheme()

Add an option definition to the current theme.

public addOptionToLiveTheme(string $name, mixed $value) : void

Will be used to turn ON ajax mode on update.

Parameters
$name : string
$value : mixed

attributeLabels()

public attributeLabels() : array<string|int, mixed>
Tags
todo

document me

Return values
array<string|int, mixed>

customized attribute labels (name=>label)

checkAndcreateSurveyConfig()

For a given survey, it checks if its theme have a all the needed configuration entries (survey + survey group).

public static checkAndcreateSurveyConfig(int $iSurveyId) : TemplateConfiguration

Else, it will create it.

Parameters
$iSurveyId : int
Return values
TemplateConfiguration

the template configuration for the survey group

checkTemplate()

Check if the template exists and is valid

public checkTemplate() : bool
Return values
bool

convertOptionsToJson()

Extracts option values from theme options node (XML) into a json key-value map.

public static convertOptionsToJson(array<string|int, mixed>|object $options) : string

Inner nodes (which maybe inside each option element) are ignored. Option values are trimmed as they may contain undesired new lines in the XML document.

Parameters
$options : array<string|int, mixed>|object

the filed to convert

Return values
string

json

formatToJsonArray()

Convert the values to a json.

public static formatToJsonArray(array<string|int, mixed>|object $oFiled[, bool $bConvertEmptyToString = false ]) : string

It checks that the correct values is inserted.

Parameters
$oFiled : array<string|int, mixed>|object

the filed to convert

$bConvertEmptyToString : bool = false

formats empty values as empty strings instead of objects.

Return values
string

json

getAllDbTemplateFolders()

Returns an array of all unique template folders that are registered in the database

public static getAllDbTemplateFolders() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getApiVersion()

get the template API version

public getApiVersion() : int
Return values
int

getButtons()

Displays survey theme action buttons

public getButtons() : string
Return values
string

getClassAndAttributes()

Core config and attributes

public getClassAndAttributes() : mixed

Most classes and id and attributes from template views are defined here. So even if users extends/modify the core template, we can still apply some debugs

NB 1: Some of the classes should be bring back to templates

NB 2: This is a temporary function. Before releasing to master, it will be replaced by a XML file inside the template itself So third party providers will also be able to use this mechanics to provides bug fixes/enhancement to their templates

getDescription()

Twig statements can be used in Theme description

public getDescription() : mixed

getHasOptionPage()

Returns true if this theme or any mothertemplate has a TemplateConfiguration set

public getHasOptionPage() : bool
Tags
throws
Exception
Return values
bool

getInstance()

Get an instance of a fitting TemplateConfiguration NOTE: for rendering prupose, you should never call this function directly, but rather Template::getInstance.

public static getInstance([string $sTemplateName = null ][, int $iSurveyGroupId = null ][, int $iSurveyId = null ][, mixed $abstractInstance = false ]) : TemplateConfiguration

if force_xmlsettings_for_survey_rendering is on, then the configuration from the XML file should be loaded, not the one from database

Parameters
$sTemplateName : string = null
$iSurveyGroupId : int = null
$iSurveyId : int = null
$abstractInstance : mixed = false
Return values
TemplateConfiguration

getInstanceFromSurveyGroup()

Returns a TemplateConfiguration Object based on a surveygroup ID If no instance is existing, it will create one.

public static getInstanceFromSurveyGroup(int $iSurveyGroupId[, string $sTemplateName = null ][, bool $abstractInstance = false ]) : TemplateConfiguration
Parameters
$iSurveyGroupId : int
$sTemplateName : string = null
$abstractInstance : bool = false
Return values
TemplateConfiguration

getInstanceFromSurveyId()

Returns a TemplateConfiguration Object based on a surveyID If no instance is existing, it will create one.

public static getInstanceFromSurveyId(int $iSurveyId[, string $sTemplateName = null ][, bool $abstractInstance = false ]) : TemplateConfiguration
Parameters
$iSurveyId : int
$sTemplateName : string = null
$abstractInstance : bool = false
Return values
TemplateConfiguration

getInstanceFromTemplateName()

Gets an instance of a templateconfiguration by name

public static getInstanceFromTemplateName(string $sTemplateName[, bool $abstractInstance = false ]) : TemplateConfiguration
Parameters
$sTemplateName : string
$abstractInstance : bool = false
Return values
TemplateConfiguration

getOptionPageAttributes()

public getOptionPageAttributes() : array<string|int, mixed>
Tags
todo

document me

Return values
array<string|int, mixed>

getPreview()

public getPreview() : array<string|int, mixed>|mixed|string|null
Tags
todo

document me

Return values
array<string|int, mixed>|mixed|string|null

getshowpopups()

Get showpopups value from config or template configuration

public getshowpopups() : mixed

getTemplateAndMotherNames()

public getTemplateAndMotherNames() : string
Tags
todo

document me

Return values
string

getTemplateForFile()

Get the template for a given file. It checks if a file exist in the current template or in one of its mother templates Can return a 302 redirect (this is not really a throw …

public getTemplateForFile(string $sFile, TemplateConfig $oRTemplate[, bool $force = false ]) : TemplateConfig
Parameters
$sFile : string

the file to look for (must contain relative path, unless it's a view file)

$oRTemplate : TemplateConfig

template from which the recurrence should start

$force : bool = false

file to be in template or mother template

Return values
TemplateConfig

getTemplateURL()

Returns the complete URL path to a given template name

public getTemplateURL() : string
Return values
string

template url

getThemeOptionsFromSurveyId()

Returns a Theme options array based on a surveyID

public static getThemeOptionsFromSurveyId([int $iSurveyId = 0 ][, bool $bInherited = false ]) : array<string|int, mixed>
Parameters
$iSurveyId : int = 0
$bInherited : bool = false

should inherited theme option values be used?

Return values
array<string|int, mixed>

importManifest()

Create a new entry in {{templates}} and {{template_configuration}} table using the template manifest

public static importManifest(string $sTemplateName[, array<string|int, mixed> $aDatas = array() ]) : bool
Parameters
$sTemplateName : string

the name of the template to import

$aDatas : array<string|int, mixed> = array()

Data

Tags
throws
Exception
Return values
bool

true on success | exception

isCompatible()

Checks if theme is compatible with the current limesurvey version

public static isCompatible( $themePath) : bool|null
Parameters
$themePath :
Return values
bool|null

model()

Returns the static model of the specified AR class.

public static model([string $className = __CLASS__ ]) : TemplateConfiguration

Please note that you should have this exact method in all your CActiveRecord descendants!

Parameters
$className : string = __CLASS__

active record class name.

Return values
TemplateConfiguration

the static model class

prepareTemplateRendering()

Prepare all the needed datas to render the temple If any problem (like template doesn't exist), it will load the default theme configuration NOTE 1: This function will create/update all the packages needed to render the template, which imply to do the same for all mother templates NOTE 2: So if you just want to access the TemplateConfiguration AR Object, you don't need to call it. Call it only before rendering anything related to the template.

public prepareTemplateRendering([string $sTemplateName = '' ][, string $iSurveyId = '' ][, bool $bUseMagicInherit = true ]) : self
Parameters
$sTemplateName : string = ''

the name of the template to load. The string comes from the template selector in survey settings

$iSurveyId : string = ''

the id of the survey. If

$bUseMagicInherit : bool = true
Return values
self

relations()

public relations() : array<string|int, mixed>
Tags
todo

document me

Return values
array<string|int, mixed>

relational rules.

removeFiles()

Remove the css/js files defined in theme config, from any package (even the core ones) The file should have the exact same name as in the package (see: application/config/packages.php and application/config/vendor.php) eg: to remove awesome-bootstrap-checkbox.css, in the theme config file add <remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css</remove>

public removeFiles() : mixed

rename()

Change the template name inside the configuration entries (called from template editor) NOTE: all tests (like template exist, etc) are done from template controller.

public static rename(string $sOldName, string $sNewName) : mixed
Parameters
$sOldName : string

The old name of the template

$sNewName : string

The newname of the template

rules()

public rules() : array<string|int, mixed>
Tags
todo

document me

Return values
array<string|int, mixed>

validation rules for model attributes.

sanitizeImagePathsOnJson()

Sanitizes the theme options making sure that paths are valid.

public sanitizeImagePathsOnJson(mixed $attribute, mixed $params) : mixed

Options that match a file will be marked as invalid if the file is not valid, or replaced with the virtual path if the file is valid.

Parameters
$attribute : mixed
$params : mixed

Retrieves a list of models based on the current search/filter conditions.

public search() : CActiveDataProvider

Typical usecase:

  • Initialize the model fields with values from filter form.
  • Execute this method to get CActiveDataProvider instance which will filter models according to data in model fields.
  • Pass data provider to CGridView, CListView or any similar widget.
Return values
CActiveDataProvider

the data provider that can return the models based on the search/filter conditions.

searchGrid()

Retrieves a list of models based on the current search/filter conditions.

public searchGrid([int $gsid = null ]) : CActiveDataProvider
Parameters
$gsid : int = null

Survey group, else get global

Tags
throws
Exception
Return values
CActiveDataProvider

setBasics()

Sets bUseMagicInherit sTemplate isStandard and path of the theme

public setBasics([string $sTemplateName = '' ][, string $iSurveyId = '' ][, bool $bUseMagicInherit = false ]) : mixed
Parameters
$sTemplateName : string = ''
$iSurveyId : string = ''
$bUseMagicInherit : bool = false

setGlobalOption()

Set a value on a given option at global setting level (survey level not affected).

public setGlobalOption(string $name, mixed $value) : void

Will be used to turn ON ajax mode on update.

Parameters
$name : string
$value : mixed

setOption()

Set option (unless if options is set to "inherit").

public setOption(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed

setOptionKeysToInherit()

Set each option key value to 'inherit' instead of having only one 'inherit' value for options.

public setOptionKeysToInherit() : mixed

Keys are fetched from parent xml configuration.

tableName()

public tableName() : string
Tags
todo

document me

Return values
string

the associated database table name

throwConsoleError()

public throwConsoleError([string|null $sCustomMessage = null ]) : mixed
Parameters
$sCustomMessage : string|null = null
Tags
throws
CException
todo

document me

uninstall()

Uninstalls the selected surveytheme and deletes database entry and configuration

public static uninstall(string $templatename) : bool|int
Parameters
$templatename : string

Name of Template

Tags
throws
CDbException
Return values
bool|int

uninstallThemesRecursive()

Uninstalls all surveythemes that are being extended from the supplied surveytheme name

public static uninstallThemesRecursive( $templateName) : void
Parameters
$templateName :
Tags
throws
CDbException

validateTheme()

Checks if a theme is valid Can be extended with more checks in the future if needed

public static validateTheme( $themeName,  $themePath[, bool $redirect = true ]) : bool
Parameters
$themeName :
$themePath :
$redirect : bool = true
Tags
throws
CDbException
Return values
bool

addMotherTemplatePackage()

loads the main theme template from the parent theme that it is extending, as a package. Ready to be registered

protected addMotherTemplatePackage(array<string|int, string> $packages) : array<string|int, string>
Parameters
$packages : array<string|int, string>
Return values
array<string|int, string>

changeMotherConfiguration()

Change the mother template configuration depending on template settings

protected changeMotherConfiguration(mixed $sType, mixed $aSettings) : array<string|int, mixed>
Parameters
$sType : mixed
$aSettings : mixed
Return values
array<string|int, mixed>

createTemplatePackage()

Create a package for the asset manager.

protected createTemplatePackage(TemplateConfiguration|TemplateManifest $oTemplate) : mixed

The asset manager will push to tmp/assets/xyxyxy/ the whole template directory (with css, js, files, etc.) And it will publish the CSS and the JS defined in config.xml. So CSS can use relative path for pictures. The publication of the package itself is in LSETwigViewRenderer::renderTemplateFromString()

Parameters
$oTemplate : TemplateConfiguration|TemplateManifest

TemplateManifest

getFilePath()

Get the file path for a given template.

protected getFilePath(string $sFile, TemplateConfig $oTemplate) : string|false

It will check if css/js (relative to path), or view (view path) It will search for current template and mother templates

Parameters
$sFile : string

relative path to the file

$oTemplate : TemplateConfig

the template where to look for (and its mother templates)

Return values
string|false

getFilesToLoad()

From a list of json files in db it will generate a PHP array ready to use by removeFileFromPackage()

protected getFilesToLoad(mixed $oTemplate, mixed $sType) : array<string|int, mixed>
Parameters
$oTemplate : mixed
$sType : mixed
Return values
array<string|int, mixed>

getFrameworkAssetsReplacement()

Get the list of file replacement from Engine Framework

protected getFrameworkAssetsReplacement(string $sType) : array<string|int, mixed>
Parameters
$sType : string

css|js the type of file

Return values
array<string|int, mixed>

getFrameworkAssetsToReplace()

Get the list of file replacement from Engine Framework

protected getFrameworkAssetsToReplace(string $sType[, bool $bInlcudeRemove = false ]) : array<string|int, mixed>
Parameters
$sType : string

css|js the type of file

$bInlcudeRemove : bool = false

also get the files to remove

Return values
array<string|int, mixed>

getOfiles()

Get the json files (to load/replace/remove) from a theme, and checks if its correctly formated

protected getOfiles( $oTemplate,  $sField) : bool|mixed
Parameters
$oTemplate :

the theme to check

$sField :

name of the DB field to get (file_css, file_js, file_print_css)

Return values
bool|mixed

getOptionKey()

Search through the inheritence chain and find the inherited value for theme option

protected getOptionKey(string $key) : mixed
Parameters
$key : string

removeFileFromPackage()

Proxy for Yii::app()->clientScript->removeFileFromPackage()

protected removeFileFromPackage(string $sPackageName, string $sType,  $aSettings) : void
Parameters
$sPackageName : string

name of the package to edit

$sType : string

the type of settings to change (css or js)

$aSettings :

array of local setting

removeFilesFromPackage()

Checks if some files are inside a package, and remove them.

protected removeFilesFromPackage(string $sPackageName, array<string|int, mixed> $aPackage, string $sType, array<string|int, mixed> $aFilesToRemove) : mixed
Parameters
$sPackageName : string

name of the package

$aPackage : array<string|int, mixed>

the package to check (as provided by Yii::app()->clientScript)

$sType : string

the type of file (css or js)

$aFilesToRemove : array<string|int, mixed>

an array containing the files to chech and remove

setIsStandard()

Check if this template is a standard template and save it in current model $this->isStandard

protected setIsStandard() : void
Tags
throws
CException

setMotherTemplates()

Configure the mother template (and its mother templates) This is an object recursive call to TemplateConfiguration::prepareTemplateRendering()

protected setMotherTemplates() : mixed

setOptionInheritance()

Loop through all theme options defined, trigger check for inheritance and write the new value back to the options object

protected setOptionInheritance() : void

setOptions()

Decodes json string from the database field "options" and stores it inside $this->oOptions Also triggers inheritence checks

protected setOptions() : void

setThisTemplate()

Set the default configuration values for the template, and use the motherTemplate value if needed

protected setThisTemplate() : void

uninstallIncorectTheme()

Uninstall a theme and, display error message, and redirect to theme list

protected uninstallIncorectTheme(string $sTemplateName) : mixed
Parameters
$sTemplateName : string

getAttributeValue()

Returns the value of the specified attribute ($attributeName) from the closest Template in the hierarchy.

private getAttributeValue(string $attributeName) : mixed
Parameters
$attributeName : string

getImageInfo()

Return image information

private getImageInfo(string $file[, mixed $pathPrefix = '' ]) : array<string|int, mixed>|null
Parameters
$file : string

with Path

$pathPrefix : mixed = ''
Return values
array<string|int, mixed>|null

getRelatedTemplate()

Returns the related Template.

private getRelatedTemplate() : Template|null

The template can only be accessed as a relation when this model is stored in the DB. Before saving, $this->template is null. In that case, this method will load the approriate Template.

Return values
Template|null

getRelativePath()

private getRelativePath( $from,  $to) : string
Parameters
$from :
$to :
Tags
todo

document me

Return values
string

replaceVariationFilesWithRtl()

When rtl language is chosen: if a css file in folder variations is in array cssFiles, then it will be replaced with the *-rtl version

private replaceVariationFilesWithRtl(array<string|int, mixed> $cssFiles) : array<string|int, mixed>
Parameters
$cssFiles : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results