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

Use associative array trick to identify related achievements for education entries.


Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent c006a45b
...@@ -176,13 +176,14 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -176,13 +176,14 @@ class LeapImportResume extends LeapImportArtefactPlugin {
// If this entry supports an achievement, that achievement will be // If this entry supports an achievement, that achievement will be
// the qualification the user gained in relation to this entry // the qualification the user gained in relation to this entry
foreach ($entry->link as $link) { foreach ($entry->link as $link) {
if ($importer->curie_equals($link['rel'], PluginImportLeap::NS_LEAP, 'supports') && isset($link['href'])) { if (!isset($other_required_entries['achievement'])
&& $importer->curie_equals($link['rel'], PluginImportLeap::NS_LEAP, 'supports') && isset($link['href'])) {
if ($potentialqualification = $importer->get_entry_by_id((string)$link['href'])) { if ($potentialqualification = $importer->get_entry_by_id((string)$link['href'])) {
$correctrdftype = count($potentialqualification->xpath('rdf:type[' $correctrdftype = count($potentialqualification->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'achievement') . ']')) == 1; . $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'achievement') . ']')) == 1;
if ($correctrdftype) { if ($correctrdftype) {
// We have a related achievement! // We have a related achievement!
$other_required_entries[] = (string)$link['href']; $other_required_entries['achievement'] = (string)$link['href'];
break; break;
} }
} }
...@@ -305,8 +306,8 @@ class LeapImportResume extends LeapImportArtefactPlugin { ...@@ -305,8 +306,8 @@ class LeapImportResume extends LeapImportArtefactPlugin {
$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 = ''; $qualtype = $qualname = '';
if (count($otherentries)) { if (isset($otherentries['achievement'])) {
$qualification = $importer->get_entry_by_id($otherentries[0]); $qualification = $importer->get_entry_by_id($otherentries['achievement']);
$qualtype = $qualification->title; $qualtype = $qualification->title;
$qualname = PluginImportLeap::get_entry_content($qualification, $importer); $qualname = PluginImportLeap::get_entry_content($qualification, $importer);
} }
......
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