Class CSVFILEDataListSource

Description

This DataListSource child class gets the data from a CSV (comma seperated values) file on disk.

The CSV MUST have a 'header' line before any data. The 'header' line is a CSV line that provides a name for each column of data in the file.

All lines that start with '#' or '//' are ignored as comments.

Located in /widgets/data_list/CSVFILEDataListSource.inc (line 33)

DataListSource
   |
   --ArrayDataListSource
      |
      --CSVFILEDataListSource
Direct descendents
Class Description
RemoteCSVFILEDataListSource This DataListSource child class gets the data from a CSV (comma seperated values) file on disk on a remote computer.
Variable Summary
mixed $_filename
mixed $_fp
Method Summary
CSVFILEDataListSource CSVFILEDataListSource (string $filename, [ $maxline = 4096])
void add_data_row ( $row)
void do_prequery ()
void do_query ()
array _construct_row (string $line)
void _get_header ()
Variables
mixed $_csv_headers = array() (line 53)

this holds the headers read

from the top of the csv file

mixed $_filename = NULL (line 40)

The csv file name/path on disk

mixed $_fp = NULL (line 46)

The file descriptor pointer

mixed $_maxlinelength = 4096 (line 60)

The length of the longest

line in the csv file (so we read the line properly)

Inherited Variables

Inherited from ArrayDataListSource

ArrayDataListSource::$_reverse_order
ArrayDataListSource::$_secondary_is_numeric
ArrayDataListSource::$_secondary_sorting_col
ArrayDataListSource::$_sorting_col

Inherited from DataListSource

DataListSource::$_columns
DataListSource::$_data
DataListSource::$_data_index
DataListSource::$_debug
DataListSource::$_query_params
Methods
Constructor CSVFILEDataListSource (line 71)

The constructor.

CSVFILEDataListSource CSVFILEDataListSource (string $filename, [ $maxline = 4096])
  • string $filename: - the path to the CSV file on on disk to use as the data source.
  • $maxline
add_data_row (line 181)

This function adds a row of data

if necesarry to the data array

void add_data_row ( $row)
  • $row
do_prequery (line 92)

The prequery. We use this to read the file

into memory so we can do operations on the data (search, sort, etc.)

void do_prequery ()

Redefinition of:
ArrayDataListSource::do_prequery()
This is a method that should be defined by the child class to do any pre-query type of things.
do_query (line 100)

This function does the query

and search/sort

void do_query ()

Redefinition of:
ArrayDataListSource::do_query()
This function does the query
_construct_row (line 160)

this is used to build a row from a csv line

array _construct_row (string $line)
  • string $line: - the original csv line from the file
_get_header (line 140)

This file trys to get the CSV header.

void _get_header ()
_prequery_filter (line 123)

Lets walk the file and read the entry, and filter what we don't want.

void _prequery_filter ()

Redefinition of:
ArrayDataListSource::_prequery_filter()
This is called to allow rebuilding the data array to remove elements that have to be filtered

Inherited Methods

Inherited From ArrayDataListSource

ArrayDataListSource::ArrayDataListSource()
ArrayDataListSource::cmp()
ArrayDataListSource::cmp_numeric()
ArrayDataListSource::do_prequery()
ArrayDataListSource::do_query()
ArrayDataListSource::get_data_index()
ArrayDataListSource::get_next_data_row()
ArrayDataListSource::prequery_row_filter()
ArrayDataListSource::sort()
ArrayDataListSource::_find_col_name()
ArrayDataListSource::_find_data()
ArrayDataListSource::_prequery_filter()
ArrayDataListSource::_sort()

Inherited From DataListSource

DataListSource::DataListSource()
DataListSource::add_column()
DataListSource::do_prequery()
DataListSource::do_query()
DataListSource::get_data_index()
DataListSource::get_limit()
DataListSource::get_next_data_row()
DataListSource::get_offset()
DataListSource::get_orderby()
DataListSource::get_reverseorder()
DataListSource::get_searchby()
DataListSource::get_searchby_value()
DataListSource::get_search_type()
DataListSource::get_secondary_orderby()
DataListSource::get_simplesearch_modifier()
DataListSource::get_total_rows()
DataListSource::query()
DataListSource::row_filter()
DataListSource::set_debug()
DataListSource::set_limit()
DataListSource::set_offset()
DataListSource::set_orderby()
DataListSource::set_reverseorder()
DataListSource::set_searchby()
DataListSource::set_searchby_value()
DataListSource::set_search_type()
DataListSource::set_secondary_orderby()
DataListSource::set_simplesearch_modifier()
DataListSource::set_total_rows()
DataListSource::sort()
DataListSource::_is_column_sortable()

Documentation generated on Fri, 28 Jan 2011 08:52:50 -0500 by phpDocumentor 1.4.3