Skip to content

Commit

Permalink
Hide additional elements for MODS/DC templates for EAD XML export.
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Nov 29, 2024
1 parent 48b5db2 commit ded6724
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?php $defTemplate = sfConfig::get('app_default_template_informationobject'); ?>
<ead>
<eadheader langencoding="iso639-2b" countryencoding="iso3166-1" dateencoding="iso8601" repositoryencoding="iso15511" scriptencoding="iso15924" relatedencoding="DC">
<?php echo $ead->renderEadId(); ?>
Expand All @@ -14,7 +15,7 @@
<edition><?php echo escape_dc(esc_specialchars($value)); ?></edition>
</editionstmt>
<?php } ?>
<?php if ($value = $resource->getRepository(['inherit' => true])) { ?>
<?php if (($defTemplate != 'mods' && $defTemplate != 'dc') && $value = $resource->getRepository(['inherit' => true])) { ?>
<publicationstmt>
<publisher encodinganalog="<?php echo $ead->getMetadataParameter('publisher'); ?>"><?php echo escape_dc(esc_specialchars($value->__toString())); ?></publisher>
<?php if ($address = $value->getPrimaryContact()) { ?>
Expand Down Expand Up @@ -57,24 +58,26 @@
<?php echo __('Generated by %1%', ['%1%' => $ead->version]); ?>
<date normal="<?php echo gmdate('o-m-d'); ?>"><?php echo gmdate('o-m-d H:i e'); ?></date>
</creation>
<langusage>
<language langcode="<?php echo strtolower($iso639convertor->getID2($exportLanguage)); ?>"><?php echo format_language($exportLanguage); ?></language>
<?php if (0 < strlen($languageOfDescription = $resource->getPropertyByName('languageOfDescription')->__toString()) && ($sf_user->isAuthenticated() || 1 == sfConfig::get('app_element_visibility_isad_control_languages'))) { ?>
<?php $langsOfDesc = unserialize($languageOfDescription); ?>
<?php if (is_array($langsOfDesc)) { ?>
<?php foreach ($langsOfDesc as $langcode) { ?>
<?php if ($langcode != $exportLanguage) { ?>
<language langcode="<?php echo strtolower($iso639convertor->getID2($langcode)); ?>"><?php echo format_language($langcode); ?></language>
<?php if ($defTemplate != 'mods' && $defTemplate != 'dc') { ?>
<langusage>
<language langcode="<?php echo strtolower($iso639convertor->getID2($exportLanguage)); ?>"><?php echo format_language($exportLanguage); ?></language>
<?php if (0 < strlen($languageOfDescription = $resource->getPropertyByName('languageOfDescription')->__toString()) && ($sf_user->isAuthenticated() || 1 == sfConfig::get('app_element_visibility_isad_control_languages'))) { ?>
<?php $langsOfDesc = unserialize($languageOfDescription); ?>
<?php if (is_array($langsOfDesc)) { ?>
<?php foreach ($langsOfDesc as $langcode) { ?>
<?php if ($langcode != $exportLanguage) { ?>
<language langcode="<?php echo strtolower($iso639convertor->getID2($langcode)); ?>"><?php echo format_language($langcode); ?></language>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php if ($sf_user->isAuthenticated() || 1 == sfConfig::get('app_element_visibility_isad_control_scripts')) { ?>
<?php foreach ($resource->scriptOfDescription as $code) { ?>
<language scriptcode="<?php echo $code; ?>"><?php echo format_script($code); ?></language>
<?php if ($sf_user->isAuthenticated() || 1 == sfConfig::get('app_element_visibility_isad_control_scripts')) { ?>
<?php foreach ($resource->scriptOfDescription as $code) { ?>
<language scriptcode="<?php echo $code; ?>"><?php echo format_script($code); ?></language>
<?php } ?>
<?php } ?>
<?php } ?>
</langusage>
</langusage>
<?php } ?>
<?php $rulesConv = 'app_element_visibility_' + $template + '_control_rules_conventions'; ?>
<?php if (0 < strlen($rules = $resource->getRules(['cultureFallback' => true])) && ($sf_user->isAuthenticated() || 1 == sfConfig::get($rulesConv))) { ?>
<descrules <?php if (0 < strlen($encoding = $ead->getMetadataParameter('descrules'))) { ?>encodinganalog="<?php echo $encoding; ?>"<?php } ?>><?php echo escape_dc(esc_specialchars($rules)); ?></descrules>
Expand All @@ -97,7 +100,7 @@

$topLevelDid = false;
?>
<?php if ($resource->getPublicationStatus()) { ?>
<?php if (($defTemplate != 'mods' && $defTemplate != 'dc') && $resource->getPublicationStatus()) { ?>
<odd type="publicationStatus"><p><?php echo escape_dc(esc_specialchars($resource->getPublicationStatus())); ?></p></odd>
<?php } ?>
<?php $levelOfDetail = 'app_element_visibility_' + $template + '_control_level_of_detail'; ?>
Expand Down Expand Up @@ -323,7 +326,7 @@
include 'indexSuccessBodyBioghistElement.xml.php';
?>

<?php if ($descendant->getPublicationStatus()) { ?>
<?php if (($defTemplate != 'mods' && $defTemplate != 'dc') && $descendant->getPublicationStatus()) { ?>
<odd type="publicationStatus"><p><?php echo escape_dc(esc_specialchars($descendant->getPublicationStatus())); ?></p></odd>
<?php } ?>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php $defTemplate = sfConfig::get('app_default_template_informationobject'); ?>

<?php if (0 < count($creators)) { ?>
<?php if (($defTemplate != 'mods' && $defTemplate != 'dc') && 0 < count($creators)) { ?>
<?php foreach ($events as $date) { ?>
<?php $creator = QubitActor::getById($date->actorId); ?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<?php } ?>

<?php if (0 < strlen($value = ${$resourceVar}->getTitle(['cultureFallback' => true]))) { ?>
<?php if ($defTemplate != 'dc' && 0 < strlen($value = ${$resourceVar}->getTitle(['cultureFallback' => true]))) { ?>
<unittitle encodinganalog="<?php echo $ead->getMetadataParameter('unittitle'); ?>"><?php echo escape_dc(esc_specialchars($value)); ?></unittitle>
<?php } ?>

Expand All @@ -58,7 +58,7 @@
<?php } ?>

<?php $repository = null; ?>
<?php if (0 < strlen(${$resourceVar}->getIdentifier())) { ?>
<?php if ($defTemplate != 'dc' && 0 < strlen(${$resourceVar}->getIdentifier())) { ?>
<?php foreach (${$resourceVar}->ancestors->andSelf()->orderBy('rgt') as $item) { ?>
<?php if (isset($item->repository)) { ?>
<?php $repository = $item->repository; ?>
Expand Down Expand Up @@ -89,7 +89,7 @@
<?php if ($value = ${$resourceVar}->getRepository(['inherit' => $topLevelDid])) { ?>
<repository>
<corpname><?php echo escape_dc(esc_specialchars($value->__toString())); ?></corpname>
<?php if ($address = $value->getPrimaryContact()) { ?>
<?php if (($defTemplate != 'mods' && $defTemplate != 'dc') && $address = $value->getPrimaryContact()) { ?>
<address>
<?php if (0 < strlen($addressline = $address->getStreetAddress())) { ?>
<addressline><?php echo escape_dc(esc_specialchars($addressline)); ?></addressline>
Expand Down

0 comments on commit ded6724

Please sign in to comment.