16 import(
'lib.pkp.plugins.importexport.native.filter.NativeExportFilter');
29 parent::__construct($filterGroup);
40 return 'plugins.importexport.onix30.filter.MonographONIX30XmlFilter';
55 $doc =
new DOMDocument(
'1.0');
61 $rootNode = $doc->createElementNS($deployment->getNamespace(),
'ONIXMessage');
64 $publicationFormats = $monograph->getCurrentPublication()->getData(
'publicationFormats');
67 foreach ($publicationFormats as $publicationFormat) {
68 $rootNode->appendChild($this->
createProductNode($doc, $monograph, $publicationFormat));
70 $doc->appendChild($rootNode);
71 $rootNode->setAttributeNS(
'http://www.w3.org/2000/xmlns/',
'xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance');
72 $rootNode->setAttribute(
'xsi:schemaLocation', $deployment->getNamespace() .
' ' . $deployment->getSchemaFilename());
73 $rootNode->setAttribute(
'release',
'3.0');
89 $context = $deployment->getContext();
91 $headNode = $doc->createElementNS($deployment->getNamespace(),
'Header');
92 $senderNode = $doc->createElementNS($deployment->getNamespace(),
'Sender');
95 $senderIdentifierNode = $doc->createElementNS($deployment->getNamespace(),
'SenderIdentifier');
96 $senderIdentifierNode->appendChild($this->
_buildTextNode($doc,
'SenderIDType', $context->getData(
'codeType')));
97 $senderIdentifierNode->appendChild($this->
_buildTextNode($doc,
'IDValue', $context->getData(
'codeValue')));
99 $senderNode->appendChild($senderIdentifierNode);
102 $senderNode->appendChild($this->
_buildTextNode($doc,
'SenderName', $context->getLocalizedName()));
103 $senderNode->appendChild($this->
_buildTextNode($doc,
'ContactName', $context->getContactName()));
104 $senderNode->appendChild($this->
_buildTextNode($doc,
'EmailAddress', $context->getContactEmail()));
106 $headNode->appendChild($senderNode);
109 $headNode->appendChild($this->
_buildTextNode($doc,
'SentDateTime', date(
'Ymd')));
124 $context = $deployment->getContext();
127 $productNode = $doc->createElementNS($deployment->getNamespace(),
'Product');
130 $productNode->appendChild($this->
_buildTextNode($doc,
'RecordReference', $request->url($context->getPath(),
'monograph',
'view', array($submission->getId()))));
131 $productNode->appendChild($this->
_buildTextNode($doc,
'NotificationType',
'03'));
132 $productNode->appendChild($this->
_buildTextNode($doc,
'RecordSourceType',
'04'));
134 $identificationCodes = $publicationFormat->getIdentificationCodes();
136 while ($code = $identificationCodes->next()) {
137 $productIdentifierNode = $doc->createElementNS($deployment->getNamespace(),
'ProductIdentifier');
138 $productIdentifierNode->appendChild($this->
_buildTextNode($doc,
'ProductIDType', $code->getCode()));
139 $productIdentifierNode->appendChild($this->
_buildTextNode($doc,
'IDValue', $code->getValue()));
140 $productNode->appendChild($productIdentifierNode);
142 unset($productIdentifierNode);
148 if (is_array($pubIdPlugins)) {
149 foreach ($pubIdPlugins as $plugin) {
150 if ($plugin->getEnabled() && $plugin->getPubIdType() ==
'doi' && $publicationFormat->getStoredPubId(
'doi')) {
151 $productIdentifierNode = $doc->createElementNS($deployment->getNamespace(),
'ProductIdentifier');
152 $productIdentifierNode->appendChild($this->
_buildTextNode($doc,
'ProductIDType',
'06'));
153 $productIdentifierNode->appendChild($this->
_buildTextNode($doc,
'IDValue', $publicationFormat->getStoredPubId(
'doi')));
154 $productNode->appendChild($productIdentifierNode);
156 unset($productIdentifierNode);
161 unset($pubIdPlugins);
164 $descDetailNode = $doc->createElementNS($deployment->getNamespace(),
'DescriptiveDetail');
166 $descDetailNode->appendChild($this->
_buildTextNode($doc,
'ProductComposition',
167 $publicationFormat->getProductCompositionCode() ? $publicationFormat->getProductCompositionCode() :
'00'));
169 $descDetailNode->appendChild($this->
_buildTextNode($doc,
'ProductForm', $publicationFormat->getEntryKey()));
171 if ($publicationFormat->getProductFormDetailCode() !=
'') {
172 $descDetailNode->appendChild($this->
_buildTextNode($doc,
'ProductFormDetail', $publicationFormat->getProductFormDetailCode()));
176 if ($publicationFormat->getPhysicalFormat()) {
178 if ($publicationFormat->getHeight() !=
'') {
179 $measureNode = $this->
_createMeasurementNode($doc, $deployment,
'01', $publicationFormat->getHeight(), $publicationFormat->getHeightUnitCode());
180 $descDetailNode->appendChild($measureNode);
184 if ($publicationFormat->getWidth() !=
'') {
185 $measureNode = $this->
_createMeasurementNode($doc, $deployment,
'02', $publicationFormat->getWidth(), $publicationFormat->getWidthUnitCode());
186 $descDetailNode->appendChild($measureNode);
190 if ($publicationFormat->getThickness() !=
'') {
191 $measureNode = $this->
_createMeasurementNode($doc, $deployment,
'03', $publicationFormat->getThickness(), $publicationFormat->getThicknessUnitCode());
192 $descDetailNode->appendChild($measureNode);
196 if ($publicationFormat->getWeight() !=
'') {
197 $measureNode = $this->
_createMeasurementNode($doc, $deployment,
'08', $publicationFormat->getWeight(), $publicationFormat->getWeightUnitCode());
198 $descDetailNode->appendChild($measureNode);
203 if($publicationFormat->getCountryManufactureCode() !=
'') {
204 $descDetailNode->appendChild($this->
_buildTextNode($doc,
'CountryOfManufacture', $publicationFormat->getCountryManufactureCode()));
207 if (!$publicationFormat->getPhysicalFormat() && $publicationFormat->getTechnicalProtectionCode() !=
'') {
208 $descDetailNode->appendChild($this->
_buildTextNode($doc,
'EpubTechnicalProtection', $publicationFormat->getTechnicalProtectionCode()));
213 $seriesCollectionNode = $doc->createElementNS($deployment->getNamespace(),
'Collection');
214 $seriesCollectionNode->appendChild($this->
_buildTextNode($doc,
'CollectionType',
'10'));
215 $descDetailNode->appendChild($seriesCollectionNode);
217 $seriesTitleDetailNode = $doc->createElementNS($deployment->getNamespace(),
'TitleDetail');
218 $seriesTitleDetailNode->appendChild($this->
_buildTextNode($doc,
'TitleType',
'01'));
219 $seriesCollectionNode->appendChild($seriesTitleDetailNode);
221 $titleElementNode = $doc->createElementNS($deployment->getNamespace(),
'TitleElement');
222 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitleElementLevel',
'02'));
223 $seriesTitleDetailNode->appendChild($titleElementNode);
228 $series = $seriesDao->getById($submission->getCurrentPublication()->getData(
'seriesId'));
229 if ($series !=
null) {
231 if ($submission->getCurrentPublication()->getData(
'seriesPosition')) {
232 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'PartNumber', $submission->getCurrentPublication()->getData(
'seriesPosition')));
235 if ($series->getLocalizedPrefix() ==
'' || $series->getLocalizedTitle(
false) ==
'') {
236 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitleText', trim(join(
' ', array($series->getLocalizedPrefix(), $series->getLocalizedTitle(
false))))));
238 if ($series->getLocalizedPrefix() !=
'') {
239 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitlePrefix', $series->getLocalizedPrefix()));
242 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitleWithoutPrefix', $series->getLocalizedTitle(
false)));
245 if ($series->getLocalizedSubtitle() !=
'') {
246 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'Subtitle', $series->getLocalizedSubtitle()));
252 $productTitleDetailNode = $doc->createElementNS($deployment->getNamespace(),
'TitleDetail');
253 $productTitleDetailNode->appendChild($this->
_buildTextNode($doc,
'TitleType',
'01'));
254 $descDetailNode->appendChild($productTitleDetailNode);
256 $titleElementNode = $doc->createElementNS($deployment->getNamespace(),
'TitleElement');
257 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitleElementLevel',
'01'));
259 $productTitleDetailNode->appendChild($titleElementNode);
261 $publication = $submission->getCurrentPublication();
262 if (!$publication->getLocalizedData(
'prefix') || !$publication->getLocalizedData(
'title')) {
263 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitleText', trim($publication->getLocalizedData(
'prefix') ?? $publication->getLocalizedTitle())));
265 if ($publication->getLocalizedData(
'prefix')) {
266 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitlePrefix', $publication->getLocalizedData(
'prefix')));
268 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'TitleWithoutPrefix', $publication->getLocalizedTitle()));
271 if ($publication->getData(
'subtitle', $publication->getData(
'locale'))) {
272 $titleElementNode->appendChild($this->
_buildTextNode($doc,
'Subtitle', $publication->getData(
'subtitle', $publication->getData(
'locale'))));
277 $authors = $publication->getData(
'authors');
279 foreach ($authors as $author) {
280 $contributorNode = $doc->createElementNS($deployment->getNamespace(),
'Contributor');
281 $contributorNode->appendChild($this->
_buildTextNode($doc,
'SequenceNumber', $sequence));
284 $userGroup = $userGroupDao->getById($author->getUserGroupId(), $submission->getContextId());
286 $userGroupOnixMap = array(
'AU' =>
'A01',
'VE' =>
'B01',
'CA' =>
'A01',
'Trans' =>
'B06',
'PE' =>
'B21');
288 $role = array_key_exists($userGroup->getLocalizedAbbrev(), $userGroupOnixMap) ? $userGroupOnixMap[$userGroup->getLocalizedAbbrev()] :
'Z99';
290 $contributorNode->appendChild($this->
_buildTextNode($doc,
'ContributorRole', $role));
291 $contributorNode->appendChild($this->
_buildTextNode($doc,
'PersonName', $author->getFullName(
false)));
292 $contributorNode->appendChild($this->
_buildTextNode($doc,
'PersonNameInverted', $author->getFullName(
false,
true)));
293 $contributorNode->appendChild($this->
_buildTextNode($doc,
'NamesBeforeKey', $author->getLocalizedGivenName()));
294 if ($author->getLocalizedFamilyName() !=
'') {
295 $contributorNode->appendChild($this->
_buildTextNode($doc,
'KeyNames', $author->getLocalizedFamilyName()));
297 $contributorNode->appendChild($this->
_buildTextNode($doc,
'KeyNames', $author->getFullName(
false)));
300 if ($author->getLocalizedBiography() !=
'') {
301 $contributorNode->appendChild($this->
_buildTextNode($doc,
'BiographicalNote', $author->getLocalizedBiography()));
304 if ($author->getCountry() !=
'') {
305 $contributorPlaceNode = $doc->createElementNS($deployment->getNamespace(),
'ContributorPlace');
306 $contributorNode->appendChild($contributorPlaceNode);
307 $contributorPlaceNode->appendChild($this->
_buildTextNode($doc,
'ContributorPlaceRelator',
'04'));
308 $contributorPlaceNode->appendChild($this->
_buildTextNode($doc,
'CountryCode', $author->getCountry()));
309 unset($contributorPlaceNode);
313 $descDetailNode->appendChild($contributorNode);
315 unset($contributorNode);
316 unset($sequenceNode);
321 if (
sizeof($authors) == 0) {
322 $descDetailNode->appendChild($this->
_buildTextNode($doc,
'NoContributor',
''));
329 $uniqueLanguages = array();
330 foreach ($allLanguages as $locale => $languages) {
331 $uniqueLanguages = array_merge($uniqueLanguages, $languages);
334 foreach ($uniqueLanguages as $language) {
335 $languageNode = $doc->createElementNS($deployment->getNamespace(),
'Language');
337 $languageNode->appendChild($this->
_buildTextNode($doc,
'LanguageRole',
'01'));
338 $onixLanguageCode = $onixCodelistItemDao->getCodeFromValue($language,
'List74');
339 if ($onixLanguageCode !=
'') {
340 $languageNode->appendChild($this->
_buildTextNode($doc,
'LanguageCode', $onixLanguageCode));
341 $descDetailNode->appendChild($languageNode);
343 unset($languageNode);
348 if ($publicationFormat->getFrontMatter() > 0) {
350 $extentNode = $this->
_createExtentNode($doc, $deployment,
'00', $publicationFormat->getFrontMatter(),
'03');
351 $descDetailNode->appendChild($extentNode);
355 if ($publicationFormat->getBackMatter() > 0) {
356 $extentNode = $this->
_createExtentNode($doc, $deployment,
'04', $publicationFormat->getBackMatter(),
'03');
357 $descDetailNode->appendChild($extentNode);
361 if (!$publicationFormat->getPhysicalFormat()) {
362 $fileSize = $publicationFormat->getFileSize() ? $publicationFormat->getFileSize() : $publicationFormat->getCalculatedFileSize();
363 $extentNode = $this->
_createExtentNode($doc, $deployment,
'08', $fileSize,
'05');
364 $descDetailNode->appendChild($extentNode);
371 $subjectNode = $doc->createElementNS($deployment->getNamespace(),
'Subject');
372 $mainSubjectNode = $doc->createElementNS($deployment->getNamespace(),
'MainSubject');
373 $subjectNode->appendChild($mainSubjectNode);
374 $subjectNode->appendChild($this->
_buildTextNode($doc,
'SubjectSchemeIdentifier',
'12'));
375 $subjectNode->appendChild($this->
_buildTextNode($doc,
'SubjectSchemeVersion',
'2'));
379 $uniqueSubjects = array();
380 foreach ($allSubjects as $locale => $subjects) {
381 $uniqueSubjects = array_merge($uniqueSubjects, $subjects);
384 if (
sizeof($uniqueSubjects) > 0) {
385 $subjectNode->appendChild($this->
_buildTextNode($doc,
'SubjectCode', trim(join(
', ', $uniqueSubjects))));
388 $descDetailNode->appendChild($subjectNode);
392 if ($submission->getData(
'audience')) {
393 $audienceNode = $doc->createElementNS($deployment->getNamespace(),
'Audience');
394 $descDetailNode->appendChild($audienceNode);
395 $audienceNode->appendChild($this->
_buildTextNode($doc,
'AudienceCodeType', $submission->getData(
'audience')));
396 $audienceNode->appendChild($this->
_buildTextNode($doc,
'AudienceCodeValue',
'01'));
399 if ($submission->getData(
'audienceRangeQualifier') !=
'') {
400 $audienceRangeNode = $doc->createElementNS($deployment->getNamespace(),
'AudienceRange');
401 $descDetailNode->appendChild($audienceRangeNode);
402 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangeQualifier', $submission->getData(
'audienceRangeQualifier')));
404 if ($submission->getData(
'audienceRangeExact') !=
'') {
405 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangePrecision',
'01'));
406 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangeValue', $submission->getData(
'audienceRangeExact')));
408 if ($submission->getData(
'audienceRangeFrom') !=
'') {
409 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangePrecision',
'03'));
410 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangeValue', $submission->getData(
'audienceRangeFrom')));
412 if ($submission->getData(
'audienceRangeTo') !=
'') {
413 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangePrecision',
'04'));
414 $audienceRangeNode->appendChild($this->
_buildTextNode($doc,
'AudienceRangeValue', $submission->getData(
'audienceRangeTo')));
419 $productNode->appendChild($descDetailNode);
420 unset($descDetailNode);
425 $collateralDetailNode = $doc->createElementNS($deployment->getNamespace(),
'CollateralDetail');
426 $productNode->appendChild($collateralDetailNode);
428 $abstract = strip_tags($publication->getLocalizedData(
'abstract'));
430 $textContentNode = $doc->createElementNS($deployment->getNamespace(),
'TextContent');
431 $collateralDetailNode->appendChild($textContentNode);
432 $textContentNode->appendChild($this->
_buildTextNode($doc,
'TextType',
'02'));
433 $textContentNode->appendChild($this->
_buildTextNode($doc,
'ContentAudience',
'00'));
434 $textContentNode->appendChild($this->
_buildTextNode($doc,
'Text', substr($abstract, 0, 250)));
436 $textContentNode = $doc->createElementNS($deployment->getNamespace(),
'TextContent');
437 $collateralDetailNode->appendChild($textContentNode);
439 $textContentNode->appendChild($this->
_buildTextNode($doc,
'TextType',
'03'));
440 $textContentNode->appendChild($this->
_buildTextNode($doc,
'ContentAudience',
'00'));
441 $textContentNode->appendChild($this->
_buildTextNode($doc,
'Text', $abstract));
445 $publishingDetailNode = $doc->createElementNS($deployment->getNamespace(),
'PublishingDetail');
446 $productNode->appendChild($publishingDetailNode);
448 if ($publicationFormat->getImprint()) {
449 $imprintNode = $doc->createElementNS($deployment->getNamespace(),
'Imprint');
450 $publishingDetailNode->appendChild($imprintNode);
451 $imprintNode->appendChild($this->
_buildTextNode($doc,
'ImprintName', $publicationFormat->getImprint()));
455 $publisherNode = $doc->createElementNS($deployment->getNamespace(),
'Publisher');
456 $publishingDetailNode->appendChild($publisherNode);
458 $publisherNode->appendChild($this->
_buildTextNode($doc,
'PublishingRole',
'01'));
459 $publisherNode->appendChild($this->
_buildTextNode($doc,
'PublisherName', $context->getData(
'publisher')));
460 if ($context->getData(
'location') !=
'') {
461 $publishingDetailNode->appendChild($this->
_buildTextNode($doc,
'CityOfPublication', $context->getData(
'location')));
464 $websiteNode = $doc->createElementNS($deployment->getNamespace(),
'Website');
465 $publisherNode->appendChild($websiteNode);
467 $websiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteRole',
'18'));
468 $websiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteLink', $request->url($context->getPath())));
472 $publicationDates = $publicationFormat->getPublicationDates();
473 while ($date = $publicationDates->next()) {
474 $pubDateNode = $doc->createElementNS($deployment->getNamespace(),
'PublishingDate');
475 $publishingDetailNode->appendChild($pubDateNode);
477 $pubDateNode->appendChild($this->
_buildTextNode($doc,
'PublishingDateRole', $date->getRole()));
479 $dateNode = $doc->createElementNS($deployment->getNamespace(),
'Date');
480 $dateNode->setAttribute(
'dateformat', $date->getDateFormat());
481 $pubDateNode->appendChild($dateNode);
482 $dateNode->appendChild($doc->createTextNode($date->getDate()));
491 $allSalesRights = $publicationFormat->getSalesRights();
492 $salesRightsROW =
null;
493 while ($salesRights = $allSalesRights->next()) {
494 if (!$salesRights->getROWSetting()) {
496 $salesRightsNode = $doc->createElementNS($deployment->getNamespace(),
'SalesRights');
497 $publishingDetailNode->appendChild($salesRightsNode);
498 $salesRightsNode->appendChild($this->
_buildTextNode($doc,
'SalesRightsType', $salesRights->getType()));
501 $territoryNode = $doc->createElementNS($deployment->getNamespace(),
'Territory');
502 $salesRightsNode->appendChild($territoryNode);
504 if (
sizeof($salesRights->getRegionsIncluded()) > 0 &&
sizeof($salesRights->getCountriesExcluded()) > 0) {
505 $territoryNode->appendChild($this->
_buildTextNode($doc,
'RegionsIncluded', trim(join(
' ', $salesRights->getRegionsIncluded()))));
506 $territoryNode->appendChild($this->
_buildTextNode($doc,
'CountriesExcluded', trim(join(
' ', $salesRights->getCountriesExcluded()))));
507 }
else if (
sizeof($salesRights->getCountriesIncluded()) > 0) {
508 $territoryNode->appendChild($this->
_buildTextNode($doc,
'CountriesIncluded', trim(join(
' ', $salesRights->getCountriesIncluded()))));
511 if (
sizeof($salesRights->getRegionsExcluded()) > 0) {
512 $territoryNode->appendChild($this->
_buildTextNode($doc,
'RegionsExcluded', trim(join(
' ', $salesRights->getRegionsExcluded()))));
515 unset($territoryNode);
516 unset($salesRightsNode);
519 $salesRightsROW = $salesRights;
523 if ($salesRightsROW !=
null) {
524 $publishingDetailNode->appendChild($this->
_buildTextNode($doc,
'ROWSalesRightsType', $salesRightsROW->getType()));
530 $markets = $publicationFormat->getMarkets();
532 while ($market = $markets->next()) {
533 $productSupplyNode = $doc->createElementNS($deployment->getNamespace(),
'ProductSupply');
534 $productNode->appendChild($productSupplyNode);
536 $marketNode = $doc->createElementNS($deployment->getNamespace(),
'Market');
537 $productSupplyNode->appendChild($marketNode);
539 $territoryNode = $doc->createElementNS($deployment->getNamespace(),
'Territory');
540 $marketNode->appendChild($territoryNode);
542 if (
sizeof($market->getCountriesIncluded()) > 0) {
543 $territoryNode->appendChild($this->
_buildTextNode($doc,
'CountriesIncluded', trim(join(
' ', $market->getCountriesIncluded()))));
546 if (
sizeof($market->getRegionsIncluded()) > 0) {
547 $territoryNode->appendChild($this->
_buildTextNode($doc,
'RegionsIncluded', trim(join(
' ', $market->getRegionsIncluded()))));
550 if (
sizeof($market->getCountriesExcluded()) > 0) {
551 $territoryNode->appendChild($this->
_buildTextNode($doc,
'CountriesExcluded', trim(join(
' ', $market->getCountriesExcluded()))));
554 if (
sizeof($market->getRegionsExcluded()) > 0) {
555 $territoryNode->appendChild($this->
_buildTextNode($doc,
'RegionsExcluded', trim(join(
' ', $market->getRegionsExcluded()))));
559 unset($territoryNode);
563 $marketPubDetailNode = $doc->createElementNS($deployment->getNamespace(),
'MarketPublishingDetail');
564 $productSupplyNode->appendChild($marketPubDetailNode);
566 $agent = $representativeDao->getById($market->getAgentId());
569 $representativeNode = $doc->createElementNS($deployment->getNamespace(),
'PublisherRepresentative');
570 $marketPubDetailNode->appendChild($representativeNode);
572 $representativeNode->appendChild($this->
_buildTextNode($doc,
'AgentRole', $agent->getRole()));
573 $representativeNode->appendChild($this->
_buildTextNode($doc,
'AgentName', $agent->getName()));
575 if ($agent->getUrl() !=
'') {
576 $agentWebsiteNode = $doc->createElementNS($deployment->getNamespace(),
'Website');
577 $representativeNode->appendChild($agentWebsiteNode);
579 $agentWebsiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteRole',
'18'));
580 $agentWebsiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteLink', $agent->getUrl()));
582 unset($representativeNode);
585 $marketPubDetailNode->appendChild($this->
_buildTextNode($doc,
'MarketPublishingStatus',
'04'));
588 $marketDateNode = $doc->createElementNS($deployment->getNamespace(),
'MarketDate');
589 $marketPubDetailNode->appendChild($marketDateNode);
591 $marketDateNode->appendChild($this->
_buildTextNode($doc,
'MarketDateRole', $market->getDateRole()));
592 $marketDateNode->appendChild($this->
_buildTextNode($doc,
'DateFormat', $market->getDateFormat()));
593 $marketDateNode->appendChild($this->
_buildTextNode($doc,
'Date', $market->getDate()));
595 unset($marketDateNode);
596 unset($marketPubDetailNode);
600 $supplier = $representativeDao->getById($market->getSupplierId());
602 $supplyDetailNode = $doc->createElementNS($deployment->getNamespace(),
'SupplyDetail');
603 $productSupplyNode->appendChild($supplyDetailNode);
605 if (isset($supplier)) {
606 $supplierNode = $doc->createElementNS($deployment->getNamespace(),
'Supplier');
607 $supplyDetailNode->appendChild($supplierNode);
609 $supplierNode->appendChild($this->
_buildTextNode($doc,
'SupplierRole', $supplier->getRole()));
610 $supplierNode->appendChild($this->
_buildTextNode($doc,
'SupplierName', $supplier->getName()));
611 if ($supplier->getPhone()) {
612 $supplierNode->appendChild($this->
_buildTextNode($doc,
'TelephoneNumber', $supplier->getPhone()));
614 if ($supplier->getEmail()) {
615 $supplierNode->appendChild($this->
_buildTextNode($doc,
'EmailAddress', $supplier->getEmail()));
618 if ($supplier->getUrl() !=
'') {
619 $supplierWebsiteNode = $doc->createElementNS($deployment->getNamespace(),
'Website');
620 $supplierNode->appendChild($supplierWebsiteNode);
622 $supplierWebsiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteRole',
'18'));
623 $supplierWebsiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteLink', $supplier->getUrl()));
625 unset($supplierWebsiteNode);
627 unset($supplierNode);
628 unset($supplierWebsiteNode);
631 $supplierNode = $doc->createElementNS($deployment->getNamespace(),
'Supplier');
632 $supplyDetailNode->appendChild($supplierNode);
634 $supplierNode->appendChild($this->
_buildTextNode($doc,
'SupplierRole',
'09'));
635 $supplierNode->appendChild($this->
_buildTextNode($doc,
'SupplierName', $context->getData(
'publisher')));
637 if ($context->getData(
'contactEmail') !=
'') {
638 $supplierNode->appendChild($this->
_buildTextNode($doc,
'EmailAddress', $context->getData(
'contactEmail')));
641 $supplierWebsiteNode = $doc->createElementNS($deployment->getNamespace(),
'Website');
642 $supplierNode->appendChild($supplierWebsiteNode);
644 $supplierWebsiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteRole',
'18'));
645 $supplierWebsiteNode->appendChild($this->
_buildTextNode($doc,
'WebsiteLink', $request->url($context->getPath())));
647 unset($supplierNode);
648 unset($supplierWebsiteNode);
651 if ($publicationFormat->getReturnableIndicatorCode() !=
'') {
652 $returnsNode = $doc->createElementNS($deployment->getNamespace(),
'ReturnsConditions');
653 $supplyDetailNode->appendChild($returnsNode);
655 $returnsNode->appendChild($this->
_buildTextNode($doc,
'ReturnsCodeType',
'02'));
656 $returnsNode->appendChild($this->
_buildTextNode($doc,
'ReturnsCode', $publicationFormat->getReturnableIndicatorCode()));
661 $supplyDetailNode->appendChild($this->
_buildTextNode($doc,
'ProductAvailability',
662 $publicationFormat->getProductAvailabilityCode() ? $publicationFormat->getProductAvailabilityCode() :
'20'));
664 $priceNode = $doc->createElementNS($deployment->getNamespace(),
'Price');
665 $supplyDetailNode->appendChild($priceNode);
667 if ($market->getPriceTypeCode() !=
'') {
668 $priceNode->appendChild($this->
_buildTextNode($doc,
'PriceType', $market->getPriceTypeCode()));
671 if ($market->getDiscount() !=
'') {
672 $discountNode = $doc->createElementNS($deployment->getNamespace(),
'Discount');
673 $priceNode->appendChild($discountNode);
674 $discountNode->appendChild($this->
_buildTextNode($doc,
'DiscountPercent', $market->getDiscount()));
675 unset($discountNode);
678 $priceNode->appendChild($this->
_buildTextNode($doc,
'PriceAmount', $market->getPrice()));
680 if ($market->getTaxTypeCode() !=
'' || $market->getTaxRateCode() !=
'') {
681 $taxNode = $doc->createElementNS($deployment->getNamespace(),
'Tax');
682 $priceNode->appendChild($taxNode);
684 if ($market->getTaxTypeCode()) {
685 $taxNode->appendChild($this->
_buildTextNode($doc,
'TaxType', $market->getTaxTypeCode()));
687 if ($market->getTaxRateCode()) {
688 $taxNode->appendChild($this->
_buildTextNode($doc,
'TaxRateCode', $market->getTaxRateCode()));
693 if ($market->getCurrencyCode() !=
'') {
694 $priceNode->appendChild($this->
_buildTextNode($doc,
'CurrencyCode', $market->getCurrencyCode()));
698 unset($supplyDetailNode);
715 $measureNode =& $doc->createElementNS($deployment->getNamespace(),
'Measure');
717 $measureTypeNode = $doc->createElementNS($deployment->getNamespace(),
'MeasureType');
718 $measureTypeNode->appendChild($doc->createTextNode($type));
720 $measurementNode = $doc->createElementNS($deployment->getNamespace(),
'Measurement');
721 $measurementNode->appendChild($doc->createTextNode($measurement));
723 $measureUnitNode = $doc->createElementNS($deployment->getNamespace(),
'MeasureUnitCode');
724 $measureUnitNode->appendChild($doc->createTextNode($unitCode));
726 $measureNode->appendChild($measureTypeNode);
727 $measureNode->appendChild($measurementNode);
728 $measureNode->appendChild($measureUnitNode);
743 $extentNode =& $doc->createElementNS($deployment->getNamespace(),
'Extent');
745 $typeNode = $doc->createElementNS($deployment->getNamespace(),
'ExtentType');
746 $typeNode->appendChild($doc->createTextNode($type));
748 $valueNode = $doc->createElementNS($deployment->getNamespace(),
'ExtentValue');
749 $valueNode->appendChild($doc->createTextNode($extentValue));
751 $unitNode = $doc->createElementNS($deployment->getNamespace(),
'ExtentUnit');
752 $unitNode->appendChild($doc->createTextNode($extentUnit));
754 $extentNode->appendChild($typeNode);
755 $extentNode->appendChild($valueNode);
756 $extentNode->appendChild($unitNode);
770 $node = $doc->createElementNS($deployment->getNamespace(), $nodeName);
771 $node->appendChild($doc->createTextNode($textContent));