Forums / Developer / eZmatrix attribute and export to csv
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
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