TargetLoaderAbstract is used for classes that chain from \Gems_Loader but are also a target themselves.

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

package Gems
subpackage Agenda
copyright Copyright (c) 2013 Erasmus MC
license New BSD License
since Class available since version 1.6.2
inherited_from \Gems_Loader_TargetLoaderAbstract

 Methods

Copy from \Zend_Translate_Adapter

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

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

__construct()

__construct(\type $container, array $dirs) 

Parameters

$container

\type

A container acting as source for \MUtil_Registry_Source

$dirs

array

The directories where to look for requested classes

__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)

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

afterRegistry() : void

This function is no needed if the classes are setup correctly

inherited_from \Gems_Loader_TargetLoaderAbstract::afterRegistry()

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.

Dynamically load and create a [Gems|Project]_Agenda_ class

createAgendaClass(string $className, mixed $param1 = null, mixed $param2 = null) : object

Parameters

$className

string

$param1

mixed

$param2

mixed

Returns

object

Create agenda select

createAppointmentSelect(string|array $fields = '*') : \Gems\Agenda\AppointmentSelect

Parameters

$fields

stringarray

The appointment fields to select

Returns

\Gems\Agenda\AppointmentSelect

Find the first appointment matching this query

getActiveAppointments(integer $respondentId, integer $organizationId, string $patientNr = null, string $where = null) : integer: array

Parameters

$respondentId

integer

When null $patientNr is required

$organizationId

integer

$patientNr

string

Optional for when $respondentId is null

$where

string

Optional extra where statement

Returns

