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
edb6c80d
Commit
edb6c80d
authored
Aug 17, 2009
by
Nigel McNie
Browse files
Beginnings of importing personalinformation resume data.
Currently imports date of birth and gender.
parent
ccdedd5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/resume/import/leap/lib.php
View file @
edb6c80d
...
...
@@ -130,6 +130,59 @@ class LeapImportResume extends LeapImportArtefactPlugin {
return
$artefactmapping
;
}
/**
* Imports data for the personalinformation artefact type, by looking for
* it in the persondata element
*/
public
static
function
import_author_data
(
PluginImport
$importer
,
$persondataid
)
{
if
(
$persondataid
)
{
$composites
=
array
();
$person
=
$importer
->
get_entry_by_id
(
$persondataid
);
$persondata
=
$person
->
xpath
(
'leap:persondata'
);
foreach
(
$persondata
as
$item
)
{
$leapattributes
=
array
();
foreach
(
$item
->
attributes
(
PluginImportLeap
::
NS_LEAP
)
as
$key
=>
$value
)
{
$leapattributes
[
$key
]
=
(
string
)
$value
;
}
if
(
!
isset
(
$leapattributes
[
'field'
]))
{
// 'Field' is required
// http://wiki.cetis.ac.uk/2009-03/LEAP2A_personal_data#field
$importer
->
trace
(
'WARNING: persondata element did not have leap:field attribute'
);
continue
;
}
if
(
$leapattributes
[
'field'
]
==
'dob'
)
{
$composites
[
'dateofbirth'
]
=
(
string
)
$item
;
}
if
(
$leapattributes
[
'field'
]
==
'gender'
)
{
$gender
=
(
string
)
$item
;
if
(
$gender
==
'1'
)
{
$composites
[
'gender'
]
=
'male'
;
}
else
if
(
$gender
==
'2'
)
{
$composites
[
'gender'
]
=
'female'
;
}
else
{
$importer
->
trace
(
'WARNING: gender found but not male or female - no gender stored for this user'
);
}
}
}
if
(
$composites
)
{
$importer
->
trace
(
'Resume personal information:'
);
$importer
->
trace
(
$composites
);
$artefact
=
new
ArtefactTypePersonalinformation
(
0
,
array
(
'owner'
=>
$importer
->
get
(
'usr'
)));
foreach
(
$composites
as
$key
=>
$value
)
{
$artefact
->
set_composite
(
$key
,
$value
);
}
$artefact
->
commit
();
}
}
}
/**
* Creates an artefact in the manner required to overwrite existing profile
* artefacts
...
...
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