Class TemplateConfig Common methods for TemplateConfiguration and TemplateManifest
package |
Default |
---|
__get(string $name) : mixed
string
the name of the attribute
mixed
__toString()
_filterImages( $file)
addFileReplacement(string $sFile, string $sType) : boolean|void
..}, "css/template.css",]} In general, should be called from TemplateManifest, after adding a file replacement inside the manifest.
Throws |
|
---|
string
the file to replace
string
css|js
boolean|void
addMotherTemplatePackage( $packages)
attributeLabels() : array
array
customized attribute labels (name=>label)
changeMotherConfiguration( $sType, $aSettings) : array
var |
string the type of settings to change (css or js) array array of local setting |
---|---|
array
checkAndcreateSurveyConfig(integer $iSurveyId) : \TemplateConfiguration
TODO |
: recursivity for survey group |
---|
integer
\TemplateConfiguration
the template configuration for the survey group
checkTemplate()
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()
formatToJsonArray(array|object $oFiled) : string
It checks that the correct values is inserted.
array|object
the filed to convert
string
json
getAllDbTemplateFolders()
getApiVersion() : integer
integer
getButtons()
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
getDependsPackages(\TemplateConfiguration $oTemplate) : array<mixed,string>
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
string
relative path to the file
string|false
getFrameworkAssetsReplacement(string $sType) : array
string
css|js the type of file
array
getFrameworkAssetsToReplace(string $sType, boolean $bInlcudeRemove = false) : array
string
css|js the type of file
boolean
also get the files to remove
array
getHasOptionPage()
getInstance(string $sTemplateName = null, integer $iSurveyGroupId = null, integer $iSurveyId = null) : \TemplateConfiguration
string
integer
integer
\TemplateConfiguration
getInstanceFromSurveyGroup(integer $iSurveyGroupId, string $sTemplateName = null) : \TemplateConfiguration
getInstanceFromSurveyId(integer $iSurveyId, string $sTemplateName = null) : \TemplateConfiguration
getInstanceFromTemplateName(string $sTemplateName) : \TemplateConfiguration
getOptionKey(string $key) : mixed
string
mixed
getOptionPage()
getOptionPageAttributes()
getParentConfiguration()
getPreview()
getTemplateAndMotherNames() : string
string
getTemplateForFile(string $sFile, \TemplateConfig $oRTemplate) : \TemplateConfig
Throws |
|
---|
string
the file to look for (must contain relative path, unless it's a view file)
\TemplateConfig
getTemplateForPath(\TemplateConfiguration $oRTemplate, string $sPath)
getTemplatesWithNoDb()
getTemplateURL() : string
string
template url
getTypeIcon()
importManifest(string $sTemplateName, array $aDatas) : boolean
Throws |
|
---|
string
the name of the template to import
array
boolean
true on success | exception
model(string $className = __CLASS__) : \TemplateConfiguration
Please note that you should have this exact method in all your CActiveRecord descendants!
string
active record class name.
\TemplateConfiguration
the static model class
prepareTemplateRendering(string $sTemplateName = '', string $iSurveyId = '', boolean $bUseMagicInherit = true) : $this
string
the name of the template to load. The string comes from the template selector in survey settings
string
the id of the survey. If
boolean
$this
relations() : array
array
relational rules.
removeFileFromPackage(string $sPackageName, string $sType, $aSettings) : array
string
string name of the package to edit
string
string the type of settings to change (css or js)
array array of local setting
array
rename(string $sOldName, string $sNewName)
string
The old name of the template
string
The newname of the template
rules() : array
array
validation rules for model attributes.
search() : \CActiveDataProvider
Typical usecase:
\CActiveDataProvider
the data provider that can return the models based on the search/filter conditions.
setBasics( $sTemplateName = '', $iSurveyId = '')
setCssFramework()
setIsStandard() : boolean|null
boolean|null
setMotherTemplates()
setOptionInheritance()
setOptions()
setThisTemplate()
setToInherit()
tableName() : string
string
the associated database table name
uninstall( $templatename)
uninstallIncorectTheme(string $sTemplateName)
string
oParentTemplate : \TemplateConfiguration
var |
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) |
---|
\TemplateConfiguration
bUseMagicInherit :
bJustCreated :
sPreviewImgTag : string
var |
the template preview image tag for the template list |
---|
string
aInstancesFromTemplateName : array
var |
cache for method getInstanceFromTemplateName |
---|
array
aPreparedToRender : array
var |
cache for method prepareTemplateRendering |
---|
array
bTemplateCheckResult : boolean
var |
is the template valid? |
---|
boolean
sTypeIcon : string
var |
the type of template for icon (core vs user) |
---|
string
aFilesToLoad : array
var |
cache for the method getFilesToLoad() |
---|
array
aFrameworkAssetsToReplace : array
var |
cache for the method getFrameworkAssetsToReplace() |
---|
array
aReplacements : array
var |
cache for the method getFrameworkAssetsReplacement |
---|
array
generalFilesPath :
sTemplateName : string
var |
The template name |
---|
string
sPackageName : string
var |
Name of the asset package of this template |
---|
string
path : string
var |
Path of this template |
---|
string
sTemplateurl : array<mixed,string>
var |
Url to reach the framework |
---|
array<mixed,string>
viewPath : string
var |
Path of the views files (twig template) |
---|
string
filesPath : string
var |
Path of the tmeplate's files |
---|
string
cssFramework : array<mixed,string>
var |
What framework css is used |
---|
array<mixed,string>
isStandard : boolean
var |
Is this template a core one? |
---|
boolean
config : \SimpleXMLElement
var |
Will contain the config.xml |
---|
\SimpleXMLElement
oMotherTemplate : \TemplateConfiguration
var |
The mother template object This is used when a template inherit another one. |
---|
\TemplateConfiguration
oOptions : array
var |
The template options |
---|
array
depends : array<mixed,string>
var |
List of all dependencies (could be more that just the config.xml packages) |
---|
array<mixed,string>
apiVersion : integer
var |
Version of the LS API when created. Must be private : disallow update |
---|
integer
iSurveyId : string
var |
The current Survey Id. It can be void. It's use only to retreive the current template of a given survey |
---|
string
hasConfigFile : string
var |
Does it has a config.xml file? |
---|
string
packages : array<mixed,\stdClass>
var |
Array of package dependencies defined in config.xml |
---|
array<mixed,\stdClass>
xmlFile : string
var |
What xml config file does it use? (config/minimal) |
---|
string
aCssFrameworkReplacement : array
var |
Css Framework Replacement |
---|
array
allDbTemplateFolders :
aTemplatesWithoutDB :