Open Journal Systems  2.4.3
 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

 $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 189 of file ArrayItemIterator.inc.php.

Referenced by ArrayItemIterator().

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 41 of file ArrayItemIterator.inc.php.

References array_slice_key(), and wasEmpty().

Referenced by fromRangeInfo().

ArrayItemIterator::atFirstPage ( )

Determine whether or not this iterator represents the first page

Returns
boolean

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

ArrayItemIterator::atLastPage ( )

Determine whether or not this iterator represents the last page

Returns
boolean

Definition at line 108 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 140 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 61 of file ArrayItemIterator.inc.php.

References ArrayItemIterator().

Referenced by AdminCategoriesHandler\categories(), EmailHandler\emails(), AuthorHandler\index(), ReviewerHandler\index(), and EditorHandler\index().

ArrayItemIterator::getCount ( )

Get the total count of items

Returns
int

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

& ArrayItemIterator::getLastPageRangeInfo ( )

Get the range info representing the last page of results.

Returns
object DBResultRange

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

References getPageCount().

ArrayItemIterator::getPage ( )

Get the current page number

Returns
int

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

ArrayItemIterator::getPageCount ( )

Get the number of pages

Returns
int

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

Referenced by getLastPageRangeInfo(), and isInBounds().

ArrayItemIterator::isInBounds ( )

Determine whether or not the iterator is within bounds.

Returns
boolean

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

References getPageCount().

& ArrayItemIterator::next ( )

Return the next item in the iterator.

Returns
object

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

Referenced by nextWithKey().

ArrayItemIterator::nextWithKey ( )

Return the next item in the iterator, with key.

Returns
array (key, value)

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

References next().

& ArrayItemIterator::toArray ( )

Convert this iterator to an array

Returns
array

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

ArrayItemIterator::wasEmpty ( )

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

Returns
boolean

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

References $wasEmpty.

Referenced by ArrayItemIterator().

Member Data Documentation

ArrayItemIterator::$wasEmpty

Whether or not the iterator was empty from the start

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

Referenced by wasEmpty().


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