Development Guide
Test-Export Plugins
This feature is available for ILIAS 4.4.x+.
The purpose of this plugin slot is offering the possibility to create, list and dowload custom test export files in the export area of ILIAS tests. It is also possible to use this plugin slot as a kind of hook to transport certain test data to another service, e.g. by a webservice. Each active test export plugin will be listed in the list of possible export formats in the Export area of an ILIAS test.
The plugin slot is named Export (Administration » Plugins » Slots). The corresponding plugin target directory is: [ILIAS_MAIN_DIRECTORY]/Customizing/global/plugins/Modules/Test/Export . Your plugin class has to named il[YOUR_PLUGIN_NAME]Plugin (filename: class.il[YOUR_PLUGIN_NAME]Plugin.php) and extend the abstract class ilTestExportPlugin (located in: [ILIAS_MAIN_DIRECTORY]/Modules/Test/classes).
You have to implement three abstract methods.
1 | require_once 'Modules/Test/classes/class.ilTestExportPlugin.php'; |
Please note, that the format identifier is not meant to be the exports filename extension.
Also, the export formats ILIAS ships with are not be used here and are reserved. (At the time of this writing: xml, xls and csv)
The following paragraph is only important if you want to create/list/download an ILIAS compliant export file (have a look at the screenshot above). It is not important if you transport test data to another system (which is also possible as mentioned above).
An instance of class ilTestExportFilename is passed as the one and only argument to your overridden buildExportFile method. This object can be used to get an ILIAS compliant filename for your export content. Therefore you have to call ...
1 | [...] |
This method returns a compliant filename based on the passed file extension. You can use the return value to put your export content into the file. If the file is stored in filesystem (this has to be done by using native php functions), it is automatically listed in the list of export files and can be downloaded.
Additional Infomation
Your plugin has access to the current test instance. Your can call the getTest() method to retrieve this instance. You can use it to fetch relevant information of the test you want to export, by calling any of its public methods.
1 | [...] |