Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
cad1c37e
Commit
cad1c37e
authored
Jul 23, 2010
by
Adrian Schlegel
Browse files
added capability to import publications as defined in leap2a version 2010-07
Signed-off-by:
Adrian Schlegel
<
adrian@liip.ch
>
parent
b585c6c1
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/artefact/resume/import/leap/lib.php
View file @
cad1c37e
...
...
@@ -102,6 +102,7 @@ class LeapImportResume extends LeapImportArtefactPlugin {
$isactivity
=
PluginImportLeap
::
is_rdf_type
(
$entry
,
$importer
,
'activity'
);
$isaffiliation
=
PluginImportLeap
::
is_rdf_type
(
$entry
,
$importer
,
'affiliation'
);
$isresource
=
PluginImportLeap
::
is_rdf_type
(
$entry
,
$importer
,
'resource'
);
$ispublication
=
PluginImportLeap
::
is_rdf_type
(
$entry
,
$importer
,
'publication'
);
// Goals, cover letter & interests
if
(
$isentry
&&
$correctplugintype
)
{
...
...
@@ -162,7 +163,7 @@ class LeapImportResume extends LeapImportArtefactPlugin {
// Books
$other_required_entries
=
array
();
if
((
$isresource
||
$isentry
)
&&
PluginImportLeap
::
is_correct_category_scheme
(
$entry
,
$importer
,
'resource_type'
,
'Printed'
))
{
if
((
$ispublication
||
$isresource
||
$isentry
)
&&
PluginImportLeap
::
is_correct_category_scheme
(
$entry
,
$importer
,
'resource_type'
,
'Printed'
))
{
// If it exists, the related achievement will be the user's role in
// relation to the book
foreach
(
$entry
->
link
as
$link
)
{
...
...
@@ -323,6 +324,14 @@ class LeapImportResume extends LeapImportArtefactPlugin {
$contribution
=
$role
->
title
;
$description
=
PluginImportLeap
::
get_entry_content
(
$role
,
$importer
);
}
// check if the import is of the version leap2a 2010-07. If it is then override the contribution and description
if
(
$importer
->
get_leap2a_namespace
()
==
PluginImportLeap
::
NS_LEAP
)
{
$myrole
=
PluginImportLeap
::
get_leap_myrole
(
$entry
,
$importer
->
get_namespaces
(),
$importer
->
get_leap2a_namespace
());
if
(
$myrole
)
{
$contribution
=
$myrole
;
}
$description
=
PluginImportLeap
::
get_entry_content
(
$entry
,
$importer
);
}
$values
=
array
(
'date'
=>
$enddate
,
...
...
htdocs/import/leap/lib.php
View file @
cad1c37e
...
...
@@ -1143,6 +1143,28 @@ class PluginImportLeap extends PluginImport {
return
$dates
;
}
/**
* Look for a leap2:myrole element that is part of an entry (if any) and
* return the value
*
*
* @param SimpleXMLElement $entry The element containing the date
* @param array $namespaces array of namespaces @see PluginImportLeap::namespaces
* @param string $ns namespace URL which is used as a key in the $namespaces array
*
* @return string
*
* Spec reference: http://wiki.leapspecs.org/2A/literals#myrole
*/
public
static
function
get_leap_myrole
(
SimpleXMLElement
$entry
,
$namespaces
,
$ns
)
{
$myrole
=
$entry
->
xpath
(
$namespaces
[
$ns
]
.
':myrole'
);
// we only expect one role
if
(
$myrole
[
0
])
{
return
$myrole
[
0
];
}
return
''
;
}
/**
* Waffer thin helper to grab all attributes in a namespace.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment