public static function createFromXML( DOMElement $node )
    {
        $newObj = new eZPageBlock();

        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 == 'item' )
            {
                $blockItemNode = eZPageBlockItem::createFromXML( $node );
                $newObj->addItem( $blockItemNode );
            }
            elseif ( $node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'rotation' )
            {
                $attrValue = array();

                foreach ( $node->childNodes as $subNode )
                {
                    if ( $subNode->nodeType == XML_ELEMENT_NODE )
                        $attrValue[$subNode->nodeName] = $subNode->nodeValue;
                }

                $newObj->setAttribute( $node->nodeName, $attrValue );
            }
            elseif ( $node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'custom_attributes' )
            {
                $attrValue = array();

                foreach ( $node->childNodes as $subNode )
                {
                    if ( $subNode->nodeType == XML_ELEMENT_NODE )
                        $attrValue[$subNode->nodeName] = $subNode->nodeValue;
                }

                $newObj->setAttribute( $node->nodeName, $attrValue );
            }
            else
            {
                if ( $node->nodeType == XML_ELEMENT_NODE )
                    $newObj->setAttribute( $node->nodeName, $node->nodeValue );
            }
        }

        return $newObj;
    }
public static function createFromXML( DOMElement $node )
    {
        $newObj = new eZPageBlock();

        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 == 'item' )
            {
                $blockItemNode = eZPageBlockItem::createFromXML( $node );
                $newObj->addItem( $blockItemNode );
            }
            elseif ( $node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'rotation' )
            {
                $attrValue = array();

                foreach ( $node->childNodes as $subNode )
                {
                    if ( $subNode->nodeType == XML_ELEMENT_NODE )
                        $attrValue[$subNode->nodeName] = $subNode->nodeValue;
                }

                $newObj->setAttribute( $node->nodeName, $attrValue );
            }
            elseif ( $node->nodeType == XML_ELEMENT_NODE && $node->nodeName == 'custom_attributes' )
            {
                $attrValue = array();

                foreach ( $node->childNodes as $subNode )
                {
                    if ( $subNode->nodeType == XML_ELEMENT_NODE )
                        $attrValue[$subNode->nodeName] = $subNode->nodeValue;
                }

                $newObj->setAttribute( $node->nodeName, $attrValue );
            }
            else
            {
                if ( $node->nodeType == XML_ELEMENT_NODE )
                    $newObj->setAttribute( $node->nodeName, $node->nodeValue );
            }
        }

        return $newObj;
    }
public static function createFromXML ( DOMElement $ node ) { $ newObj = new eZPageBlock ( ) ; 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 == 'item' ) { $ blockItemNode = eZPageBlockItem :: createFromXML ( $ node ) ; $ newObj -> addItem ( $ blockItemNode ) ; } elseif ( $ node -> nodeType == XML_ELEMENT_NODE && $ node -> nodeName == 'rotation' ) { $ attrValue = array ( ) ; foreach ( $ node -> childNodes as $ subNode ) { if ( $ subNode -> nodeType == XML_ELEMENT_NODE ) $ attrValue [ $ subNode -> nodeName ] = $ subNode -> nodeValue ; } $ newObj -> setAttribute ( $ node -> nodeName , $ attrValue ) ; } elseif ( $ node -> nodeType == XML_ELEMENT_NODE && $ node -> nodeName == 'custom_attributes' ) { $ attrValue = array ( ) ; foreach ( $ node -> childNodes as $ subNode ) { if ( $ subNode -> nodeType == XML_ELEMENT_NODE ) $ attrValue [ $ subNode -> nodeName ] = $ subNode -> nodeValue ; } $ newObj -> setAttribute ( $ node -> nodeName , $ attrValue ) ; } else { if ( $ node -> nodeType == XML_ELEMENT_NODE ) $ newObj -> setAttribute ( $ node -> nodeName , $ node -> nodeValue ) ; } } return $ newObj ; }
Creates and return eZPageBlock object from given XML

@static
@param DOMElement $node
@return eZPageBlock
Creates and return eZPageBlock object from given XML