| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * class WactArrayIterator. 12 * 13 * @package wact 14 * @version $Id: WactArrayIterator.class.php 5945 2007-06-06 08:31:43Z pachanga $ 15 */ 16 class WactArrayIterator extends ArrayIterator 17 { 18 public $position = 0; 19 public $offset = 0; 20 public $limit = 0; 21 protected $paginated = false; 22 23 function rewind() 24 { 25 $this->position = 0; 26 parent :: rewind(); 27 if($this->offset) 28 $this->seek($this->offset); 29 } 30 31 function current() 32 { 33 return new WactArrayObject(parent :: current()); 34 } 35 36 function next() 37 { 38 $this->position++; 39 return parent :: next(); 40 } 41 42 function valid() 43 { 44 if($this->limit && ($this->position >= $this->limit)) 45 return false; 46 return parent :: valid(); 47 } 48 49 function getOffset() 50 { 51 return $this->offset; 52 } 53 54 function getLimit() 55 { 56 return $this->limit; 57 } 58 59 function paginate($offset, $limit) 60 { 61 $this->offset = $offset; 62 $this->limit = $limit; 63 $this->paginated = true; 64 } 65 66 function countPaginated() 67 { 68 if(!$this->paginated) 69 return $this->count(); 70 71 $total = $this->count(); 72 if(($this->offset + $this->limit) < $total) 73 return $this->limit; 74 else 75 return $total - $this->offset; 76 } 77 } 78 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Dec 1 03:56:46 2008 | Cross-referenced by PHPXref 0.7 |