Data formats: Difference between revisions
(Created page with "Dataformat's are plugins that define how a table of data can be exported for download. Moodle comes with plugins for CSV, Excel, ODS, JSON, and HTML. =Components= '''datafo...") |
No edit summary |
||
Line 1: | Line 1: | ||
Dataformat's are plugins that define how a table of data can be exported for download. Moodle comes with plugins for CSV, Excel, ODS, JSON, and HTML. | Dataformat's are plugins that define how a table of data can be exported for download. Moodle comes with plugins for CSV, Excel, ODS, JSON, and HTML. | ||
= Components = | |||
=Components= | |||
'''dataformat/FORMATNAME/lang/en/format_FORMATNAME.php''' | '''dataformat/FORMATNAME/lang/en/format_FORMATNAME.php''' | ||
Line 15: | Line 14: | ||
Version definitions, see [[version.php]]. It is highly recommended always to have it and it is required if you have any files in db folder | Version definitions, see [[version.php]]. It is highly recommended always to have it and it is required if you have any files in db folder | ||
Generally no other files are needed, but all the other files available to other plugins could also be used here such as db files. | |||
= Creating a new Dataformat = | |||
The dataformat interface is quite simple, to create a new format the easiest approach would be to clone and rename one of the existing text based formats such as /dataformat/json or /dataformat/html. |
Revision as of 03:16, 20 May 2016
Dataformat's are plugins that define how a table of data can be exported for download. Moodle comes with plugins for CSV, Excel, ODS, JSON, and HTML.
Components
dataformat/FORMATNAME/lang/en/format_FORMATNAME.php
Contains the English language strings used in the format. You can also define strings for other languages.
dataformat/FORMATNAME/classes/writer.php
This file is the real meat of the form, it contains class which extends \core\dataformat\base defining how the data stream should be encoded.
dataformat/FORMATNAME/version.php
Version definitions, see version.php. It is highly recommended always to have it and it is required if you have any files in db folder
Generally no other files are needed, but all the other files available to other plugins could also be used here such as db files.
Creating a new Dataformat
The dataformat interface is quite simple, to create a new format the easiest approach would be to clone and rename one of the existing text based formats such as /dataformat/json or /dataformat/html.