Create and return a representation node.
public createRepresentationNode ( $doc, $representation ) : DOMElement | ||
$doc | DOMDocument | |
$representation | Representation | |
return | DOMElement |
/** * Create and return a representation node. Extend the parent class * with publication format specific data. * @param $doc DOMDocument * @param $representation Representation * @return DOMElement */ function createRepresentationNode($doc, $representation) { $representationNode = parent::createRepresentationNode($doc, $representation); $representationNode->setAttribute('approved', $representation->getIsApproved() ? 'true' : 'false'); $representationNode->setAttribute('available', $representation->getIsAvailable() ? 'true' : 'false'); $representationNode->setAttribute('physical_format', $representation->getPhysicalFormat() ? 'true' : 'false'); // If all nexessary press settings exist, export ONIX metadata $context = $this->getDeployment()->getContext(); if ($context->getSetting('publisher') && $context->getSetting('location') && $context->getSetting('codeType') && $context->getSetting('codeValue')) { $submission = $this->getDeployment()->getSubmission(); $filterDao = DAORegistry::getDAO('FilterDAO'); $nativeExportFilters = $filterDao->getObjectsByGroup('monograph=>onix30-xml'); assert(count($nativeExportFilters) == 1); // Assert only a single serialization filter $exportFilter = array_shift($nativeExportFilters); $exportFilter->setDeployment(new Onix30ExportDeployment(Request::getContext(), Request::getUser())); $onixDoc = $exportFilter->execute($submission); if ($onixDoc) { // we do this to ensure validation. // assemble just the Product node we want. $publicationFormatDOMElement = $exportFilter->createProductNode($doc, $submission, $representation); if ($publicationFormatDOMElement instanceof DOMElement) { import('lib.pkp.classes.xslt.XSLTransformer'); $xslTransformer = new XSLTransformer(); $xslFile = 'plugins/importexport/native/onixProduct2NativeXml.xsl'; $productXml = $publicationFormatDOMElement->ownerDocument->saveXML($publicationFormatDOMElement); $filteredXml = $xslTransformer->transform($productXml, XSL_TRANSFORMER_DOCTYPE_STRING, $xslFile, XSL_TRANSFORMER_DOCTYPE_FILE, XSL_TRANSFORMER_DOCTYPE_STRING); $representationFragment = $doc->createDocumentFragment(); $representationFragment->appendXML($filteredXml); $representationNode->appendChild($representationFragment); } } } return $representationNode; }
/** * Create and return a representation node. Extend the parent class * with publication format specific data. * @param $doc DOMDocument * @param $representation Representation * @return DOMElement */ function createRepresentationNode($doc, $representation) { $representationNode = parent::createRepresentationNode($doc, $representation); $representationNode->setAttribute('approved', $representation->getIsApproved() ? 'true' : 'false'); $submission = $this->getDeployment()->getSubmission(); return $representationNode; }
/** * Create and return a representation node. Extend the parent class * with publication format specific data. * @param $doc DOMDocument * @param $representation Representation * @return DOMElement */ function createRepresentationNode($doc, $representation) { $representationNode = parent::createRepresentationNode($doc, $representation); $representationNode->setAttribute('approved', $representation->getIsApproved() ? 'true' : 'false'); $representationNode->setAttribute('galley_type', $representation->getGalleyType()); $deployment = $this->getDeployment(); $representationNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'remote_url', $representation->getRemoteUrl())); $submission = $this->getDeployment()->getSubmission(); return $representationNode; }