Interface description of SourceInterface for (external) survey sources.
package | Gems |
---|---|
subpackage | Tracker |
copyright | Copyright (c) 2011 Erasmus MC |
license | New BSD License |
since | Class available since version 1.2 |
__construct(array $sourceData, \Zend_Db_Adapter_Abstract $gemsDb)
array
The information from gems__sources for this source.
\Zend_Db_Adapter_Abstract
Do not want to copy db using registry because that is public and this should be private
checkSourceActive(integer $userId) : boolean
integer
Id of the user who takes the action (for logging)
boolean
checkSurvey(string $sourceSurveyId, integer $surveyId, integer $userId) : mixed
string
integer
integer
mixed
message string or array of messagescopyTokenToSource(\Gems_Tracker_Token $token, string $language, integer $surveyId, string $sourceSurveyId = null
) : integer
\Gems_Tracker_Token
string
integer
Gems Survey Id
string
Optional Survey Id used by source
\Gems_Tracker_Source_SurveyNotFoundException |
---|
integer
1 of the token was inserted or changed, 0 otherwisegetAnswerDateTime(string $fieldName, \Gems_Tracker_Token $token, integer $surveyId, string $sourceSurveyId = null
) : \MUtil_Date
A seperate function as only the source knows what format the date/time value has.
string
Name of answer field
\Gems_Tracker_Token
Gems token object
integer
Gems Survey Id
string
Optional Survey Id used by source
\MUtil_Date
date time or nullgetCompletionTime(\Gems_Tracker_Token $token, integer $surveyId, string $sourceSurveyId = null
) : \MUtil_Date
A source always return null when it does not know this time (or does not know it well enough). In the case \Gems_Tracker_Token will do it's best to keep track by itself.
\Gems_Tracker_Token
Gems token object
integer
Gems Survey Id
string
Optional Survey Id used by source
\MUtil_Date
date time or nullgetDatesList(string $language, integer $surveyId, string $sourceSurveyId = null
) : array
Used in dropdown list etc..
string
(ISO) language string
integer
Gems Survey Id
string
Optional Survey Id used by source
array
fieldname => labelgetId() : integer
integer
The source Id of this sourcegetQuestionInformation(string $language, integer $surveyId, string $sourceSurveyId = null
) : array
string
(ISO) language string
integer
Gems Survey Id
string
Optional Survey Id used by source
array
Nested arraygetQuestionList(string $language, integer $surveyId, string $sourceSurveyId = null
) : array
.
string
(ISO) language string
integer
Gems Survey Id
string
Optional Survey Id used by source
array
fieldname => labelgetRawTokenAnswerRow(string $tokenId, integer $surveyId, string $sourceSurveyId = null
) : array
Function may return more fields than just the answers.
string
Gems Token Id
integer
Gems Survey Id
string
Optional Survey Id used by source
array
Field => Value arraygetRawTokenAnswerRows(array $filter, integer $surveyId, string $sourceSurveyId = null
) : array
Function may return more fields than just the answers. The $filter param is an array of filters to apply to the selection, it has some special formatting rules. The key is the db-field to filter on and the value could be a value or an array of values to filter on.
Special keys that should be mapped to the right field by the source are: respondentid organizationid consentcode token
So a filter of [token]=>[abc-def][def-abc] will return the results for these two tokens while a filter of [organizationid] => 70 will return all results for this organization.
array
filter array
integer
Gems Survey Id
string
Optional Survey Id used by source
array
Of nested Field => Value arrays indexed by tokenIdgetRawTokenAnswerRowsCount(array $filter, integer $surveyId, string $sourceSurveyId = null
) : integer
array
filter array
integer
Gems Survey Id
string
Optional Survey Id used by source
integer
getSourceDatabase() : \Zend_Db_Adapter_Abstract
\Zend_Db_Adapter_Abstract
getStartTime(\Gems_Tracker_Token $token, integer $surveyId, string $sourceSurveyId = null
) : \MUtil_Date
A source always return null when it does not know this time (or does not know it well enough). In the case \Gems_Tracker_Token will do it's best to keep track by itself.
\Gems_Tracker_Token
Gems token object
integer
Gems Survey Id
string
Optional Survey Id used by source
\MUtil_Date
date time or nullgetSurveyAnswerModel(\Gems_Tracker_Survey $survey, string $language= null
, string $sourceSurveyId= null
) : \MUtil_Model_ModelAbstract
\Gems_Tracker_Survey
string
Optional (ISO) language string
string
Optional Survey Id used by source
\MUtil_Model_ModelAbstract
getTokenUrl(\Gems_Tracker_Token $token, string $language, integer $surveyId, string $sourceSurveyId) : string
\Gems_Tracker_Token
Gems token object
string
integer
Gems Survey Id
string
Optional Survey Id used by source
string
The url to start the surveyinSource(\Gems_Tracker_Token $token, integer $surveyId, string $sourceSurveyId = null
) : boolean: boolean
\Gems_Tracker_Token
Gems token object
integer
Gems Survey Id
string
Optional Survey Id used by source
boolean
/
public function hasBatch();
Checks whether the token is in the source.boolean
isCompleted(\Gems_Tracker_Token $token, integer $surveyId, string $sourceSurveyId = null
) : boolean
\Gems_Tracker_Token
Gems token object
integer
Gems Survey Id
string
Optional Survey Id used by source
boolean
True if the token has completedsetRawTokenAnswers(\Gems_Tracker_Token $token, $answers, integer $surveyId, string $sourceSurveyId = null
) : true
Use $this->hasBatch to check for existence
\Gems_Tracker_Token
Gems token object
array Field => Value array
integer
Gems Survey Id
string
Optional Survey Id used by source
true
When answers changedsetTokenCompletionTime(\Gems_Tracker_Token $token, \Zend_Date|null $completionTime, integer $surveyId, string $sourceSurveyId = null
)
\Gems_Tracker_Token
Gems token object
\Zend_Date
null
\Zend_Date or null
integer
Gems Survey Id (actually required)
string
Optional Survey Id used by source
synchronizeSurveyBatch(\Gems_Task_TaskRunnerBatch $batch, integer $userId) : array
\Gems_Task_TaskRunnerBatch
integer
Id of the user who takes the action (for logging)
array
Returns an array of messagesupdateConsent(\Gems_Tracker_Token $token, integer $surveyId, string $sourceSurveyId= null
, string $consentCode= null
) : array: integer
\Gems_Tracker_Token
integer
Gems Survey Id
string
Optional Survey Id used by source
string
Optional consent code, otherwise code from token is used.
array
Returns an array of messages
/
public function synchronizeSurveys($userId);
Updates the consent code of the the token in the source (if needed)integer
1 of the token was inserted or changed, 0 otherwise