Commit 858b95e2 authored by Nigel McNie's avatar Nigel McNie
Browse files

Revert "Removed unnecessary method."

This reverts commit 24e0d6fc

.

What the hell was I smoking??
Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent 320e52bd
......@@ -376,6 +376,64 @@ class LeapImportResume extends LeapImportArtefactPlugin {
return $artefactmapping;
}
/**
* Imports data for the personalinformation artefact type, by looking for
* it in the persondata element
*/
public static function import_author_data(PluginImport $importer, $persondataid) {
if ($persondataid) {
$composites = array();
$person = $importer->get_entry_by_id($persondataid);
$persondata = $person->xpath('leap:persondata');
foreach ($persondata as $item) {
$leapattributes = PluginImportLeap::get_attributes($item, PluginImportLeap::NS_LEAP);
if (!isset($leapattributes['field'])) {
// 'Field' is required
// http://wiki.cetis.ac.uk/2009-03/LEAP2A_personal_data#field
$importer->trace('WARNING: persondata element did not have leap:field attribute');
continue;
}
if ($leapattributes['field'] == 'dob') {
$composites['dateofbirth'] = (string)$item;
}
if ($leapattributes['field'] == 'gender') {
$gender = (string)$item;
if ($gender == '1') {
$composites['gender'] = 'male';
}
else if ($gender == '2') {
$composites['gender'] = 'female';
}
else {
$importer->trace('WARNING: gender found but not male or female - no gender stored for this user');
}
}
$maharaattributes = PluginImportLeap::get_attributes($item, PluginImportLeap::NS_MAHARA);
if (isset($maharaattributes['field'])) {
if (in_array($maharaattributes['field'], array('placeofbirth', 'citizenship', 'visastatus', 'maritalstatus'))) {
$composites[$maharaattributes['field']] = (string)$item;
}
}
}
if ($composites) {
$importer->trace('Resume personal information:');
$importer->trace($composites);
$artefact = new ArtefactTypePersonalinformation(0, array('owner' => $importer->get('usr')));
foreach ($composites as $key => $value) {
$artefact->set_composite($key, $value);
}
$artefact->commit();
}
}
}
/**
* Creates an artefact in the manner required to overwrite existing profile
* artefacts
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment