Forums | Mahara Community
Double type plugin
21 July 2011, 3:52 AM
I'm trying to implement an import feature for the Europass plugin (which is an artefact type plugin), and I wondering, do I have to create a separate plugin with the "import" type or the plugin can have two different types? If it can, in which folder should it be? Does it stay in the artefact folder or I have to move it in import folder?
21 July 2011, 3:30 PM
The current import functionality in Mahara core only allows an administrator to import Leap2A zip files from which a new user can be created.
Can't give you more information beyond that though I am afraid.
23 July 2011, 9:58 AM
Basically you need to revert the process for exporting. You should look these files:
- htdocs/artefact/europass/lib.php (to add menu item 'Import Europass' or something like that)
- htdocs/artefact/europass/export.php (contains the form for users to select export options)
- htdocs/artefact/europass/theme/raw/export.tpl (calls exportgenerate.php with the export options that user selected)
- htdocs/artefact/europass/exportgenerate.php (calls function which creates xml file from mahara db data and sends that xml to europass webservice - as the result the webservice sends appropriate file: pdf, doc, odt, or xml/html
- htdocs/artefact/europass/lin/europassxml.php (contains the function, which createxml file from mahara db data)
You'll need to:
- add this code to htdocs/artefact/europass/lib.php (around line 70):
'path' => 'myportfolio/importeuropass',
'title' => get_string('importeuropass', 'artefact.europass'),
'url' => 'artefact/europass/import.php',
'weight' => 92,
- create htdocs/artefact/europass/import.php file, which will contain the form for users to find/upload their official europass generated xml file
- write function to get the data from xml file and store that data into mahara db
Currently I don't have time to write the import functionallity myself. If there would be enough interest and if you're not in a big hurry I could write it in the future...
I'm also planning to change the layout to be more mahara 1.4 tabs-like.
If you write the import function yourself, please send me the code to include it.
25 July 2011, 7:17 AM
Thanks for your answers!
@Kristina: Europass plugin uses Mahara profile informations and adds more fields to complete the profile. In the Europass official website you can import an XML file, modify and export it. It is possible with the Europass plugin in Mahara to manually complete your Europass profile and export it, but not import the XML that's why I'm working on it.
@Gregor: Thanks for your help! I think I'm able to do the points 1 and 3, but for the point 2 I don't know how to reuse the browser input file in a form in the Europass plugin. That's why I thought about the "import" plugin type library because it's used by Leap2A and Leap2A plugin temporarly loads on the server the file to parse and deletes it.
I've already corrected the code to work on Mahara 1.4. I also had a part of the personal address (the city and postal code) that weren't present at the export and other minor bug. If you want the code before the import function is created, I can give it to you.
Did you write the XSL files for the CV blocktype yourself? I can't find them on Europass and EIFEL websites and I have seen a little mistake for the postal code (if you wrote it yourself I will correct it, whereas if it's on Europass website I will see before that if it's up to date).
I will write 1 and 3 and give you the code. Any idea about the point 2 will be very helpful.
26 July 2011, 6:18 AM
Thank you very much for the clarification.
All the best with your work on the plugin.
26 July 2011, 7:17 AM
I didn't write XLS files myself... found them at http://europass.cedefop.europa.eu/europass/home/hornav/Downloads/TechnicalResources/XML.csp?loc=en_GB
27 July 2011, 8:55 AM
Thank both of you!