Skip to content

Commit

Permalink
Attempt to filter out records without metadata.
Browse files Browse the repository at this point in the history
Not functioning
  • Loading branch information
jajreijnders committed Jan 4, 2022
1 parent aaaec85 commit 1b6dbf3
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions oai-pmh/oai.php
Expand Up @@ -221,18 +221,30 @@ function getTemplates($metadataPrefix,$from,$until) {
$response->site_url = $xerte_toolkits_site->site_url;
$response->site_name = $xerte_toolkits_site->site_name;

$response->count = count($templates);
$response->templates = $templates;

//To make sure the response templates are the same as the filled in metadata number
$tmpTemplates = array();

$tmpRecords = array();
for($i=0;$i<count($templates);$i++)
{
$currentTemplate = $templates[$i];
$tempMetaData = call_user_func(get_meta_data,$currentTemplate['template_id'],$currentTemplate["owner_username"],$currentTemplate["template_type"]);
$currentRecord = call_user_func(makeRecordFromTemplate,$metadataPrefix,$currentTemplate, $tempMetaData);
$tmpRecords[] = $currentRecord;
if($tempMetaData->domain == 'unknown' or $tempMetaData->level == "unknown"){
echo "Public record without metadata specified.";
}
else
{
$currentRecord = call_user_func(makeRecordFromTemplate,$metadataPrefix,$currentTemplate, $tempMetaData);
$tmpRecords[] = $currentRecord;
$tmpTemplates[] = $currentTemplate;
}
}

$response->templates = $tmpTemplates;
$response->count = count($tmpTemplates);


return $tmpRecords;
};

Expand Down

0 comments on commit 1b6dbf3

Please sign in to comment.