Actions

Developer Area/Import//Export/HTML Export: Difference between revisions

From Mahara Wiki

< Developer Area‎ | Import//Export
No edit summary
Line 41: Line 41:
The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.
The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.


</div></div>
 
====Adjustments====
 
Currently the html export gives you the raw images/css files rather than fetching them directly from the theme.
It would be better if we could tally up the themes/skins used and export them all within the export zip file and get the correct page using the correct theme/skin
 
Each artefact can have special templates for the html export.
- at the very least we need to update them when we update the artefact they relate to (not to forget them).
- also may need to create some more for artefacts/blocks that are not displaying correctly for the html export

Revision as of 17:19, 26 March 2015

Mahara's HTML export is implemented as a plugin for Mahara's "Export" plugin type. It allows Mahara to export portfolios as standalone HTML websites, easily viewed in a standard web browser. It is not possible to import from this format again.

Architecture

The HTML export plugin lives in htdocs/export/html/. The export plugin itself handles the exporting of Views, while offloading the export of Artefacts to the associated artefact plugins. If artefact plugins want to export data to the HTML export, they need to add an export/html/lib.php file which implements the class HtmlExport which extends HtmlExportArtefactPlugin.

Implementation

A directory is set up in which the exported data should be generated. This is known to the exporter as $this->rootdir. In this directory, directories for artefact plugins, views and static data are set up.

Artefacts

Each artefact plugin is in charge of exporting its own artefacts. Each one has a 'fileroot' property which points to the directory where it should write its files. The artefact plugin is free to write whatever it needs there, including creating any subdirectories.

If creating a templated file, such as an index.html for a directory, the artefact plugins should call $this->exporter->get_smarty($rootpath) to get the smarty object they need. The $rootpath is a relative path to the root of the export from where the file is to be written, and is used to create links in the templates back to the homepage of the export, among other things.

Artefact plugins should test that files/folders are able to be created, and throw SystemExceptions when they can't.

Views

The HTML export plugin exports Views itself. They appear in the views/ subdirectory of the export.

Export Homepage

The homepage for the export provides a summary of all the exported information. It gets this information by polling all the artefact plugins for it, as well as asking itself for a summary of the Views exported.

Finishing up

The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.


Adjustments

Currently the html export gives you the raw images/css files rather than fetching them directly from the theme. It would be better if we could tally up the themes/skins used and export them all within the export zip file and get the correct page using the correct theme/skin

Each artefact can have special templates for the html export. - at the very least we need to update them when we update the artefact they relate to (not to forget them). - also may need to create some more for artefacts/blocks that are not displaying correctly for the html export