CSWebservicePlugin
extends CSPlugin
in package
This class represents the parent class of all plugin apis and offers some utilitiy methods which should be available in every plugin.
To define a new plugin, this class should be inherited in a file placed within a plugins directory. Those plugin folders can be placed in all licensed modules, extensions and the admin/core, admin.local and project folders. It must be in a relative subdirectory defined with the PluginPath Since 5.1.2 all plugins support subfolders which name describes the module where the plugin should work within. If used, this improves performance as only the plugins from a module and not from all modules must be loaded and called. If given, a Plugin must succeed the FileNamePattern syntax.
Example: A CSGuiListPlugin should be placed e.g. in the folder plugins/gui with a FileName ending with List.php. A defined plugin is used for all lists in all modules, if it is placed directly in this folder. If it is placed in plugins/gui/pdm the plugin is only loaded and called, when displaying components within the pdm module.
If the PluginPath points to a single file, the plugin defined within this file is returned. Otherwise the directory is searched for matching plugins. For the plugin concept there is the following naming convention: The objects defined in the file XYZ.php must have the class name XYZ.
The order in which the plugins are returned is defined by the getLevel method. This method is called for sorting and the objects are returned in descending order (highest value first).
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() : mixed
- _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.
- addComplexElements() : mixed
- This function must be used to create for the current service all complex types and arrays. This methods should use the methods 'addComplexArray' and 'addComplexStruct
- addServiceFunctions() : mixed
- All functions represented by the current service must be registed in this method. Each Function must be in a seperate file. The Function name must be equal to the method-name (without class-prefix). Additional a special structure must be used (see examples).Please make sure that all used complexTypes and complexArray are specified in the curren plugin.
- getAlternativePluginFolder() : array<string|int, mixed>
- getComplexArray() : Returns
- Returnn an array of all registered complex arrays.
- getComplexArrayCount() : Returns
- Returns the number complex array registered in this webservice.
- getComplexSequence() : Returns
- Returnn a sequence of all registered complex sequences.
- getComplexSequenceCount() : Returns
- Returns the number complex sequence registered in this webservice.
- getComplexStructure() : Returns
- Returns an array of all registered complex strcutres.
- getComplexStructureCount() : Returns
- Returns the number complex structures registered in this webservice.
- getCurrentDatetime() : the
- This method a legal xsd:datetime from the current time as string.
- getDatetimeFromTimestamp() : the
- This method converts a php-timestamp to a legal xsd:datetime string.
- getDatetimeFromUNIXTime() : the
- This method converts a UNIX-Timestamp to a legal xsd:datetime string.
- getFunctions() : The
- Returns all functions regsitered by this service.
- 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.
- getRequestAttachments() : The
- This method return the attachments of the saop request.
- getServiceDescription() : Returns
- This method returns a description regarding the current webservice.
- getServiceName() : Returns
- Returns the Name of the current Service. Please make sure to use a service name once.
- getServieFunctionInfos() : The
- Returns all informations to a specific function.
- getVersion() : Returns
- The Version of the webservice is shown in the backend.
- isAvailable() : Returns
- Returns true if the wsdl module is licensed.
- resetLoadedPlugins() : mixed
- reset the internal plugins cache for loaded plugins
- setAttachmentEncoding() : mixed
- this methods sets the encoding for the attachment.
- soapAttachment() : mixed
- This method is used to add an attachement to a soap-request.
- soapException() : mixed
- This methods should be used if an error occures in the operation-code.
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()
public
__construct() : mixed
Tags
Return values
mixed —_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 —addComplexElements()
This function must be used to create for the current service all complex types and arrays. This methods should use the methods 'addComplexArray' and 'addComplexStruct
public
addComplexElements() : mixed
Tags
Return values
mixed —addServiceFunctions()
All functions represented by the current service must be registed in this method. Each Function must be in a seperate file. The Function name must be equal to the method-name (without class-prefix). Additional a special structure must be used (see examples).Please make sure that all used complexTypes and complexArray are specified in the curren plugin.
public
addServiceFunctions() : mixed
Tags
Return values
mixed —getAlternativePluginFolder()
public
static getAlternativePluginFolder() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getComplexArray()
Returnn an array of all registered complex arrays.
public
getComplexArray() : Returns
Tags
Return values
Returns —an array of all registered complex arrays.
getComplexArrayCount()
Returns the number complex array registered in this webservice.
public
getComplexArrayCount() : Returns
Tags
Return values
Returns —the number complex array registered in this webservice.
getComplexSequence()
Returnn a sequence of all registered complex sequences.
public
getComplexSequence() : Returns
Tags
Return values
Returns —a sequence of all registered complex sequences.
getComplexSequenceCount()
Returns the number complex sequence registered in this webservice.
public
getComplexSequenceCount() : Returns
Tags
Return values
Returns —the number complex sequence registered in this webservice.
getComplexStructure()
Returns an array of all registered complex strcutres.
public
getComplexStructure() : Returns
Tags
Return values
Returns —an array of all registered complex strcutres
getComplexStructureCount()
Returns the number complex structures registered in this webservice.
public
getComplexStructureCount() : Returns
Tags
Return values
Returns —the number complex structures registered in this webservice.
getCurrentDatetime()
This method a legal xsd:datetime from the current time as string.
public
getCurrentDatetime() : the
Tags
Return values
the —timestring
getDatetimeFromTimestamp()
This method converts a php-timestamp to a legal xsd:datetime string.
public
getDatetimeFromTimestamp(int $timestamp) : the
Parameters
- $timestamp : int
-
the php-timestamp
Tags
Return values
the —timestring
getDatetimeFromUNIXTime()
This method converts a UNIX-Timestamp to a legal xsd:datetime string.
public
getDatetimeFromUNIXTime(long $unix) : the
Parameters
- $unix : long
-
the unix-time
Tags
Return values
the —timestring
getFunctions()
Returns all functions regsitered by this service.
public
getFunctions() : The
Tags
Return values
The —list of service-functions.
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
getRequestAttachments()
This method return the attachments of the saop request.
public
getRequestAttachments() : The
Tags
Return values
The —list of attachments (may be an empty array).
getServiceDescription()
This method returns a description regarding the current webservice.
public
getServiceDescription() : Returns
Tags
Return values
Returns —the service description
getServiceName()
Returns the Name of the current Service. Please make sure to use a service name once.
public
getServiceName() : Returns
Tags
Return values
Returns —the name of the current service
getServieFunctionInfos()
Returns all informations to a specific function.
public
getServieFunctionInfos(string $function) : The
Parameters
- $function : string
-
The name of the function.
Tags
Return values
The —array with all informations.
getVersion()
The Version of the webservice is shown in the backend.
public
getVersion() : Returns
Tags
Return values
Returns —the version
isAvailable()
Returns true if the wsdl module is licensed.
public
isAvailable() : Returns
Tags
Return values
Returns —true if the wsdl module licensed
resetLoadedPlugins()
reset the internal plugins cache for loaded plugins
public
static resetLoadedPlugins() : mixed
Tags
Return values
mixed —setAttachmentEncoding()
this methods sets the encoding for the attachment.
public
setAttachmentEncoding(int $enc) : mixed
Parameters
- $enc : int
-
one of the three possible encoding (see constants)
Tags
Return values
mixed —soapAttachment()
This method is used to add an attachement to a soap-request.
public
soapAttachment(string $data[, string $filename = '' ][, string $contenttype = 'application/octet-stream' ][, string $cid = FALSE ]) : mixed
Parameters
- $data : string
-
the content of the file
- $filename : string = ''
-
the filename
- $contenttype : string = 'application/octet-stream'
-
the contenttype of the data
- $cid : string = FALSE
-
the content-id
Tags
Return values
mixed —soapException()
This methods should be used if an error occures in the operation-code.
public
soapException(string $faultstring[, string $faultactor = '' ][, string $faultdetails = '' ]) : mixed
When this method ist called the operation code will be ended and a soap-fault message will be send to the requester.
Parameters
- $faultstring : string
-
the error message
- $faultactor : string = ''
-
the name of the operation or other regarding informations
- $faultdetails : string = ''
-
additional, detailed informations regarding the error
