Class Horde_Data

Description

Abstract class to handle different kinds of Data formats and to help data exchange between Horde applications and external sources.

$Horde: framework/Data/Data.php,v 1.80.10.20 2010/05/09 18:44:05 mrubinsk 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.php (line 41)

PEAR
   |
   --Horde_Data
Direct descendents
Class Description
 class Horde_Data_csv Horde_Data implementation for comma-separated data (CSV).
 class Horde_Data_imc Abstract implementation of the Horde_Data:: API for IMC data - vCards and iCalendar data, etc. Provides a number of utility methods that vCard and iCalendar implementation can share and rely on.
 class Horde_Data_tsv Horde_Data implementation for tab-separated data (TSV).
Variable Summary
 string $_contentType
 string $_extension
 array $_warnings
Method Summary
 mixed cleanup ()
 void exportData ()
 void exportFile ()
 Horde_Data &factory (mixed $format)
 string getContentType ()
 string getFilename (string $basename)
 string getNewline ()
 void importData ()
 void importFile ( $filename, [ $header = false])
 mixed nextStep (integer $action, [array $param = array()])
 Horde_Data &singleton (string $format)
 array warnings ()
Variables
string $_contentType = 'text/plain' (line 55)

MIME content type.


Redefined in descendants as:
string $_extension (line 48)

File extension.


Redefined in descendants as:
array $_warnings = array() (line 63)

A list of warnings raised during the last operation.

  • since: Horde 3.1
Methods
cleanup (line 417)

Cleans the session data up and removes any uploaded and moved files. If a function called "_cleanup()" exists, this gets called too.

  • return: If _cleanup() was called, the return value of this call. This should be the value of the first import step.
mixed cleanup ()
exportData (line 75)

Stub to return exported data.

void exportData ()

Redefined in descendants as:
exportFile (line 91)

Stub to export data to a file.

void exportFile ()

Redefined in descendants as:
  • Horde_Data_csv::exportFile() : 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.
  • Horde_Data_imc::exportFile() : Builds an iCalendar 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.
  • Horde_Data_tsv::exportFile() : Builds a TSV file from a given data structure and triggers its download.
factory (line 166)

Attempts to return a concrete Horde_Data instance based on $format.

  • return: The newly created concrete Horde_Data instance, or false on an error.
Horde_Data &factory (mixed $format)
  • mixed $format: The type of concrete Horde_Data subclass to return. If $format is an array, then we will look in $format[0]/lib/Data/ for the subclass implementation named $format[1].php.
getContentType (line 137)

Returns the content type.

  • return: The content type.
string getContentType ()
getFilename (line 127)

Returns the full filename including the basename and extension.

  • return: The file name.
string getFilename (string $basename)
  • string $basename: Basename for the file.
getNewline (line 102)

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

  • return: The guessed expected newline characters, either \n, \r or \r\n.
string getNewline ()
importData (line 68)

Stub to import passed data.

void importData ()

Redefined in descendants as:
importFile (line 82)

Stub to import a file.

void importFile ( $filename, [ $header = false])
  • $filename
  • $header

Redefined in descendants as:
nextStep (line 312)

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.

Redefined in descendants as:
  • Horde_Data_csv::nextStep() : Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.
  • Horde_Data_imc::nextStep() : Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.
  • Horde_Data_tsv::nextStep() : Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.
singleton (line 211)

Attempts to return a reference to a concrete Horde_Data instance based on $format. It will only create a new instance if no Horde_Data instance with the same parameters currently exists.

This should be used if multiple data sources (and, thus, multiple Horde_Data instances) are required.

This method must be invoked as: $var = &Horde_Data::singleton()

  • return: The concrete Horde_Data reference, or false on an error.
Horde_Data &singleton (string $format)
  • string $format: The type of concrete Horde_Data subclass to return.
warnings (line 150)

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

  • return: A (possibly empty) list of warnings.
  • since: Horde 3.1
array warnings ()

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