General developer forum

local classes vs locallib (again) re: export/import of editor data

Richard Jones
local classes vs locallib (again) re: export/import of editor data
Particularly helpful MoodlersPlugin developersTesters

Some time ago I asked about using local classes rather than locallib.php.

Now I'm trying to use the portfolio.lib to export an xml file of data (including images) in a similar way to the glossary export.

I find this in the code for checking the required portfolio_include_callback_file:

debugging('Please standardise your plugin by renaming your portfolio callback file to locallib.php, or if that file already exists moving the portfolio functionality there.', DEBUG_DEVELOPER);

So if I want to follow the glossary (xml) model I must use locallib.php, is that right?

I can export the files I want using the download_as_dataformat (dataformatlib) route and a json file.

Justin Hunt has been kind enough to point out some examples of how to write the encoded images into json format (similar to the way glossary handles them) , does anyone know if there are some equivalent existing library files in Moodle already?

Average of ratings: -