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

Public Member Functions

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

Static Public Member Functions

static factory ($wholeArray, $rangeInfo)
 

Public Attributes

 $count
 
 $itemsPerPage
 
 $page
 
 $theArray
 
 $wasEmpty
 

Detailed Description

Provides paging and iteration for "virtual" arrays – arrays for which only the current "page" is available, but are much bigger in entirety.

Definition at line 20 of file VirtualArrayIterator.inc.php.

Member Function Documentation

VirtualArrayIterator::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 ArrayItemIterator.

See Also
http://ca3.php.net/manual/en/function.array-slice.php
Parameters
$arrayArray
$offsetint
$lenint

Definition at line 188 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::atFirstPage ( )

Check whether or not this iterator is for the first page of a sequence

Returns
boolean

Definition at line 115 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::atLastPage ( )

Check whether or not this iterator is for the last page of a sequence

Returns
boolean

Definition at line 123 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::eof ( )

Return a boolean indicating whether or not we've reached the end of results Note: This implementation requires that next() be called before every eof() will function properly (except the first call).

Returns
boolean

Definition at line 157 of file VirtualArrayIterator.inc.php.

static VirtualArrayIterator::factory (   $wholeArray,
  $rangeInfo 
)
static

Factory Method. Extracts the appropriate page items from the whole array and calls the constructor.

Parameters
$wholeArrayarray The whole array of items
$rangeInfoint The number of items per page
Returns
object VirtualArrayIterator

Definition at line 80 of file VirtualArrayIterator.inc.php.

Referenced by UnassignedSubmissionsListGridHandler\getSubmissions().

VirtualArrayIterator::getCount ( )

Get the total number of items in the virtual array

Returns
int

Definition at line 139 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::getPage ( )

Get the page number that this iterator represents

Returns
int

Definition at line 131 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::getPageCount ( )

Get the total number of pages in the virtual array

Returns
int

Definition at line 147 of file VirtualArrayIterator.inc.php.

& VirtualArrayIterator::next ( )

Return the next item in the iterator.

Returns
object

Definition at line 89 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::nextWithKey ( )

Return the next item in the iterator, with key.

Returns
array (key, value)

Definition at line 105 of file VirtualArrayIterator.inc.php.

& VirtualArrayIterator::toArray ( )

Convert the iterator into an array

Returns
array

Definition at line 173 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::VirtualArrayIterator ( $theArray,
  $totalItems,
  $page = -1,
  $itemsPerPage = -1 
)

Constructor.

Parameters
$theArrayarray The array of items to iterate through
$totalItemsint The total number of items in the virtual "larger" array
$pageint the current page number
$itemsPerPageint Number of items to display per page

Definition at line 58 of file VirtualArrayIterator.inc.php.

VirtualArrayIterator::wasEmpty ( )

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

Returns
boolean

Definition at line 165 of file VirtualArrayIterator.inc.php.

Member Data Documentation

int VirtualArrayIterator::$count

The total number of items.

Definition at line 43 of file VirtualArrayIterator.inc.php.

int VirtualArrayIterator::$itemsPerPage

Number of items to iterate through on this page

Definition at line 31 of file VirtualArrayIterator.inc.php.

int VirtualArrayIterator::$page

The current page.

Definition at line 37 of file VirtualArrayIterator.inc.php.

array VirtualArrayIterator::$theArray

The array of contents of this iterator.

Definition at line 25 of file VirtualArrayIterator.inc.php.

boolean VirtualArrayIterator::$wasEmpty

Whether or not the iterator was empty from the start

Definition at line 49 of file VirtualArrayIterator.inc.php.


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