CSOpenSearchAreaPlugin
extends CSPlugin
in package
The base of all Search Area Plugins To be included, it must be placed in a plugins/opensearch subfolder with a file name ending with SearchArea.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.
- addItems() : void
- This method is used to add the the Items for Detail to the Search Result. The ItemIDs to add can be retrieved by using @see CSOpenSearchResponse::getIDsForDetail();
- addSelectModeItems() : void
- This method is used to add the the Items which a found by active SelectMode.
- executeMassActionForMailSend() : CSOpenSearchFormResponse|mixed
- Executes Send E-Mail mass action.
- getAlternativePluginFolder() : array<string|int, mixed>
- getCSSLink() : string
- The Plugins may return here an relative or absolute link to a CSS file if they wish This link will be added to the Search GUI. Use CS::getLinkToResource(url, format) with the format param absolute or relative to generate a link that can be used within any REST url
- getEmailComponent() : CSOpenSearchEmailComponent|null
- Returns a CSOpenSearchEmailComponent object.
- getItemSearchFilter() : CSItemSearchFilter
- Returns ItemSearchFilter for searching in OpenSearch
- 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.
- getPaneSortOrder() : int
- Returns the default sort oder for the area panes.
- 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.
- getPreviewHtml() : string
- Allows the Plugin to provide some html that should be displayed as preview of an item
- getReferenceItemList() : mixed
- returns reference item list for the given item class.
- getRootIds() : string
- Returns the configured root IDs of the search area
- getSearchArea() : CSOpenSearchArea
- Returns the search area.
- isAvailable() : bool
- The plugin is available only when gives record type and plugin type is of same type
- isAvailableForSearchAreaType() : mixed
- isEmailComponentAvailableByViewType() : bool
- Returns a flag if EMail component is available or not.
- isEmailComponentEnabled() : bool
- Tells if the available EMail component is currently on the Search Area enabled or not.
- isPreviewFieldAvailable() : bool
- Preview Images field Available
- mayDeleteItemsFromShare() : bool
- This method can be overwritten by the plugin to enable the functionality to delete the item from the share
- prepareEditor() : void
- This method can be overwritten by the plugin to add fields to the area editor
- prepareWindow() : void
- This method can be overwritten by the plugin to add fields to the area window
- resetLoadedPlugins() : mixed
- reset the internal plugins cache for loaded plugins
- resolveConfigurationName() : string
- Modifies the field name if required
- resolvePluginForRecord() : CSPlugin
- Resolves plugin for the given record.
- search() : void
- This is the most important method to implement when defining your CSOpenSearch Here the search is executed and the found IDs will be added to the Response
- setFieldValue() : void
- sets the field values of the area.
- setSearchArea() : void
- Sets the search area
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 —addItems()
This method is used to add the the Items for Detail to the Search Result. The ItemIDs to add can be retrieved by using @see CSOpenSearchResponse::getIDsForDetail();
public
addItems(CSOpenSearchRequest $oRequest, CSOpenSearchResponse $oResponse) : void
Parameters
- $oRequest : CSOpenSearchRequest
- $oResponse : CSOpenSearchResponse
Tags
Return values
void —addSelectModeItems()
This method is used to add the the Items which a found by active SelectMode.
public
addSelectModeItems(CSOpenSearchRequest $oRequest, CSOpenSearchResponse $oResponse) : void
The ItemIDs to add can be retrieved by using @see CSOpenSearchResponse::getIDsForDetail();
Note: Do not load any real Items to improve performance. You can load them in the code flow at last when you are retrieving CSOpenSearchItems with $oResponse->getItems()
Parameters
- $oRequest : CSOpenSearchRequest
- $oResponse : CSOpenSearchResponse
Tags
Return values
void —executeMassActionForMailSend()
Executes Send E-Mail mass action.
public
executeMassActionForMailSend(CSOpenSearchRequest $oRequest, array<string|int, CSOpenSearchFormFieldRequest> $aoFormFields) : CSOpenSearchFormResponse|mixed
Parameters
- $oRequest : CSOpenSearchRequest
- $aoFormFields : array<string|int, CSOpenSearchFormFieldRequest>
Tags
Return values
CSOpenSearchFormResponse|mixed —getAlternativePluginFolder()
public
static getAlternativePluginFolder() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getCSSLink()
The Plugins may return here an relative or absolute link to a CSS file if they wish This link will be added to the Search GUI. Use CS::getLinkToResource(url, format) with the format param absolute or relative to generate a link that can be used within any REST url
public
getCSSLink() : string
Tags
Return values
string —the link with an absolute or relative url
getEmailComponent()
Returns a CSOpenSearchEmailComponent object.
public
getEmailComponent() : CSOpenSearchEmailComponent|null
This Component is a virtual object for E-Mail fields. The Component does not store any information back to the Area
Tags
Return values
CSOpenSearchEmailComponent|null —getItemSearchFilter()
Returns ItemSearchFilter for searching in OpenSearch
public
getItemSearchFilter([CSOpenSearchRequest $oRequest = null ]) : CSItemSearchFilter
Parameters
- $oRequest : CSOpenSearchRequest = null
Tags
Return values
CSItemSearchFilter —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
getPaneSortOrder()
Returns the default sort oder for the area panes.
public
getPaneSortOrder() : int
Overwrite this method to manipulate the sorting.
Tags
Return values
int —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
getPreviewHtml()
Allows the Plugin to provide some html that should be displayed as preview of an item
public
getPreviewHtml(int $iId, CSOpenSearchRequest $oRequest) : string
Parameters
- $iId : int
-
the ID that was provided with the addItem Method in the @see search method
- $oRequest : CSOpenSearchRequest
Tags
Return values
string —html code that can be embedded via Ajax call in the search window
getReferenceItemList()
returns reference item list for the given item class.
public
getReferenceItemList(string $sItemClass, int $iItemID) : mixed
Parameters
- $sItemClass : string
-
the item class like "Pdmarticle"
- $iItemID : int
-
the item id.
Tags
Return values
mixed —getRootIds()
Returns the configured root IDs of the search area
public
getRootIds() : string
Tags
Return values
string —A comma separated string of IDs
getSearchArea()
Returns the search area.
public
getSearchArea() : CSOpenSearchArea
Tags
Return values
CSOpenSearchArea —The search area.
isAvailable()
The plugin is available only when gives record type and plugin type is of same type
public
isAvailable([null $oRecord = null ]) : bool
Parameters
- $oRecord : null = null
-
the record object like "Pdmarticle"
Tags
Return values
bool —returns true if plugin available.
isAvailableForSearchAreaType()
public
final isAvailableForSearchAreaType([mixed $iSearchAreaType = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA ]) : mixed
Parameters
- $iSearchAreaType : mixed = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA
Tags
Return values
mixed —isEmailComponentAvailableByViewType()
Returns a flag if EMail component is available or not.
public
isEmailComponentAvailableByViewType([int $iViewType = CSOpenSearchArea::VIEW_TYPE_ALWAYS ]) : bool
At the moment EMal Component is not available for all Item Plugins.
Parameters
- $iViewType : int = CSOpenSearchArea::VIEW_TYPE_ALWAYS
-
One of the following View Types CSOpenSearchArea::VIEW_TYPE_*
Tags
Return values
bool —isEmailComponentEnabled()
Tells if the available EMail component is currently on the Search Area enabled or not.
public
isEmailComponentEnabled() : bool
Tags
Return values
bool —isPreviewFieldAvailable()
Preview Images field Available
public
isPreviewFieldAvailable() : bool
- @return bool
Tags
Return values
bool —mayDeleteItemsFromShare()
This method can be overwritten by the plugin to enable the functionality to delete the item from the share
public
mayDeleteItemsFromShare() : bool
To enable this functionality, the overwritten method must return boolean TRUE.
Tags
Return values
bool —TRUE if the items from the share can be deleted by the User FALSE, otherwise
prepareEditor()
This method can be overwritten by the plugin to add fields to the area editor
public
prepareEditor(CSGuiEditor $oEditor) : void
Parameters
- $oEditor : CSGuiEditor
Tags
Return values
void —prepareWindow()
This method can be overwritten by the plugin to add fields to the area window
public
prepareWindow(CSOpenSearchWindow $oWindow) : void
Parameters
- $oWindow : CSOpenSearchWindow
-
The Open Search window object
Tags
Return values
void —resetLoadedPlugins()
reset the internal plugins cache for loaded plugins
public
static resetLoadedPlugins() : mixed
Tags
Return values
mixed —resolveConfigurationName()
Modifies the field name if required
public
resolveConfigurationName(mixed $sName) : string
Parameters
- $sName : mixed
-
string field name
Tags
Return values
string —field name
resolvePluginForRecord()
Resolves plugin for the given record.
public
resolvePluginForRecord(Record $oRecord) : CSPlugin
Parameters
- $oRecord : Record
-
is the record object.
Tags
Return values
CSPlugin —available plugin for the given record.
search()
This is the most important method to implement when defining your CSOpenSearch Here the search is executed and the found IDs will be added to the Response
public
search(CSOpenSearchRequest $oRequest, CSOpenSearchResponse $oResponse) : void
Parameters
- $oRequest : CSOpenSearchRequest
-
the search request
- $oResponse : CSOpenSearchResponse
-
the search result
Tags
Return values
void —setFieldValue()
sets the field values of the area.
public
setFieldValue(string $sFieldName, string $sFieldValue) : void
Parameters
- $sFieldName : string
-
Field Name
- $sFieldValue : string
-
Field Value
Tags
Return values
void —setSearchArea()
Sets the search area
public
setSearchArea(CSOpenSearchArea $oSearchArea) : void
Parameters
- $oSearchArea : CSOpenSearchArea
-
the area
