Plugin system architecture

A plugin can extend functionality of LimeSurvey. The plugin registers on what events it wants to extend. This could be adding a button to the menu, do something when a respondent starts or finishes the survey... the possibilities are endless.

For the plugin to be able to do it's magic it might need some special configuration. Below is the 'lifetime of a plugin':

beforeInstall When the plugin is added to the system, this event is fired on the plugin. This way the plugin can set a default config, of check for dependencies. The method can return success or failure and an optional message. This method is also fired when a new version of the plugin is uploaded. This way the plugin can handle upgrades when neccessary.

beforeActivate Like the beforeInstall event, but this time it is fired when the plugin is activated.

beforeDeactivate You guessed right, on deactivation. Might show a warning about dependencies of other plugins, lost functionaity etc.

beforeDeinstall This should handle cleanup of extra tables, config etc.

The plugins will extend a base class.

The base plugin class will initialize a storage interface and create wrapper functions for the get and set implemented in the interface.

Code below might contain mistakes, textarea doesnt have syntax checking :p

To see how to add a new menu item and display a page when the menu item is clicked see Add_new_menu_and_view_by_a_plugin