CSItemSearchPlugin
extends CSPlugin
in package
This Plugin modifies the standard CONTENTSERV item search.
To be included, it must be placed in any plugins/core folder with a file name ending with Search.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.
- extendSearchTree() : void
- Gives the posibility to modify the default search tree.
- filterCustomFieldsForExtendedSearchGui() : array<string|int, mixed>
- Allows filtering of custom fields that are shown in the extended search dropdown.
- filterDefaultFieldsForExtendedSearchGui() : array<string|int, mixed>
- Allows filtering of default fields that are shown in the extended search dropdown.
- getAdditionalSearchHtml() : bool
- Adds some additional components to the search dialog before the advanced search part
- getAdvancedSort() : array<string|int, mixed>
- Returns an array of selectable sort orders.
- 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.
- getPreparedSearchFields() : array<string|int, mixed>
- Returns an array of searchable fields.
- getSearchedIdsForExtendedSearch() : array<string|int, mixed>
- Can be overwritten to change the result of an extended search.
- getSearchedIdsForSimpleSearch() : array<string|int, mixed>
- Can be overwritten to change the result of a simple search.
- getSearchFieldType() : search
- Returns the search type of a field in the form {'bonds' :[BONDS}, 'presets' : [PRESETS']}.
- getSearchModuleName() : string
- Returns the module name of the record which should be searched
- getSearchRecord() : Record
- Returns the record which should be searched
- getSimpleSearchFields() : array<string|int, mixed>
- Gives the posibility to modify the fields which are searched with the simple search.
- getSortFields() : array<string|int, mixed>
- Returns an array of the names of fields which can be sorted.
- groupSearchFields() : bool
- Checks whether the search fields should be grouped as standard attributes and custom attributes
- isAvailable() : bool
- Checks whether this plugin is available for the current search
- isDefaultTreeVisible() : bool
- Checks whether a standard tree is visible in the search dialog
- isExtendedSearchVisible() : bool
- Checks whether the extended search is visible in the search dialog
- isSortOrderChooserVisible() : bool
- Checks whether the sort order chooser is visible in the search dialog
- makeHtml() : void
- This method is called before the makeHtml is executed to be able to do some modifications
- modifySearch() : void
- Gives the posibility to modify the search API object.
- prepareBooleanSearchField() : array<string|int, mixed>
- Prepares a boolean search field
- prepareDateSearchField() : array<string|int, mixed>
- Prepares a date search field
- prepareDefaultSearchField() : array<string|int, mixed>
- Prepares any search field with the default search field type. This utility method may be used in the getSearchFieldType method
- prepareNumericSearchField() : array<string|int, mixed>
- Prepares a numerical search field
- prepareSearchField() : array<string|int, mixed>
- Prepares any search field
- prepareSelectionSearchField() : array<string|int, mixed>
- Prepares a search field which should be searched as selection
- prepareStringSearchField() : array<string|int, mixed>
- Prepares the default string search field
- preventOtherPlugins() : bool
- As multiple plugins can listen to the some object, some method require the other plugins to be also executed, but some methods would like to prevent this behaviour.
- resetLoadedPlugins() : mixed
- reset the internal plugins cache for loaded plugins
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 —extendSearchTree()
Gives the posibility to modify the default search tree.
public
extendSearchTree(CSGuiMixedTree $tree) : void
For example new subtrees might be inserted.
Parameters
- $tree : CSGuiMixedTree
-
the default search tree
Tags
Return values
void —filterCustomFieldsForExtendedSearchGui()
Allows filtering of custom fields that are shown in the extended search dropdown.
public
filterCustomFieldsForExtendedSearchGui(array<string|int, mixed> $aCustomFields, Record $oRecord) : array<string|int, mixed>
Parameters
- $aCustomFields : array<string|int, mixed>
-
A list of all fields in the form FieldID => FieldName
- $oRecord : Record
-
The record for which the extended search is being built.
Tags
Return values
array<string|int, mixed> —The filtered list of fields.
filterDefaultFieldsForExtendedSearchGui()
Allows filtering of default fields that are shown in the extended search dropdown.
public
filterDefaultFieldsForExtendedSearchGui(array<string|int, mixed> $aDefaultFields, Record $oRecord) : array<string|int, mixed>
Parameters
- $aDefaultFields : array<string|int, mixed>
-
A list of all fields in the form FieldID => FieldName
- $oRecord : Record
-
The record for which the extended search is being built.
Tags
Return values
array<string|int, mixed> —The filtered list of fields.
getAdditionalSearchHtml()
Adds some additional components to the search dialog before the advanced search part
public
getAdditionalSearchHtml() : bool
Tags
Return values
bool —string additional html which should be displayed in the search dialog
getAdvancedSort()
Returns an array of selectable sort orders.
public
getAdvancedSort() : array<string|int, mixed>
If this is set the standard sort order selector is replaced by this one The special sort fields can not changed in the direction, but can be even a more complex sort, e.g. "ExternalKey ASC, CreationDate DESC" The result format is an array with the field name as key and a CS_SORT constant as value (e.g. CS_SORT_STRING_ASC or CS_SORT_NUMERICAL_DESC) The example above would habe the SORT_ARRAY: array('ExternalKey' => CS_SORT_STRING_ASC, 'CreationDate' => CS_SORT_STRING_DESC)
Tags
Return values
array<string|int, mixed> —the new sort fields in the form LABEL => SORT_ARRAY
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
getPreparedSearchFields()
Returns an array of searchable fields.
public
getPreparedSearchFields([array<string|int, mixed> $defaultFields = array() ]) : array<string|int, mixed>
The fields [FIELD] could either be a real database field name or a custom field in the form field:[ID]
Parameters
- $defaultFields : array<string|int, mixed> = array()
-
the default fields which are marked as searchable in the form [FIELD] => [LABEL]
Tags
Return values
array<string|int, mixed> —of prepared field informations in the form [FIELD] => [LABEL]
getSearchedIdsForExtendedSearch()
Can be overwritten to change the result of an extended search.
public
getSearchedIdsForExtendedSearch(CSGuiExtendedSearch $oExtendedSearch, int $iLimit) : array<string|int, mixed>
Parameters
- $oExtendedSearch : CSGuiExtendedSearch
-
The extended search object defining the search.
- $iLimit : int
-
If a limit was set for the search, this variable contains the integer value for it. If set to 0, no limit is given.
Tags
Return values
array<string|int, mixed> —List of ids to show for the search query. The plugin interface assums that if an array is returned no other search plugins are evaluated. If null is returned other plugins are called.
getSearchedIdsForSimpleSearch()
Can be overwritten to change the result of a simple search.
public
getSearchedIdsForSimpleSearch(CSGuiExtendedSearch $oSimpleSearch, int $iLimit) : array<string|int, mixed>
Parameters
- $oSimpleSearch : CSGuiExtendedSearch
-
The simple search object defining the search.
- $iLimit : int
-
If a limit was set for the search, this variable contains the integer value for it. If set to 0, no limit is given.
Tags
Return values
array<string|int, mixed> —List of ids to show for the search query. The plugin interface assums that if an array is returned no other search plugins should be evaluated. If null is returned, other plugins are called.
getSearchFieldType()
Returns the search type of a field in the form {'bonds' :[BONDS}, 'presets' : [PRESETS']}.
public
getSearchFieldType(string $fieldName) : search
To get standard values you can use the prepareXYZSearchField methods.
Parameters
- $fieldName : string
-
the name of the field
Tags
Return values
search —type data of the requested field
getSearchModuleName()
Returns the module name of the record which should be searched
public
static getSearchModuleName() : string
Tags
Return values
string —the module name of the searched record
getSearchRecord()
Returns the record which should be searched
public
static getSearchRecord() : Record
Tags
Return values
Record —the searched record
getSimpleSearchFields()
Gives the posibility to modify the fields which are searched with the simple search.
public
getSimpleSearchFields([array<string|int, mixed> $defaultFields = array() ]) : array<string|int, mixed>
Parameters
- $defaultFields : array<string|int, mixed> = array()
-
the default fields which are marked as searchable
Tags
Return values
array<string|int, mixed> —the fields which should be searched
getSortFields()
Returns an array of the names of fields which can be sorted.
public
getSortFields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —the sortable fields in the form LABEL => FIELDNAME
groupSearchFields()
Checks whether the search fields should be grouped as standard attributes and custom attributes
public
groupSearchFields() : bool
Tags
Return values
bool —whether the searchFields should be grouped
isAvailable()
Checks whether this plugin is available for the current search
public
isAvailable([string $module = null ][, string $recordClass = null ][, string $type = null ]) : bool
Parameters
- $module : string = null
-
the module which is searched
- $recordClass : string = null
-
the class of the record which is searched
- $type : string = null
-
the type of the search dialog
Tags
Return values
bool —whether this plugin is available
isDefaultTreeVisible()
Checks whether a standard tree is visible in the search dialog
public
isDefaultTreeVisible(string $type) : bool
Parameters
- $type : string
-
the type of the tree which should be checked
Tags
Return values
bool —whether the given tree is visible
isExtendedSearchVisible()
Checks whether the extended search is visible in the search dialog
public
isExtendedSearchVisible() : bool
Tags
Return values
bool —whether the extended search is visible
isSortOrderChooserVisible()
Checks whether the sort order chooser is visible in the search dialog
public
isSortOrderChooserVisible() : bool
Tags
Return values
bool —whether the sort order chooser is visible
makeHtml()
This method is called before the makeHtml is executed to be able to do some modifications
public
makeHtml(mixed $itemDetailedSearch) : void
Parameters
- $itemDetailedSearch : mixed
Tags
Return values
void —modifySearch()
Gives the posibility to modify the search API object.
public
modifySearch(mixed $csItemSearch) : void
This gives the possibility to add new dynamic or static search filters
Parameters
- $csItemSearch : mixed
Tags
Return values
void —prepareBooleanSearchField()
Prepares a boolean search field
public
prepareBooleanSearchField(string $fieldName[, string $label = null ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $label : string = null
-
the label of the field
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
prepareDateSearchField()
Prepares a date search field
public
prepareDateSearchField(string $fieldName[, string $label = null ][, mixed $dateFormat = '' ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $label : string = null
-
the label of the field
- $dateFormat : mixed = ''
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
prepareDefaultSearchField()
Prepares any search field with the default search field type. This utility method may be used in the getSearchFieldType method
public
prepareDefaultSearchField(string $fieldName[, string $label = null ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $label : string = null
-
the label of the field
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
prepareNumericSearchField()
Prepares a numerical search field
public
prepareNumericSearchField(string $fieldName[, array<string|int, mixed> $values = array() ][, string $label = null ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $values : array<string|int, mixed> = array()
-
the default values of the field which should be displayed as selection
- $label : string = null
-
the label of the field
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
prepareSearchField()
Prepares any search field
public
prepareSearchField(string $fieldName, array<string|int, mixed> $bonds, array<string|int, mixed> $presets[, string $label = null ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $bonds : array<string|int, mixed>
-
the bonds of the field which should be displayed
- $presets : array<string|int, mixed>
-
the preset values of the field which should be displayed
- $label : string = null
-
the label of the field
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
prepareSelectionSearchField()
Prepares a search field which should be searched as selection
public
prepareSelectionSearchField(string $fieldName, array<string|int, mixed> $values[, bool $isMultipleSelection = false ][, string $label = null ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $values : array<string|int, mixed>
-
the values of the field which should be displayed
- $isMultipleSelection : bool = false
-
whether the selection is a multiple selection
- $label : string = null
-
the label of the field
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
prepareStringSearchField()
Prepares the default string search field
public
prepareStringSearchField(string $fieldName[, string $label = null ]) : array<string|int, mixed>
Parameters
- $fieldName : string
-
the name of the field which should be searched
- $label : string = null
-
the label of the field
Tags
Return values
array<string|int, mixed> —an array containing the prepared search to be passed in the getSearchFieldType method
preventOtherPlugins()
As multiple plugins can listen to the some object, some method require the other plugins to be also executed, but some methods would like to prevent this behaviour.
public
preventOtherPlugins(string $methodName) : bool
For this reason this method can be used to prevent other plugins to execute some methods afterwards
Parameters
- $methodName : string
-
the name of the called method
Tags
Return values
bool —whether the method should be prevented from other plugins
resetLoadedPlugins()
reset the internal plugins cache for loaded plugins
public
static resetLoadedPlugins() : mixed
