protected function createDocDOMElement( DOMDocument $domDocument, eZContentObjectTreeNode $node )
    {
        $ooDocumentElement = $domDocument->createElement( 'OODocument' );

        $fileName = eZOOConverter::objectToOO( $node->attribute( 'node_id' ) );

        if ( is_array( $fileName ) )
        {
            throw new Exception( 'Could not generate OO document, ID: ' . $node->attribute( 'node_id' ) . ', Description: ' . $fileName[0] );
        }

        // Add odt document to DOMElement
        $ooDocumentElement->setAttribute( 'base64Encoded', '1' );
        $ooDocumentElement->setAttribute( 'filename', $node->attribute( 'name' ) . '.doc' );

        // need to generate? a file name
        $convertedFile = '/tmp/word.doc';
        //if ( file_exists( $convertedFile ) )
        {
        //    unlink( $convertedFile );
        }

        $this->daemonConvert( realpath( $fileName ), $convertedFile );

        // need to see if the conversion was successful

        $ooDocumentElement->appendChild( $domDocument->createCDATASection( base64_encode( file_get_contents( $convertedFile ) ) ) );
        unlink( $fileName );

        // need to delete the converted file (does not work?)
        // unlink( $convertedFile );

        return $ooDocumentElement;
    }
protected function createDocDOMElement( DOMDocument $domDocument, eZContentObjectTreeNode $node )
    {
        $ooDocumentElement = $domDocument->createElement( 'OODocument' );

        $fileName = eZOOConverter::objectToOO( $node->attribute( 'node_id' ) );

        if ( is_array( $fileName ) )
        {
            throw new Exception( 'Could not generate OO document, ID: ' . $node->attribute( 'node_id' ) . ', Description: ' . $fileName[0] );
        }

        // Add odt document to DOMElement
        $ooDocumentElement->setAttribute( 'base64Encoded', '1' );
        $ooDocumentElement->setAttribute( 'filename', $node->attribute( 'name' ) . '.doc' );

        // need to generate? a file name
        $convertedFile = '/tmp/word.doc';
        //if ( file_exists( $convertedFile ) )
        {
        //    unlink( $convertedFile );
        }

        $this->daemonConvert( realpath( $fileName ), $convertedFile );

        // need to see if the conversion was successful

        $ooDocumentElement->appendChild( $domDocument->createCDATASection( base64_encode( file_get_contents( $convertedFile ) ) ) );
        unlink( $fileName );

        // need to delete the converted file (does not work?)
        // unlink( $convertedFile );

        return $ooDocumentElement;
    }
protected function createDocDOMElement ( DOMDocument $ domDocument , eZContentObjectTreeNode $ node ) { $ ooDocumentElement = $ domDocument -> createElement ( 'OODocument' ) ; $ fileName = eZOOConverter :: objectToOO ( $ node -> attribute ( 'node_id' ) ) ; if ( is_array ( $ fileName ) ) { throw new Exception ( 'Could not generate OO document, ID: ' . $ node -> attribute ( 'node_id' ) . ', Description: ' . $ fileName [ 0 ] ) ; } // Add odt document to DOMElement $ ooDocumentElement -> setAttribute ( 'base64Encoded' , '1' ) ; $ ooDocumentElement -> setAttribute ( 'filename' , $ node -> attribute ( 'name' ) . '.doc' ) ; // need to generate? a file name $ convertedFile = '/tmp/word.doc' ; //if ( file_exists( $convertedFile ) ) { //    unlink( $convertedFile ); } $ this -> daemonConvert ( realpath ( $ fileName ) , $ convertedFile ) ; // need to see if the conversion was successful $ ooDocumentElement -> appendChild ( $ domDocument -> createCDATASection ( base64_encode ( file_get_contents ( $ convertedFile ) ) ) ) ; unlink ( $ fileName ) ; // need to delete the converted file (does not work?) // unlink( $convertedFile ); return $ ooDocumentElement ; }
Create OO document element with conversion to Word 97 format.

Added by Alex 2008/04/16

@param DOMDocument Owner DOMDocument
@param eZContentObjectTreeNode eZContentObjectTreeNode object.

@return DOMElement NameList DOMDocument, example:

<OODocument base64Encoded="1" filename="My article.doc">
<![CDATA[ ad lkøjsdaølfhadsø fiuancfivn søgsbdnvsahfø ]]>
</OODocument>
Create OO document element with conversion to Word 97 format .