PluginManager

Extends \PluginManager

Factory for limesurvey plugin objects.

Methods

Creates the plugin manager.

init() 

a reference to an already constructed reference.

Return a list of installed plugins, but only if the files are still there

getInstalledPlugins() : array

This prevents errors when a plugin was installed but the files were removed from the server.

Response

array

Return the status of plugin (true/active or false/desactive)

isPluginActive($sPluginName) : boolean

Arguments

$sPluginName

Response

boolean

Returns the storage instance of type $storageClass.

getStore(string $storageClass) 

If needed initializes the storage object.

Arguments

$storageClass

string

This function returns an API object, exposing an API to each plugin.

getAPI() : \ls\pluginmanager\LimesurveyApi

In the current case this is the LimeSurvey API.

Response

\ls\pluginmanager\LimesurveyApi

Registers a plugin to be notified on some event.

subscribe(\ls\pluginmanager\iPlugin $plugin, string $event, string $function = null) 

Arguments

$plugin

\ls\pluginmanager\iPlugin

Reference to the plugin.

$event

string

Name of the event.

$function

string

Optional function of the plugin to be called.

Unsubscribes a plugin from an event.

unsubscribe(\ls\pluginmanager\iPlugin $plugin, string $event) 

Arguments

$plugin

\ls\pluginmanager\iPlugin

Reference to the plugin being unsubscribed.

$event

string

Name of the event. Use '*', to unsubscribe all events for the plugin.

This function dispatches an event to all registered plugins.

dispatchEvent(\ls\pluginmanager\PluginEvent $event, string|array $target = array()) : \ls\pluginmanager\PluginEvent

Arguments

$event

\ls\pluginmanager\PluginEvent

Object holding all event properties

$target

string|array

Optional name of plugin to fire the event on

Response

\ls\pluginmanager\PluginEvent

Scans the plugin directory for plugins.

scanPlugins($forceReload = false) 

This function is not efficient so should only be used in the admin interface that specifically deals with enabling / disabling plugins.

Arguments

$forceReload

Gets the description of a plugin. The description is accessed via a static function inside the plugin file.

getPluginInfo(string $pluginClass, $pluginDir = null) 

Arguments

$pluginClass

string

The classname of the plugin

$pluginDir

Returns the instantiated plugin

loadPlugin(string $pluginName, int $id = null) : \ls\pluginmanager\iPlugin|null

Arguments

$pluginName

string

$id

int

Identifier used for identifying a specific plugin instance. If ommitted will return the first instantiated plugin with the given name.

Response

\ls\pluginmanager\iPlugin|null

The plugin or null when missing

Handles loading all active plugins

loadPlugins() 

Possible improvement would be to load them for a specific context. For instance 'survey' for runtime or 'admin' for backend. This needs some thinking before implementing.

Get a list of question objects and load some information about them.

loadQuestionObjects($forceReload = false) 

This registers the question object classes with Yii.

Arguments

$forceReload

Construct a question object from a GUID.

constructQuestionFromGUID(string $guid, $questionId = null, int $responseId = null) : \ls\pluginmanager\iQuestion

Arguments

$guid

string

$questionId

$responseId

int

Response

\ls\pluginmanager\iQuestion

Properties

Object containing any API that the plugins can use.

api : mixed
var

The class name of the API class to load, or

Type(s)

mixed

Array mapping guids to question object class names.

guidToQuestion : \ls\pluginmanager\type
var

Type(s)

\ls\pluginmanager\type

plugins

plugins : 

pluginDirs

pluginDirs : 

stores

stores : 

subscriptions

subscriptions :