Make sure a \Gems_Form is used for validation

package Gems
subpackage Model_Translator
copyright Copyright (c) 2014 Erasmus MC
license New BSD License
since Class available since version 1.6.3 24-apr-2014 14:46:04
inherited_from \Gems_Model_Translator_RespondentAnswerTranslator

 Methods

Add the current row to a (possibly separate) batch that does the importing.

addSaveTask(\MUtil_Task_TaskBatch $importBatch, string $key, array $row) : \MUtil_Model_ModelTranslatorAbstract
Inherited

Parameters

$importBatch

\MUtil_Task_TaskBatch

The import batch to impor this row into

$key

string

The current iterator key

$row

array

translated and validated row

Returns

\MUtil_Model_ModelTranslatorAbstract(continuation pattern)

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void
Inherited

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

checkRegistryRequestsAnswers() : boolean
Inherited

Returns

booleanFalse if required values are missing.

Get information on the field translations

getFieldsTranslations() : array
Inherited

Exceptions

\MUtil_Model_ModelException

Returns

arrayof fields sourceName => targetName

Get the treatment when no token exists

getNoToken() : string
Inherited

Returns

stringOne of the TOKEN_ constants.

Get the error message for when no token exists

getNoTokenError(array $row, $key) : string
inherited_from \Gems_Model_Translator_RespondentAnswerTranslator::getNoTokenError()

Parameters

$row

$key

Returns

string

Get the error message for when no token exists

getNoTokenError(array $row, $key) : string
Inherited

Parameters

$row

$key

Returns

string

Returns an array of the field names that are required

getRequiredFields() : array
inherited_from \Gems_Model_Translator_RespondentAnswerTranslator::getRequiredFields()

Returns

arrayof fields sourceName => targetName

Returns an array of the field names that are required

getRequiredFields() : array
Inherited

Returns

arrayof fields sourceName => targetName

Get information on the field translations

getRespondentAnswerTranslations() : array
inherited_from \Gems_Model_Translator_RespondentAnswerTranslator::getRespondentAnswerTranslations()

Exceptions

\MUtil_Model_ModelException

Returns

arrayof fields sourceName => targetName

Get information on the field translations

getRespondentAnswerTranslations() : array
Inherited

Exceptions

\MUtil_Model_ModelException

Returns

arrayof fields sourceName => targetName

Get the id of the survey to import to

getSurveyId() : integer
Inherited

Returns

integer$surveyId

Get the treatment for completed tokens

getTokenCompleted() : string
Inherited

Returns

stringOne of the TOKEN_ constants.

Get the id of the track to import to or null

getTrackId() : integer
Inherited

Returns

integer$trackId

Get the treatment when no token exists

setNoToken(string $noToken) : \Gems_Model_Translator_AnswerTranslatorAbstract
Inherited

Parameters

$noToken

string

One of the TOKEN_ constants, but not TOKEN_OVERWRITE.

Returns

\Gems_Model_Translator_AnswerTranslatorAbstract(continuation pattern)

Get the treatment when no token exists

setSkipUnknownPatients(boolean $skip = false) : \Gems_Model_Translator_AnswerTranslatorAbstract
Inherited

Parameters

$skip

boolean

Returns

\Gems_Model_Translator_AnswerTranslatorAbstract(continuation pattern)

Set the id of the survey to import to

setSurveyId(integer $surveyId) : \Gems_Model_Translator_AnswerTranslatorAbstract
Inherited

Parameters

$surveyId

integer

Returns

\Gems_Model_Translator_AnswerTranslatorAbstract(continuation pattern)

Set the treatment for answered or double tokens

setTokenCompleted(string $tokenCompleted) : \Gems_Model_Translator_AnswerTranslatorAbstract
Inherited

Parameters

$tokenCompleted

string

One f the TOKEN_ constants.

Returns

\Gems_Model_Translator_AnswerTranslatorAbstract(continuation pattern)

Set the id of the track to import to or null

setTrackId(integer $trackId) : \Gems_Model_Translator_AnswerTranslatorAbstract
Inherited

Parameters

$trackId

integer

Returns

\Gems_Model_Translator_AnswerTranslatorAbstract(continuation pattern)

Perform any translations necessary for the code to work

translateRowValues(mixed $row, scalar $key) : mixed
Inherited

Parameters

$row

mixed

array or \Traversable row

$key

scalar

Returns

mixedRow array or false when errors occurred

Validate the data against the target form

validateRowValues(array $row, scalar $key) : mixed
Inherited

Parameters

$row

array

$key

scalar

Returns

mixedRow array or false when errors occurred

Create an empty form for filtering and validation

_createTargetForm() : \MUtil_Form
Inherited

Returns

\MUtil_Form

Check should a patient be imported

checkPatient(string $patientNr, integer $orgId) : boolean
Inherited

Parameters

$patientNr

string

$orgId

integer

Returns

boolean

If the token can be created find the respondent track for the token

findRespondentTrackFor(array $row) : integer | null
Inherited

Parameters

$row

array

Returns

integernull

Find the token id using the passed row data and the other translator parameters.

findTokenFor(array $row) : string | null
inherited_from \Gems_Model_Translator_RespondentAnswerTranslator::findTokenFor()

Parameters

$row

array

Returns

stringnull

Find the token id using the passed row data and the other translator parameters.

findTokenFor(array $row) : string | null
Inherited

Parameters

$row

array

Returns

stringnull

 Properties

 

One of the TOKEN_ constants telling what to do when no token exists

$_noToken : string

Default

self::TOKEN_ERROR
 

$_skipUnknownPatients

$_skipUnknownPatients : boolean

Default

false
 

The Gems id of the survey to import to

$_surveyId : integer

Default

 

One of the TOKEN_ constants telling what to do when the token is completed

$_tokenCompleted : string

Default

self::TOKEN_ERROR
 

The id of the track to import to or null

$_trackId : integer

Default

 

The name of the field to (temporarily) store the patient nr in

$completionField : string

Default

'completion_date'
 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$loader

$loader : \Gems_Loader

Default

 

The name of the field to (temporarily) store the organization id in

$orgIdField : string

Default

'organization_id'
 

Extra values the origanization id field accepts

$orgTranslations : array

Default

 

The name of the field to (temporarily) store the patient nr in

$patientNrField : string

Default

'patient_id'
 

The task used for import

$saveTask : string

Default

'Import_SaveAnswerTask'
 

$util

$util : \Gems_Util

Default

 Constants

 

Constant for creating an extra token when a token was already filled in.

TOKEN_DOUBLE = 'double' 
 

Constant for generating an error when a token does not exist or is already filled in.

TOKEN_ERROR = 'error' 
 

Constant for creating a new token, while disabling the existing token

TOKEN_OVERWRITE = 'overwrite' 
 

Constant for creating a new token, while disabling the existing token

TOKEN_SKIP = 'skip'