Solutions Open Source

Référence de la classe tx_impexp

Liste de tous les membres

Fonctions membres publiques

 init ($dontCompress=0, $mode='')
 setHeaderBasics ()
 setCharset ($charset)
 setMetaData ($title, $description, $notes, $packager_username, $packager_name, $packager_email)
 addThumbnail ($imgFilepath)
 setPageTree ($idH)
 unsetExcludedSections ($idH)
 flatInversePageTree ($idH, $a=array())
 flatInversePageTree_pid ($idH, $a=array(), $pid=-1)
 export_addRecord ($table, $row, $relationLevel=0)
 export_addDBRelations ($relationLevel=0)
 export_addDBRelations_registerRelation ($fI, &$addR, $tokenID='')
 export_addFilesFromRelations ()
 export_addFile ($fI, $recordRef='', $fieldname='')
 flatDBrels ($dbrels)
 flatSoftRefs ($dbrels)
 compileMemoryToFileContent ($type='')
 createXML ()
 doOutputCompress ()
 addFilePart ($data, $compress=FALSE)
 importData ($pid)
 writeRecords_pages ($pid)
 writeRecords_pages_order ($pid)
 writeRecords_records ($pid)
 writeRecords_records_order ($mainPid)
 addSingle ($table, $uid, $pid)
 addToMapId ($substNEWwithIDs)
 getNewTCE ()
 unlinkTempFiles ()
 setRelations ()
 setRelations_db ($itemArray)
 import_addFileNameToBeCopied ($fI)
 setFlexFormRelations ()
 remapListedDBRecords_flexFormCallBack ($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2, $path)
 processSoftReferences ()
 processSoftReferences_flexFormCallBack ($pParams, $dsConf, $dataValue, $dataValue_ext1, $dataValue_ext2, $path)
 processSoftReferences_substTokens ($tokenizedContent, $softRefCfgs, $table, $uid)
 processSoftReferences_saveFile ($relFileName, $cfg, $table, $uid)
 processSoftReferences_saveFile_createRelFile ($origDirPrefix, $fileName, $fileID, $table, $uid)
 writeFileVerify ($fileName, $fileID, $bypassMountCheck=FALSE)
 checkOrCreateDir ($dirPrefix)
 verifyFolderAccess ($dirPrefix, $noAlternative=FALSE)
 loadFile ($filename, $all=0)
 getNextFilePart ($fd, $unserialize=0, $name='')
 loadContent ($filecontent)
 getNextContentPart ($filecontent, &$pointer, $unserialize=0, $name='')
 loadInit ()
 fixCharsets ()
 displayContentOverview ()
 traversePageTree ($pT, &$lines, $preCode='')
 traversePageRecords ($pT, &$lines)
 traverseAllRecords ($pT, &$lines)
 singleRecordLines ($table, $uid, &$lines, $preCode, $checkImportInPidRecord=0)
 addRelations ($rels, &$lines, $preCode, $recurCheck=array(), $htmlColorClass='')
 addFiles ($rels, &$lines, $preCode, $htmlColorClass='', $tokenID='')
 checkDokType ($checkTable, $doktype)
 renderControls ($r)
 softrefSelector ($cfg)
 isTableStatic ($table)
 inclRelation ($table)
 isExcluded ($table, $uid)
 includeSoftref ($tokenID)
 checkPID ($pid)
 dontIgnorePid ($table, $uid)
 doesRecordExist ($table, $uid, $fields='')
 getRecordPath ($pid)
 renderSelectBox ($prefix, $value, $optValues)
 compareRecords ($databaseRecord, $importRecord, $table, $inverseDiff=FALSE)
 getRTEoriginalFilename ($string)
getFileProcObj ()
 error ($msg)
 printErrorLog ()

