Difference between revisions of "Developer Area/Import//Export/HTML Export"
(Created page with "Mahara's HTML export is implemented as a plugin for Mahara's "Export" plugin type. It allows Mahara to export portfolios …")
Revision as of 17:55, 9 May 2011
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.
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
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.
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.
The HTML export plugin exports Views itself. They appear in the
views/ subdirectory of the export.
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.
The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.