Ejemplo n.º 1
0
 /**
  *  creates the METS:dmdSec element for a published Paper
  */
 function generatePublishedPaperDmdSecDom(&$doc, &$root, &$paper, &$conference, &$schedConf)
 {
     if ($paper->getStatus() == STATUS_PUBLISHED) {
         $dmdSec =& XMLCustomWriter::createElement($doc, 'METS:dmdSec');
         XMLCustomWriter::setAttribute($dmdSec, 'ID', 'P' . $paper->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 = $conference->getPrimaryLocale();
         foreach ($paper->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);
         }
         foreach ($paper->getAbstract(null) as $locale => $abstract) {
             XMLCustomWriter::createChildWithText($doc, $mods, 'mods:abstract', $abstract);
         }
         MetsExportDom::generateAuthorsDom($doc, $mods, $paper->getId());
         XMLCustomWriter::createChildWithText($doc, $mods, 'mods:genre', 'submission');
         if ($paper->getDatePublished() != '') {
             $originInfo =& XMLCustomWriter::createElement($doc, 'mods:originInfo');
             $sDate = XMLCustomWriter::createChildWithText($doc, $originInfo, 'mods:dateIssued', $paper->getDatePublished());
             XMLCustomWriter::appendChild($mods, $originInfo);
         }
         XMLCustomWriter::appendChild($xmlData, $mods);
         XMLCustomWriter::appendChild($dmdSec, $mdWrap);
         XMLCustomWriter::appendChild($mdWrap, $xmlData);
         XMLCustomWriter::appendChild($root, $dmdSec);
         $exportSuppFiles =& Request::getUserVar('exportSuppFiles');
         $rtDao = DAORegistry::getDAO('RTDAO');
         $conferenceRt =& $rtDao->getConferenceRTByConference($schedConf->getConference());
         if ($exportSuppFiles == 'on' || $conferenceRt->getEnabled()) {
             $suppFileDAO = DAORegistry::getDAO('SuppFileDAO');
             $paperFilesArray =& $suppFileDAO->getSuppFilesByPaper($paper->getId());
             $i = 0;
             while ($i < sizeof($paperFilesArray)) {
                 MetsExportDom::generatePaperSuppFilesDmdSecDom($doc, $root, $paperFilesArray[$i], $conference, $schedConf);
                 $i++;
             }
         }
     }
 }