TemplateConfig

Extends\CActiveRecord

Class TemplateConfig Common methods for TemplateConfiguration and TemplateManifest

package

Default

Methods

__toString

__toString(): string
todo

document me

Response

string

Change the mother template configuration depending on template settings

changeMotherConfiguration( $sType, $aSettings): array
var

string the type of settings to change (css or js)

array array of local setting

Arguments

$sType

$aSettings

Response

array

Create a package for the asset manager.

createTemplatePackage(\TemplateConfiguration $oTemplate)

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()

Arguments

$oTemplate

\TemplateConfiguration

TemplateManifest

Convert the values to a json.

formatToJsonArray(array|object $oFiled,boolean $bConvertEmptyToString = false): string
static

It checks that the correct values is inserted.

Arguments

$oFiled

array|object

the filed to convert

$bConvertEmptyToString

boolean

formats empty values as empty strings instead of objects.

Response

string

json

getAllDbTemplateFolders

getAllDbTemplateFolders(): array|null
todo

document me

Response

array|null

get the template API version

getApiVersion(): integer

Response

integer

Core config and attributes

getClassAndAttributes()

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

Get the depends package

getDependsPackages(\TemplateConfiguration $oTemplate): array<mixed,\stdClass>
uses

Arguments

Response

array<mixed,\stdClass>

Get the file path for a given template.

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

Arguments

$sFile

string

relative path to the file

$oTemplate

\TemplateConfig

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

Response

string|false

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

getFilesToLoad( $oTemplate, $sType): array
var

string js or css ?

Arguments

$oTemplate

$sType

Response

array

getPreview

getPreview(): array|mixed|string|null
todo

document me

Response

array|mixed|string|null

Find which template should be used to render a given view

getTemplateForAsset(string $sFile,\TemplateConfiguration $oRTemplate): \TemplateConfiguration|boolean

Arguments

$sFile

string

the file to check

$oRTemplate

\TemplateConfiguration

the template where the custom option page should be looked for

Response

\TemplateConfiguration|boolean

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 …

getTemplateForFile(string $sFile,\TemplateConfig $oRTemplate,boolean $force = false): \TemplateConfig

Arguments

$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

boolean

file to be in template or mother template

Response

\TemplateConfig

getTemplatesWithNoDb

getTemplatesWithNoDb(): array|null
todo

document me

Response

array|null

Returns the complete URL path to a given template name

getTemplateURL(): string

Response

string

template url

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

importManifest(string $sTemplateName,array $aDatas): boolean
static
Throws
\Exception|\InvalidArgumentException

Arguments

$sTemplateName

string

the name of the template to import

$aDatas

array

Response

boolean

true on success | exception

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.

prepareTemplateRendering(string $sTemplateName = '',string $iSurveyId = '',boolean $bUseMagicInherit = true): $this

Arguments

$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

boolean

Response

$this

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/third_party.php) eg: to remove awesome-bootstrap-checkbox.css, in the theme config file add <remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css</remove>

removeFiles()

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

removeFilesFromPackage(string $sPackageName,array $aPackage,string $sType,array $aFilesToRemove)

Arguments

$sPackageName

string

name of the package

$aPackage

array

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

$sType

string

the type of file (css or js)

$aFilesToRemove

array

an array containing the files to chech and remove

setIsStandard

setIsStandard(): boolean|null
todo

document me

missing return value (php warning)

Response

boolean|null

throwConsoleError

throwConsoleError(string|null $sCustomMessage = null)
todo

document me

Throws
\CException

Arguments

$sCustomMessage

string|null

uninstall

uninstall(string $templatename): boolean|integer
static
todo

document me

Arguments

$templatename

string

Name of Template

Response

boolean|integer

Properties

The template name

sTemplateName :string
var

The template name

Type(s)

string

of prepared to render TemplateConfig

aPreparedToRender :array
static
var

of prepared to render TemplateConfig

Type(s)

array

Name of the asset package of this template

sPackageName :string
var

Name of the asset package of this template

Type(s)

string

Path of this template

path :string
var

Path of this template

Type(s)

string

Url to reach the framework

sTemplateurl :string
var

Url to reach the framework

Type(s)

string

Path of the views files (twig template)

viewPath :string
var

Path of the views files (twig template)

Type(s)

string

Path of the tmeplate's files

filesPath :string
var

Path of the tmeplate's files

Type(s)

string

What framework css is used

cssFramework :object
var

What framework css is used

Type(s)

object

Is this template a core one?

isStandard :boolean
var

Is this template a core one?

Type(s)

boolean

Will contain the config.xml

config :\SimpleXMLElement
var

Will contain the config.xml

Type(s)

\SimpleXMLElement

The mother template object This is used when a template inherit another one.

oMotherTemplate :\TemplateConfiguration
var

The mother template object This is used when a template inherit another one.

Type(s)

\TemplateConfiguration

The template options

oOptions :object
var

The template options

Type(s)

object

oOptionAttributes

oOptionAttributes :

Type(s)

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

depends :array<mixed,string>
var

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

Type(s)

array<mixed,string>

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

apiVersion :integer
var

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

Type(s)

integer

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

iSurveyId :string
var

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

Type(s)

string

Does it has a config.xml file?

hasConfigFile :string
var

Does it has a config.xml file?

Type(s)

string

Array of package dependencies defined in config.xml

packages :array<mixed,\stdClass>
var

Array of package dependencies defined in config.xml

Type(s)

array<mixed,\stdClass>

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

xmlFile :string
var

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

Type(s)

string

Css Framework Replacement

aCssFrameworkReplacement :array
var

Css Framework Replacement

Type(s)

array

allDbTemplateFolders

allDbTemplateFolders :

Type(s)

aTemplatesWithoutDB

aTemplatesWithoutDB :
static

Type(s)

options_page

options_page :

Type(s)