/** * 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); }
/** * Update the contact info for an item. * * @param stro,g $entityId * @param EntityType $entityType * @param \CultureFeed_Cdb_Data_ContactInfo $contactInfo */ public function updateContactInfo($entityId, EntityType $entityType, \CultureFeed_Cdb_Data_ContactInfo $contactInfo) { $dom = new \DOMDocument('1.0', 'utf-8'); $domElement = $dom->createElement('info'); $contactInfo->appendToDOM($domElement); $contactInfoNode = $dom->importNode($domElement->childNodes->item(0), true); $dom->appendChild($contactInfoNode); $request = $this->getClient()->post($this->updatePath($entityId, $entityType) . '/updateContactinfo', array('Content-Type' => 'application/xml; charset=UTF-8'), $dom->saveXml()); $response = $request->send(); $rsp = Rsp::fromResponseBody($response->getBody(true)); $this->guardItemUpdateResponseIsSuccessful($rsp); return $rsp; }
/** * 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; $eventElement = $dom->createElement('event'); if ($this->ageFrom) { $eventElement->appendChild($dom->createElement('agefrom', $this->ageFrom)); } if ($this->availableFrom) { $eventElement->setAttribute('availablefrom', $this->availableFrom); } if ($this->availableTo) { $eventElement->setAttribute('availableto', $this->availableTo); } if ($this->cdbId) { $eventElement->setAttribute('cdbid', $this->cdbId); } if ($this->createdBy) { $eventElement->setAttribute('createdby', $this->createdBy); } if ($this->creationDate) { $eventElement->setAttribute('creationdate', $this->creationDate); } if ($this->externalId) { $eventElement->setAttribute('externalid', $this->externalId); } if (isset($this->isParent)) { $eventElement->setAttribute('isparent', $this->isParent ? 'true' : 'false'); } if (isset($this->lastUpdated)) { $eventElement->setAttribute('lastupdated', $this->lastUpdated); } if (isset($this->lastUpdatedBy)) { $eventElement->setAttribute('lastupdatedby', $this->lastUpdatedBy); } if (isset($this->owner)) { $eventElement->setAttribute('owner', $this->owner); } if (isset($this->pctComplete)) { $eventElement->setAttribute('pctcomplete', $this->pctComplete); } if (isset($this->private)) { $eventElement->setAttribute('private', $this->private ? 'true' : 'false'); } if (isset($this->published)) { $eventElement->setAttribute('published', $this->published ? 'true' : 'false'); } if (isset($this->validator)) { $eventElement->setAttribute('validator', $this->validator); } if (isset($this->wfStatus)) { $eventElement->setAttribute('wfstatus', $this->wfStatus); } if ($this->publisher) { $eventElement->setAttribute('publisher', $this->publisher); } if ($this->calendar) { $this->calendar->appendToDOM($eventElement); } if ($this->categories) { $this->categories->appendToDOM($eventElement); } if ($this->contactInfo) { $this->contactInfo->appendToDOM($eventElement); } if ($this->details) { $this->details->appendToDOM($eventElement); } if (count($this->keywords) > 0) { $keywordsElement = $dom->createElement('keywords'); if (version_compare($cdbScheme, '3.3', '>=')) { foreach ($this->keywords as $keyword) { $keyword->appendToDOM($keywordsElement); } $eventElement->appendChild($keywordsElement); } else { $keywords = array(); foreach ($this->keywords as $keyword) { $keywords[$keyword->getValue()] = $keyword->getValue(); } $keywordsElement->appendChild($dom->createTextNode(implode(';', $keywords))); $eventElement->appendChild($keywordsElement); } } if (isset($this->languages)) { $this->languages->appendToDOM($eventElement); } if ($this->location) { $this->location->appendToDOM($eventElement); } if ($this->organiser) { $this->organiser->appendToDOM($eventElement); } if ($this->maxParticipants) { $eventElement->appendChild($dom->createElement('maxparticipants', $this->maxParticipants)); } if ($this->bookingPeriod) { $this->bookingPeriod->appendToDOM($eventElement); } if (!empty($this->relations)) { $relationsElement = $dom->createElement('eventrelations'); foreach ($this->relations as $relation) { $relationElement = $dom->createElement('relatedproduction'); $relationElement->appendChild($dom->createTextNode($relation->getTitle())); $relationElement->setAttribute('cdbid', $relation->getCdbid()); $externalId = $relation->getExternalId(); if ($externalId) { $relationElement->setAttribute('externalid', $relation->getExternalId()); } $relationsElement->appendChild($relationElement); } $eventElement->appendChild($relationsElement); } $element->appendChild($eventElement); }