Skip to content

Commit

Permalink
Get metadata helperfunction and intro of oai_config.php
Browse files Browse the repository at this point in the history
  • Loading branch information
torinfo committed Oct 21, 2021
1 parent 7694b23 commit 2dd760a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions oai-pmh/oai_config.php
Expand Up @@ -11,4 +11,5 @@
$config = array(
'institute' => "DLearning",
'adminEmail' => "tom.reijnders@dlearing.nl",
'thumbnail' => $xerte_toolkits_site->site_url . 'oai-pmh/xerteobject.png',
);
30 changes: 28 additions & 2 deletions oai-pmh/xerteobjects.php
Expand Up @@ -21,10 +21,35 @@
function get_meta_data($template_id, $creator_user_name="", $template_type_name="")
{
global $config;
global $xerte_toolkits_site;

$xml = get_template_data_as_xml($template_id, $creator_user_name, $template_type_name);
$xerteMetaObj = new stdClass();
$xerteMetaObj->name = (string)$xml['name'];
if (isset($xml['educode']))
{
$xerteMetaObj->educode = (string)$xml['educode'];
}
if (isset($xml['education']))
{
$xerteMetaObj->education = (string)$xml['education'];
}
if (isset($xml['level']))
{
$xerteMetaObj->level = (string)$xml['level'];
}
else
{
$xerteMetaObj->level = 12;
}
if (isset($xml['thumbnail']))
{
$xerteMetaObj->thumbnail = (string)$xml['thumbnail'];
}
else
{
$xerteMetaObj->thumbnail = $config['thumbnail'];
}
if (isset($xml['course']))
$xerteMetaObj->course = (string)$xml['course'];
else
Expand All @@ -47,10 +72,11 @@ function get_meta_data($template_id, $creator_user_name="", $template_type_name=
else
$xerteMetaObj->author = $config['institute'];
if (isset($xml['category']))
$xerteMetaObj->category = (string)$xml['category'];
$xerteMetaObj->domain = (string)$xml['category'];
else
$xerteMetaObj->category = 'unknown';
$xerteMetaObj->domain = 'unknown';
$xerteMetaObj->language = (string)$xml['language'];
$xerteMetaObj->publisher = $config['institute'];

return $xerteMetaObj;
}
Expand Down

0 comments on commit 2dd760a

Please sign in to comment.