wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
CSVUtil Class Reference

Public Member Functions

 getErrorMsg ()
 
 readCSVFile ($filename, $separator, $fielddelimiter)
 
 getFieldValue ($line, $fieldName)
 
 getValues ($line, $separator, $fielddelimiter)
 

Public Attributes

 $_errorMsg = ''
 
 $_fields = array()
 

Detailed Description

CSVUtil provides basic support for csv file functionality. The first line of a csv file is supposed to hold the field names.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.CSVUtil.php 1462 2014-02-04 23:52:27Z iherwig
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 29 of file class.CSVUtil.php.

Member Function Documentation

CSVUtil::getErrorMsg ( )

Get last error message.

Returns
The error string

Definition at line 38 of file class.CSVUtil.php.

References $_errorMsg.

CSVUtil::readCSVFile (   $filename,
  $separator,
  $fielddelimiter 
)

Read a CSV file into an array

Parameters
filenameThe name of the CSV file
separatorThe field separator used in the CSV file (e.g. \t)
fielddelimiterThe field delimiter used in the CSV file (e.g. ")
Returns
An assoziative array with keys 'fields', 'values' where values is an array of arrays holding the values

Definition at line 50 of file class.CSVUtil.php.

References $_fields, and getValues().

+ Here is the call graph for this function:

CSVUtil::getFieldValue (   $line,
  $fieldName 
)

Get the values of of field from a line

Parameters
lineThe line (represented as array returned from readCSVFile)
fieldNameThe name of the field
Returns
The value or false if not existing

Definition at line 80 of file class.CSVUtil.php.

CSVUtil::getValues (   $line,
  $separator,
  $fielddelimiter 
)

Get the values of of line

Parameters
lineThe line to split
separatorThe field separator used in the CSV file (e.g. \t)
fielddelimiterThe field delimiter used in the CSV file (e.g. ")
Returns
An array of values

Definition at line 94 of file class.CSVUtil.php.

Referenced by readCSVFile().

Member Data Documentation

CSVUtil::$_errorMsg = ''

Definition at line 31 of file class.CSVUtil.php.

Referenced by getErrorMsg().

CSVUtil::$_fields = array()

Definition at line 32 of file class.CSVUtil.php.

Referenced by readCSVFile().


The documentation for this class was generated from the following file: