18 import(
'lib.pkp.classes.core.ItemIterator');
44 parent::__construct();
49 $this->itemsPerPage = max(count($this->theArray),1);
52 $this->count = $totalItems;
54 $this->
wasEmpty = count($this->theArray)==0;
55 reset($this->theArray);
66 static function factory($wholeArray, $rangeInfo) {
67 if ($rangeInfo->isValid()) $slicedArray = array_slice($wholeArray, $rangeInfo->getCount() * ($rangeInfo->getPage()-1), $rangeInfo->getCount(),
true);
76 if (!is_array($this->theArray)) {
80 $value =
current($this->theArray);
81 if (
next($this->theArray)==
null) {
82 $this->theArray =
null;
92 $key = key($this->theArray);
93 $value = $this->
next();
94 return array($key, $value);
102 return $this->page==1;
110 return ($this->page * $this->itemsPerPage) + 1 >
$this->count;
134 return max(1, ceil($this->count / $this->itemsPerPage));
144 return (($this->theArray ==
null) || (
count($this->theArray)==0));
175 if (!is_array($array))
return false;
178 $length = $len >= 0? $len: count($array);
179 $keys = array_slice(array_keys($array), $offset, $length);
180 foreach($keys as $key) {
181 $return[$key] = $array[$key];