<?php
 class AdvancedCatalogModuleItemTypeVO implements MotoDomObjectInterface { public $id; public $labelPropertyID; public $thumbnailPropertyID; public $name; public $properties; public $template; public $childTypes; public $maxItems; public $defaultLabel; public $defaultThumbnail; public function __construct(DOMNode $parent = null) { if (!empty($parent)) { $this->loadDomElement($parent); } } public function loadDomElement(DOMNode $parent) { $this->id = (integer) $parent->getAttribute('id'); $this->labelPropertyID = (integer) $parent->getAttribute('labelPropertyID'); $this->thumbnailPropertyID = (integer) $parent->getAttribute('thumbnailPropertyID'); $node = MotoXML::findOneByXPath("./name", $parent); if (!is_null($node)) $this->name = (string) $node->nodeValue; $this->properties = PropertyTypeVO::findAll($parent); $template = MotoXML::findOneByXPath("./template", $parent); if (!is_null($template)) { $this->template = new AdvancedCatalogModuleItemVO($template, false); } $node = MotoXML::findOneByXPath("./childTypes", $parent); if (!is_null($node)) { $childs = explode(",", (string) $node->nodeValue); $this->childTypes = null; foreach($childs as $child) if (trim($child)*1 > 0) { if ($this->childTypes === null) $this->childTypes = array(); $this->childTypes[] = trim($child)*1; } } $node = MotoXML::findOneByXPath("./maxItems", $parent); if (!is_null($node)) $this->maxItems = (integer) $node->nodeValue; $node = MotoXML::findOneByXPath("./defaultLabel", $parent); if (!is_null($node)) $this->defaultLabel = (string) $node->nodeValue; $node = MotoXML::findOneByXPath("./defaultThumbnail", $parent); if (!is_null($node)) $this->defaultThumbnail = (string) $node->nodeValue; return $this; } public function saveDomElement(DOMNode $parent) { } public static function findById($id, DOMNode $context) { return MotoXML::findOneByXPath(".//structure/items/item[@id='{$id}']", $context, get_class()); } public static function findAll(DOMNode $context) { return MotoXML::findByXPath(".//structure/items/item", $context, get_class()); } } ?>