Commit c690f661 authored by Nigel McNie's avatar Nigel McNie
Browse files

Rudimentary importing of education history.

parent c0859da6
...@@ -59,6 +59,11 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -59,6 +59,11 @@ class LeapImportResume extends LeapImportArtefactPlugin {
*/ */
const STRATEGY_IMPORT_AS_BOOK = 5; const STRATEGY_IMPORT_AS_BOOK = 5;
/**
* Activities in category life_area:Education map to education history
*/
const STRATEGY_IMPORT_AS_EDUCATION = 6;
/** /**
* Description of strategies used * Description of strategies used
*/ */
...@@ -136,6 +141,19 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -136,6 +141,19 @@ class LeapImportResume extends LeapImportArtefactPlugin {
); );
} }
// Education
$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="Education"]')) == 1;
if ($correctrdftype && $correctcategoryscheme) {
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_EDUCATION,
'score' => 100,
'other_required_entries' => array(), // TODO: we need is_supported_by entries, which in mahara usually refer to organisations
);
}
return $strategies; return $strategies;
} }
...@@ -226,6 +244,22 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -226,6 +244,22 @@ class LeapImportResume extends LeapImportArtefactPlugin {
); );
ArtefactTypeResumeComposite::ensure_composite_value($values, 'book', $importer->get('usr')); ArtefactTypeResumeComposite::ensure_composite_value($values, 'book', $importer->get('usr'));
break; break;
case self::STRATEGY_IMPORT_AS_EDUCATION:
$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,
'qualtype' => '', // TODO - get from related entry (achievement)
'qualname' => $entry->title,
'institution' => '', // TODO - get from related entry (organisation)
'qualdescription' => PluginImportLeap::get_entry_content($entry, $importer),
'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'educationhistory', $importer->get('usr'));
break;
default: default:
throw new ImportException($importer, 'TODO: get_string: unknown strategy chosen for importing entry'); throw new ImportException($importer, 'TODO: get_string: unknown strategy chosen for importing entry');
} }
......
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