The RespondentTrackModel is the model used to display and edit respondent tracks in snippets.

The main additions to a standard JoinModel are for filling in the respondent and track info while creating new tracks and key fiddling code for the different use cases.

The respondent track model combines all possible information about the respondents track from the tables:

  • gems__reception_codes
  • gems__respondent2org
  • gems__respondent2track
  • gems__respondents
  • gems__staff (on created by)
  • gems__tracks
package Gems
subpackage Tracker_Model
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.4
inherited_from \Gems_Model_HiddenOrganizationModel

 Methods

Copy from \Zend_Translate_Adapter

_(string $text, string|\Zend_Locale $locale = null) : string
Inherited

Translates the given string returns the translation

Parameters

$text

string

Translation string

$locale

string\Zend_Locale

(optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information

Returns

string

Default constructor

__construct(string $name = 'surveys'

Parameters

$name

string

Optional different name for model

Create a model that joins two or more tables

__construct(string $name, string $startTable, string $fieldPrefix = null, mixed $saveable = null
Inherited

Parameters

$name

string

A name for the model

$startTable

string

The base table for the model

$fieldPrefix

string

Prefix to use for change fields (date/userid), if $saveable empty sets it to true

$saveable

mixed

Will changes to this table be saved, true or a combination of SAVE_MODE constants

Add tracking off manual end date changes by the user

addEditTracking() : \Gems_Tracker_Model_StandardTokenModel

Returns

\Gems_Tracker_Model_StandardTokenModel

Add a table to the model with a left join

addLeftTable(mixed $table, array $joinFields, string $fieldPrefix = null, mixed $saveable = null) : \Gems_Model_JoinModel
Inherited

Parameters

$table

mixed

The name of the table to join or a table object or an array(corr_name => tablename) or array(int => tablename, corr_name)

$joinFields

array

Array of source->dest primary keys for this join

$fieldPrefix

string

Prefix to use for change fields (date/userid), if $saveable empty sets it to true

$saveable

mixed

Will changes to this table be saved, true or a combination of SAVE_MODE constants

Returns

\Gems_Model_JoinModel

Add a table to the model with a right join

addRightTable(mixed $table, array $joinFields, string $fieldPrefix = null, mixed $saveable = null) : \Gems_Model_JoinModel
Inherited

Parameters

$table

mixed

The name of the table to join or a table object or an array(corr_name => tablename) or array(int => tablename, corr_name)

$joinFields

array

Array of source->dest primary keys for this join

$fieldPrefix

string

Prefix to use for change fields (date/userid), if $saveable empty sets it to true

$saveable

mixed

Will changes to this table be saved, true or a combination of SAVE_MODE constants

Returns

\Gems_Model_JoinModel

Add a table to the model with an inner join

addTable(mixed $table, array $joinFields, string $fieldPrefix = null, mixed $saveable = null) : \Gems_Model_JoinModel
Inherited

Parameters

$table

mixed

The name of the table to join or a table object or an array(corr_name => tablename) or array(int => tablename, corr_name)

$joinFields

array

Array of source->dest primary keys for this join

$fieldPrefix

string

Prefix to use for change fields (date/userid), if $saveable empty sets it to true

$saveable

mixed

Will changes to this table be saved, true or a combination of SAVE_MODE constants

Returns

\Gems_Model_JoinModel

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

afterRegistry() : void
Inherited

This function is no needed if the classes are setup correctly

Set those settings needed for the browse display

applyBrowseSettings() : \Gems_Model_RespondentTrackModel

Returns

\Gems_Model_RespondentTrackModel

Set those settings needed for the detailed display

applyDetailSettings(\Gems_Tracker_Engine_TrackEngineInterface $trackEngine, boolean $edit = false) : \Gems_Model_RespondentTrackModel

Parameters

$trackEngine

\Gems_Tracker_Engine_TrackEngineInterface

$edit

boolean

When true the fields are added in edit mode

Returns

\Gems_Model_RespondentTrackModel

Set those values needed for editing

applyEditSettings(\Gems_Tracker_Engine_TrackEngineInterface $trackEngine) : \Gems_Model_RespondentTrackModel

Parameters

$trackEngine

\Gems_Tracker_Engine_TrackEngineInterface

Returns

\Gems_Model_RespondentTrackModel

Stores the fields that can be used for sorting or filtering in the sort / filter objects attached to this model.

applyParameters(array $parameters, boolean $includeNumericFilters = false) : array
inherited_from \Gems_Model_HiddenOrganizationModel::applyParameters()

Parameters

$parameters

array

$includeNumericFilters

boolean

When true numeric filter keys (0, 1, 2...) are added to the filter as well

Returns

arrayThe $parameters minus the sort & textsearch keys

Stores the fields that can be used for sorting or filtering in the sort / filter objects attached to this model.

applyParameters(array $parameters, boolean $includeNumericFilters = false) : array
Inherited

Parameters

$parameters

array

$includeNumericFilters

boolean

When true numeric filter keys (0, 1, 2...) are added to the filter as well

Returns

arrayThe $parameters minus the sort & textsearch keys

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

The current organization id of the current user

getCurrentOrganization() : integer
Inherited

Returns

integer

Return an identifier the item specified by $forData

getKeyRef(mixed $forData, array $href = array(), $organizationInKey = null) : array
Inherited

basically transforms the fieldnames ointo oan IDn => value array

Parameters

$forData

mixed

Array value to vilter on

$href

array

Or \ArrayObject

$organizationInKey

Returns

arrayThat can by used as href

Creates new items - in memory only. Extended to load information from linked table using $filter().

loadNew(integer $count = null, array $filter = null) : array

When $filter contains the keys gr2o_patient_nr and gr2o_id_organization the corresponding respondent information is loaded into the new item.

When $filter contains the key gtr_id_track the corresponding track information is loaded.

The $filter values are also propagated to the corresponding key values in the new item.

Parameters

$count

integer

When null a single new item is return, otherwise a nested array with $count new items

$filter

array

Allowed key values: gr2o_patient_nr, gr2o_id_organization and gtr_id_track

Returns

arrayNested when $count is not null, otherwise just a simple array

Copy from \Zend_Translate_Adapter

plural(string $singular, string $plural, integer $number, string|\Zend_Locale $locale = null) : string
Inherited

Translates the given string using plural notations Returns the translated string

see

Parameters

$singular

string

Singular translation string

$plural

string

Plural translation string

$number

integer

Number for detecting the correct plural

$locale

string\Zend_Locale

(Optional) Locale/Language to use, identical with locale identifier, @see \Zend_Locale for more information

Returns

string

Save a single model item.

save(array $newValues, array $filter = null) : array

Parameters

$newValues

array

The values to store for a single model item.

$filter

array

If the filter contains old key values these are used to decide on update versus insert.

Returns

arrayThe values as they are after saving (they may change).

setTableSaveable()

setTableSaveable(string $table_name, string $fieldPrefix = null, mixed $saveable = null) : \Gems_Model_JoinModel
Inherited

Parameters

$table_name

string

Does not test for existence

$fieldPrefix

string

Prefix to use for change fields (date/userid), if $saveable empty sets it to true

$saveable

mixed

Will changes to this table be saved, true or a combination of SAVE_MODE constants

Returns

\Gems_Model_JoinModel

_checkSaveable()

_checkSaveable(mixed $saveable, string $fieldPrefix) : mixed
Inherited

Parameters

$saveable

mixed

Will changes to this table be saved, true or a combination of SAVE_MODE constants

$fieldPrefix

string

Prefix to use for change fields (date/userid), if $saveable empty sets it to true

Returns

mixedThe saveable setting to use

Returns a translate adaptor

getTranslateAdapter() : \Zend_Translate_Adapter
Inherited

Returns

\Zend_Translate_Adapter

Function that checks the setup of this class/traight

initTranslateable() 
Inherited

This function is not needed if the variables have been defined correctly in the source for this object and theose variables have been applied.

return @void

 Properties

 

$currentUser

$currentUser : \Gems_User_User

Default

 

$translate

$translate : \Zend_Translate

Default

 

$translateAdapter

$translateAdapter : \Zend_Translate_Adapter

Default

 

$util

$util : \Gems_Util

Default