Exporting data (CSV)

Author Message

laurent le cadet

Friday 08 July 2005 6:50:04 am

Hi,

Is there a simple way to export data ?
I need to create a text file with all the items of a specific classe and retrieve all attributes line by line.

Possible ?

Regards.

Laurent.

Steve P

Saturday 09 July 2005 2:34:03 am

I've just installed a fantastic extension:
http://ez.no/community/contribs/import_export/csv_extract_pubsvn

It was a doddle to install & I think can be easily adapted to suit your requirements.

Best

Steve

laurent le cadet

Saturday 09 July 2005 3:28:24 am

Hi and thanks for response,

I'm trying to install the extension I'm not very familiar with extensions.

I tryed to place the files in the right place but not sure it's the right way

What I've done :

extension/extract/modules/extract

- module.php
- user.php

extension/extract/packages

- empty folder (what is use for ?)

extension/extract/settings

- module.ini.append

settings/override/site.ini.append.php

[ExtensionSettings]
ActiveAccessExtensions[]=extract

ModuleList[]
ModuleList[]=extract


Part[ezextractnavigationpart]=Extract


[TopAdminMenu]
Tabs[]=extract
[Topmenu_extract]
NavigationPartIdentifier=ezextractnavigationpart
Name=Extract
Tooltip=Extract Users to csv
URL[]
URL[default]=extract/user
Enabled[]
Enabled[default]=true
Enabled[browse]=false
Enabled[edit]=false
Shown[]
Shown[default]=true
Shown[edit]=true
Shown[navigation]=true
Shown[browse]=false

settings/override/

- browse.ini.append.php

settings/override/

- design.ini.append.php

settings/override/

- export.ini.append.php (write [ExportSettings] instead of [ExportSettngs] )

standard/templates/extract

- browse_node.tpl
- user.tpl

-----end

I think I forgot something or maybe there is a fine tune to perform cause by clicking on the tab "Extract" ezP can't findthe module...

Laurent

Marco Zinn

Saturday 09 July 2005 3:31:28 am

As Björn created some extension for this, use it :)

I think, you should be able to do this with pure templating, too, but this will be some work.

Marco
http://www.hyperroad-design.com

laurent le cadet

Saturday 09 July 2005 3:38:45 am

Hi marco,

I'm almost trying to use it !

What you mean by "use it" ?
Isn't it the right way to install it ?

Laurent

Steve P

Saturday 09 July 2005 3:49:46 am

Hi Laurent

I think you're trying to make it too complicated! Just unpack the files & copy to your extensions dir. Add the lines:

[ExtensionSettings]
ActiveExtensions[]=extract

[ModuleSettings]
ExtensionRepositories[]=extract

..to your settings/override/site.ini.append, clear the caches & bingo!!

laurent le cadet

Saturday 09 July 2005 4:13:23 am

As you said : BINGO !

I just add in override/menu.ini.append.php

[TopAdminMenu]
Tabs[]
Tabs[]=extract

because there was no "Extract" tab.

Nice job (not mine ;)

Many thanks to Björn and both of you !

Laurent.

Steve P

Saturday 09 July 2005 4:24:09 am

I didn't need the menu mods?

Glad it's running OK :)

Do you know anything about the store() function? See my post...

laurent le cadet

Saturday 09 July 2005 4:24:53 am

Sorry to be back again.

I just wanted to say it was REALLY a nice job and exactly what I was looking for !

Steve P

Saturday 09 July 2005 4:26:20 am

Me too! I'd been struggling to try & implement something much simpler...

laurent le cadet

Saturday 09 July 2005 4:29:31 am

Sorry Steve I don't think I'll be helpfull about the store() function

Pål J Didriksen

Saturday 09 July 2005 5:32:37 am

I also installed the extension. But my date-fields are shown as "Object" in the CSV-file.

Any tips on how to turn it into a proper date?

Steve P

Monday 11 July 2005 2:01:16 am

