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 Program_Root/widgets/data_list/CSVFILEDataListSource.inc (line 31)

DataListSource
   |
   --CSVFILEDataListSource
Variable Summary
mixed $_filename
mixed $_fp
Method Summary
void CSVFILEDataListSource (string $filename, [mixed $maxline = 4096])
void add_data_row (mixed $row)
void cmp (mixed $data1, mixed $data2)
void do_prequery ()
void do_query ()
void sort ()
array _construct_row (string $line)
void _find_data (mixed $row_data)
void _get_header ()
Variables
mixed $_csv_headers = array() (line 51)

this holds the headers read

from the top of the csv file

mixed $_filename = NULL (line 38)

The csv file name/path on disk

mixed $_fp = NULL (line 44)

The file descriptor pointer

mixed $_maxlinelength = 4096 (line 58)

The length of the longest

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

Inherited Variables

Inherited from DataListSource

DataListSource::$_columns
DataListSource::$_data
DataListSource::$_data_index
DataListSource::$_not_found_message
DataListSource::$_query_params
Methods
Constructor CSVFILEDataListSource (line 69)

The constructor.

void CSVFILEDataListSource (string $filename, [mixed $maxline = 4096])
  • string $filename:

    - the path to the CSV file on on disk to use as the data source.

add_data_row (line 192)

This function adds a row of data

if necesarry to the data array

void add_data_row (mixed $row)
cmp (line 221)
void cmp (mixed $data1, mixed $data2)
do_prequery (line 90)

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:
DataListSource::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 98)

This function does the query

and search/sort

void do_query ()

Redefinition of:
DataListSource::do_query()
This is the function that does the data fetching, and sorting if needed.
get_next_data_row (line 122)

This function returns the next row of valid data.

void get_next_data_row ()

Redefinition of:
DataListSource::get_next_data_row()
This function gets the next data row from the query()
sort (line 211)
void sort ()

Redefinition of:
DataListSource::sort()
A generic method API that can be used at the bottom half of the do_query() method to sort data that is stored locally. This is only needed when the source is a non database.
_construct_row (line 169)

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

_find_data (line 230)
void _find_data (mixed $row_data)
_get_header (line 149)

This file trys to get the CSV header.

void _get_header ()

Inherited Methods

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_not_found_message()
DataListSource::get_offset()
DataListSource::get_orderby()
DataListSource::get_reverseorder()
DataListSource::get_searchby()
DataListSource::get_searchby_value()
DataListSource::get_search_type()
DataListSource::get_simplesearch_modifier()
DataListSource::get_total_rows()
DataListSource::query()
DataListSource::row_filter()
DataListSource::set_limit()
DataListSource::set_not_found_message()
DataListSource::set_offset()
DataListSource::set_orderby()
DataListSource::set_reverseorder()
DataListSource::set_searchby()
DataListSource::set_searchby_value()
DataListSource::set_search_type()
DataListSource::set_simplesearch_modifier()
DataListSource::set_total_rows()
DataListSource::sort()
DataListSource::_is_column_sortable()

Documention generated on Thu, 31 Jul 2003 18:32:20 -0700 by phpDocumentor 1.2.0