Object representing a specific Survey

package Gems
subpackage Tracker
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.4
inherited_from \Gems_Registry_TargetAbstract

 Methods

__construct()

__construct(mixed $gemsSurveyData) 

Parameters

$gemsSurveyData

mixed

Token Id or array containing token record

Returns a callable if a method is called as a variable

__get(string $name) : Callable
Inherited

Parameters

$name

string

Returns

Callable

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean

Returns

booleanFalse if required are missing.

Inserts the token in the source (if needed) and sets those attributes the source wants to set.

copyTokenToSource(\Gems_Tracker_Token $token, string $language) : integer

Parameters

$token

\Gems_Tracker_Token

$language

string

Exceptions

\Gems_Tracker_Source_SurveyNotFoundException

Returns

integer1 of the token was inserted or changed, 0 otherwise

Returns a field from the raw answers as a date object.

getAnswerDateTime(string $fieldName, \Gems_Tracker_Token $token) : \MUtil_Date

Parameters

$fieldName

string

Name of answer field

$token

\Gems_Tracker_Token

Gems token object

Returns

\MUtil_Datedate time or null

Returns a model for displaying the answers to this survey in the requested language.

getAnswerModel(string $language) : \MUtil_Model_ModelAbstract

Parameters

$language

string

(ISO) language string

Returns

\MUtil_Model_ModelAbstract

Returns a snippet name that can be used to display the answers to the token or nothing.

getAnswerSnippetNames(\Gems_Tracker_Token $token) : array

Parameters

$token

\Gems_Tracker_Token

Returns

arrayOf snippet names

getCode()

getCode() : string

Returns

stringInternal code of the survey

The time the survey was completed according to the source

getCompletionTime(\Gems_Tracker_Token $token) : \MUtil_Date

Parameters

$token

\Gems_Tracker_Token

Gems token object

Returns

\MUtil_Datedate time or null

Returns an array containing fieldname => label for each date field in the survey.

getDatesList(string $language) : array

Used in dropdown list etc..

Parameters

$language

string

(ISO) language string

Returns

arrayReturns an array of the strings datename => label

getDescription()

getDescription() : string

Returns

stringDescription of the survey

getDuration()

getDuration() : string

Returns

stringThe (manually entered) normal duration for taking this survey

getExportCode()

getExportCode() : string

Returns

stringExport code of the survey

getGroupId()

getGroupId() : integer

Returns

integerGems group id for survey

Calculate the until date for single survey insertion

getInsertDateUntil(\MUtil_Date $from) : \MUtil_Date

Parameters

$from

\MUtil_Date

Returns

\MUtil_Date

getName()

getName() : string

Returns

stringName of the survey

Returns an array of array with the structure: question => string, class => question|question_sub group => is for grouping type => (optional) source specific type answers => string for single types, array for selection of, nothing for no answer

getQuestionInformation(string $language) : array

Parameters

$language

string

(ISO) language string

Returns

arrayNested array

Returns a fieldlist with the field names as key and labels as array.

getQuestionList(string $language) : array

Parameters

$language

string

(ISO) language string

Returns

arrayof fieldname => label type

Returns the answers in simple raw array format, without value processing etc.

getRawTokenAnswerRow(string $tokenId) : array

Function may return more fields than just the answers.

Parameters

$tokenId

string

Gems Token Id

Returns

arrayField => Value array

Returns the answers of multiple tokens in simple raw nested array format, without value processing etc.

getRawTokenAnswerRows(array $filter = array()) : array

Function may return more fields than just the answers.

Parameters

$filter

array

XXX

Returns

arrayOf nested Field => Value arrays indexed by tokenId

Returns the number of answers of multiple tokens

getRawTokenAnswerRowsCount(array $filter = array()) : array

Parameters

$filter

array

XXX

Returns

arrayOf nested Field => Value arrays indexed by tokenId

Retrieve the name of the resultfield

getResultField() : string

The resultfield should be present in this surveys answers.

Returns

string

getSource()

getSource() : \Gems_Tracker_Source_SourceInterface

Returns

\Gems_Tracker_Source_SourceInterface

getSourceSurveyId()

getSourceSurveyId() : integer

Returns

integerGems survey ID

The time the survey was started according to the source

getStartTime(\Gems_Tracker_Token $token) : \MUtil_Date

Parameters

$token

\Gems_Tracker_Token

Gems token object

Returns

\MUtil_Datedate time or null

getStatus()

getStatus() : string

Returns

stringSurvey status

Return the Survey Before Answering event (if any)

getSurveyBeforeAnsweringEvent() : \Gems_Event_SurveyBeforeAnsweringEventInterface

Returns

\Gems_Event_SurveyBeforeAnsweringEventInterfaceevent instance or null

Return the Survey Completed event

getSurveyCompletedEvent() : \Gems_Event_SurveyCompletedEventInterface

Returns

\Gems_Event_SurveyCompletedEventInterfaceevent instance or null

getSurveyId()

getSurveyId() : integer

Returns

integerGems survey ID

Returns the url that (should) start the survey for this token

getTokenUrl(\Gems_Tracker_Token $token, string $language) : string

Parameters

$token

\Gems_Tracker_Token

Gems token object

$language

string

Returns

stringThe url to start the survey

hasPdf()

hasPdf() : boolean

Returns

booleanTrue if the survey has a pdf

Checks whether the token is in the source.

inSource(\Gems_Tracker_Token $token) : boolean

Parameters

$token

\Gems_Tracker_Token

Gems token object

Returns

boolean

isActive()

isActive() : boolean

Returns

booleanTrue if the survey is active

isActiveInSource()

isActiveInSource() : boolean

Returns

booleanTrue if the survey is active in the source

Returns true if the survey was completed according to the source

isCompleted(\Gems_Tracker_Token $token) : boolean

Parameters

$token

\Gems_Tracker_Token

Gems token object

Returns

booleanTrue if the token has completed

Should this survey be filled in by staff members.

isTakenByStaff() : boolean

Returns

boolean

Update the survey, both in the database and in memory.

saveSurvey(array $values, integer $userId) : integer

Parameters

$values

array

The values that this token should be set to

$userId

integer

The current user

Returns

integer1 if data changed, 0 otherwise

Updates the consent code of the the token in the source (if needed)

updateConsent(\Gems_Tracker_Token $token, string $consentCode = null) : integer

Parameters

$token

\Gems_Tracker_Token

$consentCode

string

Optional consent code, otherwise code from token is used.

Returns

integer1 of the token was inserted or changed, 0 otherwise

Makes sure the group data is part of the $this->_gemsSurvey

_ensureGroupData(boolean $reload = false

Parameters

$reload

boolean

Optional parameter to force reload.

Update the survey, both in the database and in memory.

_updateSurvey(array $values, integer $userId) : integer

Parameters

$values

array

The values that this token should be set to

$userId

integer

The current user

Returns

integer1 if data changed, 0 otherwise

 Properties

 

True when the survey does exist.

$exists : boolean

Default

true
 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$events

$events : \Gems_Events

Default

 

$tracker

$tracker : \Gems_Tracker

Default

 

The gems survey data

$_gemsSurvey : array

Default

 

$_source

$_source : \Gems_Tracker_SourceInterface

Default

 

The id of the token

$_surveyId : string

Default