Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_ArrayIteratorList class

• Introduction

Module iterator list model.

• Class synopsis

AMI_ArrayIteratorList implements AMI_iModTableList, Iterator (internal interface) {
/* Properties */
// Recordset columns
protected array $aColumns = array();
// Search condition
protected array $aCondition;
// Processed data array
protected array $aData = array();
// Primary keys array
protected array $aKeys = array();
// Raw data array
protected array $aRaw = array();
// Current iterator element index
protected int $dataIndex = 0;
// Limit read
protected int $limit = 10;
// Default list mask
protected string $mask = '*';
// AMI_ArrayIterator object
// Search position
protected mixed $position;
// Sort direction (PHP constant)
protected int $sortDirection;
// Field to sort by
protected string $sortField;
// Start read position
protected int $start = 0;
// Number of found rows
protected int $total = 0;
/* Methods */
// Initializing array data.
public __construct ( AMI_ArrayIterator $oIterator, [ string $mask = null ] ) returns AMI_ArrayIteratorList;
// Necessary for AMI_ModTableList compatibility.
public addCalcFoundRows ( [ bool $bState = null ] ) returns AMI_ArrayIteratorList;
// Necessary for AMI_ModTableList compatibility.
public addColumns ( $aColumns, [ string $model = null ] ) returns AMI_ArrayIteratorList;
// Necessary for AMI_ModTableList compatibility.
public addExpressionColumn ( string $name, string $expression, [ string $model = '' ] ) returns AMI_ArrayIteratorList;
// Necessary for AMI_ModTableList compatibility.
public addNavColumns ( ) returns AMI_ArrayIteratorList;
// Sets order parameters.
public addOrder ( string $field, [ string $direction = '' ] ) returns AMI_ArrayIteratorList;
// Adds search condition.
public addSearchCondition ( $aCondition ) returns AMI_ArrayIteratorList;
// Necessary for AMI_ModTableList compatibility.
public addWhereDef ( string $expression ) returns AMI_ArrayIteratorList;
// Counts elements of an object.
public count ( ) returns int;
// Returns the current element.
public current ( ) returns AMI_ArrayIteratorItem;
// Excludes fields not from available list.
public filterFields ( $aFields ) returns array;
// Returns array of available fields.
public getAvailableFields ( [ bool $bAppendEventFields = null ] ) returns array;
// Necessary for AMI_ModTableList compatibility.
public getColumns ( ) returns array;
// Returns an array with list keys.
public getKeys ( ) returns array;
// Necessary for AMI_ModTableList compatibility.
public getMainTableAlias ( [ bool $bAsPrefix = null ] ) returns null;
// Get the number of found rows when bCalcFoundRows is true.
// Gets position of the applied element.
public getPosition ( string $fieldName, integer $appliedValue, integer $position ) returns integer;
// Returns primary key field name.
public getPrimaryKeyField ( ) returns string;
// Necessary for AMI_ModTableList compatibility.
public getQuery ( ) returns bool;
// Returns sort field.
public getSortField ( ) returns string;
// Returns TRUE if list model has passed column .
public hasColumn ( string $column, [ string $alias = '' ], [ bool $bAppendEventFields = TRUE ] ) returns bool;
// Returns the key of the current element.
public key ( ) returns integer;
// Loads data from array and init recordset.
public load ( ) returns AMI_ArrayIteratorList;
// Fills array aData with the current page items.
public loadCurrentPage ( ) returns void;
// Move forward to the next element.
public next ( ) returns void;
// Rewinds the Iterator to the first element.
public rewind ( ) returns void;
// Seeks to a position.
public seek ( integer $position ) returns void;
// Sets limit parameters.
public setLimitParameters ( int $start, int $limit ) returns AMI_ArrayIteratorList;
// Sets module id.
public setModId ( string $modId ) returns void;
// Sorts aData list by field.
public sortList ( [ string $sortField = '' ], [ string $sort = null ] ) returns void;
// Forms an array with list keys.
public storeKeys ( [ string $keyField = false ] ) returns void;
// Checks if current position is valid.
public valid ( ) returns bool;
// Filter raw data array by conditions.
protected filterByConditions ( [ mixed $position = false ] ) returns void;
// Returns module id.
protected getModId ( ) returns string;
// Filter callback function.
protected _filterCallback ( $aItem ) returns bool;
}
Tags:
abstract
since 5.14.8

• Class Properies

protected array $aColumns

Recordset columns

protected array $aCondition

Search condition

protected array $aData

Processed data array

protected array $aKeys

Primary keys array

protected array $aRaw

Raw data array

protected int $dataIndex

Current iterator element index

protected int $limit

Limit read

protected string $mask

Default list mask

protected AMI_ArrayIterator $oIterator

AMI_ArrayIterator object

protected mixed $position

Search position

protected int $sortDirection

Sort direction (PHP constant)

protected string $sortField

Field to sort by

protected int $start

Start read position

protected int $total

Number of found rows

• Class Methods

// Initializing array data.
public __construct ( AMI_ArrayIterator $oIterator, [ string $mask = null ] ) returns AMI_ArrayIteratorList;
// Necessary for AMI_ModTableList compatibility.
public addCalcFoundRows ( [ bool $bState = null ] ) returns AMI_ArrayIteratorList;
  • bool $bState
    Null
