DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT:sa_addressexport

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Stefan Alpers
Changed:2004-09-08T15:20:49
Author:Stefan Alpers
Email:typo3@sa-net.de
Info 3:
Info 4:

EXT:sa_addressexport

Extension Key: sa_addressexport

Copyright 2000-2002, Stefan Alpers, <typo3@sa-net.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT:sa_addressexport 1

Introduction 1

What does it do? 1

Screenshots 1

Users manual 3

Export profiles 3

FAQ 3

Adminstration 4

FAQ 4

Configuration 4

Creating Exporter Plugins 4

Tutorial 5

Known problems 5

To-Do list 5

Changelog 6

Introduction

What does it do?

This extension exports a list of tt_address records to various formats. You can extend the extension by adding your own format using plugins. The fields being exported and the export plugincan be selected for each export profile.

Screenshots

img-1 Screenshot 1Plugin configuration

img-2 Screenshot 2Export profile

img-3 Screenshot 3Page header

img-4 Screenshot 4Output option: "Show Data" used with exporter HTML

img-5 Screenshot 5Ouput option "Download exported data as file"

Users manual

Install the extension using the extension manager. Afterwards create a new sysfolder to store the export profiles in. Then create a new page for the export its self. Edit the page headerand set the “ General Record Storage page ” the sysfolder previously created. Now add a new “Address Export” plugin to the page. Point “ Startingpoint ” to the location of your tt_address records.

At last the export profile have to be created in the sysfolder. Click on the sysfolder in the pageview an select “new”. Then Click on “Export profile”. Now you can create your export profiles.

Export profiles

Export profiles are the extension's way to handle export settings without changing Typoscript.It is possible to have multiple profiles in parallel so you can export to various formats or export various fields.

Another area of application is to export specific fields for different fe_groups.

FAQ

- Possible subsections: FAQ

Adminstration

See Users manual .

FAQ

- Possible subsections: FAQ

Configuration

More exporters can be added to the extension using a simple plugin api.

Creating Exporter Plugins

Warning! The exporter interface is still experimental. Please test your exporters thoroughly before using in production environments!

Creating exporter pluginsis very easy. If you follow these steps you won't encounter any problems.

Extending the exporter class

The exporter is based on the class tx _ saaddressexport _exporterBase which has to extended by your own exporter class. Furthermore you have to implement the functions:

::

function name

exporter()

description

The actual export function which is called by export(). This method does all the exporting and stores it to an internal value. Default is $this->filecontent but not mandatory. You can define own values in your class. See below for returning methods.

Return true on success and false on error.

::

function name

saveData()

description

Save the data generated by exporter() to $this->getFilename()

Return true on success and false on error.

::

function name

getData()

description

Return the data generated $this->exporter()

As an example we want to create a plugin for the type XYZ:

The three letter code XYZ will multiple times and will be printed red. It is important that the three letter code is replaced with your code. Otherwise the plugin will fail with a fatal error.

Create the class

Create the file res/exporters/class.tx_saaddressexport_exporter XYZ .php

class tx_saaddressexport_exporterXYZ extends tx_saaddressexport_exporterBase
{
        var $filecontent;
        function exporter()
        {
                //write your exporter code here
                $this->filecontent='my exported data';
                if ($success)
                {
                        return(true);
                }
                else
                {
                        return(false);
                }
        }

        /**
        * Save the data to $this->getFilename()
        * return true on success false on failure
        *
        */
        function saveData()
        {
                return(t3lib_div::writeFile($this->getFilename(),$this->getData()));
        }

        /**
        * Return the data exported by your class
        *
        */
        function getData()
        {
                return($this->filecontent);
        }

}

As you see the th code appears in the filename an in the class name. You have to implement the three methods otherwise the exporter will die with a fatal error stating that the method is not implemented. When exporting text files you can copy saveData() and getData() you only haveto change them when exporting to binary data.

Editing the xmlfile

Open the file res/plugins.xml in an editor.

<phparray>
        <numIndex index="0" type="array">
                <name>CSV</name>
                <ext>csv</ext>
        </numIndex>
        <numIndex index="1" type="array">
                <name>XML</name>
                <ext>xml</ext>
        </numIndex>
        <numIndex index="2" type="array">
                <name>HTML</name>
                <ext>html</ext>
        </numIndex>
  <numIndex index="3" type="array">
          <name>XYZ</name>
          <ext>zyx</ext>
  </numIndex>
</phparray>

Add a new section to the xml file. Be sure to increment index. This is very important! Set name to the three letter code and ext to the extension of your export file.

Add the plugin to the backend

At last we must add the plugin to the list of exporters in backend. This can be a bit confusing and can lead to errors in the backend. So make a backup of your files before editing them!

Open locallang_db.php in an editor and search for “tx_saaddressexport_xportprofile.xportfunction.I”. You will find multiple entries which are numbered. The last entry's number should (index of your plugin)-1 (see above – Editing the xml file) copy this line, change the number to your index and change the text appropriately. This file contains Translations for every language, insert the translation for every language you know as described.

Now open tca.php and locate sa_addressexport/locallang_db.php:t x_saaddressexport_xportprofile.xportfunction.I.This has to end with the same number as above. Copy the complete line and change the numbers the same way as you did above.

Now you are done and you can use your plugin.

Reference

Reference (TypoScript)

allWrap /+stdWrap

Property

allWrap /+stdWrap

Data type

wrap

Description

Wraps the whole item

Default

Known problems

- Only the standard tt_address is covered yet. Even is the table has been extended only standard fields will be exported.

To-Do list

  • Implement the checkboxes “Address Category” and “Assigned FrontendUser” 04.09.2004
  • Implement Pluginbuilder (very far away) 04.09.2004
  • Split into frontend plugin and library. Libary should generic exporter. 04.09.2004

Changelog

- Initial version (05.09.2004)

img-6 EXT:sa_addressexport - 6