CSTreeRecordPlugin
extends CSRecordPlugin
in package
This Plugin extends any CONTENTSERV Item.
To be included, it must be placed in any plugins/record/[RECORDMODULE] subfolder where RECORDMODULE is the name of the Module where the Item which should be extended is placed within, e.g. plugins/record/pdm for Pdm Items The filename of the Plugin must end with TreeRecord.php.
Tags
Table of Contents
- __call() : mixed|string
- All method calls which are not defined within the plugin are forwarded to the module Therefore it is possible to get, e.g. the label by calling the getSuiteName() method.
- _construct() : void
- The construct method may be used to initialize custom plugin properties it is called immediately after instantiating the plugin all arguments passed to the getPlugins method are also available in this method.
- addAlternativePluginFolder() : void
- A path to a specific folder in which should be search for plugins.
- getActions() : array<string|int, mixed>
- Adds some actions (in form of popups or buttons[editor]) similar to the tree, list and editor
- getAdditionalData() : array<string|int, mixed>
- Adds some more fields to a record data section. If it is not defined for additional format, the CONTENTSERV default values 0 and '' are used
- getAdditionalFormat() : array<string|int, mixed>
- Adds some more fields to a record format section.
- getAdditionalIconToppings() : array<string|int, mixed>
- this method can be used to add additional toppings to the tree icon
- getAdditionalSearchableFields() : array<string|int, mixed>
- Adds additional Searchable fields to a record section.
- getAlternativePluginFolder() : array<string|int, mixed>
- getLevel() : int
- The getLevel method may be overwritten in the plugins and defines the order, the plugins are called, where the highest level is called first.
- getMetaData() : CSMetaData
- Returns the CSMetaData of the current plugin.
- getModule() : CSModule
- Returns the module, if the plugin is defined within a module.
- getPlugin() : CSPlugin|null
- Returns a CSPlugin for the given plugin type and plugin class name.
- getPluginChooser() : array<string|int, mixed>
- Returns an array all defined CSPlugins for the current plugin type
- getPluginData() : mixed
- getPluginDefinitionFile() : string
- Returns the path to the file, the plugin is defined.
- getPluginName() : mixed
- getPlugins() : array<string|int, CSPlugin>
- Returns all defined CSPlugins for the current plugin type It should be used to get all matching plugins for a given plugin api.
- getPluginsInModule() : array<string|int, mixed>
- Returns all CSPlugins for the current plugin type which are defined within the given module It should be used to get all matching plugins for a given plugin api.
- getRootIDs() : array<string|int, mixed>
- Modifies the RootIDs (Startpoints in the Tree) which are visible for the current user
- getTreeIcon() : string
- returns an alternative tree/workflow icon for a given record
- getTreeNodeTooltip() : string
- Returns an modified / replaced tooltip for a given record
- importValue() : bool
- Imports a value into the given record It can be used if additional colums should be imported or prepared before importing them
- isAvailable() : bool
- This method is called to check, whether the plugin is available.
- resetLoadedPlugins() : mixed
- reset the internal plugins cache for loaded plugins
- updateCSVFromExportData() : array<string|int, mixed>
- Prepares the csv export data for a CSV Export.
Methods
__call()
All method calls which are not defined within the plugin are forwarded to the module Therefore it is possible to get, e.g. the label by calling the getSuiteName() method.
public
__call(mixed $methodName, mixed $methodArguments) : mixed|string
Parameters
- $methodName : mixed
- $methodArguments : mixed
Tags
Return values
mixed|string —_construct()
The construct method may be used to initialize custom plugin properties it is called immediately after instantiating the plugin all arguments passed to the getPlugins method are also available in this method.
public
_construct() : void
Tags
Return values
void —addAlternativePluginFolder()
A path to a specific folder in which should be search for plugins.
public
static addAlternativePluginFolder(mixed $sPluginFolder) : void
Parameters
- $sPluginFolder : mixed
Tags
Return values
void —getActions()
Adds some actions (in form of popups or buttons[editor]) similar to the tree, list and editor
public
getActions(Record $record, string $type) : array<string|int, mixed>
Parameters
- $record : Record
-
The record for which the actions should be returned
- $type : string
-
The type of the request ('list', 'tree', 'editor') to be able to add the action only to specific components
Tags
Return values
array<string|int, mixed> —an array containing the each action as own array in the form: array(name => array(icon, label, phpCode, menuName, javascript, popupIndex, groupIdentifier, groupIndex))
Where:
- name => is the unique identifier name of the action
- icon => is the icon relative to the admin/images directory
- label => is the label of the label of the action
- phpCode => The phpCode which should be executed, if the action is selected where the current Record could be accessed using $record
- menuName => The name of the menubar in the editor
- javascript => javascript which is executed before the action is applied. The action can be cancelled using "return 'CANCEL';". Otherwise the return value is appended to the request
- popupIndex => The index in a popup (0=top, null=end)
- groupIdentifier => The identifier to add the popup item to a group, which has separator at the beginning and at the end.
- groupIndex => The index of the group. The index will be used to order the groups. The lowest index will be taken of all popup items inside of a group. Example: return array( 'test' => array( 'add.gif', 'Test', 'alert("test ok");', 'MENU_FILE', 'if (!confirm("really?")) return "CANCEL";', null, CSGuiPopup::GROUP_IDENTIFIER_, CSGuiPopup::GROUP_INDEX_ ) );
getAdditionalData()
Adds some more fields to a record data section. If it is not defined for additional format, the CONTENTSERV default values 0 and '' are used
public
getAdditionalData(string $className) : array<string|int, mixed>
Parameters
- $className : string
-
the name of the record where fields should be added to
Tags
Return values
array<string|int, mixed> —the additional data in the form name => value
getAdditionalFormat()
Adds some more fields to a record format section.
public
getAdditionalFormat(string $className) : array<string|int, mixed>
Parameters
- $className : string
-
the name of the record where fields should be added to
Tags
Return values
array<string|int, mixed> —the additional formats in the form name => databaseformat
getAdditionalIconToppings()
this method can be used to add additional toppings to the tree icon
public
getAdditionalIconToppings(array<string|int, mixed> $arrTreeRecord, TreeRecord $treeRecord) : array<string|int, mixed>
Parameters
- $arrTreeRecord : array<string|int, mixed>
-
the data of the current record
- $treeRecord : TreeRecord
-
an instance of a TreeRecord the icon should be created for
Tags
Return values
array<string|int, mixed> —getAdditionalSearchableFields()
Adds additional Searchable fields to a record section.
public
getAdditionalSearchableFields(string $sClassName) : array<string|int, mixed>
Parameters
- $sClassName : string
-
the name of the record where fields should be added to
Tags
Return values
array<string|int, mixed> —the additional fields to add to the search
getAlternativePluginFolder()
public
static getAlternativePluginFolder() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getLevel()
The getLevel method may be overwritten in the plugins and defines the order, the plugins are called, where the highest level is called first.
public
getLevel() : int
The method can also be set for all plugins within a module by overwriting the modules getLevel method.
Tags
Return values
int —the level of the plugin where it is called
getMetaData()
Returns the CSMetaData of the current plugin.
public
getMetaData() : CSMetaData
Tags
Return values
CSMetaData —getModule()
Returns the module, if the plugin is defined within a module.
public
getModule() : CSModule
This method can be used in the plugin api and the plugin wherever access to the defining module is required. If it is used in the Api, it should be noticed that this method may return null, if the plugin is directly defined in the projects or admin.local plugins directory.
Tags
Return values
CSModule —the module object, if the plugin defined in a module or null otherwise
getPlugin()
Returns a CSPlugin for the given plugin type and plugin class name.
public
static getPlugin(string $pluginApiPath, string $className[, mixed $arguments = NULL ]) : CSPlugin|null
As standard behaviour the module subfolder is guessed from the forward URL parameter. If a plugin should point to something in a special module subfolder, this scope can be added by adding the module name in squared bracket at the end of the $pluginApiPath, e.g. 'core/api/plugins/CSRecordPlugin.php[pms]' to get all CSRecordPlugins defined for pms records.
Parameters
- $pluginApiPath : string
-
The relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).
- $className : string
-
The target plugin class name, which should be loaded.
- $arguments : mixed = NULL
-
one or multiple arguments which should be passed to the isAvailable method.
Tags
Return values
CSPlugin|null —Returns the requested plugin for the given parameter.
getPluginChooser()
Returns an array all defined CSPlugins for the current plugin type
public
static getPluginChooser(string $pluginApiPath[, mixed $arguments = NULL ]) : array<string|int, mixed>
Parameters
- $pluginApiPath : string
-
the relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).
- $arguments : mixed = NULL
-
one ore multiple arguments which should be passed to the isAvailable method.
Tags
Return values
array<string|int, mixed> —of CSPlugins in the form [CLASSNAME => LABEL] where the CLASSNAME may be used in the CSPlugin::getPlugin method
getPluginData()
public
getPluginData() : mixed
Tags
Return values
mixed —getPluginDefinitionFile()
Returns the path to the file, the plugin is defined.
public
getPluginDefinitionFile() : string
Tags
Return values
string —the path to the plugin
getPluginName()
public
getPluginName() : mixed
Tags
Return values
mixed —getPlugins()
Returns all defined CSPlugins for the current plugin type It should be used to get all matching plugins for a given plugin api.
public
static getPlugins(string $pluginApiPath[, mixed $arguments = NULL ]) : array<string|int, CSPlugin>
As standard behaviour the module subfolder is guessed from the forward URL parameter. If a plugin should point to something in a special module subfolder, this scope can be added by adding the module name in squared bracket at the end of the $pluginApiPath, e.g. 'core/api/plugins/CSRecordPlugin.php[pms]' to get all CSRecordPlugins defined for pms records.
Parameters
- $pluginApiPath : string
-
the relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).
- $arguments : mixed = NULL
-
one ore multiple arguments which should be passed to the isAvailable method.
Tags
Return values
array<string|int, CSPlugin> —array of CSPlugin objects matching the defined plugin criteria
getPluginsInModule()
Returns all CSPlugins for the current plugin type which are defined within the given module It should be used to get all matching plugins for a given plugin api.
public
static getPluginsInModule(string $moduleName, string $pluginApiPath[, mixed $sFileNamePattern = '' ][, mixed $arguments = NULL ]) : array<string|int, mixed>
Parameters
- $moduleName : string
-
the module which should be searched for plugins
- $pluginApiPath : string
-
the relative path in filesystem for the requested plugin api.
- $sFileNamePattern : mixed = ''
- $arguments : mixed = NULL
-
one ore multiple arguments which should be passed to the isAvailable method.
Tags
Return values
array<string|int, mixed> —of CSPlugin objects matching the defined plugin criterias
getRootIDs()
Modifies the RootIDs (Startpoints in the Tree) which are visible for the current user
public
getRootIDs(string $className, array<string|int, mixed> $rootIDs) : array<string|int, mixed>
Parameters
- $className : string
-
the name of the record where the RootIDs should be set for
- $rootIDs : array<string|int, mixed>
-
the RootIDs like defined in the system (e.g. in the User Options)
Tags
Return values
array<string|int, mixed> —the new RootIDs as array of RecordIDs
getTreeIcon()
returns an alternative tree/workflow icon for a given record
public
getTreeIcon(array<string|int, mixed> $arrTreeRecord, TreeRecord $treeRecord) : string
Parameters
- $arrTreeRecord : array<string|int, mixed>
-
the data of the current record
- $treeRecord : TreeRecord
-
an instance of a TreeRecord the icon should be created for
Tags
Return values
string —the icon path relative to the admin/images/tree folder
getTreeNodeTooltip()
Returns an modified / replaced tooltip for a given record
public
getTreeNodeTooltip(string $sCurrentToolTip, array<string|int, mixed> $aData, TreeRecord $oTreeRecord) : string
Parameters
- $sCurrentToolTip : string
-
The current tooltip that will be written to the node.
- $aData : array<string|int, mixed>
-
The data of the current record.
- $oTreeRecord : TreeRecord
-
An instance of a TreeRecord the icon should be created for.
Tags
Return values
string —The new tooltip for the node
importValue()
Imports a value into the given record It can be used if additional colums should be imported or prepared before importing them
public
importValue(Record $record, string $key, string $value, array<string|int, mixed> $dataArray) : bool
Parameters
- $record : Record
-
the record where the value should be imported to
- $key : string
-
the key of the value which should be imported
- $value : string
-
the new value which should be imported
- $dataArray : array<string|int, mixed>
-
all values which should be imported to the Record
Tags
Return values
bool —whether the value had been imported and no other import should be called
isAvailable()
This method is called to check, whether the plugin is available.
public
isAvailable() : bool
If further arguments are added to the CSPlugin::getPlugins call, they are added as arguments to this method.
For simpler usage of the plugin concept: This method should be overwritten with the correct signature for a plugin call, if arguments are passed.
Tags
Return values
bool —whether the plugin is available for the given arguments
resetLoadedPlugins()
reset the internal plugins cache for loaded plugins
public
static resetLoadedPlugins() : mixed
Tags
Return values
mixed —updateCSVFromExportData()
Prepares the csv export data for a CSV Export.
public
updateCSVFromExportData(array<string|int, mixed> $csv, array<string|int, mixed> $exportData, array<string|int, mixed> $fields, mixed $record) : array<string|int, mixed>
It can be used, if additional columns should be added or some should be removed in the CSV Export
Parameters
- $csv : array<string|int, mixed>
-
the array containing the prepared CSV data in the form [COLUMN] => [VALUE]
- $exportData : array<string|int, mixed>
-
the array containing the real data
- $fields : array<string|int, mixed>
-
the fields which should be exported
- $record : mixed
Tags
Return values
array<string|int, mixed> —the new csv data array
