Commit 3f2a5b7d authored by Nigel McNie's avatar Nigel McNie
Browse files

Rudimentary book importing support.


Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent aa983c0d
......@@ -54,6 +54,11 @@ class LeapImportResume extends LeapImportArtefactPlugin {
*/
const STRATEGY_IMPORT_AS_EMPLOYMENT = 4;
/**
* Resources of resource_type:Printed map to books/publications
*/
const STRATEGY_IMPORT_AS_BOOK = 5;
/**
* Description of strategies used
*/
......@@ -118,6 +123,19 @@ class LeapImportResume extends LeapImportArtefactPlugin {
);
}
// Books
$correctrdftype = count($entry->xpath('rdf:type['
. $importer->curie_xpath('@rdf:resource', PluginImportLeap::NS_LEAPTYPE, 'resource') . ']')) == 1;
$correctcategoryscheme = count($entry->xpath('a:category[('
. $importer->curie_xpath('@scheme', PluginImportLeap::NS_CATEGORIES, 'resource_type#') . ') and @term="Printed"]')) == 1;
if ($correctrdftype && $correctcategoryscheme) {
$strategies[] = array(
'strategy' => self::STRATEGY_IMPORT_AS_BOOK,
'score' => 100,
'other_required_entries' => array(),
);
}
return $strategies;
}
......@@ -195,6 +213,19 @@ class LeapImportResume extends LeapImportArtefactPlugin {
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'employmenthistory', $importer->get('usr'));
break;
case self::STRATEGY_IMPORT_AS_BOOK:
$dates = PluginImportLeap::get_leap_dates($entry);
$enddate = (isset($dates['end'])) ? self::convert_leap_date_to_resume_date($dates['end']) : '';
$values = array(
'date' => $enddate,
'title' => $entry->title,
'contribution' => '', // TODO - get from related entry
'description' => PluginImportLeap::get_entry_content($entry, $importer), // TODO Still debate over what this is the description of
'displayorder' => '', // TODO: get from the grouping, or failing that, from this entry itself
);
ArtefactTypeResumeComposite::ensure_composite_value($values, 'book', $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