Class Horde_Data_csv

Description

Horde_Data implementation for comma-separated data (CSV).

$Horde: framework/Data/Data/csv.php,v 1.30.10.12 2009/01/06 15:23:01 jan Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /Data/Data/csv.php (line 26)

PEAR
   |
   --Horde_Data
      |
      --Horde_Data_csv
Direct descendents
Class Description
 class Horde_Data_outlookcsv Horde_Data implementation for Outlook comma-separated data (CSV).
Variable Summary
Method Summary
 array discoverFormat (string $filename)
 string exportData (array $data, [boolean $header = false], [ $export_mapping = array()])
 void exportFile (string $filename, array $data, [boolean $header = false], [ $export_mapping = array()])
 array importFile (string $filename, [boolean $header = false], [string $sep = ''], [string $quote = ''], [integer $fields = null], [ $import_mapping = array()], [string $charset = null], [string $crlf = null])
 mixed nextStep (integer $action, [array $param = array()])
Variables
mixed $_contentType = 'text/comma-separated-values' (line 29)

Redefinition of:
Horde_Data::$_contentType
MIME content type.
mixed $_extension = 'csv' (line 28)

Redefinition of:
Horde_Data::$_extension
File extension.

Inherited Variables

Inherited from Horde_Data

Horde_Data::$_warnings
Methods
discoverFormat (line 43)

Tries to discover the CSV file's parameters.

  • return: An associative array with the following possible keys:
     'sep':    The field separator
     'quote':  The quoting character
     'fields': The number of fields (columns)
array discoverFormat (string $filename)
  • string $filename: The name of the file to investigate.
exportData (line 142)

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

  • return: The CSV data.
string exportData (array $data, [boolean $header = false], [ $export_mapping = array()])
  • array $data: A two-dimensional array containing the data set.
  • boolean $header: If true, the rows of $data are associative arrays with field names as their keys.
  • $export_mapping

Redefinition of:
Horde_Data::exportData()
Stub to return exported data.

Redefined in descendants as:
exportFile (line 189)

Builds a CSV file from a given data structure and triggers its download. It DOES NOT exit the current script but only outputs the correct headers and data.

void exportFile (string $filename, array $data, [boolean $header = false], [ $export_mapping = array()])
  • string $filename: The name of the file to be downloaded.
  • array $data: A two-dimensional array containing the data set.
  • boolean $header: If true, the rows of $data are associative arrays with field names as their keys.
  • $export_mapping

Redefinition of:
Horde_Data::exportFile()
Stub to export data to a file.
importFile (line 64)

Imports and parses a CSV file.

  • return: A two-dimensional array of all imported data rows. If $header was true the rows are associative arrays with the field/column names as the keys.
array importFile (string $filename, [boolean $header = false], [string $sep = ''], [string $quote = ''], [integer $fields = null], [ $import_mapping = array()], [string $charset = null], [string $crlf = null])
  • string $filename: The name of the file to parse.
  • boolean $header: Does the first line contain the field/column names?
  • string $sep: The field/column separator.
  • string $quote: The quoting character.
  • integer $fields: The number or fields/columns.
  • string $charset: The file's charset. @since Horde 3.1.
  • string $crlf: The file's linefeed characters. @since Horde 3.1.
  • $import_mapping

Redefinition of:
Horde_Data::importFile()
Stub to import a file.
nextStep (line 208)

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

  • return: Either the next step as an integer constant or imported data set after the final step.
mixed nextStep (integer $action, [array $param = array()])
  • integer $action: The current step. One of the IMPORT_* constants.
  • array $param: An associative array containing needed parameters for the current step.

Redefinition of:
Horde_Data::nextStep()
Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.

Inherited Methods

Inherited From Horde_Data

 Horde_Data::cleanup()
 Horde_Data::exportData()
 Horde_Data::exportFile()
 Horde_Data::factory()
 Horde_Data::getContentType()
 Horde_Data::getFilename()
 Horde_Data::getNewline()
 Horde_Data::importData()
 Horde_Data::importFile()
 Horde_Data::nextStep()
 Horde_Data::singleton()
 Horde_Data::warnings()

Documentation generated on Sun, 30 Jan 2011 05:16:09 +0000 by phpDocumentor 1.4.3