Import
in package
Import Class Class which handles the main import operations
Do not use this. Use ViewGenerator instead.
Tags
Table of Contents
Properties
- $fieldNames : array<string|int, mixed>
- $file : File|null
- $pairs : array<string|int, mixed>
- $parser : Csv|null
Methods
- cancel() : bool
- Cancels the import operation
- getFinalData() : array<string|int, mixed>
- getFinalData
- getUploadedFileFromUploader() : bool|string
- Get uploaded csv file by using uploader id
- initFieldSelectTemplate() : void
- Sets the template for the field selection
- initFileSelectTemplate() : void
- Sets the template for the file selection
- uploadFinished() : array<string|int, mixed>
- Uploader callback function
- getDataFields() : array<string|int, mixed>
- Gets the fieldnames of the importing file
- setFieldPairs() : void
- Sets the field Pairs
- setFile() : void
- Parses the file
Properties
$fieldNames
protected
array<string|int, mixed>
$fieldNames
= array()
$file
protected
File|null
$file
= null
$pairs
protected
array<string|int, mixed>
$pairs
= array()
$parser
protected
Csv|null
$parser
= null
Methods
cancel()
Cancels the import operation
public
cancel() : bool
Return values
boolgetFinalData()
getFinalData
public
getFinalData(array<string|int, mixed> $fields) : array<string|int, mixed>
This function returns the associated fields and values.
Parameters
- $fields : array<string|int, mixed>
-
Name of the fields
Return values
array<string|int, mixed>getUploadedFileFromUploader()
Get uploaded csv file by using uploader id
public
getUploadedFileFromUploader(string $uploaderId) : bool|string
Parameters
- $uploaderId : string
-
Uploader id
Return values
bool|string —File path when file exists, false otherwise
initFieldSelectTemplate()
Sets the template for the field selection
public
initFieldSelectTemplate(object &$tpl, mixed $given_fields) : void
Parses the given file and sets the template and values for the field selection.
Parameters
- $tpl : object
-
The template object (by reference)
- $given_fields : mixed
initFileSelectTemplate()
Sets the template for the file selection
public
initFileSelectTemplate(object &$tpl) : void
Sets the template and all neede variables for the file selection.
Parameters
- $tpl : object
-
The template object (by reference)
uploadFinished()
Uploader callback function
public
static uploadFinished(string $tempPath, string $tempWebPath, array<string|int, mixed> $data, string $uploaderId, array<string|int, mixed> $fileInfos, object $response) : array<string|int, mixed>
Parameters
- $tempPath : string
-
Temp path
- $tempWebPath : string
-
Temp web path
- $data : array<string|int, mixed>
-
Uploader data
- $uploaderId : string
-
Uploader id
- $fileInfos : array<string|int, mixed>
-
Info about the file
- $response : object
-
\Cx\Core_Modules\Uploader\Controller\UploadResponse
Return values
array<string|int, mixed> —temp path and temp web path
getDataFields()
Gets the fieldnames of the importing file
protected
getDataFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —$fields
setFieldPairs()
Sets the field Pairs
protected
setFieldPairs(array<string|int, mixed> $left_fields, array<string|int, mixed> $right_fields) : void
Parameters
- $left_fields : array<string|int, mixed>
- $right_fields : array<string|int, mixed>
setFile()
Parses the file
protected
setFile(string $file) : void
Parameters
- $file : string
-
Path to the csv file