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 16:08:57
inherited_from \Gems_Model_ModelTranslatorAbstract

 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

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

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 values are missing.

Get information on the field translations

getFieldsTranslations() : array

Exceptions

\MUtil_Model_ModelException

Returns

arrayof fields sourceName => targetName

Get the treatment when no token exists

getNoToken() : string

Returns

stringOne of the TOKEN_ constants.

Get the error message for when no token exists

getNoTokenError(array $row, $key) : string

Parameters

$row

$key

Returns

string

Get the id of the survey to import to

getSurveyId() : integer

Returns

integer$surveyId

Get the treatment for completed tokens

getTokenCompleted() : string

Returns

stringOne of the TOKEN_ constants.

Get the id of the track to import to or null

getTrackId() : integer

Returns

integer$trackId

Get the treatment when no token exists

setNoToken(string $noToken) : \Gems_Model_Translator_AnswerTranslatorAbstract

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

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

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

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

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

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

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

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

Parameters

$row

array

Returns

integernull

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

findTokenFor(array $row) : string | null

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

 

$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'

 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'