add methods for setting and getting decorators

This commit is contained in:
Uwe Steinmann 2019-08-08 08:39:53 +02:00
parent 452c815482
commit 9a0b6c4d3d

View File

@ -87,6 +87,13 @@ class SeedDMS_Core_DMS {
*/
protected $classnames;
/**
* @var array $decorators list of decorators for objects being instanciate
* by the dms
* @access protected
*/
protected $decorators;
/**
* @var SeedDMS_Core_User $user reference to currently logged in user. This must be
* an instance of {@link SeedDMS_Core_User}. This variable is currently not
@ -380,16 +387,16 @@ class SeedDMS_Core_DMS {
} /* }}} */
/**
* Return class name of instantiated objects
* Return class name of classes instanciated by SeedDMS_Core
*
* This method returns the class name of those objects being instantiated
* by the dms. Each class has an internal place holder, which must be
* passed to function.
*
* @param string $objectname placeholder (can be one of 'folder', 'document',
* 'documentcontent', 'user', 'group'
* 'documentcontent', 'user', 'group')
*
* @return string/boolean name of class or false if placeholder is invalid
* @return string/boolean name of class or false if object name is invalid
*/
function getClassname($objectname) { /* {{{ */
if(isset($this->classnames[$objectname]))
@ -421,6 +428,44 @@ class SeedDMS_Core_DMS {
return $oldclass;
} /* }}} */
/**
* Return list of decorators
*
* This method returns the list of decorator class names of those objects
* being instantiated
* by the dms. Each class has an internal place holder, which must be
* passed to function.
*
* @param string $objectname placeholder (can be one of 'folder', 'document',
* 'documentcontent', 'user', 'group')
*
* @return array/boolean list of class names or false if object name is invalid
*/
function getDecorators($objectname) { /* {{{ */
if(isset($this->decorators[$objectname]))
return $this->decorators[$objectname];
else
return false;
} /* }}} */
/**
* Add a decorator
*
* This method adds a single decorator class name to the list of decorators
* of those objects being instantiated
* by the dms. Each class has an internal place holder, which must be
* passed to function.
*
* @param string $objectname placeholder (can be one of 'folder', 'document',
* 'documentcontent', 'user', 'group')
*
* @return boolean true if decorator could be added, otherwise false
*/
function addDecorator($objectname, $decorator) { /* {{{ */
$this->decorators[$objectname][] = $decorator;
return true;
} /* }}} */
/**
* Return database where meta data is stored
*