// Necessary for AMI_ModTableList compatibility.
public addColumns ( $aColumns, [ string $model = null ] ) returns AMI_ArrayIteratorList;
  • array $aColumns
    Array of column field names
  • string $model
    Null

Implementation of: AMI_iModTableList::addColumns().

// Necessary for AMI_ModTableList compatibility.
public addExpressionColumn ( string $name, string $expression, [ string $model = '' ] ) returns AMI_ArrayIteratorList;
  • string $name
    Column field name
  • string $expression
    Expression
  • string $model
    Dependent model alias
// Necessary for AMI_ModTableList compatibility.
public addNavColumns ( ) returns AMI_ArrayIteratorList;
// Sets order parameters.
public addOrder ( string $field, [ string $direction = '' ] ) returns AMI_ArrayIteratorList;
  • string $field
    Sort field name
  • string $direction
    Sort direction

Implementation of: AMI_iModTableList::addOrder().

// Adds search condition.
public addSearchCondition ( $aCondition ) returns AMI_ArrayIteratorList;
  • array $aCondition
    List search condition - array(field => value)
// Necessary for AMI_ModTableList compatibility.
public addWhereDef ( string $expression ) returns AMI_ArrayIteratorList;
  • string $expression
    Null
// Counts elements of an object.
public count ( ) returns int;
Countable::count() implementation.
// Returns the current element.
public current ( ) returns AMI_ArrayIteratorItem;

Implementation of: Iterator::current.

Iterator interface implementation.
// Excludes fields not from available list.
public filterFields ( $aFields ) returns array;
  • array $aFields
    Fields

Implementation of: AMI_iModTableList::filterFields().

Wrapper for AMI_ArrayIterator::filterFields().
// Returns array of available fields.
public getAvailableFields ( [ bool $bAppendEventFields = null ] ) returns array;
  • bool $bAppendEventFields
    Null
// Necessary for AMI_ModTableList compatibility.
public getColumns ( ) returns array;
// Returns an array with list keys.
public getKeys ( ) returns array;
// Necessary for AMI_ModTableList compatibility.
public getMainTableAlias ( [ bool $bAsPrefix = null ] ) returns null;
  • bool $bAsPrefix
    Null
// Get the number of found rows when bCalcFoundRows is true.
// Gets position of the applied element.
public getPosition ( string $fieldName, integer $appliedValue, integer $position ) returns integer;
  • string $fieldName
    Field name to search in
  • integer $appliedValue
    Field value of the applied element
  • integer $position
    Initial position

Implementation of: AMI_iModTableList::getPosition().

// Returns primary key field name.
public getPrimaryKeyField ( ) returns string;
// Necessary for AMI_ModTableList compatibility.
public getQuery ( ) returns bool;
// Returns sort field.
public getSortField ( ) returns string;
// Returns TRUE if list model has passed column .
public hasColumn ( string $column, [ string $alias = '' ], [ bool $bAppendEventFields = TRUE ] ) returns bool;
  • string $column
    Column name
  • string $alias
    Model alias
  • bool $bAppendEventFields
    See AMI_ArrayIterator::getAvailableFields()
// Returns the key of the current element.
public key ( ) returns integer;

Implementation of: Iterator::key.

Iterator interface implementation.
// Loads data from array and init recordset.
public load ( ) returns AMI_ArrayIteratorList;

Implementation of: AMI_iModTableList::load().

// Fills array aData with the current page items.
public loadCurrentPage ( ) returns void;
// Move forward to the next element.
public next ( ) returns void;

Implementation of: Iterator::next.

Iterator interface implementation.
// Rewinds the Iterator to the first element.
public rewind ( ) returns void;

Implementation of: Iterator::rewind.

Iterator interface implementation.
// Seeks to a position.
public seek ( integer $position ) returns void;
  • integer $position
    The index position to seek to
SeekableIterator::seek() implementation.
// Sets limit parameters.
public setLimitParameters ( int $start, int $limit ) returns AMI_ArrayIteratorList;
  • int $start
    Start position
  • int $limit
    Limit
// Sets module id.
public setModId ( string $modId ) returns void;
  • string $modId
    Module Id.
// Sorts aData list by field.
public sortList ( [ string $sortField = '' ], [ string $sort = null ] ) returns void;
  • string $sortField
    Field to sort by
  • string $sort
    Sort type
// Forms an array with list keys.
public storeKeys ( [ string $keyField = false ] ) returns void;
  • string $keyField
    Primary key field
// Checks if current position is valid.
public valid ( ) returns bool;

Implementation of: Iterator::valid.

Iterator interface implementation.
// Filter raw data array by conditions.
protected filterByConditions ( [ mixed $position = false ] ) returns void;
  • mixed $position
    Needle position
// Returns module id.
protected getModId ( ) returns string;

Overridden in child classes as: AMI_ModSpecblock_ArrayIteratorList::getModId().

// Filter callback function.
protected _filterCallback ( $aItem ) returns bool;
  • array $aItem
    Array item