Object representing a track assignment to a respondent.

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 $respTracksData) 

Parameters

$respTracksData

mixed

Track Id or array containing reps2track record

Returns a callable if a method is called as a variable

__get(string $name) : Callable
Inherited

Parameters

$name

string

Returns

Callable

Check this respondent track for the number of tokens completed / to do

_checkTrackCount(integer $userId) : integer

Parameters

$userId

integer

Id of the user who takes the action (for logging)

Returns

integer1 if the track was changed by this code

Adds the code fields to the fieldData array

_fixFieldData() 

Add a one-off survey to the existing track.

addSurveyToTrack(\type $surveyId, \type $surveyData, integer $userId, boolean $checkTrack = true) : \Gems_Tracker_Token

Parameters

$surveyId

\type

the gsu_id of the survey to add

$surveyData

\type

$userId

integer

$checkTrack

boolean

Should the track be checked? Set to false when adding more then one and check manually

Returns

\Gems_Tracker_Token

Add a one-off survey to the existing track.

addTokenToTrack(\Gems_Tracker_Token $token, $tokenData, integer $userId, boolean $checkTrack = true) : \Gems_Tracker_Token

Parameters

$token

$tokenData

$userId

integer

$checkTrack

boolean

Should the track be checked? Set to false when adding more then one and check manually

Returns

\Gems_Tracker_Token

Set menu parameters from this token

applyToMenuSource(\Gems_Menu_ParameterSource $source) : \Gems_Tracker_RespondentTrack

Parameters

$source

\Gems_Menu_ParameterSource

Returns

\Gems_Tracker_RespondentTrack(continuation pattern)

Assign the tokens to the correct relation

assignTokensToRelations() : integer

Only surveys that have not yet been answered will be assigned to the correct relation.

Returns

integerNumber of changes tokens

Calculates the track end date

calculateEndDate() : string

The end date can be calculated when:

  • all active tokens have a completion date
  • or all active tokens have a valid until date
  • or the end date of the tokens is calculated using the end date

    You can overrule this calculation at the project level.

Returns

stringor null

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.

Check this respondent track for changes to the tokens

checkTrackTokens(integer $userId, \Gems_Tracker_Token $fromToken = null, \Gems_Tracker_Token $skipToken = null) : integer

Parameters

$userId

integer

Id of the user who takes the action (for logging)

$fromToken

\Gems_Tracker_Token

Optional token to start from

$skipToken

\Gems_Tracker_Token

Optional token to skip in the recalculation when $fromToken is used

Returns

integerThe number of tokens changed by this code

Returns a token with a success reception code for this round or null

getActiveRoundToken(\type $roundId, \Gems_Tracker_Token $token = null) : \Gems_Tracker_Token

Parameters

$roundId

\type

Gems round id

$token

\Gems_Tracker_Token

Optional token to add as a round (for speed optimization)

Returns

\Gems_Tracker_Token

getCode()

getCode() : string

Returns

stringInternal code of the track

Return all possible code fields with the values filled for those that exist for this track, optionally with a prefix

getCodeFields() : array

Returns

array[prefix]code => value

getComment()

getComment() : string

Returns

stringComment field

getCompleted()

getCompleted() : integer

Returns

integerThe number of rounds completed

getCount()

getCount() : integer

Returns

integerThe number of rounds

The round description of the first round that has not been answered.

getCurrentRound() : string

Returns

stringRound description or Stopped/Completed if not found.

getDate()

getDate(string $fieldName) : \MUtil_Date

Parameters

$fieldName

string

Returns

\MUtil_Date

getDeleteSnippets()

getDeleteSnippets() : array

Returns

arrayof snippet names for deleting the track

getEditSnippets()

getEditSnippets() : array
deprecated since version 1.7.1 Snippets defined TrackAction

Returns

arrayof snippet names for editing this respondent track

The end date of this track

getEndDate() : \MUtil_Date

Returns

\MUtil_Dateor null

Returns the field data for this respondent track id.

getFieldData() : array

Returns

arrayof the existing field values for this respondent track

Returns the description of this track as stored in the fields.

getFieldsInfo() : string

Returns

string

Returns the first token in this track

getFirstToken() : \Gems_Tracker_Token

Returns

\Gems_Tracker_Token

Returns the first token in this track

getLastToken() : \Gems_Tracker_Token

Returns

\Gems_Tracker_Token

getOrganizationId()

getOrganizationId() : integer

Returns

integerThe organization id

getPatientNumber()

getPatientNumber() : string

Returns

stringThe respondents patient number

Return the \Gems_Util_ReceptionCode object

getReceptionCode() : \Gems_Util_ReceptionCode

Returns

\Gems_Util_ReceptionCodereception code

Get the respondent linked to this token

getRespondent() : \Gems_Tracker_Respondent

Returns

\Gems_Tracker_Respondent

getRespondentId()

getRespondentId() : integer

Returns

integerThe respondent id

Return the default language for the respondent

getRespondentLanguage() : string

Returns

stringTwo letter language code

Return the name of the respondent

getRespondentName() : string

Returns

stringThe respondents name

getRespondentTrackId()

