QuestionTheme
extends LSActiveRecord
in package
This is the model class for table "{{question_themes}}".
The following are the available columns in table '{{question_themes}}':
Table of Contents
Constants
- THEME_TYPE_CORE = 'coreQuestion'
- THEME_TYPE_CUSTOM = 'customCoreTheme'
- THEME_TYPE_USER = 'customUserTheme'
Properties
- $api_version : string
- $author : string
- $author_email : string
- $author_url : string
- $bEncryption : mixed
- $copyright : string
- $core_theme : int
- $creation_date : string
- $description : string
- $extends : string
- $group : string
- $id : int
- $image_path : string
- $last_update : string
- $license : string
- $name : string
- $owner_id : int
- $question_type : string
- $settings : string
- $theme_type : string
- $title : string
- $version : string
- $visible : string
- $xml_path : string
- $xssFilterAttributes : array<string|int, string>
Methods
- attributeLabels() : array<string|int, mixed>
- behaviors() : array<string|int, mixed>
- Lists the behaviors of this model
- convertLS3toLS5() : array<string|int, mixed>
- Converts LS3 Question Theme to LS5
- decrypt() : mixed
- Decrypt values from database
- decryptEncryptAttributes() : mixed
- Encrypt/decrypt values
- decryptSingle() : string
- Decrypt single value
- decryptSingleOld() : string
- Decrypt single value
- deleteAllByAttributes() : int
- dispatchPluginModelEvent() : PluginEvent
- encrypt() : mixed
- Encrypt values
- encryptAttributeValues() : array<string|int, mixed>
- Attribute values are encrypted ( if needed )to be used for searching purposes
- encryptSave() : mixed
- Encrypt values before saving to the database
- encryptSingle() : mixed
- Enrypt single value
- findAllAsArray() : array<string|int, mixed>
- Finds all active records satisfying the specified condition but returns them as array
- findAllByAttributes() : array<string|int, static>
- Overriding of Yii's findAllByAttributes method to provide encrypted attribute value search
- findAllQuestionMetaDataForSelector() : array<string|int, QuestionTheme>
- Returns all Question Meta Data for the question type selector
- findByAttributes() : static|null
- Overriding of Yii's findByAttributes method to provide encrypted attribute value search
- findQuestionMetaData() : QuestionTheme
- Returns all QuestionTheme settings
- findQuestionMetaDataForAllTypes() : array<string, QuestionTheme>
- Returns all base question themes as an array indexed by question type (all entries in table question_themes extends='')
- getAbsolutePathForType() : string
- Returns the corresponding absolute path, given a relative path and the theme type.
- getAdditionalAttrFromExtendedTheme() : array<string|int, mixed>
- Gets the additional attributes for an extended theme from xml file.
- getAllEncryptedAttributes() : array<string|int, mixed>
- getAllQuestionMetaData() : array<string|int, mixed>
- Returns an array of all question themes and their metadata, split into available_themes and broken_themes
- getAllQuestionXMLPaths() : array<string|int, mixed>
- Find all XML paths for specified Question Root folders
- getAnswerColumnDefinition() : string
- Returns the table definition for the current Question
- getAvailableQuestionThemes() : array<string|int, mixed>
- Returns question themes available in the filesystem AND installed in the database
- getBaseThemeNameForQuestionType() : string|null
- Returns the name of the base question theme for the question type $questionType
- getDecodedSettings() : mixed
- Returns the settings attribute decoded
- getDummyInstance() : QuestionTheme
- Returns a dummy instance of QuestionTheme, with the question type $questionType.
- getManifestButtons() : mixed
- Install Button for the available questions
- getMaxId() : false|int
- Return the max value for a field
- getMetaDataArray() : array<string|int, mixed>
- Returns QuestionMetaData Array for use in ->save operations
- getMinId() : false|int
- Return the min value for a field
- getQuestionMetaData() : array<string|int, mixed>
- Read all the MetaData for given Question XML definition
- getQuestionThemeAttributeValues() : array<string|int, mixed>
- Return the question theme custom attributes values -- gets coreAttributes from xml-file -- gets additional attributes from extended theme (if theme is extended) -- gets "own" attributes via plugin
- getQuestionThemeDirectories() : array<string|int, mixed>
- getQuestionThemeDirectoryForType() : string
- Returns the path for the specified question theme type
- getQuestionThemeImageName() : string
- Return the question Theme preview URL
- getQuestionXMLPathForBaseType() : string
- Returns the Config Path for the selected Question Type base definition
- getRelativeXmlPath() : string
- Returns the XML path relative to the path configured for the question theme type
- getThemeDirectoryPath() : mixed
- getThemeType() : string
- Returns the type of question theme (coreQuestion, customCoreTheme, customUserTheme)
- getVisibilityButton() : string|array<string|int, mixed>
- Returns visibility button.
- getXmlPath() : string
- Returns the XML path It may be absolute or relative to the Limesurvey root
- importManifest() : bool|string
- Import config manifest to database.
- model() : static
- Returns the static model of the specified AR class.
- primaryKey() : string
- Returns this table's primary key
- relations() : array<string|int, mixed>
- rules() : array<string|int, mixed>
- scopes() : mixed
- search() : CActiveDataProvider
- Retrieves a list of models based on the current search/filter conditions.
- setEncryptedAttributeLabel() : string
- Function to show encryption symbol in gridview attribute header if value ois encrypted
- tableName() : string
- uninstall() : array<string|int, mixed>|false
- updateAll() : int
- Updates records with the specified condition.
- query() : mixed
- Modified version that default to do the same as the original, but allows via a third parameter to retrieve the result as array instead of active records. This solves a joining problem. Usage via findAllAsArray method
Constants
THEME_TYPE_CORE
public
mixed
THEME_TYPE_CORE
= 'coreQuestion'
THEME_TYPE_CUSTOM
public
mixed
THEME_TYPE_CUSTOM
= 'customCoreTheme'
THEME_TYPE_USER
public
mixed
THEME_TYPE_USER
= 'customUserTheme'
Properties
$api_version
public
string
$api_version
$author
public
string
$author
$author_email
public
string
$author_email
$author_url
public
string
$author_url
$bEncryption
public
mixed
$bEncryption
= \false
$copyright
public
string
$copyright
$core_theme
public
int
$core_theme
$creation_date
public
string
$creation_date
$description
public
string
$description
$extends
public
string
$extends
$group
public
string
$group
$id
public
int
$id
$image_path
public
string
$image_path
$last_update
public
string
$last_update
$license
public
string
$license
$name
public
string
$name
$owner_id
public
int
$owner_id
$question_type
public
string
$question_type
$settings
public
string
$settings
$theme_type
public
string
$theme_type
$title
public
string
$title
$version
public
string
$version
$visible
public
string
$visible
$xml_path
public
string
$xml_path
$xssFilterAttributes
protected
array<string|int, string>
$xssFilterAttributes
= []
Array of attributes that should be XSS filtered on mass updates
Methods
attributeLabels()
public
attributeLabels() : array<string|int, mixed>
Return values
array<string|int, mixed> —customized attribute labels (name=>label)
behaviors()
Lists the behaviors of this model
public
behaviors() : array<string|int, mixed>
Below is a list of all behaviors we register:
Tags
Return values
array<string|int, mixed>convertLS3toLS5()
Converts LS3 Question Theme to LS5
public
static convertLS3toLS5(string $sXMLDirectoryPath) : array<string|int, mixed>
Parameters
- $sXMLDirectoryPath : string
Return values
array<string|int, mixed> —$success Returns an array with the conversion status
decrypt()
Decrypt values from database
public
decrypt([mixed $value = '' ]) : mixed
Parameters
- $value : mixed = ''
decryptEncryptAttributes()
Encrypt/decrypt values
public
decryptEncryptAttributes([mixed $action = 'decrypt' ]) : mixed
Parameters
- $action : mixed = 'decrypt'
decryptSingle()
Decrypt single value
public
static decryptSingle([string $value = '' ]) : string
Parameters
- $value : string = ''
-
String value which needs to be decrypted
Return values
string —the decrypted string
decryptSingleOld()
Decrypt single value
public
static decryptSingleOld([string $value = '' ]) : string
Parameters
- $value : string = ''
-
String value which needs to be decrypted
Return values
string —the decrypted string
deleteAllByAttributes()
public
deleteAllByAttributes(array<string|int, mixed> $attributes[, string $condition = '' ][, array<string|int, mixed> $params = [] ]) : int
Parameters
- $attributes : array<string|int, mixed>
-
list of attribute values (indexed by attribute names) that the active records should match. An attribute value can be an array which will be used to generate an IN condition.
- $condition : string = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Tags
Return values
int —number of rows affected by the execution.
dispatchPluginModelEvent()
public
dispatchPluginModelEvent(string $sEventName, CDbCriteria $criteria = null, array<string|int, mixed> $eventParams = []) : PluginEvent
Parameters
- $sEventName : string
- $criteria = null : CDbCriteria
- $eventParams = [] : array<string|int, mixed>
Return values
PluginEventencrypt()
Encrypt values
public
encrypt() : mixed
encryptAttributeValues()
Attribute values are encrypted ( if needed )to be used for searching purposes
public
encryptAttributeValues([array<string|int, mixed> $attributes = null ][, mixed $bEncryptedOnly = false ][, mixed $bReplaceValues = true ]) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed> = null
-
list of attribute values (indexed by attribute names) that the active records should match. An attribute value can be an array which will be used to generate an IN condition.
- $bEncryptedOnly : mixed = false
- $bReplaceValues : mixed = true
Return values
array<string|int, mixed> —attributes array with encrypted atrribute values is returned
encryptSave()
Encrypt values before saving to the database
public
encryptSave([mixed $runValidation = false ]) : mixed
Parameters
- $runValidation : mixed = false
encryptSingle()
Enrypt single value
public
static encryptSingle([string $value = '' ]) : mixed
Parameters
- $value : string = ''
-
String value which needs to be encrypted
findAllAsArray()
Finds all active records satisfying the specified condition but returns them as array
public
findAllAsArray([mixed $condition = '' ][, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Return values
array<string|int, mixed> —list of active records satisfying the specified condition. An empty array is returned if none is found.
findAllByAttributes()
Overriding of Yii's findAllByAttributes method to provide encrypted attribute value search
public
findAllByAttributes(array<string|int, mixed> $attributes[, mixed $condition = '' ][, array<string|int, mixed> $params = [] ]) : array<string|int, static>
Parameters
- $attributes : array<string|int, mixed>
-
list of attribute values (indexed by attribute names) that the active records should match. An attribute value can be an array which will be used to generate an IN condition.
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Return values
array<string|int, static> —the records found. An empty array is returned if none is found.
findAllQuestionMetaDataForSelector()
Returns all Question Meta Data for the question type selector
public
static findAllQuestionMetaDataForSelector() : array<string|int, QuestionTheme>
Return values
array<string|int, QuestionTheme>findByAttributes()
Overriding of Yii's findByAttributes method to provide encrypted attribute value search
public
findByAttributes(array<string|int, mixed> $attributes[, mixed $condition = '' ][, array<string|int, mixed> $params = [] ]) : static|null
Parameters
- $attributes : array<string|int, mixed>
-
list of attribute values (indexed by attribute names) that the active record should match. An attribute value can be an array which will be used to generate an IN condition.
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = []
-
parameters to be bound to an SQL statement.
Return values
static|null —the record found. Null if none is found.
findQuestionMetaData()
Returns all QuestionTheme settings
public
static findQuestionMetaData(string $question_type[, string $question_theme_name = null ][, string $language = '' ]) : QuestionTheme
Parameters
- $question_type : string
- $question_theme_name : string = null
- $language : string = ''
Return values
QuestionThemefindQuestionMetaDataForAllTypes()
Returns all base question themes as an array indexed by question type (all entries in table question_themes extends='')
public
static findQuestionMetaDataForAllTypes() : array<string, QuestionTheme>
Return values
array<string, QuestionTheme>getAbsolutePathForType()
Returns the corresponding absolute path, given a relative path and the theme type.
public
static getAbsolutePathForType(string $relativePath, string $themeType) : string
Parameters
- $relativePath : string
- $themeType : string
Return values
stringgetAdditionalAttrFromExtendedTheme()
Gets the additional attributes for an extended theme from xml file.
public
static getAdditionalAttrFromExtendedTheme(string $sQuestionThemeName, string $type) : array<string|int, mixed>
If there are no attributes, an empty array is returned
Parameters
- $sQuestionThemeName : string
-
the question theme name (see table question theme "name")
- $type : string
-
the extended typ (see table question_themes "extends")
Return values
array<string|int, mixed> —additional attributes for an extended theme or empty array
getAllEncryptedAttributes()
public
getAllEncryptedAttributes(int $iSurveyId, string $sClassName) : array<string|int, mixed>
Parameters
- $iSurveyId : int
- $sClassName : string
Return values
array<string|int, mixed> —TODO: Should be split into seperate functions in the appropiate model or helper class TODO: Make an interface for records that support encryption.
getAllQuestionMetaData()
Returns an array of all question themes and their metadata, split into available_themes and broken_themes
public
getAllQuestionMetaData([bool $core = true ][, bool $custom = true ][, bool $user = true ]) : array<string|int, mixed>
Parameters
- $core : bool = true
- $custom : bool = true
- $user : bool = true
Tags
Return values
array<string|int, mixed>getAllQuestionXMLPaths()
Find all XML paths for specified Question Root folders
public
static getAllQuestionXMLPaths([bool $core = true ][, bool $custom = true ][, bool $user = true ]) : array<string|int, mixed>
Parameters
- $core : bool = true
- $custom : bool = true
- $user : bool = true
Return values
array<string|int, mixed>getAnswerColumnDefinition()
Returns the table definition for the current Question
public
static getAnswerColumnDefinition(string $name, string $type) : string
Parameters
- $name : string
- $type : string
Return values
string —mixed
getAvailableQuestionThemes()
Returns question themes available in the filesystem AND installed in the database
public
getAvailableQuestionThemes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getBaseThemeNameForQuestionType()
Returns the name of the base question theme for the question type $questionType
public
getBaseThemeNameForQuestionType(string $questionType) : string|null
Parameters
- $questionType : string
Return values
string|null —question theme name or null if no question theme is found
getDecodedSettings()
Returns the settings attribute decoded
public
getDecodedSettings() : mixed
getDummyInstance()
Returns a dummy instance of QuestionTheme, with the question type $questionType.
public
static getDummyInstance(string $questionType) : QuestionTheme
Parameters
- $questionType : string
Return values
QuestionThemegetManifestButtons()
Install Button for the available questions
public
getManifestButtons() : mixed
getMaxId()
Return the max value for a field
public
getMaxId([string $field = null ][, bool $forceRefresh = false ]) : false|int
This is a convenience method, that uses the primary key of the model to retrieve the highest value.
Parameters
- $field : string = null
-
The field that contains the Id, when null primary key is used if it is a single field
- $forceRefresh : bool = false
-
Don't use value from static cache but always requery the database
Tags
Return values
false|intgetMetaDataArray()
Returns QuestionMetaData Array for use in ->save operations
public
static getMetaDataArray(array<string|int, mixed> $questionMetaData) : array<string|int, mixed>
Parameters
- $questionMetaData : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —$questionMetaData
getMinId()
Return the min value for a field
public
getMinId([string $field = null ][, bool $forceRefresh = false ]) : false|int
This is a convenience method, that uses the primary key of the model to retrieve the highest value.
Parameters
- $field : string = null
-
The field that contains the Id, when null primary key is used if it is a single field
- $forceRefresh : bool = false
-
Don't use value from static cache but always requery the database
Tags
Return values
false|intgetQuestionMetaData()
Read all the MetaData for given Question XML definition
public
static getQuestionMetaData(string $pathToXmlFolder) : array<string|int, mixed>
Parameters
- $pathToXmlFolder : string
Tags
Return values
array<string|int, mixed> —Question Meta Data
getQuestionThemeAttributeValues()
Return the question theme custom attributes values -- gets coreAttributes from xml-file -- gets additional attributes from extended theme (if theme is extended) -- gets "own" attributes via plugin
public
static getQuestionThemeAttributeValues(string $type[, string $sQuestionThemeName = null ]) : array<string|int, mixed>
Parameters
- $type : string
-
question type (this is the attribute 'question_type' in table question_theme)
- $sQuestionThemeName : string = null
-
: question theme name
Tags
Return values
array<string|int, mixed> —: the attribute settings for this question type
getQuestionThemeDirectories()
public
static getQuestionThemeDirectories() : array<string|int, mixed>
Return values
array<string|int, mixed>getQuestionThemeDirectoryForType()
Returns the path for the specified question theme type
public
static getQuestionThemeDirectoryForType(string $themeType) : string
Parameters
- $themeType : string
Tags
Return values
stringgetQuestionThemeImageName()
Return the question Theme preview URL
public
static getQuestionThemeImageName([ $sType = null ]) : string
Parameters
Return values
string —: question theme preview URL
getQuestionXMLPathForBaseType()
Returns the Config Path for the selected Question Type base definition
public
static getQuestionXMLPathForBaseType(string $type) : string
Parameters
- $type : string
Tags
Return values
string —Path to config XML
getRelativeXmlPath()
Returns the XML path relative to the path configured for the question theme type
public
getRelativeXmlPath() : string
Return values
stringgetThemeDirectoryPath()
public
static getThemeDirectoryPath(mixed $sQuestionConfigFilePath) : mixed
Parameters
- $sQuestionConfigFilePath : mixed
getThemeType()
Returns the type of question theme (coreQuestion, customCoreTheme, customUserTheme)
public
getThemeType() : string
coreQuestion = Themes shipped with Limesurvey that don't extend other theme customCoreTheme = Themes shipped with Limesurvey that extend other theme customUserTheme = User provided question themes
Return values
stringgetVisibilityButton()
Returns visibility button.
public
getVisibilityButton() : string|array<string|int, mixed>
Return values
string|array<string|int, mixed>getXmlPath()
Returns the XML path It may be absolute or relative to the Limesurvey root
public
getXmlPath() : string
Return values
stringimportManifest()
Import config manifest to database.
public
importManifest(string $sXMLDirectoryPath[, bool $bSkipConversion = false ][, $bThrowConversionException = false ]) : bool|string
Parameters
- $sXMLDirectoryPath : string
-
the relative path to the Question Theme XML directory
- $bSkipConversion : bool = false
-
If converting should be skipped
- $bThrowConversionException : = false
-
If true, throws exception instead of redirecting
Tags
Return values
bool|stringmodel()
Returns the static model of the specified AR class.
public
static model([string $className = __CLASS__ ]) : static
Please note that you should have this exact method in all your CActiveRecord descendants!
Parameters
- $className : string = __CLASS__
-
active record class name.
Return values
staticprimaryKey()
Returns this table's primary key
public
primaryKey() : string
Tags
Return values
stringrelations()
public
relations() : array<string|int, mixed>
Return values
array<string|int, mixed> —relational rules.
rules()
public
rules() : array<string|int, mixed>
Return values
array<string|int, mixed> —validation rules for model attributes.
scopes()
public
scopes() : mixed
Tags
search()
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.
setEncryptedAttributeLabel()
Function to show encryption symbol in gridview attribute header if value ois encrypted
public
setEncryptedAttributeLabel(int $surveyId, string $className, string $attributeName) : string
Parameters
- $surveyId : int
- $className : string
- $attributeName : string
Tags
Return values
stringtableName()
public
tableName() : string
Return values
string —the associated database table name
uninstall()
public
static uninstall(QuestionTheme $oQuestionTheme) : array<string|int, mixed>|false
Parameters
- $oQuestionTheme : QuestionTheme
Tags
Return values
array<string|int, mixed>|falseupdateAll()
Updates records with the specified condition.
public
updateAll(array<string|int, mixed> $attributes[, mixed $condition = '' ][, array<string|int, mixed> $params = array() ]) : int
XSS filtering is enforced for attributes listed in model's $xssFilterAttributes property. See for detailed explanation about $condition and $params. Note, the attributes are not checked for safety and no validation is done.
Parameters
- $attributes : array<string|int, mixed>
-
list of attributes (name=>$value) to be updated
- $condition : mixed = ''
-
query condition or criteria.
- $params : array<string|int, mixed> = array()
-
parameters to be bound to an SQL statement.
Return values
int —the number of rows being updated
query()
Modified version that default to do the same as the original, but allows via a third parameter to retrieve the result as array instead of active records. This solves a joining problem. Usage via findAllAsArray method
protected
query(CDbCriteria $criteria[, bool $all = false ][, bool $asAR = true ]) : mixed
Performs the actual DB query and populates the AR objects with the query result. This method is mainly internally used by other AR query methods.
Parameters
- $criteria : CDbCriteria
-
the query criteria
- $all : bool = false
-
whether to return all data
- $asAR : bool = true
Tags
Return values
mixed —the AR objects populated with the query result