Attributs publics

 $showStaticRelations = FALSE
 $fileadminFolderName = 'fileadmin'
 $mode = ''
 $update = FALSE
 $doesImport = FALSE
 $display_import_pid_record = ''
 $suggestedInsertUids = array()
 $import_mode = array()
 $global_ignore_pid = FALSE
 $force_all_UIDS = FALSE
 $showDiff = FALSE
 $allowPHPScripts = FALSE
 $enableLogging = FALSE
 $softrefInputValues = array()
 $fileIDMap = array()
 $maxFileSize = 1000000
 $maxRecordSize = 1000000
 $maxExportSize = 10000000
 $relOnlyTables = array()
 $relStaticTables = array()
 $excludeMap = array()
 $softrefCfg = array()
 $extensionDependencies = array()
 $dontCompress = 0
 $includeExtFileResources = 0
 $extFileResourceExtensions = 'html,htm,css'
 $import_mapId = array()
 $import_newId = array()
 $import_newId_pids = array()
 $import_data = array()
 $errorLog = array()
 $cache_getRecordPath = array()
 $checkPID_cache = array()
 $compress = 0
 $dat = array()
 $fileProcObj = ''


Documentation des fonctions membres

tx_impexp::init ( dontCompress = 0,
mode = '' 
)

Init the object, both import and export

Paramètres:
boolean If set, compression in t3d files is disabled
string Mode of usage, either "import" or "export"
Renvoie:
void

tx_impexp::setHeaderBasics (  ) 

Set header basics

Renvoie:
void

tx_impexp::setCharset ( charset  ) 

Set charset

Paramètres:
string Charset for the content in the export. During import the character set will be converted if the target system uses another charset.
Renvoie:
void

tx_impexp::setMetaData ( title,
description,
notes,
packager_username,
packager_name,
packager_email 
)

Sets meta data

Paramètres:
string Title of the export
string Description of the export
string Notes about the contents
string Backend Username of the packager (the guy making the export)
string Real name of the packager
string Email of the packager
Renvoie:
void

tx_impexp::addThumbnail ( imgFilepath  ) 

Sets a thumbnail image to the exported file

Paramètres:
string Filename reference, gif, jpg, png. Absolute path.
Renvoie:
void

tx_impexp::setPageTree ( idH  ) 

Sets the page-tree array in the export header and returns the array in a flattened version

Paramètres:
array Hierarchy of ids, the page tree: array([uid] => array("uid" => [uid], "subrow" => array(.....)), [uid] => ....)
Renvoie:
array The hierarchical page tree converted to a one-dimensional list of pages

tx_impexp::unsetExcludedSections ( idH  ) 

Removes entries in the page tree which are found in ->excludeMap[]

Paramètres:
array Page uid hierarchy
Renvoie:
array Modified input array private
Voir également:
setPageTree()

tx_impexp::flatInversePageTree ( idH,
a = array() 
)

Recursively flattening the idH array (for setPageTree() function)

