00001 <?php
00002
00011 class SDRContextObj extends SXMLModel {
00012 private static $ATTRIBUTES = array(
00013 'brand_image_url' => array('type' => 'string'),
00014 'brand_image_width' => array(),
00015 'brand_image_height' => array(),
00016 'brand_altText' => array('type' => 'string'),
00017 'description' => array('type' => 'string'),
00018 'title' => array('type' => 'string')
00019 );
00020
00029 public function __construct($xml = null) {
00030 parent::__construct();
00031
00032 $this->registerAttributes(self::$ATTRIBUTES);
00033
00034 if($xml) {
00035 $this->registerNodeName($xml->getName());
00036 $this->setXML($xml);
00037 }
00038 }
00039
00048 protected function setXMLImpl($xml) {
00049 $this->registerNodeName($xml->getName());
00050 $this->set('brand_image_url', $xml->brand->image);
00051 $attrs = $xml->brand->image->attributes();
00052 $this->set('brand_image_width', $attrs['width']);
00053 $this->set('brand_image_height', $attrs['height']);
00054 $this->set('brand_altText', $xml->brand->altText);
00055 $this->set('description', $xml->description);
00056 $this->set('title', $xml->title);
00057
00058 return true;
00059 }
00060
00070 protected function getXMLImpl($root, $forceRegen) {
00071 $nodeName = $this->getNodeName();
00072
00073 $brand_image_width = htmlspecialchars($this->get('brand_image_width'));
00074 $brand_image_height = htmlspecialchars($this->get('brand_image_height'));
00075 $brand_image_url = htmlspecialchars($this->get('brand_image_url'));
00076 $brand_altText = htmlspecialchars($this->get('brand_altText'));
00077 $description = htmlspecialchars($this->get('description'));
00078 $title = htmlspecialchars($this->get('title'));
00079
00080 return <<<END_XML
00081 <$nodeName>
00082 <brand>
00083 <image width="$brand_image_width" height="$brand_image_height">$brand_image_url</image>
00084 <altText>$brand_altText</altText>
00085 </brand>
00086 <description>$description</description>
00087 <title>$title</title>
00088 </$nodeName>
00089 END_XML;
00090 }
00091 }
00092
00093 ?>