getRespondentTrackId() : integer

Returns

integerThe respondent2track id

Return the appointment (if any) linked to the valid after setting of given roundId

getRoundAfterAppointmentId(integer $roundId) : integer

Parameters

$roundId

integer

Returns

integer| null | false False when RoundId not found or not an appointment otherwise appointment id or null when not set

Return the round code for a given roundId

getRoundCode(integer $roundId) : string | null

Parameters

$roundId

integer

Returns

stringnullNull when RoundId not found

The start date of this track

getStartDate() : \MUtil_Date

Returns

\MUtil_Date

Returns all the tokens in this track

getTokens(boolean $refresh = false) : array

Parameters

$refresh

boolean

When true, always reload

Returns

arrayof \Gems_Tracker_Token

getTrackEngine()

getTrackEngine() : \Gems_Tracker_Engine_TrackEngineInterface

Returns

\Gems_Tracker_Engine_TrackEngineInterface

getTrackId()

getTrackId() : integer

Returns

integerThe track id

Find out if there are field update events and delegate to the event if needed

handleFieldUpdate(integer $userId) 

Parameters

$userId

integer

handleRoundCompletion()

handleRoundCompletion(mixed $token, integer $userId) : integer

Parameters

$token

mixed

$userId

integer

The current user

Returns

integerThe number of tokens changed by this event

Find out if there are track calculation events and delegate to the event if needed

handleTrackCalculation(integer $userId) 

Parameters

$userId

integer

Find out if there are track completion events and delegate to the event if needed

handleTrackCompletion(array $values, integer $userId) 

Parameters

$values

array

The values changed before entering this event

$userId

integer

hasSuccesCode()

hasSuccesCode() : boolean

Returns

boolean

Are there still unanswered rounds

isOpen() : boolean

Returns

boolean

Refresh the fields (to reflect any changed appointments)

recalculateFields(integer $userId, $fieldsChanged = false) : integer

Parameters

$userId

integer

The current user or null if a recalculation should not be performed

$fieldsChanged

Returns

integerThe number of tokens changed as a result of this update

refresh()

refresh(array $gemsData = null) : \Gems_Tracker_RespondentTrack

Parameters

$gemsData

array

Optional, the data refresh with, otherwise refresh from database.

Returns

\Gems_Tracker_RespondentTrack(continuation pattern)

Restores tokens for this track, when the reception code matches the given $oldCode

restoreTokens(\Gems_Util_ReceptionCode $oldCode, \Gems_Util_ReceptionCode $newCode) : integer

Used when restoring a respondent or this tracks, and the restore tracks/tokens box is checked.

Parameters

$oldCode

\Gems_Util_ReceptionCode

The old reception code

$newCode

\Gems_Util_ReceptionCode

the new reception code

Returns

integerThe number of restored tokens

Set the end date for this respondent track.

setEndDate(mixed $endDate, integer $userId) : integer

Parameters

$endDate

mixed

The new end date for this track

$userId

integer

The current user

Returns

integer1 if the token has changed, 0 otherwise

Update one or more values for this track's fielddata.

setFieldData(array $data, integer $userId = null) : array

Return the complete set of fielddata

Parameters

$data

array

$userId

integer

The current user, when passed the track_info is recalculated and saved

Returns

array

Set the reception code for this respondent track and make sure the necessary cascade to the tokens and thus the source takes place.

setReceptionCode(string $code, string $comment, integer $userId) : integer

Parameters

$code

string

The new (non-success) reception code or a \Gems_Util_ReceptionCode object

$comment

string

Comment for tokens. False values leave value unchanged

$userId

integer

The current user

Returns

integer1 if the token has changed, 0 otherwise

Makes sure the respondent data is part of the $this->_respTrackData

_ensureRespondentData() 

Makes sure the rounds info is loaded

_ensureRounds(boolean $reload = false

Parameters

$reload

boolean

Makes sure the fieldData is in $this->_fieldData

_ensureFieldData(boolean $reload = false

Parameters

$reload

boolean

Optional parameter to force reload.

_updateTrack()

_updateTrack(array $values, $userId) 

Parameters

$values

$userId

 Properties

 

of round_id => \Gems_Tracker_Token

$_activeTokens : array

Default

array()
 

$_checkStart

$_checkStart : \Gems_Tracker_Token

Default

 

If a field has a code name the value will occur both using the code name and using the id.

$_fieldData : array

Default

null
 

$_firstToken

$_firstToken : \Gems_Tracker_Token

Default

 

The gems__respondent2track data

$_respTrackData : array

Default

 

The gems__respondent2track id

$_respTrackId : integer

Default

 

$_respondentObject

$_respondentObject : \Gems_Tracker_Respondent

Default

null
 

The gems__rounds data

$_rounds : array

Default

null
 

of \Gems_Tracker_Token

$_tokens : array

Default

 

$currentUser

$currentUser : \Gems_User_User

Default

 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$loader

$loader : \Gems_Loader

Default

 

$locale

$locale : \Zend_Locale

Default

 

$tracker

$tracker : \Gems_Tracker

Default

 

$util

$util : \Gems_Util

Default