Documentation

Horde_Data_Outlookcsv extends Horde_Data_Csv
in package

Horde_Data implementation for Outlook comma-separated data (CSV).

Tags
author

Jan Schneider jan@horde.org

author

Chuck Hagenbuch chuck@horde.org

category

Horde

copyright

1999-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL

Table of Contents

$storage  : Horde_Data_Storage
Storage object.
$_browser  : Horde_Browser
Browser object.
$_cleanupCallback  : callable
Cleanup callback function.
$_contentType  : string
MIME content type.
$_extension  : string
File extension.
$_http  : Horde_Http_Client
HTTP client object.
$_vars  : Horde_Variables
Variables object.
$_warnings  : array<string|int, mixed>
A list of warnings raised during the last operation.
__construct()  : mixed
Constructor.
cleanup()  : mixed
Removes any uploaded and moved files.
exportData()  : string
Builds a CSV file from a given data structure and returns it as a string.
exportFile()  : mixed
Stub to export data to a file.
getContentType()  : string
Returns the content type.
getCsv()  : array<string|int, mixed>|bool
Wrapper around fgetcsv().
getFilename()  : string
Returns the full filename including the basename and extension.
getNewline()  : string
Tries to determine the expected newline character based on the platform information passed by the browser's agent header.
importData()  : mixed
Stub to import passed data.
importFile()  : mixed
Imports a file.
importUrl()  : mixed
Imports a URL.
nextStep()  : mixed
Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.
warnings()  : array<string|int, mixed>
Returns a list of warnings that have been raised during the last operation.
_mapDate()  : string
Maps a date/time string to an associative array.

Properties

$_browser

Browser object.

protected Horde_Browser $_browser

$_cleanupCallback

Cleanup callback function.

protected callable $_cleanupCallback

$_contentType

MIME content type.

protected string $_contentType = 'text/plain'

$_extension

File extension.

protected string $_extension = ''

$_http

HTTP client object.

protected Horde_Http_Client $_http

$_vars

Variables object.

protected Horde_Variables $_vars

$_warnings

A list of warnings raised during the last operation.

protected array<string|int, mixed> $_warnings = array()

Methods

__construct()

Constructor.

public __construct(Horde_Data_Storage $storage[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
$storage : Horde_Data_Storage
$params : array<string|int, mixed> = array()

Optional parameters:

  • browser: (Horde_Browser) A browser object.
  • http: (Horde_Http_Client) A HTTP client object.
  • cleanup: (callback) A callback to call at cleanup time.
  • vars: (Horde_Variables) Form data.
Return values
mixed

cleanup()

Removes any uploaded and moved files.

public cleanup() : mixed
Return values
mixed

If callback called, the return value of this call. This should be the value of the first import step.

exportData()

Builds a CSV file from a given data structure and returns it as a string.

public exportData(array<string|int, mixed> $data[, bool $header = false ][, array<string|int, mixed> $export_mapping = array() ]) : string
Parameters
$data : array<string|int, mixed>

A two-dimensional array containing the data set.

$header : bool = false

If true, the rows of $data are associative arrays with field names as their keys.

$export_mapping : array<string|int, mixed> = array()

TODO

Return values
string

The CSV data.

exportFile()

Stub to export data to a file.

public abstract exportFile(mixed $filename, mixed $data) : mixed
Parameters
$filename : mixed
$data : mixed
Return values
mixed

getContentType()

Returns the content type.

public getContentType() : string
Return values
string

The content type.

getCsv()

Wrapper around fgetcsv().

public static getCsv(resource $file[, array<string|int, mixed> $params = array() ]) : array<string|int, mixed>|bool

Empty lines will be skipped. If the 'length' parameter is provided, all rows are filled up with empty strings up to this length, or stripped down to this length.

Parameters
$file : resource

A file pointer.

$params : array<string|int, mixed> = array()

Optional parameters. Possible values:

  • escape: The escape character.
  • length: The expected number of fields.
  • quote: The quote character.
  • separator: The field delimiter.
Return values
array<string|int, mixed>|bool

A row from the CSV file or false on error or end of file.

getFilename()

Returns the full filename including the basename and extension.

public getFilename(string $basename) : string
Parameters
$basename : string

Basename for the file.

Return values
string

The file name.

getNewline()

Tries to determine the expected newline character based on the platform information passed by the browser's agent header.

public getNewline() : string
Return values
string

The guessed expected newline characters, either \n, \r or \r\n.

importData()

Stub to import passed data.

public importData(mixed $text) : mixed
Parameters
$text : mixed
Return values
mixed

importFile()

Imports a file.

public importFile(mixed $filename[, mixed $header = false ]) : mixed
Parameters
$filename : mixed
$header : mixed = false
Return values
mixed

importUrl()

Imports a URL.

public importUrl(mixed $url[, mixed $header = false ]) : mixed
Parameters
$url : mixed
$header : mixed = false
Tags
since
2.1.0
Return values
mixed

nextStep()

Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.

public nextStep(int $action[, array<string|int, mixed> $param = array() ]) : mixed
Parameters
$action : int

The current step. One of the IMPORT_* constants.

$param : array<string|int, mixed> = array()

An associative array containing needed parameters for the current step.

Tags
throws
Horde_Data_Exception
Return values
mixed

Either the next step as an integer constant or imported data set after the final step.

warnings()

Returns a list of warnings that have been raised during the last operation.

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

A (possibly empty) list of warnings.

_mapDate()

Maps a date/time string to an associative array.

protected _mapDate(string $date, string $type, array<string|int, mixed> $params, int $key) : string
Parameters
$date : string

The date.

$type : string

One of 'date', 'time' or 'datetime'.

$params : array<string|int, mixed>

Two-dimensional array with additional information about the formatting. Possible keys are:

  • delimiter: The character that seperates the different date/time parts.
  • format: If 'ampm' and $date contains a time we assume that it is in AM/PM format.
  • order: If $type is 'datetime' the order of the day and time parts: -1 (timestamp), 0 (day/time), 1 (time/day).
$key : int

The key to use for $params.

Return values
string

The date or time in ISO format.

Search results