modules/Import/sources/ImportFile.php

Show: inherited
Table of Contents

\ImportFile

Package:
Parent(s)
\ImportDataSource < ?\Iterator

Properties

Propertyprivate  $_createdCount= '0'
inherited

Count of newly created rows

Inherited from: \ImportDataSource::$$_createdCount
Default value0Details
Type
n/a
Inherited_from
\ImportDataSource::$$_createdCount  
Propertyprotected  $_currentRow= 'FALSE'
inherited

Array of the values in the current array we are in

Inherited from: \ImportDataSource::$$_currentRow
Default valueFALSEDetails
Type
n/a
Inherited_from
\ImportDataSource::$$_currentRow  
Propertyprotected  $_dataSet= 'array()'
inherited

Stores a subset or entire portion of the data set requested.

Inherited from: \ImportDataSource::$$_dataSet
Default valuearray()Details
Type
n/a
Inherited_from
\ImportDataSource::$$_dataSet  
Propertyprivate  $_date_format= 'false'

CSV date format

Default valuefalseDetails
Type
n/a
Propertyprivate  $_deleteFile= ''

Stores whether or not we are deleting the import file in the destructor

Details
Type
n/a
Propertyprivate  $_delimiter= ''

Delimiter string we are using (i.e. , or ;)

Details
Type
n/a
Propertyprivate  $_detector= 'null'

True if the csv file has a header row.

Default valuenullDetails
Type
n/a
Propertyprivate  $_dupeCount= '0'
inherited

Count of duplicate rows

Inherited from: \ImportDataSource::$$_dupeCount
Default value0Details
Type
n/a
Inherited_from
\ImportDataSource::$$_dupeCount  
Propertyprivate  $_enclosure= ''

