Class ArrayDataListSource

Description

This DataListSource child class gets the data from an external array

The array is a 2D array and each sub-array is a set of elements for each row in the list

Located in /widgets/data_list/ArrayDataListSource.inc (line 29)

DataListSource
   |
   --ArrayDataListSource
Direct descendents
Class Description
CSVFILEDataListSource This DataListSource child class gets the data from a CSV (comma seperated values) file on disk.
Variable Summary
Method Summary
ArrayDataListSource ArrayDataListSource (array &$data)
natural cmp (string $data1, string $data2)
compare cmp_numeric (string $data1, string $data2)
void do_prequery ()
void do_query ()
boolean prequery_row_filter (array &$row_data)
none sort ()
the _find_col_name (string $sort_name)
boolean _find_data (array $row_data)
void _sort (string $column_name)
Variables
mixed $_reverse_order = false (line 47)

Sorting in reverse order, to speed up things

mixed $_secondary_is_numeric = FALSE (line 42)
mixed $_secondary_sorting_col = NULL (line 41)

Secondary sorting column, if any

mixed $_sorting_col = NULL (line 36)

internal class variable to tell us which column to order by.

Inherited Variables

Inherited from DataListSource

DataListSource::$_columns
DataListSource::$_data
DataListSource::$_data_index
DataListSource::$_debug
DataListSource::$_query_params
Methods
Constructor ArrayDataListSource (line 55)

The constructor.

ArrayDataListSource ArrayDataListSource (array &$data)
  • array &$data: data - an array of array elements for each row
cmp (line 260)

This method is used for comparing 2 string values

  • return: compare results
natural cmp (string $data1, string $data2)
  • string $data1: first entry to compare
  • string $data2: second entry to compare
cmp_numeric (line 291)

This method is used for comparing 2 numerical values

  • return: results
compare cmp_numeric (string $data1, string $data2)
  • string $data1: first entry to compare
  • string $data2: second entry to compare
do_prequery (line 89)

This is a method that should be defined by the child class to do any pre-query type of things.

Such as building a sql query string for a DB, or checking to make sure the file on disk exists if the source is a file on disk.

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.

Redefined in descendants as:
do_query (line 63)

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.

Redefined in descendants as:
get_data_index (line 164)

This function returns the data_index value and increments it

int get_data_index ()

Redefinition of:
DataListSource::get_data_index()
This function returns the data_index value and increments it
get_next_data_row (line 98)

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()
prequery_row_filter (line 134)

This is used to perform pre-query filtering Gives us a chance to run the next row through a filter before any processing has been done

  • return: - TRUE = allow the row. FALSE = drop it.
boolean prequery_row_filter (array &$row_data)
  • array &$row_data: - the row to run through the filter
sort (line 177)

This method sorts our data array by the requested column order by. This could be expensive for HUGE arrays.

none 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.
_find_col_name (line 218)

This function gets the column name from the sortname

  • return: column name
the _find_col_name (string $sort_name)
  • string $sort_name: the sortorder name
_find_data (line 329)

This is used to do the default search capability in the DataListSource parent class.

This is used so we can filter our results to what the user searched for.

  • return: found it or not
boolean _find_data (array $row_data)
  • array $row_data: the row data entry. We will look for a specific column's value here to test against.
_prequery_filter (line 146)

This is called to allow rebuilding the data array to remove elements that have to be filtered

This is done on pre-processing phase and used for simple and advanced searches

void _prequery_filter ()

Redefined in descendants as:
_sort (line 240)

This method actually calls the usort methods

void _sort (string $column_name)
  • string $column_name

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_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:49 -0500 by phpDocumentor 1.4.3