topical media & game development
mobile-wikitude-arml.php / php
<?php
Class that represents an ARML-Document
author: Thomas Krammer - www.powerhour.at
version: 1.1
class PowerHour_Wikitude_Arml
{
protected ns_ar = 'http://www.openarml.org/arml/1.0';
protected doc = null;
protected providerid = "";
protected description = "";
protected providerUrl = "";
protected icon = "";
protected provider, this->providerid = this->name = this->doc = new DOMDocument('1.0', 'utf-8');
this->doc->createElementNS(this->kml = this->kml);
this->xmlns,'xmlns:ar', this->kml->setAttributeNS(this->ns_wiki);
}
returns: the
public function getProviderid() {
return this->providerid;
}
parameter: providerid to set
public function setProviderid(this->providerid =
returns: the name
public function getName() {
return
parameter: name the
public function setName(name) {
name;
}
returns: the
public function getDescription() {
return this->description;
}
parameter: description to set
public function setDescription(this->description =
returns: the tags
public function getTags() {
return
parameter: tags the
public function setTags(tags) {
tags;
}
returns: the
public function getProviderUrl() {
return this->providerUrl;
}
parameter: providerUrl to set
public function setProviderUrl(this->providerUrl =
returns: the icon
public function getLogo() {
return
parameter: icon the
public function setLogo(logo) {
logo;
}
returns: the
public function getIcon() {
return this->icon;
}
parameter: icon to set
public function setIcon(this->icon =
Adds a Single-POI to the ARML-Document
parameter: PowerHour_Wikitude_IPOI poi
public function addPOI(PowerHour_Wikitude_IPOI this->poiList[] =
Adds a list of POI to the ARML-Document
parameter: array poiList Must implement PowerHour_Wikitude_IPOI
public function addPOIList(array poiList as this->addPOI(
Translates the content of the class to a valid ARML-String
public function __toString()
{
Document = this->doc->createElement('Document'));
Document->appendChild(this->ns_ar, 'ar:provider'));
this->doc->createAttribute('id');
provider_id);
this->doc->createTextNode(provider->appendChild(this->ns_ar, 'ar:name', descr = this->doc->createElementNS(descr->appendChild(this->description));
this->doc->createElementNS(this->providerUrl));
this->doc->createElementNS(this->tags));
this->doc->createElementNS(this->logo));
this->doc->createElementNS(this->icon));
foreach(poi)
{
Document->appendChild(attr_id = placemark->appendChild(attr_id->appendChild(poi->getId()));
this->doc->createElementNS(this->getProviderid()));
this->doc->createElement('name', (description = this->doc->createElement('description'));
this->doc->createCDATASection(wikiinfo = this->doc->createElementNS(poi->getThumbnail()) > 0)
this->doc->createElementNS(poi->getThumbnail()));
if(strlen(wikiinfo->appendChild(this->ns_wiki,'wikitude:phone', poi->getUrl()) > 0)
this->doc->createElementNS(poi->getUrl()));
if(strlen(wikiinfo->appendChild(this->ns_wiki,'wikitude:email', poi->getAddress()) > 0)
this->doc->createElementNS(poi->getAddress()));
if(poi->getAttachments()) > 0)
{
wikiinfo->appendChild(this->ns_wiki,'wikitude:attachments', poi->getAttachments() as attachmentNode = this->doc->createElementNS(poi->getAddress())
);
// Name of Attachment
this->doc->createAttribute('name');
attach_name);
this->doc->createTextNode(attach_mime = attachmentNode->appendChild(attach_mime->appendChild(attachment->getType()));
// URL of Attachment
this->doc->createElementNS(attachmentNode->appendChild(attach_url->appendChild(attachment->getLink()));
// TODO implement support for attachment thumbnails
}
}
placemark->appendChild(Point->appendChild(poi->getCoordinates()));
}
return
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.