integerThe first found appointment id or false / public function findFirstAppointmentId($filterId, \Gems_Tracker_RespondentTrack $respTrack, $from = null, $oper = '>=', $uniqueness = 0) { $filter = $this->getFilter($filterId); if (! $filter) { return false; } $respondentId = $respTrack->getRespondentId(); $orgId = $respTrack->getOrganizationId(); $select = $this->db->select(); $select->from('gems__appointments', 'gap_id_appointment') ->where('gap_id_user = ?', $respondentId) ->where('gap_id_organization = ?', $orgId) ->where('gap_status IN (?)', $this->getStatusKeysActiveDbQuoted()) ->where($filter->getSqlWhere()) ->limit(1); if ($from) { if ($from instanceof \Gems_Agenda_Appointment) { $from = $from->getAdmissionTime(); } if ($from instanceof \Zend_Date) { $from = $from->toString('yyyy-MM-dd HH:mm:ss'); } $select->where("gap_admission_time $oper ?", $from); } if ('<' === $oper[0]) { $select->order('gap_admission_time DESC'); } else { $select->order('gap_admission_time ASC'); } if ($uniqueness) { $fieldId = intval($filter->getAppointmentFieldId()); $respTrackId = intval($respTrack->getRespondentTrackId()); switch ($uniqueness) { case 1: $select->where( "gap_id_appointment NOT IN (SELECT gr2t2a_id_appointment FROM gems__respondent2track2appointment WHERE gr2t2a_id_appointment IS NOT NULL AND gr2t2a_id_respondent_track = $respTrackId AND gr2t2a_id_app_field != $fieldId)" ); break; case 2: $trackId = $respTrack->getTrackId(); $select->where( "gap_id_appointment NOT IN (SELECT gr2t2a_id_appointment FROM gems__respondent2track2appointment INNER JOIN gems__respondent2track ON gr2t2a_id_respondent_track = gr2t_id_respondent_track WHERE gr2t2a_id_appointment IS NOT NULL AND gr2t_id_track = $trackId AND NOT (gr2t2a_id_respondent_track = $respTrackId AND gr2t2a_id_app_field = $fieldId))" ); break; // case 3: // $select->where( // "gap_id_appointment NOT IN // (SELECT gr2t2a_id_appointment FROM gems__respondent2track2appointment // WHERE gr2t2a_id_appointment IS NOT NULL AND // NOT (gr2t2a_id_respondent_track = $respTrackId AND // gr2t2a_id_app_field = $fieldId))" // ); // break; // default: } } // \MUtil_Echo::track($select->__toString(), $uniqueness, $filter->getSqlWhere()); return $this->db->fetchOne($select); } Get all active respondents for this user
arrayappointmentId => appointment description

getActivities()

getActivities(integer $organizationId = null) : array

Parameters

$organizationId

integer

Optional

Returns

arrayactivity_id => name

Get an appointment object

getAppointment(mixed $appointmentData) : \Gems_Agenda_Appointment

Parameters

$appointmentData

mixed

Appointment id or array containing appintment data

Returns

\Gems_Agenda_Appointment

Overrule this function to adapt the display of the agenda items for each project

getAppointmentDisplay(array $row) : string
see

Parameters

$row

array

Row containing result select

Returns

string

Get all appointments for a respondent

getAppointments(integer $respondentId, integer $organizationId, string $patientNr = null, string $where = null) : array

Parameters

$respondentId

integer

When null $patientNr is required

$organizationId

integer

$patientNr

string

Optional for when $respondentId is null

$where

string

Optional extra where statement

Returns

arrayappointmentId => appointment description

Get the field names in appontments with their labels as the value

getFieldLabels() : array

Returns

arrayfieldname => label

Get a filter from the database

getFilter($filterId) : \Gems\Agenda\AppointmentFilterInterface

Parameters

$filterId

Id of a single filter

Returns

\Gems\Agenda\AppointmentFilterInterfaceor null

Load the list of assignable filters

getFilterList() : array

Returns

arrayfilter_id => label

Get the filters from the database

getFilters($sql) : array

Parameters

$sql

SQL statement

Returns

arrayof AppointmentFilterInterface objects

getHealthcareStaff()

getHealthcareStaff(integer $organizationId = null) : array

Parameters

$organizationId

integer

Optional

Returns

arrayactivity_id => name

Returns an array with identical key => value pairs containing care provision locations.

getLocations(integer $orgId = null) : array

Parameters

$orgId

integer

Optional to slect for single organization

Returns

array

getProcedures()

getProcedures(integer $organizationId = null) : array

Parameters

$organizationId

integer

Optional

Returns

arrayactivity_id => name

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

Get the status codes for all active agenda items

getStatusCodes() : array

Returns

arraycode => label

Get the status codes for active agenda items

getStatusCodesActive() : array

Returns

arraycode => label

Get the status codes for inactive agenda items

getStatusCodesInactive() : array

Returns

arraycode => label

Get the status keys for active agenda items

getStatusKeysActive() : array

Returns

arraynr => code

Get the status keys for active agenda items as a quoted db query string for use in "x IN (?)"

getStatusKeysActiveDbQuoted() : \Zend_Db_Expr

Returns

\Zend_Db_Expr

Get the status keys for inactive agenda items

getStatusKeysInactive() : array

Returns

arraynr => code

Get the status keys for active agenda items as a quoted db query string for use in "x IN (?)"

getStatusKeysInactiveDbQuoted() : \Zend_Db_Expr

Returns

\Zend_Db_Expr

Get the type codes for agenda items

getTypeCodes() : array

Returns

arraycode => label

Returns true when the status code is active

isStatusActive(string $code) : boolean

Parameters

$code

string

Returns

boolean

Find an activity code for the name and organization.

matchActivity(string $name, integer $organizationId, boolean $create = true) : integer

Parameters

$name

string

The name to match against

$organizationId

integer

Organization id

$create

boolean

Create a match when it does not exist

Returns

integeror null

matchFilters()

matchFilters(\Gems_Agenda_Appointment $appointment) : array

Parameters

$appointment

\Gems_Agenda_Appointment

Returns

arrayof AppointmentFilterInterface

Find a healt care provider for the name and organization.

matchHealthcareStaff(string $name, integer $organizationId, boolean $create = true) : integer

Parameters

$name

string

The name to match against

$organizationId

integer

Organization id

$create

boolean

Create a match when it does not exist

Returns

integergas_id_staff staff id

Find a location for the name and organization.

matchLocation(string $name, integer $organizationId, boolean $create = true) : array

Parameters

$name

string

The name to match against

$organizationId

integer

Organization id

$create

boolean

Create a match when it does not exist

Returns

arraylocation

Find a procedure code for the name and organization.

matchProcedure(string $name, integer $organizationId, boolean $create = true) : integer

Parameters

$name

string

The name to match against

$organizationId

integer

Organization id

$create

boolean

Create a match when it does not exist

Returns

integeror null

newFilterModel()

newFilterModel() : \Gems\Agenda\AppointmentFilterModel

Returns

\Gems\Agenda\AppointmentFilterModel

Creates a new filter class object

newFilterObject(string $className) : object

Parameters

$className

string

The part after *_AgendaFilter

Returns

object

Copy from \Zend_Translate_Adapter

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

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

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

Get the select statement for appointments in getAppointments()

_getAppointmentSelect() : \Zend_Db_Select

Allows for overruling on project level

Returns

\Zend_Db_Select

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

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

Get a structured nested array contain information on all the appointment

getFieldData() : array

Returns

arrayfieldname => array(label[, tableName, tableId, tableLikeFilter))

Function that checks the setup of this class/traight

initTranslateable() 

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

Load the filters from cache or elsewhere

loadDefaultFilters() : array

Returns

arrayof AppointmentFilterInterface

 Properties

 

$appointmentDisplayFormat

$appointmentDisplayFormat : string

Default

'dd-MM-yyyy HH:mm'
 

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

 

$cache

$cache : \Zend_Cache_Core

Default

 

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

$cascade : string

Default

'Agenda'
 

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

 

$translateAdapter

$translateAdapter : \Zend_Translate_Adapter

Default

 

of \Gems_Agenda_Appointment

$_appointments : array

Default

array()
 

of AppointmentFilterInterface

$_filters : array

Default

array()