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.

eZ debug

Timing: Jan 18 2025 18:32:50
Script start
Timing: Jan 18 2025 18:32:50
Module start 'layout'
Timing: Jan 18 2025 18:32:50
Module start 'content'
Timing: Jan 18 2025 18:32:50
Module end 'content'
Timing: Jan 18 2025 18:32:50
Script end

Main resources:

Total runtime0.6148 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 589.0703152.6250
Module start 'layout' 0.00740.0026 741.695339.4453
Module start 'content' 0.00990.6034 781.1406461.8125
Module end 'content' 0.61330.0015 1,242.95318.1563
Script end 0.6147  1,251.1094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.5631160.0002
Check MTime0.00140.2280160.0001
Mysql Total
Database connection0.00080.132810.0008
Mysqli_queries0.561891.3816520.0108
Looping result0.00060.0910500.0000
Template Total0.576493.820.2882
Template load0.00240.384420.0012
Template processing0.574093.364420.2870
Template load and register function0.00020.025910.0002
states
state_id_array0.00090.145110.0009
state_identifier_array0.00100.160820.0005
Override
Cache load0.00200.3182190.0001
Sytem overhead
Fetch class attribute can translate value0.00090.151910.0009
Fetch class attribute name0.00100.156430.0003
XML
Image XML parsing0.00040.071910.0004
class_abstraction
Instantiating content class attribute0.00000.001340.0000
General
dbfile0.00090.1405160.0001
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs