QuestionTemplate
extends CFormModel
in package
Table of Contents
Properties
- $aCustomAttributes : array<string|int, mixed>
- $aViews : array<string|int, mixed>
- $bHasCustomAttributes : bool
- $bHasTemplate : bool
- $oConfig : SimpleXMLElement
- $oQuestion : Question
- $sTemplateFolderName : string
- $bHasConfigFile : bool
- $bLoadCoreCss : bool
- $bLoadCoreJs : bool
- $bLoadCorePackage : bool
- $instance : QuestionTemplate
- $sTemplatePath : string
- $sTemplateQuestionPath : string
- $sTemplateUrl : string
- $xmlFile : string
Methods
- checkIfTemplateHasView() : mixed
- Check if the question template offer a specific replacement for that view file.
- getCustomAttributes() : array<string|int, mixed>
- getFolderName() : string|null
- getNewInstance() : QuestionTemplate
- Get a new instance of the template object Each question on the page could have a different template.
- getQuestionTemplateFolderName() : false|string
- Get the template folder name
- getQuestionTemplateList() : array<string|int, mixed>
- Called from admin, to generate the template list for a given question type
- getTemplatePath() : null|string
- Retrieve the template base path if exist
- getTemplateUrl() : string
- getTypeToFolder() : array<string|int, mixed>
- Correspondence between question type and the view folder name Rem: should be in question model. We keep it here for easy access
- registerAssets() : mixed
- registerCssFile() : mixed
- Register a core css file
- registerPackage() : mixed
- Register a core package file
- registerScript() : mixed
- Register a core script
- registerScriptFile() : mixed
- Register a core script file
- setConfig() : mixed
- In the future, could retrieve data from DB
- templateLoadsCoreCss() : null|bool
- Return true if the core css should be loaded.
- templateLoadsCoreJs() : null|bool
- Return true if the core css should be loaded.
- templateLoadsCorePackage() : null|bool
- Return true if the core packages should be loaded.
Properties
$aCustomAttributes
public
array<string|int, mixed>
$aCustomAttributes
array (attribute=>value)
$aViews
public
array<string|int, mixed>
$aViews
Array of views the template can handle ($aViews['path_to_my_view']==true)
$bHasCustomAttributes
public
bool
$bHasCustomAttributes
Does the template provides custom attributes?
$bHasTemplate
public
bool
$bHasTemplate
Does this question has a template?
$oConfig
public
SimpleXMLElement
$oConfig
$oQuestion
public
Question
$oQuestion
The current question
$sTemplateFolderName
public
string
$sTemplateFolderName
The folder of the template applied to this question (if no template applied, it's false)
$bHasConfigFile
private
bool
$bHasConfigFile
$bLoadCoreCss
private
bool
$bLoadCoreCss
Should it render the core CSS of this question (script are registered in qanda)
$bLoadCoreJs
private
bool
$bLoadCoreJs
Should it render the core javascript of this question (script are registered in qanda)
$bLoadCorePackage
private
bool
$bLoadCorePackage
Should it render the core packages of this question (script are registered in qanda)
$instance
private
static QuestionTemplate
$instance
The instance of question template object
$sTemplatePath
private
string
$sTemplatePath
The path to the template
$sTemplateQuestionPath
private
string
$sTemplateQuestionPath
The path to the folder corresponding to the current question type
$sTemplateUrl
private
string
$sTemplateUrl
$xmlFile
private
string
$xmlFile
The path to the xml file
Methods
checkIfTemplateHasView()
Check if the question template offer a specific replacement for that view file.
public
checkIfTemplateHasView(string $sView) : mixed
Parameters
- $sView : string
getCustomAttributes()
public
getCustomAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getFolderName()
public
static getFolderName(string $type) : string|null
Parameters
- $type : string
Tags
Return values
string|nullgetNewInstance()
Get a new instance of the template object Each question on the page could have a different template.
public
static getNewInstance(Question $oQuestion) : QuestionTemplate
So each question must have a new instance
Parameters
- $oQuestion : Question
Return values
QuestionTemplategetQuestionTemplateFolderName()
Get the template folder name
public
getQuestionTemplateFolderName() : false|string
Return values
false|stringgetQuestionTemplateList()
Called from admin, to generate the template list for a given question type
public
static getQuestionTemplateList(string $type) : array<string|int, mixed>
Parameters
- $type : string
Tags
Return values
array<string|int, mixed>getTemplatePath()
Retrieve the template base path if exist
public
getTemplatePath() : null|string
Return values
null|stringgetTemplateUrl()
public
getTemplateUrl() : string
Return values
stringgetTypeToFolder()
Correspondence between question type and the view folder name Rem: should be in question model. We keep it here for easy access
public
static getTypeToFolder() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>registerAssets()
public
registerAssets() : mixed
registerCssFile()
Register a core css file
public
registerCssFile(string $sCssFile[, string $media = '' ]) : mixed
Parameters
- $sCssFile : string
- $media : string = ''
registerPackage()
Register a core package file
public
registerPackage(string $sPackage) : mixed
Parameters
- $sPackage : string
registerScript()
Register a core script
public
registerScript(string $sScript[, int $pos = CClientScript::POS_BEGIN ]) : mixed
Parameters
- $sScript : string
- $pos : int = CClientScript::POS_BEGIN
registerScriptFile()
Register a core script file
public
registerScriptFile(string $sFile[, int $pos = CClientScript::POS_BEGIN ]) : mixed
Parameters
- $sFile : string
- $pos : int = CClientScript::POS_BEGIN
setConfig()
In the future, could retrieve data from DB
public
setConfig() : mixed
templateLoadsCoreCss()
Return true if the core css should be loaded.
public
templateLoadsCoreCss() : null|bool
Return values
null|booltemplateLoadsCoreJs()
Return true if the core css should be loaded.
public
templateLoadsCoreJs() : null|bool
Return values
null|booltemplateLoadsCorePackage()
Return true if the core packages should be loaded.
public
templateLoadsCorePackage() : null|bool