Actions

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

From Mahara Wiki

< Developer Area‎ | Import//Export
No edit summary
No edit summary
Line 1: Line 1:
Mahara's HTML export is implemented as a plugin for Mahara's [[../../../../Developer Area/Import//Export/Export API|"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.
../../../../Developer_Area/Import%2f%2fExport/Export_API
Mahara's HTML export is implemented as a plugin for Mahara's [[../../../../Developer Area/Import%2f%2fExport/Export API|"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.


<div id="section_1">
<div id="section_1">

Revision as of 18:05, 12 Mayıs 2011

../../../../Developer_Area/Import%2f%2fExport/Export_API 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.