Commit 204805bf authored by Nigel McNie's avatar Nigel McNie
Browse files

Add strategy for importing employment history.

parent 3744e602
......@@ -49,6 +49,11 @@ class LeapImportResume extends LeapImportArtefactPlugin {
*/
const STRATEGY_IMPORT_AS_ACHIEVEMENT = 3;
/**
* Activities in category life_area:Work map to employment history
*/
const STRATEGY_IMPORT_AS_EMPLOYMENT = 4;
/**
* Description of strategies used
*/
......@@ -101,6 +106,17 @@ class LeapImportResume extends LeapImportArtefactPlugin {
}
// Employment
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'activity') . ']')) == 1;
$correctcategoryscheme = count($entry->xpath('a:category[('
. $importer->curie_xpath('@scheme', PluginImportLeap::NS_CATEGORIES, 'life_area#') . ') and @term="Work"]')) == 1;
if ($correctrdftype && $correctcategoryscheme) {
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_EMPLOYMENT,
'score' => 100,
'other_required_entries' => array(), // TODO: we need is_supported_by entries, which in mahara usually refer to organisations
);
}
return $strategies;
}
......@@ -164,6 +180,21 @@ class LeapImportResume extends LeapImportArtefactPlugin {
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'certification', $importer->get('usr'));
break;
case self::STRATEGY_IMPORT_AS_EMPLOYMENT:
$dates = PluginImportLeap::get_leap_dates($entry);
$startdate = (isset($dates['start'])) ? self::convert_leap_date_to_resume_date($dates['start']) : '';
$enddate = (isset($dates['end'])) ? self::convert_leap_date_to_resume_date($dates['end']) : '';
$values = array(
'startdate' => $startdate,
'enddate' => $enddate,
'employer' => '', // TODO - get from related organisation
'jobtitle' => $entry->title,
'positiondescription' => PluginImportLeap::get_entry_content($entry, $importer),
'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'employmenthistory', $importer->get('usr'));
break;
default:
throw new ImportException($importer, 'TODO: get_string: unknown strategy chosen for importing entry');
}
......
Markdown is supported
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