eZmatrix attribute and export to csv

Author Message

laurent le cadet

Tuesday 07 August 2007 1:55:43 am

Hi,

I'm trying to build a new parser for the Extract contribution to export the matrix datatype in a CSV.
But due to my none level in php i'm not able to do it.
I can only hit the "rows" attribute of the datatype which is an array, but I'm stuck :

class eZMatrixHandler extends BaseHandler {

	function exportAttribute(&$attribute) {
		$content  = $attribute->content();
		$rows = $content->attribute( 'rows' );
		return $this->escape( $rows );
	}
}

Some help will be greatly appreciated.

Regards.

Laurent

laurent le cadet

Tuesday 07 August 2007 2:39:27 am

replying to myself :

<?
class eZMatrixHandler extends BaseHandler {

	function exportAttribute(&$attribute) {
		$content  = $attribute->content();
		$rows = $content->attribute( 'rows' );
		foreach( $rows['sequential'] as $row )
        {
            $matrixArray[] = eZStringUtils::implodeStr( $row['columns'], '|' );
        }

        return eZStringUtils::implodeStr( $matrixArray, '&' );
		return $this->escape( $matrixArray );
	}
}

?>

A copy/paste from ezmatriwtype.php.

Hope this help

Laurent

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.