Contentserv PHP API

CSItemExporter
in package

An item exporter.

CSItemExporter can export files and products language independent.

Tags
since

CS13.2

Table of Contents

EXPORT_TYPE_CSV  = 'CSV'
EXPORT_TYPE_XML  = 'XML'
PATH_PARAM  = 'Path'
SEND_TYPE_MAIL  = 'MAIL'
__construct()  : mixed
An array of CSItemExporterData objects.
addData()  : mixed
Adds the given array of CSItemExporterData to the already existing.
createExportReport()  : bool
Main method to create a report of the export.
createExportsForItems()  : bool
The main method which do the export of data
createLanguageExports()  : bool
Create export for defined languages.
encodeDownloadFileName()  : string
Convert a given file name into a name that can be used as a download file name according to RFC 2183.
execute()  : bool
Executes the CSItemExporter.
export()  : void
Run the export.
exportReport()  : void
Export the report (gather data and creates a the export report file).
getCSVData()  : array<string|int, mixed>
Gets data.
getData()  : array<string|int, CSItemExporterData>
Returns an array with already setted CSItemExporterData objects
getDataForLanguage()  : array<string|int, CSItemExporterData>
Filters the $this->_aExportData array for a given language id.
getDefaultExportType()  : string
Gets the default export type
getDefaultZipFileName()  : string
Returns the default zip file name.
getDefaultZipSubFolderName()  : mixed
getDownloadURL()  : string
Gets the download URL
getExportLanguageIds()  : array<string|int, mixed>
Gets the defined language ids.
getExportReportName()  : string
Gets the defined report file name.
getExportType()  : string
Gets the current export type e.g. CSV/XML If none export type was set, the default type will be returned.
getItemFieldsForType()  : array<string|int, mixed>
Gets the item fields for recordType
getMailData()  : CSItemExporterData
Gets the setted mail data
getMetaExport()  : bool
Gets the flag if meta export is set.
getMetaExportFileName()  : array<string|int, mixed>|bool
Returns an CSV / XSL filename for a given type OR an array with all CSV / XSL file names.
getMetaExportForType()  : string
Gets the value for specific $sRecordType If the meta for this $sRecordType was set.
getPluginContext()  : string
Returns the plugin context.
getPlugins()  : array<string|int, CSItemExporterPlugin>
Returns all plugins for CSItemExporter
getSendViaMail()  : bool
Check if this exporter should send via mail
getZipFileName()  : string
Gets the zip file name.
getZipSize()  : int|string
Gets the size of the zipped file.
getZipSubFolderName()  : mixed
isDirectDownload()  : bool
Return the flag for direct download
sendMail()  : void
Send mail a zip attachment with exporter data.
sendMailTemplate()  : bool|string
Sends the exported data via mail
sendViaMail()  : mixed
Sets the data and sets the flag that this exporter should be send via mail
setData()  : mixed
Overwrites the setted data with given array of CSItemExporterData objects
setDirectDownload()  : mixed
Sets the flag if it is a direct download
setExportLanguageIds()  : void
Sets the language ids|id for which language the export should be done.
setExportReportName()  : void
Defines the file name of the report XLS file.
setExportType()  : mixed
Sets the desired type of the exported file
setItemFieldsForType()  : mixed
Sets an array of item fields for recordType which should be in the CSV/XML meta export.
setMetaExport()  : mixed
Sets a flag if meta export should be done.
setMetaExportFileName()  : void
Sets a CSV / XSL filename for a special type.
setMetaExportForType()  : mixed
Sets for specific recordType a flag if for this recordType the MetaExport should be done e.g. CSV/XML file with data
setOnCreateExportReportCallback()  : void
Define a callback function on export create.
setPluginContext()  : void
The context where this ItemExporter is called.
setZipFileName()  : mixed
Set the zip name to the desired name.
setZipSubFolderName()  : mixed
updateData()  : void
Update the stored $this->_aExportData data. The identifier is the uniqueID of the ExporterData object.
zip()  : void
Zip the exported files

Constants

Methods

__construct()

An array of CSItemExporterData objects.

public __construct([array<string|int, CSItemExporterData$aExporterData = array() ]) : mixed
Parameters
$aExporterData : array<string|int, CSItemExporterData> = array()
Tags
Return values
mixed

addData()

Adds the given array of CSItemExporterData to the already existing.

public addData(mixed $aExporterData) : mixed
Parameters
$aExporterData : mixed
Tags
Return values
mixed

createExportReport()

Main method to create a report of the export.

