[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/wact/src/components/list/ -> WactListComponent.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  
  10  /**
  11   * Represents list tags at runtime, providing an API for preparing the data set
  12   * @package wact
  13   * @version $Id: WactListComponent.class.php 5945 2007-06-06 08:31:43Z pachanga $
  14   */
  15  class WactListComponent extends WactRuntimeComponent
  16  {
  17    protected $dataset;
  18    protected $cached_count = null;
  19  
  20    function __construct($id)
  21    {
  22      parent :: __construct($id);
  23  
  24      $this->dataset = new WactArrayIterator(array());
  25    }
  26  
  27    function registerDataset($dataset)
  28    {
  29      $this->dataset = WactTemplate :: castToIterator($dataset);
  30      $this->cached_count = null;
  31    }
  32  
  33    function getDataset()
  34    {
  35      return $this->dataset;
  36    }
  37  
  38    function rewind()
  39    {
  40      $this->dataset->rewind();
  41    }
  42  
  43    function count()
  44    {
  45      if(is_null($this->cached_count))
  46        $this->cached_count = $this->dataset->count();
  47  
  48      return $this->cached_count;
  49    }
  50  
  51    function countPaginated()
  52    {
  53      if(method_exists($this->dataset, 'countPaginated'))
  54        return $this->dataset->countPaginated();
  55      else
  56        return $this->count();
  57    }
  58  
  59    function next()
  60    {
  61      $this->dataset->next();
  62    }
  63  
  64    function valid()
  65    {
  66      return $this->dataset->valid();
  67    }
  68  
  69    function key()
  70    {
  71      return $this->dataset->key();
  72    }
  73  
  74    function current()
  75    {
  76      return $this->dataset->current();
  77    }
  78  
  79    function getOffset()
  80    {
  81      return $this->dataset->getOffset();
  82    }
  83  }
  84  ?>


Generated: Fri Aug 29 04:49:26 2008 Cross-referenced by PHPXref 0.7