Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct (&$theArray, $totalItems, $page=-1, $itemsPerPage=-1) | |
array_slice_key ($array, $offset, $len=-1) | |
atFirstPage () | |
atLastPage () | |
eof () | |
getCount () | |
getPage () | |
getPageCount () | |
& | next () |
nextWithKey () | |
& | toArray () |
wasEmpty () | |
Public Member Functions inherited from ItemIterator | |
__construct () | |
Static Public Member Functions | |
static | factory ($wholeArray, $rangeInfo) |
Data Fields | |
$count | |
$itemsPerPage | |
$page | |
$theArray | |
$wasEmpty | |
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.
VirtualArrayIterator::__construct | ( | & | $theArray, |
$totalItems, | |||
$page = -1 , |
|||
$itemsPerPage = -1 |
|||
) |
Constructor.
$theArray | array The array of items to iterate through |
$totalItems | int The total number of items in the virtual "larger" array |
$page | int the current page number |
$itemsPerPage | int Number of items to display per page |
Definition at line 58 of file VirtualArrayIterator.inc.php.
References $itemsPerPage, $page, $theArray, and wasEmpty().
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.
$array | Array |
$offset | int |
$len | int |
Definition at line 189 of file VirtualArrayIterator.inc.php.
VirtualArrayIterator::atFirstPage | ( | ) |
Check whether or not this iterator is for the first page of a sequence
Reimplemented from ItemIterator.
Definition at line 116 of file VirtualArrayIterator.inc.php.
VirtualArrayIterator::atLastPage | ( | ) |
Check whether or not this iterator is for the last page of a sequence
Reimplemented from ItemIterator.
Definition at line 124 of file VirtualArrayIterator.inc.php.
References $count.
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).
Reimplemented from ItemIterator.
Definition at line 158 of file VirtualArrayIterator.inc.php.
|
static |
Factory Method. Extracts the appropriate page items from the whole array and calls the constructor.
$wholeArray | array The whole array of items |
$rangeInfo | int The number of items per page |
Definition at line 81 of file VirtualArrayIterator.inc.php.
VirtualArrayIterator::getCount | ( | ) |
Get the total number of items in the virtual array
Reimplemented from ItemIterator.
Definition at line 140 of file VirtualArrayIterator.inc.php.
References $count.
VirtualArrayIterator::getPage | ( | ) |
Get the page number that this iterator represents
Reimplemented from ItemIterator.
Definition at line 132 of file VirtualArrayIterator.inc.php.
References $page.
VirtualArrayIterator::getPageCount | ( | ) |
Get the total number of pages in the virtual array
Reimplemented from ItemIterator.
Definition at line 148 of file VirtualArrayIterator.inc.php.
& VirtualArrayIterator::next | ( | ) |
Return the next item in the iterator.
Reimplemented from ItemIterator.
Definition at line 90 of file VirtualArrayIterator.inc.php.
Referenced by nextWithKey().
VirtualArrayIterator::nextWithKey | ( | ) |
Return the next item in the iterator, with key.
Reimplemented from ItemIterator.
Definition at line 106 of file VirtualArrayIterator.inc.php.
References next().
& VirtualArrayIterator::toArray | ( | ) |
Convert the iterator into an array
Reimplemented from ItemIterator.
Definition at line 174 of file VirtualArrayIterator.inc.php.
References $theArray.
VirtualArrayIterator::wasEmpty | ( | ) |
Return a boolean indicating whether or not this iterator was empty from the beginning
Reimplemented from ItemIterator.
Definition at line 166 of file VirtualArrayIterator.inc.php.
References $wasEmpty.
Referenced by __construct().
int VirtualArrayIterator::$count |
The total number of items.
Definition at line 43 of file VirtualArrayIterator.inc.php.
Referenced by atLastPage(), and getCount().
int VirtualArrayIterator::$itemsPerPage |
Number of items to iterate through on this page
Definition at line 31 of file VirtualArrayIterator.inc.php.
Referenced by __construct().
int VirtualArrayIterator::$page |
The current page.
Definition at line 37 of file VirtualArrayIterator.inc.php.
Referenced by __construct(), and getPage().
array VirtualArrayIterator::$theArray |
The array of contents of this iterator.
Definition at line 25 of file VirtualArrayIterator.inc.php.
Referenced by __construct(), and toArray().
boolean VirtualArrayIterator::$wasEmpty |
Whether or not the iterator was empty from the start
Definition at line 49 of file VirtualArrayIterator.inc.php.
Referenced by wasEmpty().