Enclosure string we are using (i.e. ' or ")

Details
Type
n/a
Propertyprivate  $_errorCount= '0'
inherited

Count of rows with errors

Inherited from: \ImportDataSource::$$_errorCount
Default value0Details
Type
n/a
Inherited_from
\ImportDataSource::$$_errorCount  
Propertyprivate  $_fp= 'FALSE'

File pointer returned from fopen() call

Default valueFALSEDetails
Type
n/a
Propertyprivate  $_hasHeader= 'FALSE'

True if the csv file has a header row.

Default valueFALSEDetails
Type
n/a
Propertyprivate  $_importFile= 'null'

The import file map that this import file inherits properties from.

Default valuenullDetails
Type
n/a
Propertyprotected  $_localeSettings= 'array()'
inherited

Holds any locale settings needed for import. These can be provided by the user or explicitly set by the user.

Inherited from: \ImportDataSource::$$_localeSettings
Default valuearray()Details
Type
n/a
Inherited_from
\ImportDataSource::$$_localeSettings  
Propertyprotected  $_offset= '0'
inherited

The current offset the data set should start at

Inherited from: \ImportDataSource::$$_offset
Default value0Details
Type
n/a
Inherited_from
\ImportDataSource::$$_offset  
Propertyprotected  $_rowCountedForErrors= 'false'
inherited

True if the current row has already had an error it in, so we don't increase the $_errorCount

Inherited from: \ImportDataSource::$$_rowCountedForErrors
Default valuefalseDetails
Type
n/a
Inherited_from
\ImportDataSource::$$_rowCountedForErrors  
Propertyprotected  $_rowsCount= '0'
inherited

Count of rows processed

Inherited from: \ImportDataSource::$$_rowsCount
Default value0Details
Type
n/a
Inherited_from
\ImportDataSource::$$_rowsCount  
Propertyprotected  $_sourcename= ''
inherited

Sourcename used as an identifier for this import

Inherited from: \ImportDataSource::$$_sourcename
Details
Type
n/a
Inherited_from
\ImportDataSource::$$_sourcename  
Propertyprivate  $_time_format= 'false'

CSV time format

Default valuefalseDetails
Type
n/a
Propertyprivate  $_updatedCount= '0'
inherited

Count of updated rows

Inherited from: \ImportDataSource::$$_updatedCount
Default value0Details
Type
n/a
Inherited_from
\ImportDataSource::$$_updatedCount  

Methods

methodpublic__construct( string $filename, string $delimiter = ',', string $enclosure = '', bool $deleteFile = true,  $checkUploadPath = TRUE ) : void

Constructor

Parameters
Name Type Description
$filename string
$delimiter string
$enclosure string
$deleteFile bool
$checkUploadPath
methodpublic__destruct( ) : void

Destructor

Deletes $_importFile if $_deleteFile is true

methodpublic__get(  $var ) : void
inherited

Inherited from: \ImportDataSource::__get()
Parameters
Name Type Description
$var
methodpublic__wakeup( ) : void

This is needed to prevent unserialize vulnerability

methodpublicautoDetectCSVProperties( ) : void

methodpublicautoDetectCharacterSet( ) : void

methodpubliccurrent( ) : void

methodpublicfileExists( ) : bool

Returns true if the filename given exists and is readable

Returns
Type Description
bool
methodprotectedformatErrorMessage(  $error,  $fieldName,  $fieldValue ) : void
inherited

Inherited from: \ImportDataSource::formatErrorMessage()
Parameters
Name Type Description
$error
$fieldName
$fieldValue
methodpublicgetCurrentOffset( ) : int
inherited

Return the current offset

Inherited from: \ImportDataSource::getCurrentOffset()
Returns
Type Description
int
methodpublicgetDataSet( ) : array
inherited

Return the current data set loaded.

Inherited from: \ImportDataSource::getDataSet()
Returns
Type Description
array
methodpublicgetDateFormat( ) : void

methodpublicgetFieldCount( ) : int

Returns the number of fields in the current row

Returns
Type Description
int count of fiels in the current row
methodpublicgetFieldDelimeter( ) : void

methodpublicgetFieldEnclosure( ) : void

methodpublicgetHeaderColumns( ) : void

methodpublicgetNextRow( ) : array

Gets the next row from $_importFile

Returns
Type Description
array current row of file
methodpublicgetNumberOfLinesInfile( ) : int

Determine the number of lines in this file.

Returns
Type Description
int
methodpublicgetTimeFormat( ) : void

methodpublicgetTotalRecordCount( ) : int

Return the total count of records that will be imported.

Returns
Type Description
int
methodpublichasHeaderRow(  $autoDetect = TRUE ) : void

Parameters
Name Type Description
$autoDetect
methodpublickey( ) : void

methodpublicloadDataSet(  $totalItems = 0 ) : void

Return a result set from the external source as an associative array with the key value equal to the external field name and the rvalue equal to the actual value.

Parameters
Name Type Description
$totalItems
methodpublicmarkRowAsDuplicate(  $field_names = array() ) : void
inherited

Writes the row out to the ImportCacheFiles::getDuplicateFileName() file

Inherited from: \ImportDataSource::markRowAsDuplicate()
Parameters
Name Type Description
$field_names
methodpublicmarkRowAsImported( \$createdRecord $createdRecord = true ) : void
inherited

Marks whether this row created a new record or not

Inherited from: \ImportDataSource::markRowAsImported()
Parameters
Name Type Description
$createdRecord \$createdRecord

bool true if record is created, false if it is just updated

methodpublicnext( ) : void

methodpublicresetRowErrorCounter( ) : void
inherited

Inherited from: \ImportDataSource::resetRowErrorCounter()
methodpublicrewind( ) : void

methodpublicsetCurrentOffset(  $offset ) : void
inherited

Set the current offset.

Inherited from: \ImportDataSource::setCurrentOffset()
Parameters
Name Type Description
$offset
methodprivatesetFpAfterBOM( ) : void

Remove the BOM (Byte Order Mark) from the beginning of the import row if it exists

methodpublicsetHeaderRow(  $hasHeader ) : void

Parameters
Name Type Description
$hasHeader
methodpublicsetImportFileMap(  $map ) : void

Parameters
Name Type Description
$map
methodpublicsetSourceName(  $sourceName = '' ) : void
inherited

Set the source name.

Inherited from: \ImportDataSource::setSourceName()
Parameters
Name Type Description
$sourceName
methodpublicvalid( ) : void

methodpublicwriteError( \$error $error, \$fieldName $fieldName, \$fieldValue $fieldValue ) : void
inherited

Writes the row out to the ImportCacheFiles::getErrorFileName() file

Inherited from: \ImportDataSource::writeError()
Parameters
Name Type Description
$error \$error

string

$fieldName \$fieldName

string

$fieldValue \$fieldValue

mixed

methodpublicwriteErrorRecord(  $errorMessage = '' ) : void
inherited

Writes the row out to the ImportCacheFiles::getErrorRecordsFileName() file

Inherited from: \ImportDataSource::writeErrorRecord()
Parameters
Name Type Description
$errorMessage
methodpublicwriteRowToLastImport( string $import_module, string $module, string $id ) : void
staticinherited

Add this row to the UsersLastImport table

Inherited from: \ImportDataSource::writeRowToLastImport()
Parameters
Name Type Description
$import_module string

name of the module we are doing the import into

$module string

name of the bean we are creating for this import

$id string

id of the recorded created in the $module

methodpublicwriteStatus( ) : void
inherited

Writes the totals and filename out to the ImportCacheFiles::getStatusFileName() file

Inherited from: \ImportDataSource::writeStatus()
Documentation was generated by DocBlox 0.18.1.