Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ArrayItemIterator Class Reference
Inheritance diagram for ArrayItemIterator:
ItemIterator

Public Member Functions

 array_slice_key ($array, $offset, $len=-1)
 
 ArrayItemIterator (&$theArray, $page=-1, $itemsPerPage=-1)
 
 atFirstPage ()
 
 atLastPage ()
 
 eof ()
 
fromRangeInfo (&$theArray, &$theRange)
 
 getCount ()
 
getLastPageRangeInfo ()
 
 getPage ()
 
 getPageCount ()
 
 isInBounds ()
 
next ()
 
 nextWithKey ()
 
toArray ()
 
 wasEmpty ()
 
- Public Member Functions inherited from ItemIterator
 atFirstPage ()
 
 atLastPage ()
 
 eof ()
 
 getCount ()
 
 getPage ()
 
 getPageCount ()
 
next ()
 
 nextWithKey ()
 
toArray ()
 
 wasEmpty ()
 

Public Attributes

 $count
 
 $itemsPerPage
 
 $page
 
 $theArray
 
 $wasEmpty
 

Detailed Description

Provides paging and iteration for arrays.

Definition at line 19 of file ArrayItemIterator.inc.php.

Member Function Documentation

ArrayItemIterator::array_slice_key (   $array,
  $offset,
  $len = -1 
)

A version of array_slice that takes keys into account. Thanks to pies at sputnik dot pl. This is made redundant by PHP 5.0.2's updated array_slice, but we can't assume everyone has that. FIXME: Reconcile this against the dupe in VirtualArrayIterator.

See Also
http://ca3.php.net/manual/en/function.array-slice.php

Definition at line 201 of file ArrayItemIterator.inc.php.

ArrayItemIterator::ArrayItemIterator ( $theArray,
  $page = -1,
  $itemsPerPage = -1 
)

Constructor.

Parameters
$theArrayarray The array of items to iterate through
$pageint the current page number
$itemsPerPageint Number of items to display per page

Definition at line 53 of file ArrayItemIterator.inc.php.

ArrayItemIterator::atFirstPage ( )

Determine whether or not this iterator represents the first page

Returns
boolean

Definition at line 112 of file ArrayItemIterator.inc.php.

ArrayItemIterator::atLastPage ( )

Determine whether or not this iterator represents the last page

Returns
boolean

Definition at line 120 of file ArrayItemIterator.inc.php.

ArrayItemIterator::eof ( )

Return a boolean indicating whether or not we've reached the end of results

Returns
boolean

Definition at line 152 of file ArrayItemIterator.inc.php.

& ArrayItemIterator::fromRangeInfo ( $theArray,
$theRange 
)

Static method: Generate an iterator from an array and rangeInfo object.

Parameters
$theArrayarray
$theRangeobject

Definition at line 73 of file ArrayItemIterator.inc.php.

ArrayItemIterator::getCount ( )

Get the total count of items

Returns
int

Definition at line 136 of file ArrayItemIterator.inc.php.

& ArrayItemIterator::getLastPageRangeInfo ( )

Get the range info representing the last page of results.

Returns
object DBResultRange

Definition at line 184 of file ArrayItemIterator.inc.php.

ArrayItemIterator::getPage ( )

Get the current page number

Returns
int

Definition at line 128 of file ArrayItemIterator.inc.php.

ArrayItemIterator::getPageCount ( )

Get the number of pages

Returns
int

Definition at line 144 of file ArrayItemIterator.inc.php.

ArrayItemIterator::isInBounds ( )

Determine whether or not the iterator is within bounds.

Returns
boolean

Definition at line 176 of file ArrayItemIterator.inc.php.

& ArrayItemIterator::next ( )

Return the next item in the iterator.

Returns
object

Definition at line 86 of file ArrayItemIterator.inc.php.

ArrayItemIterator::nextWithKey ( )

Return the next item in the iterator, with key.

Returns
array (key, value)

Definition at line 102 of file ArrayItemIterator.inc.php.

& ArrayItemIterator::toArray ( )

Convert this iterator to an array

Returns
array

Definition at line 168 of file ArrayItemIterator.inc.php.

Referenced by PagingFeature\setGridDataElements().

ArrayItemIterator::wasEmpty ( )

Return a boolean indicating whether or not this iterator was empty from the beginning

Returns
boolean

Definition at line 160 of file ArrayItemIterator.inc.php.

Member Data Documentation

int ArrayItemIterator::$count

The total number of items.

Definition at line 42 of file ArrayItemIterator.inc.php.

int ArrayItemIterator::$itemsPerPage

Number of items to iterate through on this page

Definition at line 30 of file ArrayItemIterator.inc.php.

int ArrayItemIterator::$page

The current page.

Definition at line 36 of file ArrayItemIterator.inc.php.

array ArrayItemIterator::$theArray

The array of contents of this iterator.

Definition at line 24 of file ArrayItemIterator.inc.php.

ArrayItemIterator::$wasEmpty

Whether or not the iterator was empty from the start

Definition at line 45 of file ArrayItemIterator.inc.php.


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