public createExportReport() : bool
Tags
Return values
bool

createExportsForItems()

The main method which do the export of data

public createExportsForItems(null|int $iLanguageId) : bool
Parameters
$iLanguageId : null|int

Optional language id for the export.

Tags
Return values
bool

Returns if the export was successfully or not.

createLanguageExports()

Create export for defined languages.

public createLanguageExports() : bool
Tags
Return values
bool

Returns if the export was successfully or not.

encodeDownloadFileName()

Convert a given file name into a name that can be used as a download file name according to RFC 2183.

public static encodeDownloadFileName(string $sDownloadFileName[, mixed $mMamFile = array() ]) : string

That means that special characters (which are not available in US-ASCII) may be stripped from the name.

Parameters
$sDownloadFileName : string

The file name to be converted.

$mMamFile : mixed = array()

A CSMamFile object or an array of MAM file IDs. The first ID is used to retrieve its volume encoding, which is used for character set conversion.

Tags
Return values
string

The ASCII-encoded download file name.

execute()

Executes the CSItemExporter.

public execute() : bool
Tags
Return values
bool

export()

Run the export.

public export(bool &$bSuccess) : void
Parameters
$bSuccess : bool

If previous steps were successful.

Tags
Return values
void

exportReport()

Export the report (gather data and creates a the export report file).

public exportReport(bool &$bSuccess) : void
Parameters
$bSuccess : bool

If previous steps were successful.

Tags
Return values
void

getCSVData()

Gets data.

public getCSVData(array<string|int, mixed> $aTypeIds[, null $iLanguageId = NULL ][, bool $bWriteFile = FALSE ]) : array<string|int, mixed>
Parameters
$aTypeIds : array<string|int, mixed>

An array with array(RecordType => array(ExporterDataId => oExporterData object))

$iLanguageId : null = NULL
$bWriteFile : bool = FALSE

If set TRUE the exported data will be exported to a file immediately

Tags
Return values
array<string|int, mixed>

An array of csv data. If $iLanguageId given then grouped by languageId.

getDataForLanguage()

Filters the $this->_aExportData array for a given language id.

public getDataForLanguage(mixed $iLanguageId) : array<string|int, CSItemExporterData>
Parameters
$iLanguageId : mixed
Tags
Return values
array<string|int, CSItemExporterData>

getDefaultExportType()

Gets the default export type

public getDefaultExportType() : string
Tags
Return values
string

getDefaultZipFileName()

Returns the default zip file name.

public getDefaultZipFileName() : string
Tags
Return values
string

getDefaultZipSubFolderName()

public getDefaultZipSubFolderName() : mixed
Tags
Return values
mixed

getDownloadURL()

Gets the download URL

public getDownloadURL([string $sBase = 'external' ]) : string
Parameters
$sBase : string = 'external'
Tags
Return values
string

getExportLanguageIds()

Gets the defined language ids.

public getExportLanguageIds() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getExportReportName()

Gets the defined report file name.

public getExportReportName() : string
Tags
Return values
string

getExportType()

Gets the current export type e.g. CSV/XML If none export type was set, the default type will be returned.

public getExportType() : string
Tags
Return values
string

getItemFieldsForType()

Gets the item fields for recordType

public getItemFieldsForType(mixed $sRecordType) : array<string|int, mixed>
Parameters
$sRecordType : mixed
Tags
Return values
array<string|int, mixed>

getMetaExport()

Gets the flag if meta export is set.

public getMetaExport() : bool
Tags
Return values
bool

getMetaExportFileName()

Returns an CSV / XSL filename for a given type OR an array with all CSV / XSL file names.

public getMetaExportFileName([null|string $sType = NULL ]) : array<string|int, mixed>|bool
Parameters
$sType : null|string = NULL

A string with the type to get the defined filename.

Tags
Return values
array<string|int, mixed>|bool

getMetaExportForType()

Gets the value for specific $sRecordType If the meta for this $sRecordType was set.

public getMetaExportForType(mixed $sRecordType) : string
Parameters
$sRecordType : mixed
Tags
Return values
string

getPluginContext()

Returns the plugin context.

public getPluginContext() : string
Tags
Return values
string

getPlugins()

Returns all plugins for CSItemExporter

public getPlugins() : array<string|int, CSItemExporterPlugin>
Tags
Return values
array<string|int, CSItemExporterPlugin>

getSendViaMail()

Check if this exporter should send via mail

public getSendViaMail() : bool
Tags
Return values
bool

getZipFileName()

Gets the zip file name.

