The import loader is used to gather all the GemsTracker specific knowledge for importing model data.

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

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

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.

Function to load survey specific import translators, as opposed to the generic answer translators loaded using $this->getTranslators('answers')

getAnswerImporters(\Gems_Tracker_Survey $survey, string $filename = null) : array

Parameters

$survey

\Gems_Tracker_Survey

$filename

string

Optional, name of file to import

Returns

arrayname => translator

Name of the default import translator

getDefaultTranslator(string $controller, string $filename = null) : string

Parameters

$controller

string

Name of controller (or other id)

$filename

string

Optional, name of file to import

Returns

string

The directory where the file should be stored when the import failed

getFailureDirectory(string $controller = null) : string

Parameters

$controller

string

Name of controller (or other id)

Returns

string

The regex mask for source filenames, use of / slashes for directory seperator required

getFileImportMask() : string

Returns

string

Get the directory to use as the root for automatic import

getFileImportRoot() : string

Returns

string

getFileImporter()

getFileImporter(string $filename) : \Gems_Import_Importer

Parameters

$filename

string

Name of file to import

Returns

\Gems_Import_Importeror null

Get the controller that should be linked to the filename

getFilenameController(string $filename) : string

Parameters

$filename

string

Name of file to import

Returns

stringor false if none found.

getImporter()

getImporter(string $controller, \MUtil_Model_ModelAbstract $targetModel = null) : \Gems_Import_Importer

Parameters

$controller

string

Name of controller (or other id)

$targetModel

\MUtil_Model_ModelAbstract

Returns

\Gems_Import_Importer

The file name to use for final storage, minus the extension

getLongtermFileName(string $controller) : string

Parameters

$controller

string

Name of controller (or other id)

Returns

string

Get the organization name/code used by the long term filename

getOrganizationCode() : string

Returns

string

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

The directory where the file should be stored when the import succeeded

getSuccessDirectory(string $controller = null) : string

Parameters

$controller

string

Name of controller (or other id)

Returns

string

The directory to use for temporary storage

getTempDirectory() : string

Returns

string

Get the possible translators for the import snippet.

getTranslators(string $controller, string $filename = null) : array

Parameters

$controller

string

Name of controller (or other id)

$filename

string

Optional, name of file to import

Returns

arrayof \MUtil_Model_ModelTranslatorInterface objects

Set the organization name/code used by the long term filename

setOrganizationCode(string $code) : \Gems_Import_ImportLoader

Parameters

$code

string

Returns

\Gems_Import_ImportLoader(continuation pattern)

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

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

The model to use with a controller

getControllerTargetModel(string $controller) : \MUtil_Model_ModelAbstract

Parameters

$controller

string

Name of controller (or other id)

Returns

\MUtil_Model_ModelAbstractor null when not found

Returns a translate adaptor

getTranslateAdapter() : \Zend_Translate_Adapter

Returns

\Zend_Translate_Adapter

 Properties

 

$project

$project : \Gems_Project_ProjectSettings

Default

 

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

 

$_orgCode

$_orgCode : string

Default

 

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

$cascade : string

Default

'Import'
 

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

$cascade : string

Default

null
 

$currentOrganization

$currentOrganization : \Gems_User_Organization

Default

 

$currentUser

$currentUser : \Gems_User_User

Default

 

$loader

$loader : \Gems_Loader

Default

 

$translate

$translate : \Zend_Translate

Default