Central storage / access point for working with gems models.

As these classes may need setting of values this subclass implements the checkRegistryRequestsAnswers() easy access to resources.

package Gems
subpackage Model
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.0
inherited_from \Gems_Loader_TargetLoaderAbstract

 Methods

__construct()

__construct(mixed $container, array $dirs) 
Inherited

Parameters

$container

mixed

A container acting as source for \MUtil_Registry_Source

$dirs

array

The directories where to look for requested classes

__get()

__get($name) 
Inherited

Parameters

$name

Add prefixed paths to the registry of paths

addPrefixPath(string $prefix, $path, boolean $prepend = true) : \Gems_Loader_LoaderAbstract
Inherited

Parameters

$prefix

string

$path

$prepend

boolean

Put path at the beginning of the stack (has no effect when prefix / dir already set)

Returns

\Gems_Loader_LoaderAbstract(continuation pattern)

Link the model to the user_passwords table.

addUserPassword(\Gems_Model_JoinModel $model) 
Static
deprecated since version 1.5.4

Parameters

$model

\Gems_Model_JoinModel

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

afterRegistry() : void
Inherited

Allows the loader to set resources.

answerRegistryRequest(string $name, mixed $resource) : boolean
Inherited

Parameters

$name

string

Name of resource to set

$resource

mixed

The resource.

Returns

booleanTrue if $resource was OK

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.

Load project specific application model or general Gems model otherwise

createAppointmentModel() : \Gems_Model_AppointmentModel

Returns

\Gems_Model_AppointmentModel

Create a Gems project wide unique user id

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

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

integer

Load project specific model or general Gems model otherwise

createLogModel() : \Gems\Model\LogModel

Returns

\Gems\Model\LogModel

Load project specific model or general Gems model otherwise

createRespondentModel() : \Gems_Model_RespondentModel

Returns

\Gems_Model_RespondentModel

Load the comm log model

getCommLogModel(boolean $detailed) : \Gems\Model\CommLogModel

Parameters

$detailed

boolean

True when the current action is not in $summarizedActions.

Returns

\Gems\Model\CommLogModel

Load the commtemplate model

getCommtemplateModel() : \Gems_Model_CommtemplateModel

Returns

\Gems_Model_CommtemplateModel

Returns the OpenRosaFormModel

getOpenRosaFormModel() : \OpenRosa_Model_OpenRosaFormModel

It is special since it can show how many responses each table has

Returns

\OpenRosa_Model_OpenRosaFormModel

Load the organization model

getOrganizationModel(array|mixed $styles = array()) : \Gems_Model_OrganizationModel

Parameters

$styles

arraymixed

Returns

\Gems_Model_OrganizationModel

Allows the loader to know the resources to set.

getRegistryRequests() : array
Inherited

Returns those object variables defined by the subclass but not at the level of this definition.

Can be overruled.

Returns

arrayof string names

Load project specific respondent model or general Gems model otherwise

getRespondentModel($detailed) : \Gems_Model_RespondentModel

Parameters

$detailed

Returns

\Gems_Model_RespondentModel

Get the respondent relation model

getRespondentRelationModel() : \Gems_Model_RespondentRelationModel

Returns

\Gems_Model_RespondentRelationModel

Load the staffmodel

getStaffModel(boolean $addLogin = true) : \Gems_Model_StaffModel

Parameters

$addLogin

boolean

Add the login tables to the model

Returns

\Gems_Model_StaffModel

Set a field in this model as a gems unique user id

setAsGemsUserId(\MUtil_Model_DatabaseModelAbstract $model, string $idField) 

Parameters

$model

\MUtil_Model_DatabaseModelAbstract

$idField

string

Field that uses global id.

Function that automatically fills changed, changed_by, created and created_by fields with a certain prefix.

setChangeFieldsByPrefix(\MUtil_Model_DatabaseModelAbstract $model, string $prefix, integer $userid = null
Static

Parameters

$model

\MUtil_Model_DatabaseModelAbstract

$prefix

string

Three letter code

$userid

integer

Gems user id

Add a subdirectory / sub name to a list of class load paths

_cascadedDirs(array $dirs, string $cascade, boolean $fullClassnameFallback = true) : array
Inherited

Parameters

$dirs

array

prefix => path

$cascade

string

The sub directories to cascade to

$fullClassnameFallback

boolean

Allows full class name specification instead of just plugin name part

Returns

arrayprefix => path

Returns $this->$name, creating the item if it does not yet exist.

_getClass(string $name, string $className = null, array $arguments = array()) : mixed
Inherited

Parameters

$name

string

The $name of the variable to store this object in.

$className

string

Class name or null if the same as $name, prepending $this->_dirs.

$arguments

array

Class initialization arguments.

Returns

mixedInstance of $className

Create or loads the class. When only loading, this function returns a StaticCall object that can be invoked lazely.

_loadClass(string $name, boolean $create = false, array $arguments = array()) : mixed
Inherited
see
see

Parameters

$name

string

The class name, minus the part in $this->_dirs.

$create

boolean

Create the object, or only when an \MUtil_Registry_TargetInterface instance.

$arguments

array

Class initialization arguments.

Returns

mixedA class instance or a \MUtil_Lazy_StaticCall object

Link the model to the user_logins table.

addUserLogin(\Gems_Model_JoinModel $model, string $loginField, string $organizationField) 

Parameters

$model

\Gems_Model_JoinModel

$loginField

string

Field that links to login name field.

$organizationField

string

Field that links to the organization field.

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

 Properties

 

Field name in respondent model containing the login id.

$respondentLoginIdField : string

Default

'gr2o_patient_nr'
 

The prefix/path location to look for classes.

$_dirs : array

Default

The standard value is

  • => application/classes
  • Gems => library/Gems/classes

But an alternative could be:

  • Demopulse => application/classes
  • Pulse => application/classes
  • Gems => library/Gems/classes
 

$_loader

$_loader : \MUtil_Loader_PluginLoader

Default

 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

'Model'
 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

null
 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$loader

$loader : \Gems_Loader

Default

 

$translate

$translate : \Zend_Translate

Default

 

The length of a user id.

$userIdLen : integer

Default

8
 

$util

$util : \Gems_Util

Default

 Constants

 

Request key for appointments

APPOINTMENT_ID = 'aid' 
 

Request key for track fields

FIELD_ID = 'fid' 
 

ID_TYPE

ID_TYPE = 'id_type' 
 

Request key for log items

LOG_ITEM_ID = 'li' 
 

Request key for respondent tracks

RESPONDENT_TRACK = 'rt' 
 

Request key for rounds

ROUND_ID = 'rid' 
 

Request keys for surveys

SURVEY_ID = 'si' 
 

Request key for tracks (not respondent tracks, tracks!)

TRACK_ID = 'tr'