public getZipFileName() : string

If the zip file name was not set with (setZipFileName()) the default zip file name will be returned (getDefaultZipFileName()).

Tags
Return values
string

getZipSize()

Gets the size of the zipped file.

public getZipSize() : int|string
Tags
Return values
int|string

getZipSubFolderName()

public getZipSubFolderName() : mixed
Tags
Return values
mixed

isDirectDownload()

Return the flag for direct download

public isDirectDownload() : bool
Tags
Return values
bool

sendMail()

Send mail a zip attachment with exporter data.

public sendMail(bool &$bSuccess) : void
Parameters
$bSuccess : bool

If previous steps were successful.

Tags
Return values
void

sendMailTemplate()

Sends the exported data via mail

public sendMailTemplate() : bool|string
Tags
Return values
bool|string

setData()

Overwrites the setted data with given array of CSItemExporterData objects

public setData(mixed $aExporterData) : mixed
Parameters
$aExporterData : mixed
Tags
Return values
mixed

setDirectDownload()

Sets the flag if it is a direct download

public setDirectDownload([bool $bDirectDownload = FALSE ]) : mixed
Parameters
$bDirectDownload : bool = FALSE
Tags
Return values
mixed

setExportLanguageIds()

Sets the language ids|id for which language the export should be done.

public setExportLanguageIds(array<string|int, mixed>|int $mLangIds) : void
Parameters
$mLangIds : array<string|int, mixed>|int

An array of language ids or an integer language id.

Tags
throws
CSException

If the given language id is not defined in Language Interface of CS.

Return values
void

setExportReportName()

Defines the file name of the report XLS file.

public setExportReportName(mixed $sName) : void
Parameters
$sName : mixed
Tags
Return values
void

setExportType()

Sets the desired type of the exported file

public setExportType([string $sType = 'XML' ]) : mixed
Parameters
$sType : string = 'XML'
Tags
Return values
mixed

setItemFieldsForType()

Sets an array of item fields for recordType which should be in the CSV/XML meta export.

public setItemFieldsForType(string $sRecordType[, array<string|int, mixed> $aItemFields = array() ]) : mixed
Parameters
$sRecordType : string
$aItemFields : array<string|int, mixed> = array()
Tags
Return values
mixed

setMetaExport()

Sets a flag if meta export should be done.

public setMetaExport([bool $bMetaExport = FALSE ]) : mixed

Attention: This function has no influence on setMetaExportForType() E.g. if this flag isset the meta export will be done regardless of a recordType

Parameters
$bMetaExport : bool = FALSE
Tags
Return values
mixed

setMetaExportFileName()

Sets a CSV / XSL filename for a special type.

public setMetaExportFileName(string $sName, string $sType) : void
Parameters
$sName : string

The CSV / XSL filename for the export file.

$sType : string

A type where the CSV / XSL filename should be used.

Tags
Return values
void

setMetaExportForType()

Sets for specific recordType a flag if for this recordType the MetaExport should be done e.g. CSV/XML file with data

public setMetaExportForType(string $sRecordType) : mixed

Converts the given $sRecordType to format which is defined in function _convertRecordType()

Parameters
$sRecordType : string

A recordType e.g. Pdmarticle

Tags
Return values
mixed

setOnCreateExportReportCallback()

Define a callback function on export create.

public setOnCreateExportReportCallback(callable $fn) : void
Parameters
$fn : callable

A valid callback function, which should be called on report generate.

Tags
Return values
void

setPluginContext()

The context where this ItemExporter is called.

public setPluginContext(string $sContext) : void

The value will be forwarded to the isAvailable method in CSItemExporterPlugin

Parameters
$sContext : string

A calling context e.g. CSPimWidget

Tags
Return values
void

setZipFileName()

Set the zip name to the desired name.

public setZipFileName(string $sName) : mixed

If name is not given, the default name (getDefaultZipFileName()) will be set.

Parameters
$sName : string
Tags
Return values
mixed

setZipSubFolderName()

public setZipSubFolderName(mixed $sName) : mixed
Parameters
$sName : mixed
Tags
Return values
mixed

updateData()

Update the stored $this->_aExportData data. The identifier is the uniqueID of the ExporterData object.

public updateData(CSItemExporterData $oExporterData) : void
Parameters
$oExporterData : CSItemExporterData
Tags
Return values
void

zip()

Zip the exported files

public zip(bool &$bSuccess) : void
Parameters
$bSuccess : bool

If previous steps were successful.

Tags
Return values
void

        

Search results