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

Import qualification type/description from related achievement for education history entries.


Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent a80dd73b
...@@ -167,15 +167,31 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -167,15 +167,31 @@ class LeapImportResume extends LeapImportArtefactPlugin {
} }
// Education // Education
$other_required_entries = array();
$correctrdftype = count($entry->xpath('rdf:type[' $correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'activity') . ']')) == 1; . $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'activity') . ']')) == 1;
$correctcategoryscheme = count($entry->xpath('a:category[(' $correctcategoryscheme = count($entry->xpath('a:category[('
. $importer->curie_xpath('@scheme', PluginImportLeap::NS_CATEGORIES, 'life_area#') . ') and @term="Education"]')) == 1; . $importer->curie_xpath('@scheme', PluginImportLeap::NS_CATEGORIES, 'life_area#') . ') and @term="Education"]')) == 1;
if ($correctrdftype && $correctcategoryscheme) { if ($correctrdftype && $correctcategoryscheme) {
// If this entry supports an achievement, that achievement will be
// the qualification the user gained in relation to this entry
foreach ($entry->link as $link) {
if ($importer->curie_equals($link['rel'], PluginImportLeap::NS_LEAP, 'supports') && isset($link['href'])) {
if ($potentialqualification = $importer->get_entry_by_id((string)$link['href'])) {
$correctrdftype = count($potentialqualification->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'achievement') . ']')) == 1;
if ($correctrdftype) {
// We have a related achievement!
$other_required_entries[] = (string)$link['href'];
break;
}
}
}
}
$strategies[] = array( $strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_EDUCATION, 'strategy' => self::STRATEGY_IMPORT_AS_EDUCATION,
'score' => 100, 'score' => 100,
'other_required_entries' => array(), // TODO: we need is_supported_by entries, which in mahara usually refer to organisations 'other_required_entries' => $other_required_entries,
); );
} }
...@@ -288,11 +304,18 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -288,11 +304,18 @@ class LeapImportResume extends LeapImportArtefactPlugin {
$startdate = (isset($dates['start'])) ? self::convert_leap_date_to_resume_date($dates['start']) : ''; $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']) : ''; $enddate = (isset($dates['end'])) ? self::convert_leap_date_to_resume_date($dates['end']) : '';
$qualtype = $qualname = '';
if (count($otherentries)) {
$qualification = $importer->get_entry_by_id($otherentries[0]);
$qualtype = $qualification->title;
$qualname = PluginImportLeap::get_entry_content($qualification, $importer);
}
$values = array( $values = array(
'startdate' => $startdate, 'startdate' => $startdate,
'enddate' => $enddate, 'enddate' => $enddate,
'qualtype' => '', // TODO - get from related entry (achievement) 'qualtype' => $qualtype,
'qualname' => $entry->title, 'qualname' => $qualname,
'institution' => '', // TODO - get from related entry (organisation) 'institution' => '', // TODO - get from related entry (organisation)
'qualdescription' => PluginImportLeap::get_entry_content($entry, $importer), 'qualdescription' => PluginImportLeap::get_entry_content($entry, $importer),
'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself 'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself
......
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