QuestionTemplate

Extends\CFormModel

package

Default

Methods

Check if the question template offer a specific replacement for that view file.

checkIfTemplateHasView(string $sView): mixed

Arguments

$sView

string

Response

mixed

getCustomAttributes

getCustomAttributes(): array

Response

array

getFolderName

getFolderName(string $type): string|null
static
deprecated

use QuestionTheme::getQuestionXMLPathForBaseType

Arguments

$type

string

Response

string|null

Get a new instance of the template object Each question on the page could have a different template.

getNewInstance(\Question $oQuestion): \QuestionTemplate
static

So each question must have a new instance

Arguments

$oQuestion

\Question

Response

\QuestionTemplate

Get the template folder name

getQuestionTemplateFolderName(): false|string

Response

false|string

Called from admin, to generate the template list for a given question type

getQuestionTemplateList(string $type): array
static
todo

Move to QuestionTheme?

Arguments

$type

string

Response

array

Retrieve the template base path if exist

getTemplatePath(): null|string

Response

null|string

getTemplateUrl

getTemplateUrl(): string

Response

string

Correspondence between question type and the view folder name Rem: should be in question model. We keep it here for easy access

getTypeToFolder(): array
static
deprecated

Response

array

registerAssets

registerAssets()

Register a core css file

registerCssFile(string $sCssFile,string $media = '')

Arguments

$sCssFile

string

$media

string

Register a core package file

registerPackage(string $sPackage)

Arguments

$sPackage

string

Register a core script

registerScript(string $sScript,integer $pos = \CClientScript::POS_BEGIN)

Arguments

$sScript

string

$pos

integer

Register a core script file

registerScriptFile(string $sFile,integer $pos = \CClientScript::POS_BEGIN)

Arguments

$sFile

string

$pos

integer

In the future, could retrieve data from DB

setConfig()

Return true if the core css should be loaded.

templateLoadsCoreCss(): null|boolean

Response

null|boolean

Return true if the core css should be loaded.

templateLoadsCoreJs(): null|boolean

Response

null|boolean

Return true if the core packages should be loaded.

templateLoadsCorePackage(): null|boolean

Response

null|boolean

Properties

The current question

oQuestion :\Question
var

The current question

Type(s)

\Question

Does this question has a template?

bHasTemplate :boolean
var

Does this question has a template?

Type(s)

boolean

The folder of the template applied to this question (if no template applied, it's false)

sTemplateFolderName :string
var

The folder of the template applied to this question (if no template applied, it's false)

Type(s)

string

Array of views the template can handle ($aViews['path_to_my_view']==true)

aViews :array
var

Array of views the template can handle ($aViews['path_to_my_view']==true)

Type(s)

array

oConfig

oConfig :\SimpleXMLElement
var

Type(s)

\SimpleXMLElement

Does the template provides custom attributes?

bHasCustomAttributes :boolean
var

Does the template provides custom attributes?

Type(s)

boolean

array (attribute=>value)

aCustomAttributes :array
var

array (attribute=>value)

Type(s)

array

The path to the template

sTemplatePath :string
var

The path to the template

Type(s)

string

sTemplateUrl

sTemplateUrl :string
var

Type(s)

string

The path to the folder corresponding to the current question type

sTemplateQuestionPath :string
var

The path to the folder corresponding to the current question type

Type(s)

string

bHasConfigFile

bHasConfigFile :boolean
var

Type(s)

boolean

The path to the xml file

xmlFile :string
var

The path to the xml file

Type(s)

string

Should it render the core javascript of this question (script are registered in qanda)

bLoadCoreJs :boolean
var

Should it render the core javascript of this question (script are registered in qanda)

Type(s)

boolean

Should it render the core CSS of this question (script are registered in qanda)

bLoadCoreCss :boolean
var

Should it render the core CSS of this question (script are registered in qanda)

Type(s)

boolean

Should it render the core packages of this question (script are registered in qanda)

bLoadCorePackage :boolean
var

Should it render the core packages of this question (script are registered in qanda)

Type(s)

boolean

The instance of question template object

instance :\QuestionTemplate
static
var

The instance of question template object

Type(s)

\QuestionTemplate