Paramètres:
array Page uid hierarchy
array Accumulation array of pages (internal, don't set from outside)
Renvoie:
array Array with uid-uid pairs for all pages in the page tree.
Voir également:
flatInversePageTree_pid()

tx_impexp::flatInversePageTree_pid ( idH,
a = array(),
pid = -1 
)

Recursively flattening the idH array (for setPageTree() function), setting PIDs as values

Paramètres:
array Page uid hierarchy
array Accumulation array of pages (internal, don't set from outside)
integer PID value (internal)
Renvoie:
array Array with uid-pid pairs for all pages in the page tree.
Voir également:
flatInversePageTree()

tx_impexp::export_addRecord ( table,
row,
relationLevel = 0 
)

Adds the record $row from $table. No checking for relations done here. Pure data.

Paramètres:
string Table name
array Record row.
integer (Internal) if the record is added as a relation, this is set to the "level" it was on.
Renvoie:
void

tx_impexp::export_addDBRelations ( relationLevel = 0  ) 

This analyses the existing added records, finds all database relations to records and adds these records to the export file. This function can be called repeatedly until it returns an empty array. In principle it should not allow to infinite recursivity, but you better set a limit... Call this BEFORE the ext_addFilesFromRelations (so files from added relations are also included of course)

Paramètres:
integer Recursion level
Renvoie:
array overview of relations found and added: Keys [table]:[uid], values array with table and id
Voir également:
export_addFilesFromRelations()

tx_impexp::export_addDBRelations_registerRelation ( fI,
&$  addR,
tokenID = '' 
)

Helper function for export_addDBRelations()

Paramètres:
array Array with table/id keys to add
array Add array, passed by reference to be modified
string Softref Token ID, if applicable.
Renvoie:
void
Voir également:
export_addDBRelations()

tx_impexp::export_addFilesFromRelations (  ) 

This adds all files in relations. Call this method AFTER adding all records including relations.

Renvoie:
void
Voir également:
export_addDBRelations()

tx_impexp::export_addFile ( fI,
recordRef = '',
fieldname = '' 
)

Adds a files content to the export memory

Paramètres:
array File information with three keys: "filename" = filename without path, "ID_absFile" = absolute filepath to the file (including the filename), "ID" = md5 hash of "ID_absFile". "relFileName" is optional for files attached to records, but mandatory for soft referenced files (since the relFileName determines where such a file should be stored!)
string If the file is related to a record, this is the id on the form [table]:[id]. Information purposes only.
string If the file is related to a record, this is the field name it was related to. Information purposes only.
Renvoie:
void

tx_impexp::flatDBrels ( dbrels  ) 

DB relations flattend to 1-dim array. The list will be unique, no table/uid combination will appear twice.

Paramètres:
array 2-dim Array of database relations organized by table key
Renvoie:
array 1-dim array where entries are table:uid and keys are array with table/id

tx_impexp::flatSoftRefs ( dbrels  ) 

Soft References flattend to 1-dim array.

Paramètres:
array 2-dim Array of database relations organized by table key
Renvoie:
array 1-dim array where entries are arrays with properties of the soft link found and keys are a unique combination of field, spKey, structure path if applicable and token ID

tx_impexp::compileMemoryToFileContent ( type = ''  ) 

This compiles and returns the data content for an exported file

Paramètres:
string Type of output; "xml" gives xml, otherwise serialized array, possibly compressed.
Renvoie:
string The output file stream

tx_impexp::createXML (  ) 

Creates XML string from input array

Renvoie:
string XML content

tx_impexp::doOutputCompress (  ) 

Returns true if the output should be compressed.

Renvoie:
boolean True if compression is possible AND requested.

tx_impexp::addFilePart ( data,
compress = FALSE 
)

Returns a content part for a filename being build.

Paramètres:
array Data to store in part
boolean Compress file?
Renvoie:
string Content stream.

tx_impexp::importData ( pid  ) 

Imports the internal data array to $pid.

Paramètres:
integer Page ID in which to import the content
Renvoie:
void ...

tx_impexp::writeRecords_pages ( pid  ) 

Writing pagetree/pages to database:

Paramètres:
integer PID in which to import. If the operation is an update operation, the root of the page tree inside will be moved to this PID unless it is the same as the root page from the import
Renvoie:
void
Voir également:
writeRecords_records()

tx_impexp::writeRecords_pages_order ( pid  ) 

Organize all updated pages in page tree so they are related like in the import file Only used for updates and when $this->dat['header']['pagetree'] is an array.

Paramètres:
integer Page id in which to import
Renvoie:
void private
Voir également:
writeRecords_pages(), writeRecords_records_order()

tx_impexp::writeRecords_records ( pid  ) 

Write all database records except pages (writtein in writeRecords_pages())

Paramètres:
integer Page id in which to import
Renvoie:
void
Voir également:
writeRecords_pages()

tx_impexp::writeRecords_records_order ( mainPid  ) 

Organize all updated record to their new positions. Only used for updates

Paramètres:
integer Main PID into which we import.
Renvoie:
void private
Voir également:
writeRecords_records(), writeRecords_pages_order()

tx_impexp::addSingle ( table,
uid,
pid 
)

Adds a single record to the $importData array. Also copies files to tempfolder. However all File/DB-references and flexform field contents are set to blank for now! That is done with setRelations() later

Paramètres:
string Table name (from import memory)
integer Record UID (from import memory)
integer Page id
Renvoie:
void
Voir également:
writeRecords()

tx_impexp::addToMapId ( substNEWwithIDs  ) 

Registers the substNEWids in memory.

Paramètres:
array $substNEWwithIDs from tcemain to be merged into internal mapping variable in this object
Renvoie:
void
Voir également:
writeRecords()

tx_impexp::getNewTCE (  ) 

Returns a new $TCE object

Renvoie:
object $TCE object

tx_impexp::unlinkTempFiles (  ) 

Cleaning up all the temporary files stored in typo3temp/ folder

Renvoie:
void

tx_impexp::setRelations (  ) 

At the end of the import process all file and DB relations should be set properly (that is relations to imported records are all re-created so imported records are correctly related again) Relations in flexform fields are processed in setFlexFormRelations() after this function

Renvoie:
void
Voir également:
setFlexFormRelations()

tx_impexp::setRelations_db ( itemArray  ) 

Maps relations for database

Paramètres:
array Array of item sets (table/uid) from a dbAnalysis object
Renvoie:
array Array with values [table]_[uid]. These values have the regular tcemain-input group/select type which means they will automatically be processed into a uid-list or MM relations.

tx_impexp::import_addFileNameToBeCopied ( fI  ) 

Writes the file from import array to temp dir and returns the filename of it.

Paramètres:
array File information with three keys: "filename" = filename without path, "ID_absFile" = absolute filepath to the file (including the filename), "ID" = md5 hash of "ID_absFile"
Renvoie:
string Absolute filename of the temporary filename of the file. In ->alternativeFileName the original name is set.

tx_impexp::setFlexFormRelations (  ) 

After all DB relations has been set in the end of the import (see setRelations()) then it is time to correct all relations inside of FlexForm fields. The reason for doing this after is that the setting of relations may affect (quite often!) which data structure is used for the flexforms field!

Renvoie:
void
Voir également:
setRelations()

tx_impexp::remapListedDBRecords_flexFormCallBack ( pParams,
dsConf,
dataValue,
dataValue_ext1,
dataValue_ext2,
path 
)

Callback function for traversing the FlexForm structure in relation to remapping database relations

Paramètres:
array Set of parameters in numeric array: table, uid, field
array TCA config for field (from Data Structure of course)
string Field value (from FlexForm XML)
string Not used
string Not used
string Path of where the data structure of the element is found
Renvoie:
array Array where the "value" key carries the value.
Voir également:
setFlexFormRelations()

tx_impexp::processSoftReferences (  ) 

Processing of soft references

Renvoie:
void

tx_impexp::processSoftReferences_flexFormCallBack ( pParams,
dsConf,
dataValue,
dataValue_ext1,
dataValue_ext2,
path 
)

Callback function for traversing the FlexForm structure in relation to remapping softreference relations

Paramètres:
array Set of parameters in numeric array: table, uid, field
array TCA config for field (from Data Structure of course)
string Field value (from FlexForm XML)
string Not used
string Not used
string Path of where the data structure where the element is found
Renvoie:
array Array where the "value" key carries the value.
Voir également:
setFlexFormRelations()

tx_impexp::processSoftReferences_substTokens ( tokenizedContent,
softRefCfgs,
table,
uid 
)

Substition of softreference tokens

Paramètres:
string Content of field with soft reference tokens in.
array Soft reference configurations
string Table for which the processing occurs
string UID of record from table
Renvoie:
string The input content with tokens substituted according to entries in softRefCfgs

tx_impexp::processSoftReferences_saveFile ( relFileName,
cfg,
table,
uid 
)

Process a soft reference file

Paramètres:
string Old Relative filename
array soft reference configuration array
string Table for which the processing occurs
string UID of record from table
Renvoie:
string New relative filename (value to insert instead of the softref token)

tx_impexp::processSoftReferences_saveFile_createRelFile ( origDirPrefix,
fileName,
fileID,
table,
uid 
)

Create file in directory and return the new (unique) filename

Paramètres:
string Directory prefix, relative, with trailing slash
string Filename (without path)
string File ID from import memory
string Table for which the processing occurs
string UID of record from table
Renvoie:
string New relative filename, if any

tx_impexp::writeFileVerify ( fileName,
fileID,
bypassMountCheck = FALSE 
)

Writes a file from the import memory having $fileID to file name $fileName which must be an absolute path inside PATH_site

Paramètres:
string Absolute filename inside PATH_site to write to
string File ID from import memory
boolean Bypasses the checking against filemounts - only for RTE files!
Renvoie:
boolean Returns true if it went well. Notice that the content of the file is read again, and md5 from import memory is validated.

tx_impexp::checkOrCreateDir ( dirPrefix  ) 

Returns true if directory exists and if it doesn't it will create directory and return true if that succeeded.

Paramètres:
string Directory to create. Having a trailing slash. Must be in fileadmin/. Relative to PATH_site
Renvoie:
boolean True, if directory exists (was created)

tx_impexp::verifyFolderAccess ( dirPrefix,
noAlternative = FALSE 
)

Verifies that the input path (relative to PATH_site) is found in the backend users filemounts. If it doesn't it will try to find another relative filemount for the user and return an alternative path prefix for the file.

Paramètres:
string Path relative to PATH_site
boolean If set, Do not look for alternative path! Just return false
Renvoie:
string If a path is available that will be returned, otherwise false.

tx_impexp::loadFile ( filename,
all = 0 
)

Loads the header section/all of the $filename into memory

Paramètres:
string Filename, absolute
boolean If set, all information is loaded (header, records and files). Otherwise the default is to read only the header information
Renvoie:
boolean True if the operation went well

tx_impexp::getNextFilePart ( fd,
unserialize = 0,
name = '' 
)

Returns the next content part form the fileresource (t3d), $fd

Paramètres:
pointer File pointer
boolean If set, the returned content is unserialized into an array, otherwise you get the raw string
string For error messages this indicates the section of the problem.
Renvoie:
string Data string private
Voir également:
loadFile()

tx_impexp::loadContent ( filecontent  ) 

Loads T3D file content into the $this->dat array (This function can be used to test the output strings from ->compileMemoryToFileContent())

Paramètres:
string File content
Renvoie:
void

tx_impexp::getNextContentPart ( filecontent,
&$  pointer,
unserialize = 0,
name = '' 
)

Returns the next content part from the $filecontent

Paramètres:
string File content string
integer File pointer (where to read from)
boolean If set, the returned content is unserialized into an array, otherwise you get the raw string
string For error messages this indicates the section of the problem.
Renvoie:
string Data string

tx_impexp::loadInit (  ) 

Setting up the object based on the recently loaded ->dat array

Renvoie:
void

tx_impexp::fixCharsets (  ) 

Fix charset of import memory if different from system charset

Renvoie:
void
Voir également:
loadInit()

tx_impexp::displayContentOverview (  ) 

Displays an overview of the header-content.

Renvoie:
string HTML content

tx_impexp::traversePageTree ( pT,
&$  lines,
preCode = '' 
)

Go through page tree for display

Paramètres:
array Page tree array with uid/subrow (from ->dat[header][pagetree]
array Output lines array (is passed by reference and modified)
string Pre-HTML code
Renvoie:
void

tx_impexp::traversePageRecords ( pT,
&$  lines 
)

Go through remaining pages (not in tree)

Paramètres:
array Page tree array with uid/subrow (from ->dat[header][pagetree]
array Output lines array (is passed by reference and modified)
Renvoie:
void

tx_impexp::traverseAllRecords ( pT,
&$  lines 
)

Go through ALL records (if the pages are displayed first, those will not be amoung these!)

Paramètres:
array Page tree array with uid/subrow (from ->dat[header][pagetree]
array Output lines array (is passed by reference and modified)
Renvoie:
void

tx_impexp::singleRecordLines ( table,
uid,
&$  lines,
preCode,
checkImportInPidRecord = 0 
)

Add entries for a single record

Paramètres:
string Table name
integer Record uid
array Output lines array (is passed by reference and modified)
string Pre-HTML code
boolean If you want import validation, you can set this so it checks if the import can take place on the specified page.
Renvoie:
void

tx_impexp::addRelations ( rels,
&$  lines,
preCode,
recurCheck = array(),
htmlColorClass = '' 
)

Add DB relations entries for a record's rels-array

Paramètres:
array Array of relations
array Output lines array (is passed by reference and modified)
string Pre-HTML code
array Recursivity check stack
string Alternative HTML color class to use.
Renvoie:
void private
Voir également:
singleRecordLines()

tx_impexp::addFiles ( rels,
&$  lines,
preCode,
htmlColorClass = '',
tokenID = '' 
)

Add file relation entries for a record's rels-array

Paramètres:
array Array of file IDs
array Output lines array (is passed by reference and modified)
string Pre-HTML code
string Alternative HTML color class to use.
string Token ID if this is a softreference (in which case it only makes sense with a single element in the $rels array!)
Renvoie:
void private
Voir également:
singleRecordLines()

tx_impexp::checkDokType ( checkTable,
doktype 
)

Verifies that a table is allowed on a certain doktype of a page

Paramètres:
string Table name to check
integer doktype value.
Renvoie:
boolean True if OK

tx_impexp::renderControls ( r  ) 

Render input controls for import or export

Paramètres:
array Configuration for element
boolean Set if export situation
Renvoie:
string HTML

tx_impexp::softrefSelector ( cfg  ) 

Selectorbox with export options for soft references

Paramètres:
array softref configuration array. An export box is shown only if a substitution scheme is found for the soft reference.
Renvoie:
string Selector box HTML

tx_impexp::isTableStatic ( table  ) 

Returns true if the input table name is to be regarded as a static relation (that is, not exported etc).

Paramètres:
string Table name
Renvoie:
boolean True, if table is marked static

tx_impexp::inclRelation ( table  ) 

Returns true if the input table name is to be included as relation

Paramètres:
string Table name
Renvoie:
boolean True, if table is marked static

tx_impexp::isExcluded ( table,
uid 
)

Returns true if the element should be excluded as static record.

Paramètres:
string Table name
integer UID value
Renvoie:
boolean True, if table is marked static

tx_impexp::includeSoftref ( tokenID  ) 

Returns true if soft reference should be included in exported file.

Paramètres:
string Token ID for soft reference
Renvoie:
boolean True if softreference media should be included

tx_impexp::checkPID ( pid  ) 

Checking if a PID is in the webmounts of the user

Paramètres:
integer Page ID to check
Renvoie:
boolean True if OK

tx_impexp::dontIgnorePid ( table,
uid 
)

Checks if the position of an updated record is configured to be corrected. This can be disabled globally and changed for elements individually.

Paramètres:
string Table name
integer Uid or record
Renvoie:
boolean True if the position of the record should be updated to match the one in the import structure

tx_impexp::doesRecordExist ( table,
uid,
fields = '' 
)

Checks if the record exists

Paramètres:
string Table name
integer UID of record
string Field list to select. Default is "uid,pid"
Renvoie:
array Result of t3lib_BEfunc::getRecord() which means the record if found, otherwise false

tx_impexp::getRecordPath ( pid  ) 

Returns the page title path of a PID value. Results are cached internally

Paramètres:
integer Record PID to check
Renvoie:
string The path for the input PID

tx_impexp::renderSelectBox ( prefix,
value,
optValues 
)

Makes a selector-box from optValues

Paramètres:
string Form element name
string Current value
array Options to display (key/value pairs)
Renvoie:
string HTML select element

tx_impexp::compareRecords ( databaseRecord,
importRecord,
table,
inverseDiff = FALSE 
)

Compares two records, the current database record and the one from the import memory. Will return HTML code to show any differences between them!

Paramètres:
array Database record, all fields (new values)
array Import memorys record for the same table/uid, all fields (old values)
string The table name of the record
boolean Inverse the diff view (switch red/green, needed for pre-update difference view)
Renvoie:
string HTML

tx_impexp::getRTEoriginalFilename ( string  ) 

Creates the original file name for a copy-RTE image (magic type)

Paramètres:
string RTE copy filename, eg. "RTEmagicC_user_pm_icon_01.gif.gif"
Renvoie:
string RTE original filename, eg. "RTEmagicP_user_pm_icon_01.gif". IF the input filename was NOT prefixed RTEmagicC_ as RTE images would be, nothing is returned!

& tx_impexp::getFileProcObj (  ) 

Returns file processing object, initialized only once.

Renvoie:
object File processor object

tx_impexp::error ( msg  ) 

Sets error message in the internal error log

Paramètres:
string Error message
Renvoie:
void

tx_impexp::printErrorLog (  ) 

Returns a table with the error-messages.

Renvoie:
string HTML print of error log


Documentation des données membres

tx_impexp::$showStaticRe