Пример #1
0
 /**
  * Creates and return eZPageZone object from given XML
  *
  * @static
  * @param DOMElement $node
  * @return eZPageZone
  */
 public static function createFromXML(DOMElement $node)
 {
     $newObj = new eZPageZone();
     if ($node->hasAttributes()) {
         foreach ($node->attributes as $attr) {
             if ($attr->name == 'id') {
                 $value = explode('_', $attr->value);
                 $newObj->setAttribute($attr->name, $value[1]);
             } else {
                 $newObj->setAttribute($attr->name, $attr->value);
             }
         }
     }
     foreach ($node->childNodes as $node) {
         if ($node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'block') {
             $blockNode = eZPageBlock::createFromXML($node);
             $newObj->addBlock($blockNode);
         } elseif ($node->nodeType == XML_ELEMENT_NODE) {
             $newObj->setAttribute($node->nodeName, $node->nodeValue);
         }
     }
     return $newObj;
 }