Class Question
inheritdoc | |
---|---|
package | Default |
beforeSave(): boolean
boolean
behaviors(): array
Below is a list of all behaviors we register:
see | \PluginEventBehavior\CTimestampBehavior |
---|---|
array
decrypt( $value = '')
decryptEncryptAttributes( $action = 'decrypt')
decryptSingle(string $value = ''): string
string
String value which needs to be decrypted
string
the decrypted string
decryptSingleOld(string $value = ''): string
string
String value which needs to be decrypted
string
the decrypted string
delete(): boolean
Throws |
|
---|
boolean
deleteAllAnswers(): void
deleteAllByAttributes(array $attributes,string $condition = '',array $params = array()): integer
todo | This should also be moved to the behavior at some point. This method overrides the parent in order to raise PluginEvents for Bulk delete operations. Filter Criteria are wrapped into a CDBCriteria instance so we have a single instance responsible for holding the filter criteria to be passed to the PluginEvent, this also enables us to pass the fully configured CDBCriteria instead of the original Parameters. See {@link find()} for detailed explanation about $condition and $params. |
---|
array
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.
string
query condition or criteria.
array
parameters to be bound to an SQL statement.
integer
number of rows affected by the execution.
deleteAllById(mixed $questionsIds): void
mixed
deleteAllSubquestions(): void
todo | Duplication from delete() |
---|---|
dispatchPluginModelEvent(string $sEventName,\CDbCriteria $criteria = null,array $eventParams = []): \PluginEvent
string
\CDbCriteria
array
\PluginEvent
encrypt()
encryptAttributeValues(array $attributes = null, $bEncryptedOnly = false, $bReplaceValues = true): array
array
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.
array
attributes array with encrypted atrribute values is returned
encryptSave( $runValidation = false)
encryptSingle(string $value = '')
string
String value which needs to be encrypted
findAllAsArray(mixed $condition = '',array $params = array()): array
See \find() for detailed explanation about $condition and $params.
mixed
query condition or criteria.
array
parameters to be bound to an SQL statement.
array
list of active records satisfying the specified condition. An empty array is returned if none is found.
findAllByAttributes(array $attributes,mixed $condition = '',array $params = array()): array<mixed,static>
array
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.
mixed
query condition or criteria.
array
parameters to be bound to an SQL statement.
array<mixed,static>
the records found. An empty array is returned if none is found.
findByAttributes(array $attributes,mixed $condition = '',array $params = array()): static|null
array
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.
mixed
query condition or criteria.
array
parameters to be bound to an SQL statement.
static|null
the record found. Null if none is found.
fixSubQuestions(): void
todo | : move other fix here ? |
---|---|
getAdvancedSettingsWithValues(string|null $sLanguage = null,string|null $sQuestionThemeOverride = null): array
string|null
If you give a language then only the attributes for that language are returned
string|null
Name of the question theme to use instead of the question's current theme
array
getAllEncryptedAttributes(integer $iSurveyId,string $sClassName): array
integer
string
array
TODO: Should be split into seperate functions in the appropiate model or helper class TODO: Make an interface for records that support encryption.
getAllowOther(): boolean
boolean
getAllowSubquestions(): boolean
boolean
getAllSubQuestionIds(): array
array
getBasicFieldName()
getDataSetObject( $type = null)
getHasOtherSubquestions(): boolean
boolean
getHasSubquestions()
deprecated | 5.3.x unknow usage |
---|---|
getHighestQuestionOrderNumberInGroup(integer $questionGroupId): integer|null
($question->question_order).
integer
the question group id
integer|null
question highest order number or null if there are no questions belonging to the group
getMandatoryIcon()
getMaxId(string $field = null,boolean $forceRefresh = false): false|integer
This is a convenience method, that uses the primary key of the model to retrieve the highest value.
Throws |
|
---|
string
The field that contains the Id, when null primary key is used if it is a single field
boolean
Don't use value from static cache but always requery the database
false|integer
getMinId(string $field = null,boolean $forceRefresh = false): false|integer
This is a convenience method, that uses the primary key of the model to retrieve the highest value.
Throws |
|
---|
string
The field that contains the Id, when null primary key is used if it is a single field
boolean
Don't use value from static cache but always requery the database
false|integer
getNewTitle(integer $index): string|null
integer
base for question code (example : inde of question when survey import)
string|null
: new title, null if impossible
getOrderedAnswers( $scale_id = null)
getOrderedSubQuestions( $scale_id = null): array
array
getOtherIcon(): boolean
boolean
getQuestionAttribute( $sAttribute): array<mixed,\QuestionAttribute>
getQuestionClass( $sType): string
string
Question class to be added to the container
Maybe move class in typeList ? //TODO move to QuestionType
getQuestionList(integer $surveyid): array<mixed,\Question>
getQuestionListColumns()
getQuestions(integer $sid,integer $gid): \CDbDataReader
integer
integer
\CDbDataReader
getQuestionsForStatistics(string $fields,mixed $condition,string|false $orderby = false): array
string
mixed
string|false
array
getQuestionTemplateAttributes(array $aAttributeNames,array $aAttributeValues,\Question $oQuestion): mixed
deprecated | use QuestionTheme::getAdditionalAttrFromExtendedTheme() to retrieve question theme attributes and QuestionAttributeHelper->mergeQuestionAttributes() to merge with base attributes. |
---|
array
the values from getQuestionAttributesSettings($sType)
array
$attributeValues['question_template'] != 'core', only if this is true the function changes something
mixed
returns the incoming parameter $aAttributeNames or
getQuestionTheme(): \QuestionTheme|null
It's not implemented as a relation because relations only work on persisted models.
\QuestionTheme|null
getQuestionTypeName( $sType): string
deprecated | use $this->>questionType->description instead |
---|
string
Question type name
Maybe move class in typeList ?
getQuotableTypes(): array<mixed,string>
array<mixed,string>
getRenderererObject( $aFieldArray, $type = null)
getScaledAnswerOptions(): array
array
Like [0 => Answer[]] or [0 => Answer[], 1 => Answer[]]
getScaledSubquestions(): array
array
Like [0 => Question[]] or [0 => Question[], 1 => Question[]]
getTypedesc(): string
string
NOTE: Not used anymore. Based on a deprecated method. Should be deprecated.
getTypeGroup()
increaseAllOrderNumbersForGroup(integer $questionGroupId)
integer
insertRecords(array $data): boolean|null
array
boolean|null
model( $className = __CLASS__): \Question
primaryKey()
inheritdoc | |
---|---|
query(\CDbCriteria $criteria,boolean $all = false,boolean $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.
since | 1.1.7 |
---|
\CDbCriteria
the query criteria
boolean
whether to return all data
boolean
mixed
the AR objects populated with the query result
questionThemeNameValidator()
relations()
inheritdoc | |
---|---|
removeFromLastVisited()
removeInvalidSubquestions(): void
rules()
inheritdoc | TODO: make it easy to read (if possible) |
---|---|
scopes()
inheritdoc | |
---|---|
search()
setEncryptedAttributeLabel(integer $surveyId,string $className,string $attributeName): string
Throws |
|
---|
integer
string
string
string
setQuestionOrderForGroup( $questionGroupId): boolean
boolean
true if sort numbers had to be set, false otherwise
shouldOrderAnswersAlphabetically(): boolean
boolean
shouldOrderAnswersRandomly(): boolean
boolean
sortAnswerOptions( $answerOptions): \array<int,Answer[]>
Refactored from getOrderedAnswers();
\array
tableName()
inheritdoc | |
---|---|
typeList(string $language = null): array
deprecated | use QuestionTheme::findQuestionMetaDataForAllTypes() instead |
---|
string
Language for translation
array
The question type definitions
Explanation of questiontype array:
description : Question description subquestions : 0= Does not support subquestions x=Number of subquestion scales answerscales : 0= Does not need answers x=Number of answer scales (usually 1, but e.g. for dual scale question set to 2) assessable : 0=Does not support assessment values when editing answerd 1=Support assessment values
update( $attributes = null)
updateAll(array $attributes,mixed $condition = '',array $params = array()): integer
XSS filtering is enforced for attributes listed in model's $xssFilterAttributes property. See \find() for detailed explanation about $condition and $params. Note, the attributes are not checked for safety and no validation is done.
array
list of attributes (name=>$value) to be updated
mixed
query condition or criteria.
array
parameters to be bound to an SQL statement.
integer
the number of rows being updated
updateQuestionOrder(integer $gid,integer $startingOrder = 1)
integer
integer
the starting question order.
updateSortOrder(integer $gid,integer $surveyid): void
static | |
---|---|
access | public |
integer
integer
QT_1_ARRAY_DUAL
QT_5_POINT_CHOICE
QT_A_ARRAY_5_POINT
QT_B_ARRAY_10_CHOICE_QUESTIONS
QT_C_ARRAY_YES_UNCERTAIN_NO
QT_D_DATE
QT_E_ARRAY_INC_SAME_DEC
QT_F_ARRAY
QT_G_GENDER
QT_H_ARRAY_COLUMN
QT_I_LANGUAGE
QT_K_MULTIPLE_NUMERICAL
QT_L_LIST
QT_M_MULTIPLE_CHOICE
QT_N_NUMERICAL
QT_O_LIST_WITH_COMMENT
QT_P_MULTIPLE_CHOICE_WITH_COMMENTS
QT_Q_MULTIPLE_SHORT_TEXT
QT_R_RANKING
QT_S_SHORT_FREE_TEXT
QT_T_LONG_FREE_TEXT
QT_U_HUGE_FREE_TEXT
QT_X_TEXT_DISPLAY
QT_Y_YES_NO_RADIO
QT_EXCLAMATION_LIST_DROPDOWN
QT_VERTICAL_FILE_UPLOAD
QT_ASTERISK_EQUATION
QT_COLON_ARRAY_NUMBERS
QT_SEMICOLON_ARRAY_TEXT
START_SORTING_VALUE
DEFAULT_QUESTION_THEME
group_name :string
var | Stock the active group_name for questions list filtering |
---|
string
gid :
relevance :
same_script :
xssFilterAttributes :array<mixed,string>
var | Array of attributes that should be XSS filtered on mass updates |
---|
array<mixed,string>
bEncryption :
qid :integer
Question ID.
integer
sid :integer
Survey ID
integer
gid :integer
QuestionGroup ID where question is displayed
integer
type :string
string
title :string
Question Code
string
preg :string
string
other :string
Other option enabled for question (Y/N)
string
mandatory :string
Whether question is mandatory (Y/S/N)
string
encrypted :string
Whether question is encrypted (Y/N)
string
question_order :integer
Question order in greoup
integer
parent_qid :integer
Questions parent question ID eg for subquestions
integer
scale_id :integer
The scale ID
integer
same_default :integer
Saves if user set to use the same default value across languages in default options dialog ('Edit default answers')
integer
relevance :string
Questions relevane equation
string
modulename :string
string
same_script :integer
Whether the same script should be used for all languages
integer
survey :\Survey
\Survey
groups :\QuestionGroup
//@TODO should be singular
\QuestionGroup
parents :\Question
//@TODO should be singular
\Question
subquestions :array<mixed,\Question>
array<mixed,\Question>
questionAttributes :array<mixed,\QuestionAttribute>
NB! returns all QuestionArrtibute Models fot this QID regardless of the specified language
array<mixed,\QuestionAttribute>
questionl10ns :array<mixed,\QuestionL10n>
Question Languagesettings indexd by language code
array<mixed,\QuestionL10n>
quotableTypes :array<mixed,string>
Question types that can be used for quotas
array<mixed,string>
answers :array<mixed,\Answer>
array<mixed,\Answer>
questionType :\QuestionType
\QuestionType
allSubQuestionIds :array
QID-s of all question subquestions, empty array returned if no subquestions
array