예제 #1
0
 /**
  *  creates the METS:dmdSec element for an Issue
  */
 function generateIssueDmdSecDom(&$doc, &$root, &$issue, &$journal)
 {
     $dmdSec =& XMLCustomWriter::createElement($doc, 'METS:dmdSec');
     XMLCustomWriter::setAttribute($dmdSec, 'ID', 'I-' . $issue->getId());
     $mdWrap =& XMLCustomWriter::createElement($doc, 'METS:mdWrap');
     $xmlData =& XMLCustomWriter::createElement($doc, 'METS:xmlData');
     XMLCustomWriter::setAttribute($mdWrap, 'MDTYPE', 'MODS');
     $mods =& XMLCustomWriter::createElement($doc, 'mods:mods');
     XMLCustomWriter::setAttribute($mods, 'xmlns:mods', 'http://www.loc.gov/mods/v3');
     XMLCustomWriter::setAttribute($root, 'xsi:schemaLocation', str_replace(' http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd', '', $root->getAttribute('xsi:schemaLocation')) . ' http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-0.xsd');
     $titleInfo =& XMLCustomWriter::createElement($doc, 'mods:titleInfo');
     XMLCustomWriter::createChildWithText($doc, $titleInfo, 'mods:title', $issue->getLocalizedTitle());
     XMLCustomWriter::appendChild($mods, $titleInfo);
     if ($issue->getLocalizedDescription() != '') {
         $modsAbstract = XMLCustomWriter::createChildWithText($doc, $titleInfo, 'mods:abstract', $issue->getLocalizedDescription());
         XMLCustomWriter::appendChild($mods, $modsAbstract);
     }
     XMLCustomWriter::createChildWithText($doc, $mods, 'mods:genre', 'issue');
     import('classes.config.Config');
     $base_url = Config::getVar('general', 'base_url');
     $url = $base_url . '/index.php/' . $journal->getPath() . '/issue/view/' . $issue->getId();
     $modsIdentifier = XMLCustomWriter::createChildWithText($doc, $mods, 'mods:identifier', $url);
     XMLCustomWriter::setAttribute($modsIdentifier, 'type', 'uri');
     $modsOriginInfo =& XMLCustomWriter::createElement($doc, 'mods:originInfo');
     if ($issue->getDatePublished()) {
         $timeIssued = date("Y-m-dTH:i:sP", strtotime($issue->getDatePublished()));
         $modsDateIssued = XMLCustomWriter::createChildWithText($doc, $modsOriginInfo, 'mods:dateIssued', $timeIssued);
     }
     XMLCustomWriter::appendChild($mods, $modsOriginInfo);
     $modsRelatedItem =& XMLCustomWriter::createElement($doc, 'mods:relatedItem');
     XMLCustomWriter::setAttribute($modsRelatedItem, 'type', 'host');
     $modsTitleInfo =& XMLCustomWriter::createElement($doc, 'mods:titleInfo');
     $modsIdentifier = XMLCustomWriter::createChildWithText($doc, $modsTitleInfo, 'mods:title', $journal->getLocalizedTitle());
     XMLCustomWriter::appendChild($modsRelatedItem, $modsTitleInfo);
     $url = $base_url . '/index.php/' . $journal->getPath();
     $modsIdentifier = XMLCustomWriter::createChildWithText($doc, $modsRelatedItem, 'mods:identifier', $url);
     XMLCustomWriter::setAttribute($modsIdentifier, 'type', 'uri');
     $modsPart =& XMLCustomWriter::createElement($doc, 'mods:part');
     $modsVolumDetail =& XMLCustomWriter::createElement($doc, 'mods:detail');
     XMLCustomWriter::setAttribute($modsVolumDetail, 'type', 'volume');
     XMLCustomWriter::createChildWithText($doc, $modsVolumDetail, 'mods:number', $issue->getVolume());
     $modsIssueDetail =& XMLCustomWriter::createElement($doc, 'mods:detail');
     XMLCustomWriter::setAttribute($modsIssueDetail, 'type', 'issue');
     XMLCustomWriter::createChildWithText($doc, $modsIssueDetail, 'mods:number', $issue->getNumber());
     XMLCustomWriter::appendChild($modsPart, $modsVolumDetail);
     XMLCustomWriter::appendChild($modsPart, $modsIssueDetail);
     XMLCustomWriter::createChildWithText($doc, $modsPart, 'mods:date', $issue->getYear());
     XMLCustomWriter::appendChild($modsRelatedItem, $modsPart);
     XMLCustomWriter::appendChild($mods, $modsRelatedItem);
     XMLCustomWriter::appendChild($xmlData, $mods);
     XMLCustomWriter::appendChild($dmdSec, $mdWrap);
     XMLCustomWriter::appendChild($mdWrap, $xmlData);
     XMLCustomWriter::appendChild($root, $dmdSec);
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionArray =& $sectionDao->getSectionsForIssue($issue->getId());
     $i = 0;
     while ($i < sizeof($sectionArray)) {
         MetsExportDom::generateSectionDmdSecDom($doc, $root, $sectionArray[$i], $issue, $journal);
         $i++;
     }
 }