/** * Appends the current object to the passed DOM tree. * * @param DOMElement $element * The DOM tree to append to. * @param string $cdbScheme * The cdb schema version. * * @see CultureFeed_Cdb_IElement::appendToDOM() */ public function appendToDOM(DOMElement $element, $cdbScheme = '3.2') { $dom = $element->ownerDocument; $actorElement = $dom->createElement('actor'); if ($this->cdbId) { $actorElement->setAttribute('cdbid', $this->cdbId); } if ($this->externalId) { $actorElement->setAttribute('externalid', $this->externalId); } if ($this->details) { $this->details->appendToDOM($actorElement); } if ($this->categories) { $this->categories->appendToDOM($actorElement); } if ($this->contactInfo) { $this->contactInfo->appendToDOM($actorElement); } if (count($this->keywords) > 0) { $keywordElement = $dom->createElement('keywords'); $keywordElement->appendChild($dom->createTextNode(implode(';', $this->keywords))); $actorElement->appendChild($keywordElement); } if ($this->weekScheme) { $this->weekScheme->appendToDOM($actorElement); } $element->appendChild($actorElement); }
/** * Appends the current object to the passed DOM tree. * * @param DOMElement $element * The DOM tree to append to. * @param string $cdbScheme * The cdb schema version. * * @see CultureFeed_Cdb_IElement::appendToDOM() */ public function appendToDOM(DOMElement $element, $cdbScheme = '3.2') { $dom = $element->ownerDocument; $actorElement = $dom->createElement('actor'); if ($this->cdbId) { $actorElement->setAttribute('cdbid', $this->cdbId); } if ($this->externalId) { $actorElement->setAttribute('externalid', $this->externalId); } if ($this->details) { $this->details->appendToDOM($actorElement); } if ($this->categories) { $this->categories->appendToDOM($actorElement); } if ($this->contactInfo) { $this->contactInfo->appendToDOM($actorElement); } if ($this->createdBy) { $actorElement->setAttribute('createdby', $this->createdBy); } if ($this->creationDate) { $actorElement->setAttribute('creationdate', $this->creationDate); } if (isset($this->lastUpdated)) { $actorElement->setAttribute('lastupdated', $this->lastUpdated); } if (isset($this->lastUpdatedBy)) { $actorElement->setAttribute('lastupdatedby', $this->lastUpdatedBy); } if (count($this->keywords) > 0) { $keywordsElement = $dom->createElement('keywords'); if (version_compare($cdbScheme, '3.3', '>=')) { foreach ($this->keywords as $keyword) { $keyword->appendToDOM($keywordsElement); } $actorElement->appendChild($keywordsElement); } else { $keywords = array(); foreach ($this->keywords as $keyword) { $keywords[$keyword->getValue()] = $keyword->getValue(); } $keywordsElement->appendChild($dom->createTextNode(implode(';', $keywords))); $actorElement->appendChild($keywordsElement); } } if ($this->weekScheme) { $this->weekScheme->appendToDOM($actorElement); } $element->appendChild($actorElement); }