Vtiger_ExportToCsv_Model
extends Records
in package
Export to csv - class.
Table of Contents
- EXPORT_FORMAT = 0
- USER_FORMAT = 1
- $fullData : bool
- $fields : array<string|int, mixed>
- $fileExtension : string
- $format : bool
- $headers : array<string|int, mixed>
- $limit : int
- $moduleFieldInstances : array<string|int, Vtiger_Field_Model>
- $moduleInstance : Vtiger_Module_Model
- $moduleName : string
- $value : array<string|int, mixed>
- __construct() : mixed
- Constructor.
- exportData() : void
- Function exports the data based on the mode.
- get() : mixed
- Function to get the value for a given key.
- getAllModuleFieldsAsHeaders() : array<string|int, mixed>
- Function returns all module fields as headers.
- getArray() : array<string|int, mixed>
- Function to get the array values for a given key.
- getData() : array<string|int, mixed>
- Function to get all the values of the Object.
- getDataInExportFormat() : array<string|int, mixed>
- Function returns record data in export format.
- getDataInUserFormat() : array<string|int, mixed>
- Get data from record in display format.
- getDisplayValue() : string
- Get display value.
- getEntries() : array<string|int, mixed>
- Get entires.
- getExportContentType() : string
- Function returns the export type - This can be extended to support different file exports.
- getExportQuery() : Query
- Function that generates Export Query object.
- getFieldsForQuery() : array<string|int, mixed>
- Get fields for query.
- getFileName() : string
- getForHtml() : mixed
- Function to get the html encoded value for a given key.
- getForSql() : mixed
- Function to get the value if its safe to use for SQL Query (column).
- getHeaders() : array<string|int, mixed>
- Get file headers.
- getInstance() : self
- Get instance.
- getKeys() : array<string|int, string>
- Function to get keys.
- getQueryGenerator() : QueryGenerator
- Get query generator object.
- getSupportedFileFormats() : array<string|int, mixed>
- Get supported file formats.
- has() : bool
- Function to check if the key exists.
- isEmpty() : bool
- Function to check if the key is empty.
- loadFieldsFromCvId() : void
- Load fields from custom view.
- output() : mixed
- Function that create the exported file.
- remove() : mixed
- Function to remove the value.
- sanitizeInventoryValues() : array<string|int, mixed>
- Sanitize inventory values.
- sanitizeValues() : array<string|int, mixed>
- This function takes in an array of values for an user and sanitizes it for export Requires modification after adding a new field type.
- sendHttpHeader() : void
- Send HTTP Header.
- set() : $this
- Function to set the value for a given key.
- setData() : $this
- Function to set all the values.
- setField() : Vtiger_Field_Model|false
- Set field model.
- setFields() : $this
- Set.
- setFormat() : $this
- Set the format of the exported data.
- setLimit() : $this
- Set a limit for exported data.
Constants
EXPORT_FORMAT
public
int
EXPORT_FORMAT
= 0
Data export in a format that can be imported later
USER_FORMAT
public
int
USER_FORMAT
= 1
Data export in user format
Properties
$fullData
public
bool
$fullData
= false
Export all data
$fields
protected
array<string|int, mixed>
$fields
= []
Fields for export
$fileExtension
protected
string
$fileExtension
= 'csv'
File extension.
$format
protected
bool
$format
= self::EXPORT_FORMAT
Export all data
$headers
protected
array<string|int, mixed>
$headers
= []
Headers field
$limit
protected
int
$limit
Limit of exported entries
$moduleFieldInstances
protected
array<string|int, Vtiger_Field_Model>
$moduleFieldInstances
Field model instance.
$moduleInstance
protected
Vtiger_Module_Model
$moduleInstance
Module model.
$moduleName
protected
string
$moduleName
Module name
$value
protected
array<string|int, mixed>
$value
Values
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $values : array<string|int, mixed> = []
Return values
mixed —exportData()
Function exports the data based on the mode.
public
exportData() : void
Return values
void —get()
Function to get the value for a given key.
public
get(string $key) : mixed
Parameters
- $key : string
Return values
mixed —Value for the given key
getAllModuleFieldsAsHeaders()
Function returns all module fields as headers.
public
getAllModuleFieldsAsHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —getArray()
Function to get the array values for a given key.
public
getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
- $key : string
- $value : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getData()
Function to get all the values of the Object.
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDataInExportFormat()
Function returns record data in export format.
public
getDataInExportFormat(array<string|int, mixed> $recordValues) : array<string|int, mixed>
Parameters
- $recordValues : array<string|int, mixed>
Return values
array<string|int, mixed> —getDataInUserFormat()
Get data from record in display format.
public
getDataInUserFormat(array<string|int, mixed> $recordValues) : array<string|int, mixed>
Parameters
- $recordValues : array<string|int, mixed>
Return values
array<string|int, mixed> —getDisplayValue()
Get display value.
public
getDisplayValue(Vtiger_Field_Model $fieldModel, mixed $value, int $recordId, array<string|int, mixed> $rowData[, int $length = 65000 ]) : string
Parameters
- $fieldModel : Vtiger_Field_Model
- $value : mixed
- $recordId : int
- $rowData : array<string|int, mixed>
- $length : int = 65000
Return values
string —getEntries()
Get entires.
public
getEntries() : array<string|int, mixed>
Return values
array<string|int, mixed> —getExportContentType()
Function returns the export type - This can be extended to support different file exports.
public
getExportContentType() : string
Return values
string —getExportQuery()
Function that generates Export Query object.
public
getExportQuery() : Query
Return values
Query —getFieldsForQuery()
Get fields for query.
public
getFieldsForQuery() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFileName()
public
getFileName() : string
Return values
string —getForHtml()
Function to get the html encoded value for a given key.
public
getForHtml(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getForSql()
Function to get the value if its safe to use for SQL Query (column).
public
getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
- $key : string
- $skipEmtpy : bool = true
-
Skip the check if string is empty
Return values
mixed —Value for the given key
getHeaders()
Get file headers.
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —getInstance()
Get instance.
public
static getInstance(string $moduleName[, string $exportType = 'csv' ]) : self
Parameters
- $moduleName : string
- $exportType : string = 'csv'
Return values
self —getKeys()
Function to get keys.
public
getKeys() : array<string|int, string>
Return values
array<string|int, string> —getQueryGenerator()
Get query generator object.
public
getQueryGenerator() : QueryGenerator
Return values
QueryGenerator —getSupportedFileFormats()
Get supported file formats.
public
static getSupportedFileFormats(string $moduleName) : array<string|int, mixed>
Parameters
- $moduleName : string
Return values
array<string|int, mixed> —has()
Function to check if the key exists.
public
has(string $key) : bool
Parameters
- $key : string
Return values
bool —isEmpty()
Function to check if the key is empty.
public
isEmpty(string $key) : bool
Parameters
- $key : string
Return values
bool —loadFieldsFromCvId()
Load fields from custom view.
public
loadFieldsFromCvId(int $cvId) : void
Parameters
- $cvId : int
Return values
void —output()
Function that create the exported file.
public
output(array<string|int, mixed> $headers, array<string|int, mixed> $entries) : mixed
Parameters
- $headers : array<string|int, mixed>
-
- output file header
- $entries : array<string|int, mixed>
-
- output file data
Return values
mixed —remove()
Function to remove the value.
public
remove(string $key) : mixed
Parameters
- $key : string
Return values
mixed —sanitizeInventoryValues()
Sanitize inventory values.
public
sanitizeInventoryValues(array<string|int, mixed> $inventoryRow, array<string|int, mixed> $inventoryFields) : array<string|int, mixed>
Parameters
- $inventoryRow : array<string|int, mixed>
- $inventoryFields : array<string|int, mixed>
Return values
array<string|int, mixed> —sanitizeValues()
This function takes in an array of values for an user and sanitizes it for export Requires modification after adding a new field type.
public
sanitizeValues(array<string|int, mixed> $recordValues) : array<string|int, mixed>
Parameters
- $recordValues : array<string|int, mixed>
Return values
array<string|int, mixed> —sendHttpHeader()
Send HTTP Header.
public
sendHttpHeader() : void
Return values
void —set()
Function to set the value for a given key.
public
set(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setData()
Function to set all the values.
public
setData(mixed $values) : $this
Parameters
- $values : mixed
Return values
$this —setField()
Set field model.
public
setField(string $fieldName) : Vtiger_Field_Model|false
Parameters
- $fieldName : string
Return values
Vtiger_Field_Model|false —setFields()
Set.
public
setFields(array<string|int, mixed> $fields) : $this
Parameters
- $fields : array<string|int, mixed>
Return values
$this —setFormat()
Set the format of the exported data.
public
setFormat(int $format) : $this
Parameters
- $format : int
-
self::EXPORT_FORMAT or self::USER_FORMAT
Return values
$this —setLimit()
Set a limit for exported data.
public
setLimit(int $limit) : $this
Parameters
- $limit : int