/** * creates the METS:dmdSec element for a published Paper */ function generateArticleDmdSecDom(&$doc, &$root, &$article, &$issue) { $dmdSec =& XMLCustomWriter::createElement($doc, 'METS:dmdSec'); XMLCustomWriter::setAttribute($dmdSec, 'ID', 'A-' . $article->getArticleId()); $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', $article->getArticleTitle()); XMLCustomWriter::appendChild($mods, $titleInfo); // TODO: localized metadata method calls /* if($article->getTitleAlt1() != ''){ $titleInfoAlt1 = &XMLCustomWriter::createElement($doc, 'mods:titleInfo'); XMLCustomWriter::createChildWithText($doc, $titleInfoAlt1, 'mods:title', $article->getTitleAlt1()); XMLCustomWriter::setAttribute($titleInfoAlt1, 'type', 'alternative'); XMLCustomWriter::appendChild($mods, $titleInfoAlt1); } if($article->getTitleAlt2() != ''){ $titleInfoAlt2 = &XMLCustomWriter::createElement($doc, 'mods:titleInfo'); XMLCustomWriter::createChildWithText($doc, $titleInfoAlt2, 'mods:title', $article->getTitleAlt2()); XMLCustomWriter::setAttribute($titleInfoAlt2, 'type', 'alternative'); XMLCustomWriter::appendChild($mods, $titleInfoAlt2); } */ if ($article->getArticleAbstract() != '') { XMLCustomWriter::createChildWithText($doc, $mods, 'mods:abstract', $article->getArticleAbstract()); } // TODO: localized metadata method calls /* if($article->getAbstractAlt1() != '') XMLCustomWriter::createChildWithText($doc, $mods, 'mods:abstract', $article->getAbstractAlt1()); if($article->getAbstractAlt2() != '') XMLCustomWriter::createChildWithText($doc, $mods, 'mods:abstract', $article->getAbstractAlt2()); */ $i = 0; $authorsArray =& $article->getAuthors(); while ($i < sizeof($authorsArray)) { $PresenterNode =& MetsExportDom::generateAuthorDom($doc, $authorsArray[$i]); XMLCustomWriter::appendChild($mods, $PresenterNode); $i++; } XMLCustomWriter::createChildWithText($doc, $mods, 'mods:genre', 'article'); if ($issue->getDatePublished() != '') { $timeIssued = date(DATE_W3C, strtotime($issue->getDatePublished())); $originInfo =& XMLCustomWriter::createElement($doc, 'mods:originInfo'); $sDate = XMLCustomWriter::createChildWithText($doc, $originInfo, 'mods:dateIssued', $timeIssued); XMLCustomWriter::appendChild($mods, $originInfo); } if ($article->getArticleDiscipline() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $DisciplineArray = explode(";", $article->getArticleDiscipline()); $i = 0; while ($i < sizeof($DisciplineArray)) { XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:topic', $DisciplineArray[$i]); $i++; } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getArticleSubject() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $modsTopic = XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:topic', $article->getArticleSubject()); if ($article->getSubjectClass() != '') { XMLCustomWriter::setAttribute($modsSubject, 'authority', $article->getSubjectClass()); } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getArticleCoverageGeo() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $coverageArray = explode(";", $article->getArticleCoverageGeo()); $i = 0; while ($i < sizeof($coverageArray)) { XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:geographic', $coverageArray[$i]); $i++; } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getArticleCoverageChron() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $coverageArray = explode(";", $article->getArticleCoverageChron()); $i = 0; while ($i < sizeof($coverageArray)) { XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:temporal', $coverageArray[$i]); $i++; } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getArticleType() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:genre', $article->getArticleType()); XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getArticleSponsor() != '') { $PresenterNode =& XMLCustomWriter::createElement($doc, 'mods:name'); XMLCustomWriter::setAttribute($PresenterNode, 'type', 'corporate'); $fNameNode =& XMLCustomWriter::createChildWithText($doc, $PresenterNode, 'mods:namePart', $article->getArticleSponsor()); $role =& XMLCustomWriter::createElement($doc, 'mods:role'); $roleTerm =& XMLCustomWriter::createChildWithText($doc, $role, 'mods:roleTerm', 'sponsor'); XMLCustomWriter::setAttribute($roleTerm, 'type', 'text'); XMLCustomWriter::appendChild($PresenterNode, $role); XMLCustomWriter::appendChild($mods, $PresenterNode); } if ($article->getLanguage() != '') { XMLCustomWriter::createChildWithText($doc, $mods, 'mods:language', $article->getLanguage()); } XMLCustomWriter::appendChild($xmlData, $mods); XMLCustomWriter::appendChild($dmdSec, $mdWrap); XMLCustomWriter::appendChild($mdWrap, $xmlData); XMLCustomWriter::appendChild($root, $dmdSec); $SuppFileDAO =& DAORegistry::getDAO('SuppFileDAO'); $suppFilesArray =& $SuppFileDAO->getSuppFilesByArticle($article->getArticleId()); $i = 0; while ($i < sizeof($suppFilesArray)) { MetsExportDom::generateArticleSuppFilesDmdSecDom($doc, $root, $suppFilesArray[$i]); $i++; } }
/** * creates the METS:dmdSec element for a published Paper */ function generateArticleDmdSecDom(&$doc, &$root, &$article, &$issue, &$journal) { $dmdSec =& XMLCustomWriter::createElement($doc, 'METS:dmdSec'); XMLCustomWriter::setAttribute($dmdSec, 'ID', 'A-' . $article->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'); $primaryLocale = $journal->getPrimaryLocale(); foreach ($article->getTitle(null) as $locale => $title) { $titleInfo =& XMLCustomWriter::createElement($doc, 'mods:titleInfo'); XMLCustomWriter::createChildWithText($doc, $titleInfo, 'mods:title', $title); if ($locale != $primaryLocale) { XMLCustomWriter::setAttribute($titleInfo, 'type', 'alternative'); } XMLCustomWriter::appendChild($mods, $titleInfo); unset($titleInfo); } $abstracts = $article->getAbstract(null); if (is_array($abstracts)) { foreach ($abstracts as $locale => $abstract) { XMLCustomWriter::createChildWithText($doc, $mods, 'mods:abstract', $abstract); } } $i = 0; $authorsArray =& $article->getAuthors(); while ($i < sizeof($authorsArray)) { $presenterNode =& MetsExportDom::generateAuthorDom($doc, $authorsArray[$i]); XMLCustomWriter::appendChild($mods, $presenterNode); $i++; } XMLCustomWriter::createChildWithText($doc, $mods, 'mods:genre', 'article'); if ($issue->getDatePublished()) { $timeIssued = date("Y-m-dTH:i:sP", strtotime($issue->getDatePublished())); $originInfo =& XMLCustomWriter::createElement($doc, 'mods:originInfo'); $sDate = XMLCustomWriter::createChildWithText($doc, $originInfo, 'mods:dateIssued', $timeIssued); XMLCustomWriter::appendChild($mods, $originInfo); } if ($article->getLocalizedDiscipline() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $disciplineArray = explode(";", $article->getLocalizedDiscipline()); $i = 0; while ($i < sizeof($disciplineArray)) { XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:topic', $disciplineArray[$i]); $i++; } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getLocalizedSubject() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $modsTopic = XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:topic', $article->getLocalizedSubject()); if ($article->getLocalizedSubjectClass() != '') { XMLCustomWriter::setAttribute($modsSubject, 'authority', $article->getLocalizedSubjectClass()); } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getLocalizedCoverageGeo() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $coverageArray = explode(";", $article->getLocalizedCoverageGeo()); $i = 0; while ($i < sizeof($coverageArray)) { XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:geographic', $coverageArray[$i]); $i++; } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getLocalizedCoverageChron() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); $coverageArray = explode(";", $article->getLocalizedCoverageChron()); $i = 0; while ($i < sizeof($coverageArray)) { XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:temporal', $coverageArray[$i]); $i++; } XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getLocalizedType() != '') { $modsSubject =& XMLCustomWriter::createElement($doc, 'mods:subject'); XMLCustomWriter::createChildWithText($doc, $modsSubject, 'mods:genre', $article->getLocalizedType()); XMLCustomWriter::appendChild($mods, $modsSubject); } if ($article->getLocalizedSponsor() != '') { $presenterNode =& XMLCustomWriter::createElement($doc, 'mods:name'); XMLCustomWriter::setAttribute($presenterNode, 'type', 'corporate'); $fNameNode =& XMLCustomWriter::createChildWithText($doc, $presenterNode, 'mods:namePart', $article->getLocalizedSponsor()); $role =& XMLCustomWriter::createElement($doc, 'mods:role'); $roleTerm =& XMLCustomWriter::createChildWithText($doc, $role, 'mods:roleTerm', 'sponsor'); XMLCustomWriter::setAttribute($roleTerm, 'type', 'text'); XMLCustomWriter::appendChild($presenterNode, $role); XMLCustomWriter::appendChild($mods, $presenterNode); } if ($article->getLanguage() != '') { XMLCustomWriter::createChildWithText($doc, $mods, 'mods:language', $article->getLanguage()); } XMLCustomWriter::appendChild($xmlData, $mods); XMLCustomWriter::appendChild($dmdSec, $mdWrap); XMLCustomWriter::appendChild($mdWrap, $xmlData); XMLCustomWriter::appendChild($root, $dmdSec); $suppFileDao =& DAORegistry::getDAO('SuppFileDAO'); $suppFilesArray =& $suppFileDao->getSuppFilesByArticle($article->getId()); $i = 0; while ($i < sizeof($suppFilesArray)) { MetsExportDom::generateArticleSuppFilesDmdSecDom($doc, $root, $suppFilesArray[$i]); $i++; } }
/** * Process All authors for the Given Paper */ function generateAuthorsDom(&$doc, &$root, $paperID) { $authorDAO = DAORegistry::getDAO('AuthorDAO'); $i = 0; $authorsArray =& $authorDAO->getAuthorsBySubmissionId($paperID); while ($i < sizeof($authorsArray)) { $authorNode =& MetsExportDom::generateAuthorDom($doc, $authorsArray[$i]); XMLCustomWriter::appendChild($root, $authorNode); $i++; } }