SurveyObj

Methods

Returns question arrays ONLY for questions that are part of the indicated group and are top level (i.e. no subquestions will be returned). If there are no then an empty array will be returned.

getQuestions($groupId = null) 

If $groupId is not set then all top level questions will be returned regardless of the group they are a part of.

Arguments

$groupId

Returns the question code/title for the question that matches the $fieldName.

getQuestionCode(string $fieldName) : string

False is returned if no matching question is found.

Arguments

$fieldName

string

Response

string

(or false)

getQuestionText

getQuestionText($fieldName) 

Arguments

$fieldName

Returns all token records that have a token value that matches the one given. An empty array is returned if there are no matching token records.

getTokens(mixed $token) 

Arguments

$token

mixed

Returns an array containing all child question rows for the given parent question ID. If no children are found then an empty array is returned.

getSubQuestionArrays(int $parentQuestionId) : \array[int]array[string]mixed

Arguments

$parentQuestionId

int

Response

\array[int]array[string]mixed

Returns the full answer for the question that matches $fieldName and the answer that matches the $answerCode. If a match cannot be made then false is returned.

getFullAnswer(string $fieldName, string $answerCode, \Translator $translator, string $sLanguageCode) : string

The name of the variable $answerCode is not strictly an answerCode but could also be a comment entered by a participant.

Arguments

$fieldName

string

$answerCode

string

$translator

\Translator

$sLanguageCode

string

Response

string

(or false)

Returns the short answer for the question.

getShortAnswer(string $sFieldName, string $sValue) : string

Arguments

$sFieldName

string

$sValue

string

Response

string

Returns an array of possible answers to the question. If $scaleId is specified then only answers that match the $scaleId value will be returned. An empty array may be returned by this function if answers are found that match the questionId.

getAnswers(int $questionId, int $scaleId = '0') : \array[string]array[string]mixed

Arguments

$questionId

int

$scaleId

int

Response

\array[string]array[string]mixed

(or false)

Properties

id

id : int
var

Type(s)

int

Whether the survey is anonymous or not.

anonymous : boolean
var

Type(s)

boolean

Answer, codes, and full text to the questions.

answers : \array[int][string]mixed

This is used in conjunction with the fieldMap to produce some of the more verbose output in a survey export. array[recordNo][columnName]

var

Type(s)

\array[int][string]mixed

The fieldMap as generated by createFieldMap(.

fieldMap : \array[]mixed

..).

var

Type(s)

\array[]mixed

The groups in the survey.

groups : \array[int][string]mixed
var

Type(s)

\array[int][string]mixed

info about the survey

info : array
var

Type(s)

array

The questions in the survey.

questions : \array[int][string]mixed
var

Type(s)

\array[int][string]mixed

The tokens in the survey.

tokens : \array[int][string]mixed
var

Type(s)

\array[int][string]mixed

When relevant holds the available fields from the token table

tokenFields : \array[fieldname][localised
var

description]

Type(s)

\array[fieldname][localised

Stores the responses to the survey in a two dimensional array form.

responses : \array[int][string]mixed

array[recordNo][fieldMapName]

var

Type(s)

\array[int][string]mixed

languageSettings

languageSettings : \array[int][string]mixed
var

Type(s)

\array[int][string]mixed