Standard Respondent model.

When a project defines its own sub-class of this class and names it _Model_RespondentModel, that class is loaded instead.

package Gems
subpackage Model
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.0
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

Self constructor

__construct() 

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 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 the table and field to check for respondent login checks

addLoginCheck() : \Gems_Model_RespondentModel

Returns

\Gems_Model_RespondentModel(continuation pattern)

Add the respondent name as a caclulated field to the model

addNameToModel(\Gems_Model_JoinModel $model, string $label) 
Static

Parameters

$model

\Gems_Model_JoinModel

$label

string

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

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_RespondentModel

Returns

\Gems_Model_RespondentModel

Set those settings needed for the detailed display

applyDetailSettings() : \Gems_Model_RespondentModel

Returns

\Gems_Model_RespondentModel

Set those values needed for editing

applyEditSettings(boolean $create = false) : \Gems_Model_RespondentModel

Parameters

$create

boolean

True when creating

Returns

\Gems_Model_RespondentModel

Apply hash function for array_walk_recursive in _checkFilterUsed()

applyHash(string $filterValue, string $filterKey) 
see

Parameters

$filterValue

string

$filterKey

string

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.

copyKeys()

copyKeys($reset = false

Parameters

$reset

Count the number of tracks the respondent has for this organization

countTracks(string $patientId, integer $organizationId, integer $respondentId = null, boolean $active = false) : boolean

Parameters

$patientId

string

Can be empty if $respondentId is passed

$organizationId

integer

When null looks at all organizations

$respondentId

integer

Pass when at hand, is looked up otherwise

$active

boolean

When true only tracks with a success code are returned

Returns

boolean

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

Get the current reception code for a respondent

getReceptionCode(string $patientId, integer $organizationId, integer $respondentId = null) : string

Parameters

$patientId

string

Can be empty if $respondentId is passed

$organizationId

integer

$respondentId

integer

Pass when at hand, is looked up otherwise

Returns

stringThe current reception code

Create a database model for retrieving the respondent tracks

getRespondentTracksModel() : \Gems_Model_JoinModel

Returns

\Gems_Model_JoinModelA NEW JoinModel, not a continuation pattern return

Has the respondent tracks

hasTracks(string $patientId, integer $organizationId, integer $respondentId = null, boolean $active = false) : boolean

Parameters

$patientId

string

Can be empty if $respondentId is passed

$organizationId

integer

When null looks at all organizations

$respondentId

integer

Pass when at hand, is looked up otherwise

$active

boolean

When true we look only for tracks with a success code

Returns

boolean

Return a hashed version of the input value.

hideSSN(mixed $value, boolean $isNew = false, string $name = null, array $context = array(), $isPost = false) : string

Parameters

$value

mixed

The value being saved

$isNew

boolean

True when a new item is being saved

$name

string

The name of the current field

$context

array

Optional, the other values being saved

$isPost

Returns

stringThe output to display

True when the default filter can contain multiple organizations

isMultiOrganization() : boolean

Returns

boolean

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 $saveTables = 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.

$saveTables

Returns

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

Return a hashed version of the input value.

saveSSN(mixed $value, boolean $isNew = false, string $name = null, array $context = array()) : string

Parameters

$value

mixed

The value being saved

$isNew

boolean

True when a new item is being saved

$name

string

The name of the current field

$context

array

Optional, the other values being saved

Returns

stringThe salted hash as a 32-character hexadecimal number.

Set the reception code for a respondent and cascade non-success codes to the tracks / surveys.

setReceptionCode(string $patientId, integer $organizationId, string $newCode, integer $respondentId = null, string $oldCode = null) : \Gems_Util_ReceptionCode

Parameters

$patientId

string

Can be empty if $respondentId is passed

$organizationId

integer

$newCode

string

String or \Gems_Util_ReceptionCode

$respondentId

integer

Pass when at hand, is looked up otherwise

$oldCode

string

Pass when at hand as tring or \Gems_Util_ReceptionCode, is looked up otherwise

Returns

\Gems_Util_ReceptionCodeThe new code reception code object for further processing

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

Return a hashed version of the input value.

whenSSN(mixed $value, boolean $isNew = false, string $name = null, array $context = array()) : boolean

Parameters

$value

mixed

The value being saved

$isNew

boolean

True when a new item is being saved

$name

string

The name of the current field

$context

array

Optional, the other values being saved

Returns

boolean

Add an organization filter if it wasn't specified in the filter.

_checkFilterUsed(mixed $filter) : array

Checks the filter on sematic correctness and replaces the text seacrh filter with the real filter.

Parameters

$filter

mixed

True for the filter stored in this model or a filter array

Returns

arrayThe filter to use

_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

Return a list of those who could be on the created_by, changed_by or opened_by fields

getChangersList() : array

Returns

arrayid => name

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

 

Determines the algorithm used to hash the social security number

$hashAlgorithm : integer

Default

'sha512'

Can be changed is derived classes, set to null to use old md5() method

 

Determines how the social security number is stored.

$hashSsn : integer

Default

self::SSN_HASH

Can be changed is derived classes.

 

$view

$view : \Zend_View

Default

 

$currentUser

$currentUser : \Gems_User_User

Default

 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$loader

$loader : \Gems_Loader

Default

 

Should the logincheck be added automatically

$loginCheck : boolean

Default

false
 

$project

$project : \Gems_Project_ProjectSettings

Default

 

$translate

$translate : \Zend_Translate

Default

 

$translateAdapter

$translateAdapter : \Zend_Translate_Adapter

Default

 

$util

$util : \Gems_Util

Default

 Constants

 

Store the SSN hashed in the database and display only '*****'

SSN_HASH = 1 
 

Do not use the SSN

SSN_HIDE = 2 
 

Store the SSN as is and display the value.

SSN_OPEN = 4