QuestionBase

Implements \LimeSurvey\PluginManager\iQuestion

package

Default

Methods

__construct

__construct(\LimeSurvey\PluginManager\iPlugin $plugin, \LimeSurvey\PluginManager\LimesurveyApi $api, integer $questionId = null, integer $responseId = null) : void

Arguments

$plugin

\LimeSurvey\PluginManager\iPlugin

The plugin to which this question belongs.

$questionId

integer

$responseId

integer

Pass a response id to load results.

This function retrieves question data. Do not cache this data; the plugin storage engine will handling caching. After the first call to this function, subsequent calls will only consist of a few function calls and array lookups.

get(string $key = null, mixed $default = null, string $language = null, integer $questionId = null) : boolean

Arguments

$key

string

String identifier for data.

$default

mixed

Default value.

$language

string

Language to retrieve.

$questionId

integer

By default uses the question id for the current instance. Override this to read from another question.

Response

boolean

Gets the meta data for question attributes.

getAttributes(\LimeSurvey\PluginManager\type $languages = null) : \LimeSurvey\PluginManager\type

Optionally pass one or more languages to also get current values. Pass * to get all stored languages.

Arguments

$languages

\LimeSurvey\PluginManager\type

Response

\LimeSurvey\PluginManager\type

getColumns

getColumns() 

Returns the number of question this question contains.

getCount() : integer

Defaults to 1, can be set to 0 if this question should not be counted like in case for display only or equation questions.

Response

integer

This function derives a unique identifier for identifying a question type.

getGUID() : string
static

Response

string

Gets the response for the current response id.

getResponse() : \LimeSurvey\PluginManager\type

Response

\LimeSurvey\PluginManager\type

Returns the variables exposed by this question.

getVariables() : array

The returned array contains a key for each variable name and the value is an array with meta data.

Response

array

Load the question data from the questions model.

loadSubQuestions(integer $questionId) 

Arguments

$questionId

integer

This function must save the custom question attributes for a question.

saveAttributes(array $attributeValues,  $qid = null) : boolean

The default implementation just iterates over the array and saves each property.

Arguments

$attributeValues

array

$qid

Response

boolean

True on success, false on failure(s).

This function saves question data.

set(string $key, mixed $value, string $language = null,  $questionId = null) : boolean

Arguments

$key

string

$value

mixed

$language

string

$questionId

Response

boolean

Properties

api

api : \LimeSurvey\PluginManager\LimesurveyApi

Array containing meta data for supported question attributes.

attributes : array
var

Type(s)

array

Array containing an array for each column.

columns : array

The supported keys for column meta data are:

  • type
  • name
  • description
var

Type(s)

array

Array containing attributes that all question types share.

defaultAttributes : array
var

Type(s)

array

Array containing default attributes that are merged into the attribute arrays.

defaultAttributeProperties : array
var

Type(s)

array

info

info : 
static

Type(s)

plugin

plugin : \LimeSurvey\PluginManager\iPlugin

The question id for this question object instance.

questionId : integer
var

The question id for this question object instance.

Type(s)

integer

The response id for this question object instance.

responseId : integer
var

The response id for this question object instance.

Type(s)

integer

Contains the subquestion objects for this question.

subQuestions : array<mixed,\LimeSurvey\PluginManager\iQuestion>
var

Type(s)

array<mixed,\LimeSurvey\PluginManager\iQuestion>

The signature array is used for deriving a unique identifier for a question type.

signature : array
static

After initial release the contents of this array may NEVER be changed. Changing the contents of the array will identify the question object as a new question type and will break many if not all existing surveys.

  • Add more keys & values to make it more unique.
var

Type(s)

array