Pål. Assume you'll need to modify the templates but maybe the developer Björn Dieding ( bjoern@xrow.de ) would be interested in looking at this one?

Let me know how you get on...

laurent le cadet

Monday 11 July 2005 2:10:12 am

Pål,

I have also the same result for specific datatypes but most of them are supported.

Let us know if you find the way to extend to all datatypes.

Laurent

Paul Borgermans

Monday 11 July 2005 2:26:29 am

Yes,

The function

function parseContentToText( &$datatype )

in the file modules/extract/user.php

needs to be extended for some of the datatypes (maybe also custom datatypes)

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Pål J Didriksen

Monday 11 July 2005 3:54:16 am

I added some code to treat the 'ezdate' datatype, under <i>function parseContentToText( &$datatype )</i>:

           case 'ezdate':
                print "parseContentToText 5: Case ezdate.<br>";
                $content = $datatype->title();
            break;

I suppose this should work for most datatypes (except those that save data as xml), as the function <i>title()</i> formats the data that should be saved in the data_text-field. I have only tested it for ezdate, though.

Steve P

Tuesday 12 July 2005 6:36:22 am

Pål

Can you post your mod in context please? I managed to crash it so must have got it wrong :(

           case 'ezdate':
                print "parseContentToText 5: Case ezdate.<br>";
                $content = $datatype->title();
            break;

Pål J Didriksen

Tuesday 19 July 2005 11:18:32 am

In my version of extract/modules/extract/user.php, the function parseContentToText now looks like this:

function parseContentToText( &$datatype )
{
    if ( is_object( $datatype ) )
    {
        $isA = $datatype->isA();
        switch ( $isA )
        {
            case 'ezselection':
                $content = $datatype->content();
                if ( is_array( $content ) and count($content) == 1 )
                {
                    $content = $datatype->metaData();
                }
                else
                {
                    $content = $datatype->isA();
                }
                break;
            case 'ezdate':
                $content = $datatype->title();
                break;
            default:
                $content = $datatype->content();
                break;
        }
    }
    else
    {
        $content = $datatype;
    }
    return $content;
}

laurent le cadet

Monday 05 March 2007 11:46:31 pm

Hi,
About ezselection datatype...I'm trying to extract datas with a multioptions selection but I don't know how.

Someone can help me to render it lke that :

column header : option name
raw content : is selected or not

Any idea ?

Regards.

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 22:38:15
Script start
Timing: Jan 18 2025 22:38:15
Module start 'layout'
Timing: Jan 18 2025 22:38:15
Module start 'content'
Timing: Jan 18 2025 22:38:16
Module end 'content'
Timing: Jan 18 2025 22:38:16
Script end

Main resources:

Total runtime1.0056 sec
Peak memory usage4,096.0000 KB
Database Queries128

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.0234152.6094
Module start 'layout' 0.00600.0031 741.632839.4141
Module start 'content' 0.00910.9948 781.0469854.0156
Module end 'content' 1.00390.0016 1,635.062532.1875
Script end 1.0055  1,667.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3473160.0002
Check MTime0.00150.1540160.0001
Mysql Total
Database connection0.00080.078310.0008
Mysqli_queries0.873486.85861280.0068
Looping result0.00120.12281260.0000
Template Total0.973296.820.4866
Template load0.00250.251020.0013
Template processing0.970796.528020.4853
Template load and register function0.00010.010710.0001
states
state_id_array0.00070.072510.0007
state_identifier_array0.00110.105120.0005
Override
Cache load0.00260.26331300.0000
Sytem overhead
Fetch class attribute can translate value0.00040.044050.0001
Fetch class attribute name0.00120.1185230.0001
XML
Image XML parsing0.00210.212850.0004
class_abstraction
Instantiating content class attribute0.00010.0068320.0000
General
dbfile0.00120.1230350.0000
String conversion0.00000.000740.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
13content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
19content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
30content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/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: 79
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs